mjs.js 217 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027
  1. /*!
  2. * static.js v0.2.0
  3. * (c) 2018-2022 mcli
  4. */
  5. (function (global, factory) {
  6. typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
  7. typeof define === 'function' && define.amd ? define(['exports'], factory) :
  8. (factory((global.mjs = {})));
  9. }(this, (function (exports) {
  10. 'use strict';
  11. function unwrapExports(x) {
  12. return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
  13. }
  14. function createCommonjsModule(fn, module) {
  15. return module = {exports: {}}, fn(module, module.exports), module.exports;
  16. }
  17. var runtime = createCommonjsModule(function (module) {
  18. /**
  19. * Copyright (c) 2014-present, Facebook, Inc.
  20. *
  21. * This source code is licensed under the MIT license found in the
  22. * LICENSE file in the root directory of this source tree.
  23. */
  24. !(function (global) {
  25. var Op = Object.prototype;
  26. var hasOwn = Op.hasOwnProperty;
  27. var undefined; // More compressible than void 0.
  28. var $Symbol = typeof Symbol === "function" ? Symbol : {};
  29. var iteratorSymbol = $Symbol.iterator || "@@iterator";
  30. var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
  31. var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
  32. var inModule = 'object' === "object";
  33. var runtime = global.regeneratorRuntime;
  34. if (runtime) {
  35. if (inModule) {
  36. // If regeneratorRuntime is defined globally and we're in a module,
  37. // make the exports object identical to regeneratorRuntime.
  38. module.exports = runtime;
  39. }
  40. // Don't bother evaluating the rest of this file if the runtime was
  41. // already defined globally.
  42. return;
  43. }
  44. // Define the runtime globally (as expected by generated code) as either
  45. // module.exports (if we're in a module) or a new, empty object.
  46. runtime = global.regeneratorRuntime = inModule ? module.exports : {};
  47. function wrap(innerFn, outerFn, self, tryLocsList) {
  48. // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
  49. var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
  50. var generator = Object.create(protoGenerator.prototype);
  51. var context = new Context(tryLocsList || []);
  52. // The ._invoke method unifies the implementations of the .next,
  53. // .throw, and .return methods.
  54. generator._invoke = makeInvokeMethod(innerFn, self, context);
  55. return generator;
  56. }
  57. runtime.wrap = wrap;
  58. // Try/catch helper to minimize deoptimizations. Returns a completion
  59. // record like context.tryEntries[i].completion. This interface could
  60. // have been (and was previously) designed to take a closure to be
  61. // invoked without arguments, but in all the cases we care about we
  62. // already have an existing method we want to call, so there's no need
  63. // to create a new function object. We can even get away with assuming
  64. // the method takes exactly one argument, since that happens to be true
  65. // in every case, so we don't have to touch the arguments object. The
  66. // only additional allocation required is the completion record, which
  67. // has a stable shape and so hopefully should be cheap to allocate.
  68. function tryCatch(fn, obj, arg) {
  69. try {
  70. return {type: "normal", arg: fn.call(obj, arg)};
  71. } catch (err) {
  72. return {type: "throw", arg: err};
  73. }
  74. }
  75. var GenStateSuspendedStart = "suspendedStart";
  76. var GenStateSuspendedYield = "suspendedYield";
  77. var GenStateExecuting = "executing";
  78. var GenStateCompleted = "completed";
  79. // Returning this object from the innerFn has the same effect as
  80. // breaking out of the dispatch switch statement.
  81. var ContinueSentinel = {};
  82. // Dummy constructor functions that we use as the .constructor and
  83. // .constructor.prototype properties for functions that return Generator
  84. // objects. For full spec compliance, you may wish to configure your
  85. // minifier not to mangle the names of these two functions.
  86. function Generator() {
  87. }
  88. function GeneratorFunction() {
  89. }
  90. function GeneratorFunctionPrototype() {
  91. }
  92. // This is a polyfill for %IteratorPrototype% for environments that
  93. // don't natively support it.
  94. var IteratorPrototype = {};
  95. IteratorPrototype[iteratorSymbol] = function () {
  96. return this;
  97. };
  98. var getProto = Object.getPrototypeOf;
  99. var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
  100. if (NativeIteratorPrototype &&
  101. NativeIteratorPrototype !== Op &&
  102. hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
  103. // This environment has a native %IteratorPrototype%; use it instead
  104. // of the polyfill.
  105. IteratorPrototype = NativeIteratorPrototype;
  106. }
  107. var Gp = GeneratorFunctionPrototype.prototype =
  108. Generator.prototype = Object.create(IteratorPrototype);
  109. GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
  110. GeneratorFunctionPrototype.constructor = GeneratorFunction;
  111. GeneratorFunctionPrototype[toStringTagSymbol] =
  112. GeneratorFunction.displayName = "GeneratorFunction";
  113. // Helper for defining the .next, .throw, and .return methods of the
  114. // Iterator interface in terms of a single ._invoke method.
  115. function defineIteratorMethods(prototype) {
  116. ["next", "throw", "return"].forEach(function (method) {
  117. prototype[method] = function (arg) {
  118. return this._invoke(method, arg);
  119. };
  120. });
  121. }
  122. runtime.isGeneratorFunction = function (genFun) {
  123. var ctor = typeof genFun === "function" && genFun.constructor;
  124. return ctor
  125. ? ctor === GeneratorFunction ||
  126. // For the native GeneratorFunction constructor, the best we can
  127. // do is to check its .name property.
  128. (ctor.displayName || ctor.name) === "GeneratorFunction"
  129. : false;
  130. };
  131. runtime.mark = function (genFun) {
  132. if (Object.setPrototypeOf) {
  133. Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
  134. } else {
  135. genFun.__proto__ = GeneratorFunctionPrototype;
  136. if (!(toStringTagSymbol in genFun)) {
  137. genFun[toStringTagSymbol] = "GeneratorFunction";
  138. }
  139. }
  140. genFun.prototype = Object.create(Gp);
  141. return genFun;
  142. };
  143. // Within the body of any async function, `await x` is transformed to
  144. // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
  145. // `hasOwn.call(value, "__await")` to determine if the yielded value is
  146. // meant to be awaited.
  147. runtime.awrap = function (arg) {
  148. return {__await: arg};
  149. };
  150. function AsyncIterator(generator) {
  151. function invoke(method, arg, resolve, reject) {
  152. var record = tryCatch(generator[method], generator, arg);
  153. if (record.type === "throw") {
  154. reject(record.arg);
  155. } else {
  156. var result = record.arg;
  157. var value = result.value;
  158. if (value &&
  159. typeof value === "object" &&
  160. hasOwn.call(value, "__await")) {
  161. return Promise.resolve(value.__await).then(function (value) {
  162. invoke("next", value, resolve, reject);
  163. }, function (err) {
  164. invoke("throw", err, resolve, reject);
  165. });
  166. }
  167. return Promise.resolve(value).then(function (unwrapped) {
  168. // When a yielded Promise is resolved, its final value becomes
  169. // the .value of the Promise<{value,done}> result for the
  170. // current iteration. If the Promise is rejected, however, the
  171. // result for this iteration will be rejected with the same
  172. // reason. Note that rejections of yielded Promises are not
  173. // thrown back into the generator function, as is the case
  174. // when an awaited Promise is rejected. This difference in
  175. // behavior between yield and await is important, because it
  176. // allows the consumer to decide what to do with the yielded
  177. // rejection (swallow it and continue, manually .throw it back
  178. // into the generator, abandon iteration, whatever). With
  179. // await, by contrast, there is no opportunity to examine the
  180. // rejection reason outside the generator function, so the
  181. // only option is to throw it from the await expression, and
  182. // let the generator function handle the exception.
  183. result.value = unwrapped;
  184. resolve(result);
  185. }, reject);
  186. }
  187. }
  188. var previousPromise;
  189. function enqueue(method, arg) {
  190. function callInvokeWithMethodAndArg() {
  191. return new Promise(function (resolve, reject) {
  192. invoke(method, arg, resolve, reject);
  193. });
  194. }
  195. return previousPromise =
  196. // If enqueue has been called before, then we want to wait until
  197. // all previous Promises have been resolved before calling invoke,
  198. // so that results are always delivered in the correct order. If
  199. // enqueue has not been called before, then it is important to
  200. // call invoke immediately, without waiting on a callback to fire,
  201. // so that the async generator function has the opportunity to do
  202. // any necessary setup in a predictable way. This predictability
  203. // is why the Promise constructor synchronously invokes its
  204. // executor callback, and why async functions synchronously
  205. // execute code before the first await. Since we implement simple
  206. // async functions in terms of async generators, it is especially
  207. // important to get this right, even though it requires care.
  208. previousPromise ? previousPromise.then(
  209. callInvokeWithMethodAndArg,
  210. // Avoid propagating failures to Promises returned by later
  211. // invocations of the iterator.
  212. callInvokeWithMethodAndArg
  213. ) : callInvokeWithMethodAndArg();
  214. }
  215. // Define the unified helper method that is used to implement .next,
  216. // .throw, and .return (see defineIteratorMethods).
  217. this._invoke = enqueue;
  218. }
  219. defineIteratorMethods(AsyncIterator.prototype);
  220. AsyncIterator.prototype[asyncIteratorSymbol] = function () {
  221. return this;
  222. };
  223. runtime.AsyncIterator = AsyncIterator;
  224. // Note that simple async functions are implemented on top of
  225. // AsyncIterator objects; they just return a Promise for the value of
  226. // the final result produced by the iterator.
  227. runtime.async = function (innerFn, outerFn, self, tryLocsList) {
  228. var iter = new AsyncIterator(
  229. wrap(innerFn, outerFn, self, tryLocsList)
  230. );
  231. return runtime.isGeneratorFunction(outerFn)
  232. ? iter // If outerFn is a generator, return the full iterator.
  233. : iter.next().then(function (result) {
  234. return result.done ? result.value : iter.next();
  235. });
  236. };
  237. function makeInvokeMethod(innerFn, self, context) {
  238. var state = GenStateSuspendedStart;
  239. return function invoke(method, arg) {
  240. if (state === GenStateExecuting) {
  241. throw new Error("Generator is already running");
  242. }
  243. if (state === GenStateCompleted) {
  244. if (method === "throw") {
  245. throw arg;
  246. }
  247. // Be forgiving, per 25.3.3.3.3 of the spec:
  248. // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
  249. return doneResult();
  250. }
  251. context.method = method;
  252. context.arg = arg;
  253. while (true) {
  254. var delegate = context.delegate;
  255. if (delegate) {
  256. var delegateResult = maybeInvokeDelegate(delegate, context);
  257. if (delegateResult) {
  258. if (delegateResult === ContinueSentinel) continue;
  259. return delegateResult;
  260. }
  261. }
  262. if (context.method === "next") {
  263. // Setting context._sent for legacy support of Babel's
  264. // function.sent implementation.
  265. context.sent = context._sent = context.arg;
  266. } else if (context.method === "throw") {
  267. if (state === GenStateSuspendedStart) {
  268. state = GenStateCompleted;
  269. throw context.arg;
  270. }
  271. context.dispatchException(context.arg);
  272. } else if (context.method === "return") {
  273. context.abrupt("return", context.arg);
  274. }
  275. state = GenStateExecuting;
  276. var record = tryCatch(innerFn, self, context);
  277. if (record.type === "normal") {
  278. // If an exception is thrown from innerFn, we leave state ===
  279. // GenStateExecuting and loop back for another invocation.
  280. state = context.done
  281. ? GenStateCompleted
  282. : GenStateSuspendedYield;
  283. if (record.arg === ContinueSentinel) {
  284. continue;
  285. }
  286. return {
  287. value: record.arg,
  288. done: context.done
  289. };
  290. } else if (record.type === "throw") {
  291. state = GenStateCompleted;
  292. // Dispatch the exception by looping back around to the
  293. // context.dispatchException(context.arg) call above.
  294. context.method = "throw";
  295. context.arg = record.arg;
  296. }
  297. }
  298. };
  299. }
  300. // Call delegate.iterator[context.method](context.arg) and handle the
  301. // result, either by returning a { value, done } result from the
  302. // delegate iterator, or by modifying context.method and context.arg,
  303. // setting context.delegate to null, and returning the ContinueSentinel.
  304. function maybeInvokeDelegate(delegate, context) {
  305. var method = delegate.iterator[context.method];
  306. if (method === undefined) {
  307. // A .throw or .return when the delegate iterator has no .throw
  308. // method always terminates the yield* loop.
  309. context.delegate = null;
  310. if (context.method === "throw") {
  311. if (delegate.iterator.return) {
  312. // If the delegate iterator has a return method, give it a
  313. // chance to clean up.
  314. context.method = "return";
  315. context.arg = undefined;
  316. maybeInvokeDelegate(delegate, context);
  317. if (context.method === "throw") {
  318. // If maybeInvokeDelegate(context) changed context.method from
  319. // "return" to "throw", let that override the TypeError below.
  320. return ContinueSentinel;
  321. }
  322. }
  323. context.method = "throw";
  324. context.arg = new TypeError(
  325. "The iterator does not provide a 'throw' method");
  326. }
  327. return ContinueSentinel;
  328. }
  329. var record = tryCatch(method, delegate.iterator, context.arg);
  330. if (record.type === "throw") {
  331. context.method = "throw";
  332. context.arg = record.arg;
  333. context.delegate = null;
  334. return ContinueSentinel;
  335. }
  336. var info = record.arg;
  337. if (!info) {
  338. context.method = "throw";
  339. context.arg = new TypeError("iterator result is not an object");
  340. context.delegate = null;
  341. return ContinueSentinel;
  342. }
  343. if (info.done) {
  344. // Assign the result of the finished delegate to the temporary
  345. // variable specified by delegate.resultName (see delegateYield).
  346. context[delegate.resultName] = info.value;
  347. // Resume execution at the desired location (see delegateYield).
  348. context.next = delegate.nextLoc;
  349. // If context.method was "throw" but the delegate handled the
  350. // exception, let the outer generator proceed normally. If
  351. // context.method was "next", forget context.arg since it has been
  352. // "consumed" by the delegate iterator. If context.method was
  353. // "return", allow the original .return call to continue in the
  354. // outer generator.
  355. if (context.method !== "return") {
  356. context.method = "next";
  357. context.arg = undefined;
  358. }
  359. } else {
  360. // Re-yield the result returned by the delegate method.
  361. return info;
  362. }
  363. // The delegate iterator is finished, so forget it and continue with
  364. // the outer generator.
  365. context.delegate = null;
  366. return ContinueSentinel;
  367. }
  368. // Define Generator.prototype.{next,throw,return} in terms of the
  369. // unified ._invoke helper method.
  370. defineIteratorMethods(Gp);
  371. Gp[toStringTagSymbol] = "Generator";
  372. // A Generator should always return itself as the iterator object when the
  373. // @@iterator function is called on it. Some browsers' implementations of the
  374. // iterator prototype chain incorrectly implement this, causing the Generator
  375. // object to not be returned from this call. This ensures that doesn't happen.
  376. // See https://github.com/facebook/regenerator/issues/274 for more details.
  377. Gp[iteratorSymbol] = function () {
  378. return this;
  379. };
  380. Gp.toString = function () {
  381. return "[object Generator]";
  382. };
  383. function pushTryEntry(locs) {
  384. var entry = {tryLoc: locs[0]};
  385. if (1 in locs) {
  386. entry.catchLoc = locs[1];
  387. }
  388. if (2 in locs) {
  389. entry.finallyLoc = locs[2];
  390. entry.afterLoc = locs[3];
  391. }
  392. this.tryEntries.push(entry);
  393. }
  394. function resetTryEntry(entry) {
  395. var record = entry.completion || {};
  396. record.type = "normal";
  397. delete record.arg;
  398. entry.completion = record;
  399. }
  400. function Context(tryLocsList) {
  401. // The root entry object (effectively a try statement without a catch
  402. // or a finally block) gives us a place to store values thrown from
  403. // locations where there is no enclosing try statement.
  404. this.tryEntries = [{tryLoc: "root"}];
  405. tryLocsList.forEach(pushTryEntry, this);
  406. this.reset(true);
  407. }
  408. runtime.keys = function (object) {
  409. var keys = [];
  410. for (var key in object) {
  411. keys.push(key);
  412. }
  413. keys.reverse();
  414. // Rather than returning an object with a next method, we keep
  415. // things simple and return the next function itself.
  416. return function next() {
  417. while (keys.length) {
  418. var key = keys.pop();
  419. if (key in object) {
  420. next.value = key;
  421. next.done = false;
  422. return next;
  423. }
  424. }
  425. // To avoid creating an additional object, we just hang the .value
  426. // and .done properties off the next function object itself. This
  427. // also ensures that the minifier will not anonymize the function.
  428. next.done = true;
  429. return next;
  430. };
  431. };
  432. function values(iterable) {
  433. if (iterable) {
  434. var iteratorMethod = iterable[iteratorSymbol];
  435. if (iteratorMethod) {
  436. return iteratorMethod.call(iterable);
  437. }
  438. if (typeof iterable.next === "function") {
  439. return iterable;
  440. }
  441. if (!isNaN(iterable.length)) {
  442. var i = -1, next = function next() {
  443. while (++i < iterable.length) {
  444. if (hasOwn.call(iterable, i)) {
  445. next.value = iterable[i];
  446. next.done = false;
  447. return next;
  448. }
  449. }
  450. next.value = undefined;
  451. next.done = true;
  452. return next;
  453. };
  454. return next.next = next;
  455. }
  456. }
  457. // Return an iterator with no values.
  458. return {next: doneResult};
  459. }
  460. runtime.values = values;
  461. function doneResult() {
  462. return {value: undefined, done: true};
  463. }
  464. Context.prototype = {
  465. constructor: Context,
  466. reset: function (skipTempReset) {
  467. this.prev = 0;
  468. this.next = 0;
  469. // Resetting context._sent for legacy support of Babel's
  470. // function.sent implementation.
  471. this.sent = this._sent = undefined;
  472. this.done = false;
  473. this.delegate = null;
  474. this.method = "next";
  475. this.arg = undefined;
  476. this.tryEntries.forEach(resetTryEntry);
  477. if (!skipTempReset) {
  478. for (var name in this) {
  479. // Not sure about the optimal order of these conditions:
  480. if (name.charAt(0) === "t" &&
  481. hasOwn.call(this, name) &&
  482. !isNaN(+name.slice(1))) {
  483. this[name] = undefined;
  484. }
  485. }
  486. }
  487. },
  488. stop: function () {
  489. this.done = true;
  490. var rootEntry = this.tryEntries[0];
  491. var rootRecord = rootEntry.completion;
  492. if (rootRecord.type === "throw") {
  493. throw rootRecord.arg;
  494. }
  495. return this.rval;
  496. },
  497. dispatchException: function (exception) {
  498. if (this.done) {
  499. throw exception;
  500. }
  501. var context = this;
  502. function handle(loc, caught) {
  503. record.type = "throw";
  504. record.arg = exception;
  505. context.next = loc;
  506. if (caught) {
  507. // If the dispatched exception was caught by a catch block,
  508. // then let that catch block handle the exception normally.
  509. context.method = "next";
  510. context.arg = undefined;
  511. }
  512. return !!caught;
  513. }
  514. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  515. var entry = this.tryEntries[i];
  516. var record = entry.completion;
  517. if (entry.tryLoc === "root") {
  518. // Exception thrown outside of any try block that could handle
  519. // it, so set the completion value of the entire function to
  520. // throw the exception.
  521. return handle("end");
  522. }
  523. if (entry.tryLoc <= this.prev) {
  524. var hasCatch = hasOwn.call(entry, "catchLoc");
  525. var hasFinally = hasOwn.call(entry, "finallyLoc");
  526. if (hasCatch && hasFinally) {
  527. if (this.prev < entry.catchLoc) {
  528. return handle(entry.catchLoc, true);
  529. } else if (this.prev < entry.finallyLoc) {
  530. return handle(entry.finallyLoc);
  531. }
  532. } else if (hasCatch) {
  533. if (this.prev < entry.catchLoc) {
  534. return handle(entry.catchLoc, true);
  535. }
  536. } else if (hasFinally) {
  537. if (this.prev < entry.finallyLoc) {
  538. return handle(entry.finallyLoc);
  539. }
  540. } else {
  541. throw new Error("try statement without catch or finally");
  542. }
  543. }
  544. }
  545. },
  546. abrupt: function (type, arg) {
  547. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  548. var entry = this.tryEntries[i];
  549. if (entry.tryLoc <= this.prev &&
  550. hasOwn.call(entry, "finallyLoc") &&
  551. this.prev < entry.finallyLoc) {
  552. var finallyEntry = entry;
  553. break;
  554. }
  555. }
  556. if (finallyEntry &&
  557. (type === "break" ||
  558. type === "continue") &&
  559. finallyEntry.tryLoc <= arg &&
  560. arg <= finallyEntry.finallyLoc) {
  561. // Ignore the finally entry if control is not jumping to a
  562. // location outside the try/catch block.
  563. finallyEntry = null;
  564. }
  565. var record = finallyEntry ? finallyEntry.completion : {};
  566. record.type = type;
  567. record.arg = arg;
  568. if (finallyEntry) {
  569. this.method = "next";
  570. this.next = finallyEntry.finallyLoc;
  571. return ContinueSentinel;
  572. }
  573. return this.complete(record);
  574. },
  575. complete: function (record, afterLoc) {
  576. if (record.type === "throw") {
  577. throw record.arg;
  578. }
  579. if (record.type === "break" ||
  580. record.type === "continue") {
  581. this.next = record.arg;
  582. } else if (record.type === "return") {
  583. this.rval = this.arg = record.arg;
  584. this.method = "return";
  585. this.next = "end";
  586. } else if (record.type === "normal" && afterLoc) {
  587. this.next = afterLoc;
  588. }
  589. return ContinueSentinel;
  590. },
  591. finish: function (finallyLoc) {
  592. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  593. var entry = this.tryEntries[i];
  594. if (entry.finallyLoc === finallyLoc) {
  595. this.complete(entry.completion, entry.afterLoc);
  596. resetTryEntry(entry);
  597. return ContinueSentinel;
  598. }
  599. }
  600. },
  601. "catch": function (tryLoc) {
  602. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  603. var entry = this.tryEntries[i];
  604. if (entry.tryLoc === tryLoc) {
  605. var record = entry.completion;
  606. if (record.type === "throw") {
  607. var thrown = record.arg;
  608. resetTryEntry(entry);
  609. }
  610. return thrown;
  611. }
  612. }
  613. // The context.catch method must only be called with a location
  614. // argument that corresponds to a known catch block.
  615. throw new Error("illegal catch attempt");
  616. },
  617. delegateYield: function (iterable, resultName, nextLoc) {
  618. this.delegate = {
  619. iterator: values(iterable),
  620. resultName: resultName,
  621. nextLoc: nextLoc
  622. };
  623. if (this.method === "next") {
  624. // Deliberately forget the last sent value so that we don't
  625. // accidentally pass it on to the delegate.
  626. this.arg = undefined;
  627. }
  628. return ContinueSentinel;
  629. }
  630. };
  631. })(
  632. // In sloppy mode, unbound `this` refers to the global object, fallback to
  633. // Function constructor if we're in global strict mode. That is sadly a form
  634. // of indirect eval which violates Content Security Policy.
  635. (function () {
  636. return this
  637. })() || Function("return this")()
  638. );
  639. });
  640. /**
  641. * Copyright (c) 2014-present, Facebook, Inc.
  642. *
  643. * This source code is licensed under the MIT license found in the
  644. * LICENSE file in the root directory of this source tree.
  645. */
  646. // This method of obtaining a reference to the global object needs to be
  647. // kept identical to the way it is obtained in runtime.js
  648. var g = (function () {
  649. return this
  650. })() || Function("return this")();
  651. // Use `getOwnPropertyNames` because not all browsers support calling
  652. // `hasOwnProperty` on the global `self` object in a worker. See #183.
  653. var hadRuntime = g.regeneratorRuntime &&
  654. Object.getOwnPropertyNames(g).indexOf("regeneratorRuntime") >= 0;
  655. // Save the old regeneratorRuntime in case it needs to be restored later.
  656. var oldRuntime = hadRuntime && g.regeneratorRuntime;
  657. // Force reevalutation of runtime.js.
  658. g.regeneratorRuntime = undefined;
  659. var runtimeModule = runtime;
  660. if (hadRuntime) {
  661. // Restore the original runtime.
  662. g.regeneratorRuntime = oldRuntime;
  663. } else {
  664. // Remove the global property added by runtime.js.
  665. try {
  666. delete g.regeneratorRuntime;
  667. } catch (e) {
  668. g.regeneratorRuntime = undefined;
  669. }
  670. }
  671. var regenerator = runtimeModule;
  672. // 7.1.4 ToInteger
  673. var ceil = Math.ceil;
  674. var floor = Math.floor;
  675. var _toInteger = function (it) {
  676. return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
  677. };
  678. // 7.2.1 RequireObjectCoercible(argument)
  679. var _defined = function (it) {
  680. if (it == undefined) throw TypeError("Can't call method on " + it);
  681. return it;
  682. };
  683. // true -> String#at
  684. // false -> String#codePointAt
  685. var _stringAt = function (TO_STRING) {
  686. return function (that, pos) {
  687. var s = String(_defined(that));
  688. var i = _toInteger(pos);
  689. var l = s.length;
  690. var a, b;
  691. if (i < 0 || i >= l) return TO_STRING ? '' : undefined;
  692. a = s.charCodeAt(i);
  693. return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
  694. ? TO_STRING ? s.charAt(i) : a
  695. : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
  696. };
  697. };
  698. var _library = true;
  699. var _global = createCommonjsModule(function (module) {
  700. // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
  701. var global = module.exports = typeof window != 'undefined' && window.Math == Math
  702. ? window : typeof self != 'undefined' && self.Math == Math ? self
  703. // eslint-disable-next-line no-new-func
  704. : Function('return this')();
  705. if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef
  706. });
  707. var _core = createCommonjsModule(function (module) {
  708. var core = module.exports = {version: '2.6.11'};
  709. if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef
  710. });
  711. var _core_1 = _core.version;
  712. var _aFunction = function (it) {
  713. if (typeof it != 'function') throw TypeError(it + ' is not a function!');
  714. return it;
  715. };
  716. // optional / simple context binding
  717. var _ctx = function (fn, that, length) {
  718. _aFunction(fn);
  719. if (that === undefined) return fn;
  720. switch (length) {
  721. case 1:
  722. return function (a) {
  723. return fn.call(that, a);
  724. };
  725. case 2:
  726. return function (a, b) {
  727. return fn.call(that, a, b);
  728. };
  729. case 3:
  730. return function (a, b, c) {
  731. return fn.call(that, a, b, c);
  732. };
  733. }
  734. return function (/* ...args */) {
  735. return fn.apply(that, arguments);
  736. };
  737. };
  738. var _isObject = function (it) {
  739. return typeof it === 'object' ? it !== null : typeof it === 'function';
  740. };
  741. var _anObject = function (it) {
  742. if (!_isObject(it)) throw TypeError(it + ' is not an object!');
  743. return it;
  744. };
  745. var _fails = function (exec) {
  746. try {
  747. return !!exec();
  748. } catch (e) {
  749. return true;
  750. }
  751. };
  752. // Thank's IE8 for his funny defineProperty
  753. var _descriptors = !_fails(function () {
  754. return Object.defineProperty({}, 'a', {
  755. get: function () {
  756. return 7;
  757. }
  758. }).a != 7;
  759. });
  760. var document$1 = _global.document;
  761. // typeof document.createElement is 'object' in old IE
  762. var is = _isObject(document$1) && _isObject(document$1.createElement);
  763. var _domCreate = function (it) {
  764. return is ? document$1.createElement(it) : {};
  765. };
  766. var _ie8DomDefine = !_descriptors && !_fails(function () {
  767. return Object.defineProperty(_domCreate('div'), 'a', {
  768. get: function () {
  769. return 7;
  770. }
  771. }).a != 7;
  772. });
  773. // 7.1.1 ToPrimitive(input [, PreferredType])
  774. // instead of the ES6 spec version, we didn't implement @@toPrimitive case
  775. // and the second argument - flag - preferred type is a string
  776. var _toPrimitive = function (it, S) {
  777. if (!_isObject(it)) return it;
  778. var fn, val;
  779. if (S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) return val;
  780. if (typeof (fn = it.valueOf) == 'function' && !_isObject(val = fn.call(it))) return val;
  781. if (!S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) return val;
  782. throw TypeError("Can't convert object to primitive value");
  783. };
  784. var dP = Object.defineProperty;
  785. var f = _descriptors ? Object.defineProperty : function defineProperty(O, P, Attributes) {
  786. _anObject(O);
  787. P = _toPrimitive(P, true);
  788. _anObject(Attributes);
  789. if (_ie8DomDefine) try {
  790. return dP(O, P, Attributes);
  791. } catch (e) { /* empty */
  792. }
  793. if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');
  794. if ('value' in Attributes) O[P] = Attributes.value;
  795. return O;
  796. };
  797. var _objectDp = {
  798. f: f
  799. };
  800. var _propertyDesc = function (bitmap, value) {
  801. return {
  802. enumerable: !(bitmap & 1),
  803. configurable: !(bitmap & 2),
  804. writable: !(bitmap & 4),
  805. value: value
  806. };
  807. };
  808. var _hide = _descriptors ? function (object, key, value) {
  809. return _objectDp.f(object, key, _propertyDesc(1, value));
  810. } : function (object, key, value) {
  811. object[key] = value;
  812. return object;
  813. };
  814. var hasOwnProperty = {}.hasOwnProperty;
  815. var _has = function (it, key) {
  816. return hasOwnProperty.call(it, key);
  817. };
  818. var PROTOTYPE = 'prototype';
  819. var $export = function (type, name, source) {
  820. var IS_FORCED = type & $export.F;
  821. var IS_GLOBAL = type & $export.G;
  822. var IS_STATIC = type & $export.S;
  823. var IS_PROTO = type & $export.P;
  824. var IS_BIND = type & $export.B;
  825. var IS_WRAP = type & $export.W;
  826. var exports = IS_GLOBAL ? _core : _core[name] || (_core[name] = {});
  827. var expProto = exports[PROTOTYPE];
  828. var target = IS_GLOBAL ? _global : IS_STATIC ? _global[name] : (_global[name] || {})[PROTOTYPE];
  829. var key, own, out;
  830. if (IS_GLOBAL) source = name;
  831. for (key in source) {
  832. // contains in native
  833. own = !IS_FORCED && target && target[key] !== undefined;
  834. if (own && _has(exports, key)) continue;
  835. // export native or passed
  836. out = own ? target[key] : source[key];
  837. // prevent global pollution for namespaces
  838. exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]
  839. // bind timers to global for call from export context
  840. : IS_BIND && own ? _ctx(out, _global)
  841. // wrap global constructors for prevent change them in library
  842. : IS_WRAP && target[key] == out ? (function (C) {
  843. var F = function (a, b, c) {
  844. if (this instanceof C) {
  845. switch (arguments.length) {
  846. case 0:
  847. return new C();
  848. case 1:
  849. return new C(a);
  850. case 2:
  851. return new C(a, b);
  852. }
  853. return new C(a, b, c);
  854. }
  855. return C.apply(this, arguments);
  856. };
  857. F[PROTOTYPE] = C[PROTOTYPE];
  858. return F;
  859. // make static versions for prototype methods
  860. })(out) : IS_PROTO && typeof out == 'function' ? _ctx(Function.call, out) : out;
  861. // export proto methods to core.%CONSTRUCTOR%.methods.%NAME%
  862. if (IS_PROTO) {
  863. (exports.virtual || (exports.virtual = {}))[key] = out;
  864. // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME%
  865. if (type & $export.R && expProto && !expProto[key]) _hide(expProto, key, out);
  866. }
  867. }
  868. };
  869. // type bitmap
  870. $export.F = 1; // forced
  871. $export.G = 2; // global
  872. $export.S = 4; // static
  873. $export.P = 8; // proto
  874. $export.B = 16; // bind
  875. $export.W = 32; // wrap
  876. $export.U = 64; // safe
  877. $export.R = 128; // real proto method for `library`
  878. var _export = $export;
  879. var _redefine = _hide;
  880. var _iterators = {};
  881. var toString = {}.toString;
  882. var _cof = function (it) {
  883. return toString.call(it).slice(8, -1);
  884. };
  885. // fallback for non-array-like ES3 and non-enumerable old V8 strings
  886. // eslint-disable-next-line no-prototype-builtins
  887. var _iobject = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
  888. return _cof(it) == 'String' ? it.split('') : Object(it);
  889. };
  890. // to indexed object, toObject with fallback for non-array-like ES3 strings
  891. var _toIobject = function (it) {
  892. return _iobject(_defined(it));
  893. };
  894. // 7.1.15 ToLength
  895. var min = Math.min;
  896. var _toLength = function (it) {
  897. return it > 0 ? min(_toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
  898. };
  899. var max = Math.max;
  900. var min$1 = Math.min;
  901. var _toAbsoluteIndex = function (index, length) {
  902. index = _toInteger(index);
  903. return index < 0 ? max(index + length, 0) : min$1(index, length);
  904. };
  905. // false -> Array#indexOf
  906. // true -> Array#includes
  907. var _arrayIncludes = function (IS_INCLUDES) {
  908. return function ($this, el, fromIndex) {
  909. var O = _toIobject($this);
  910. var length = _toLength(O.length);
  911. var index = _toAbsoluteIndex(fromIndex, length);
  912. var value;
  913. // Array#includes uses SameValueZero equality algorithm
  914. // eslint-disable-next-line no-self-compare
  915. if (IS_INCLUDES && el != el) while (length > index) {
  916. value = O[index++];
  917. // eslint-disable-next-line no-self-compare
  918. if (value != value) return true;
  919. // Array#indexOf ignores holes, Array#includes - not
  920. } else for (; length > index; index++) if (IS_INCLUDES || index in O) {
  921. if (O[index] === el) return IS_INCLUDES || index || 0;
  922. }
  923. return !IS_INCLUDES && -1;
  924. };
  925. };
  926. var _shared = createCommonjsModule(function (module) {
  927. var SHARED = '__core-js_shared__';
  928. var store = _global[SHARED] || (_global[SHARED] = {});
  929. (module.exports = function (key, value) {
  930. return store[key] || (store[key] = value !== undefined ? value : {});
  931. })('versions', []).push({
  932. version: _core.version,
  933. mode: _library ? 'pure' : 'global',
  934. copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
  935. });
  936. });
  937. var id = 0;
  938. var px = Math.random();
  939. var _uid = function (key) {
  940. return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
  941. };
  942. var shared = _shared('keys');
  943. var _sharedKey = function (key) {
  944. return shared[key] || (shared[key] = _uid(key));
  945. };
  946. var arrayIndexOf = _arrayIncludes(false);
  947. var IE_PROTO$1 = _sharedKey('IE_PROTO');
  948. var _objectKeysInternal = function (object, names) {
  949. var O = _toIobject(object);
  950. var i = 0;
  951. var result = [];
  952. var key;
  953. for (key in O) if (key != IE_PROTO$1) _has(O, key) && result.push(key);
  954. // Don't enum bug & hidden keys
  955. while (names.length > i) if (_has(O, key = names[i++])) {
  956. ~arrayIndexOf(result, key) || result.push(key);
  957. }
  958. return result;
  959. };
  960. // IE 8- don't enum bug keys
  961. var _enumBugKeys = (
  962. 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
  963. ).split(',');
  964. // 19.1.2.14 / 15.2.3.14 Object.keys(O)
  965. var _objectKeys = Object.keys || function keys(O) {
  966. return _objectKeysInternal(O, _enumBugKeys);
  967. };
  968. var _objectDps = _descriptors ? Object.defineProperties : function defineProperties(O, Properties) {
  969. _anObject(O);
  970. var keys = _objectKeys(Properties);
  971. var length = keys.length;
  972. var i = 0;
  973. var P;
  974. while (length > i) _objectDp.f(O, P = keys[i++], Properties[P]);
  975. return O;
  976. };
  977. var document$2 = _global.document;
  978. var _html = document$2 && document$2.documentElement;
  979. // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
  980. var IE_PROTO = _sharedKey('IE_PROTO');
  981. var Empty = function () { /* empty */
  982. };
  983. var PROTOTYPE$1 = 'prototype';
  984. // Create object with fake `null` prototype: use iframe Object with cleared prototype
  985. var createDict = function () {
  986. // Thrash, waste and sodomy: IE GC bug
  987. var iframe = _domCreate('iframe');
  988. var i = _enumBugKeys.length;
  989. var lt = '<';
  990. var gt = '>';
  991. var iframeDocument;
  992. iframe.style.display = 'none';
  993. _html.appendChild(iframe);
  994. iframe.src = 'javascript:'; // eslint-disable-line no-script-url
  995. // createDict = iframe.contentWindow.Object;
  996. // html.removeChild(iframe);
  997. iframeDocument = iframe.contentWindow.document;
  998. iframeDocument.open();
  999. iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);
  1000. iframeDocument.close();
  1001. createDict = iframeDocument.F;
  1002. while (i--) delete createDict[PROTOTYPE$1][_enumBugKeys[i]];
  1003. return createDict();
  1004. };
  1005. var _objectCreate = Object.create || function create(O, Properties) {
  1006. var result;
  1007. if (O !== null) {
  1008. Empty[PROTOTYPE$1] = _anObject(O);
  1009. result = new Empty();
  1010. Empty[PROTOTYPE$1] = null;
  1011. // add "__proto__" for Object.getPrototypeOf polyfill
  1012. result[IE_PROTO] = O;
  1013. } else result = createDict();
  1014. return Properties === undefined ? result : _objectDps(result, Properties);
  1015. };
  1016. var _wks = createCommonjsModule(function (module) {
  1017. var store = _shared('wks');
  1018. var Symbol = _global.Symbol;
  1019. var USE_SYMBOL = typeof Symbol == 'function';
  1020. var $exports = module.exports = function (name) {
  1021. return store[name] || (store[name] =
  1022. USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : _uid)('Symbol.' + name));
  1023. };
  1024. $exports.store = store;
  1025. });
  1026. var def = _objectDp.f;
  1027. var TAG = _wks('toStringTag');
  1028. var _setToStringTag = function (it, tag, stat) {
  1029. if (it && !_has(it = stat ? it : it.prototype, TAG)) def(it, TAG, {configurable: true, value: tag});
  1030. };
  1031. var IteratorPrototype = {};
  1032. // 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
  1033. _hide(IteratorPrototype, _wks('iterator'), function () {
  1034. return this;
  1035. });
  1036. var _iterCreate = function (Constructor, NAME, next) {
  1037. Constructor.prototype = _objectCreate(IteratorPrototype, {next: _propertyDesc(1, next)});
  1038. _setToStringTag(Constructor, NAME + ' Iterator');
  1039. };
  1040. // 7.1.13 ToObject(argument)
  1041. var _toObject = function (it) {
  1042. return Object(_defined(it));
  1043. };
  1044. // 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
  1045. var IE_PROTO$2 = _sharedKey('IE_PROTO');
  1046. var ObjectProto = Object.prototype;
  1047. var _objectGpo = Object.getPrototypeOf || function (O) {
  1048. O = _toObject(O);
  1049. if (_has(O, IE_PROTO$2)) return O[IE_PROTO$2];
  1050. if (typeof O.constructor == 'function' && O instanceof O.constructor) {
  1051. return O.constructor.prototype;
  1052. }
  1053. return O instanceof Object ? ObjectProto : null;
  1054. };
  1055. var ITERATOR = _wks('iterator');
  1056. var BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next`
  1057. var FF_ITERATOR = '@@iterator';
  1058. var KEYS = 'keys';
  1059. var VALUES = 'values';
  1060. var returnThis = function () {
  1061. return this;
  1062. };
  1063. var _iterDefine = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) {
  1064. _iterCreate(Constructor, NAME, next);
  1065. var getMethod = function (kind) {
  1066. if (!BUGGY && kind in proto) return proto[kind];
  1067. switch (kind) {
  1068. case KEYS:
  1069. return function keys() {
  1070. return new Constructor(this, kind);
  1071. };
  1072. case VALUES:
  1073. return function values() {
  1074. return new Constructor(this, kind);
  1075. };
  1076. }
  1077. return function entries() {
  1078. return new Constructor(this, kind);
  1079. };
  1080. };
  1081. var TAG = NAME + ' Iterator';
  1082. var DEF_VALUES = DEFAULT == VALUES;
  1083. var VALUES_BUG = false;
  1084. var proto = Base.prototype;
  1085. var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT];
  1086. var $default = $native || getMethod(DEFAULT);
  1087. var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined;
  1088. var $anyNative = NAME == 'Array' ? proto.entries || $native : $native;
  1089. var methods, key, IteratorPrototype;
  1090. // Fix native
  1091. if ($anyNative) {
  1092. IteratorPrototype = _objectGpo($anyNative.call(new Base()));
  1093. if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) {
  1094. // Set @@toStringTag to native iterators
  1095. _setToStringTag(IteratorPrototype, TAG, true);
  1096. // fix for some old engines
  1097. if (!_library && typeof IteratorPrototype[ITERATOR] != 'function') _hide(IteratorPrototype, ITERATOR, returnThis);
  1098. }
  1099. }
  1100. // fix Array#{values, @@iterator}.name in V8 / FF
  1101. if (DEF_VALUES && $native && $native.name !== VALUES) {
  1102. VALUES_BUG = true;
  1103. $default = function values() {
  1104. return $native.call(this);
  1105. };
  1106. }
  1107. // Define iterator
  1108. if ((!_library || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) {
  1109. _hide(proto, ITERATOR, $default);
  1110. }
  1111. // Plug for library
  1112. _iterators[NAME] = $default;
  1113. _iterators[TAG] = returnThis;
  1114. if (DEFAULT) {
  1115. methods = {
  1116. values: DEF_VALUES ? $default : getMethod(VALUES),
  1117. keys: IS_SET ? $default : getMethod(KEYS),
  1118. entries: $entries
  1119. };
  1120. if (FORCED) for (key in methods) {
  1121. if (!(key in proto)) _redefine(proto, key, methods[key]);
  1122. } else _export(_export.P + _export.F * (BUGGY || VALUES_BUG), NAME, methods);
  1123. }
  1124. return methods;
  1125. };
  1126. var $at = _stringAt(true);
  1127. // 21.1.3.27 String.prototype[@@iterator]()
  1128. _iterDefine(String, 'String', function (iterated) {
  1129. this._t = String(iterated); // target
  1130. this._i = 0; // next index
  1131. // 21.1.5.2.1 %StringIteratorPrototype%.next()
  1132. }, function () {
  1133. var O = this._t;
  1134. var index = this._i;
  1135. var point;
  1136. if (index >= O.length) return {value: undefined, done: true};
  1137. point = $at(O, index);
  1138. this._i += point.length;
  1139. return {value: point, done: false};
  1140. });
  1141. var _iterStep = function (done, value) {
  1142. return {value: value, done: !!done};
  1143. };
  1144. // 22.1.3.4 Array.prototype.entries()
  1145. // 22.1.3.13 Array.prototype.keys()
  1146. // 22.1.3.29 Array.prototype.values()
  1147. // 22.1.3.30 Array.prototype[@@iterator]()
  1148. var es6_array_iterator = _iterDefine(Array, 'Array', function (iterated, kind) {
  1149. this._t = _toIobject(iterated); // target
  1150. this._i = 0; // next index
  1151. this._k = kind; // kind
  1152. // 22.1.5.2.1 %ArrayIteratorPrototype%.next()
  1153. }, function () {
  1154. var O = this._t;
  1155. var kind = this._k;
  1156. var index = this._i++;
  1157. if (!O || index >= O.length) {
  1158. this._t = undefined;
  1159. return _iterStep(1);
  1160. }
  1161. if (kind == 'keys') return _iterStep(0, index);
  1162. if (kind == 'values') return _iterStep(0, O[index]);
  1163. return _iterStep(0, [index, O[index]]);
  1164. }, 'values');
  1165. // argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)
  1166. _iterators.Arguments = _iterators.Array;
  1167. var TO_STRING_TAG = _wks('toStringTag');
  1168. var DOMIterables = ('CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,' +
  1169. 'DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,' +
  1170. 'MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,' +
  1171. 'SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,' +
  1172. 'TextTrackList,TouchList').split(',');
  1173. for (var i = 0; i < DOMIterables.length; i++) {
  1174. var NAME = DOMIterables[i];
  1175. var Collection = _global[NAME];
  1176. var proto = Collection && Collection.prototype;
  1177. if (proto && !proto[TO_STRING_TAG]) _hide(proto, TO_STRING_TAG, NAME);
  1178. _iterators[NAME] = _iterators.Array;
  1179. }
  1180. // getting tag from 19.1.3.6 Object.prototype.toString()
  1181. var TAG$1 = _wks('toStringTag');
  1182. // ES3 wrong here
  1183. var ARG = _cof(function () {
  1184. return arguments;
  1185. }()) == 'Arguments';
  1186. // fallback for IE11 Script Access Denied error
  1187. var tryGet = function (it, key) {
  1188. try {
  1189. return it[key];
  1190. } catch (e) { /* empty */
  1191. }
  1192. };
  1193. var _classof = function (it) {
  1194. var O, T, B;
  1195. return it === undefined ? 'Undefined' : it === null ? 'Null'
  1196. // @@toStringTag case
  1197. : typeof (T = tryGet(O = Object(it), TAG$1)) == 'string' ? T
  1198. // builtinTag case
  1199. : ARG ? _cof(O)
  1200. // ES3 arguments fallback
  1201. : (B = _cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;
  1202. };
  1203. var _anInstance = function (it, Constructor, name, forbiddenField) {
  1204. if (!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)) {
  1205. throw TypeError(name + ': incorrect invocation!');
  1206. }
  1207. return it;
  1208. };
  1209. // call something on iterator step with safe closing on error
  1210. var _iterCall = function (iterator, fn, value, entries) {
  1211. try {
  1212. return entries ? fn(_anObject(value)[0], value[1]) : fn(value);
  1213. // 7.4.6 IteratorClose(iterator, completion)
  1214. } catch (e) {
  1215. var ret = iterator['return'];
  1216. if (ret !== undefined) _anObject(ret.call(iterator));
  1217. throw e;
  1218. }
  1219. };
  1220. // check on default Array iterator
  1221. var ITERATOR$1 = _wks('iterator');
  1222. var ArrayProto = Array.prototype;
  1223. var _isArrayIter = function (it) {
  1224. return it !== undefined && (_iterators.Array === it || ArrayProto[ITERATOR$1] === it);
  1225. };
  1226. var ITERATOR$2 = _wks('iterator');
  1227. var core_getIteratorMethod = _core.getIteratorMethod = function (it) {
  1228. if (it != undefined) return it[ITERATOR$2]
  1229. || it['@@iterator']
  1230. || _iterators[_classof(it)];
  1231. };
  1232. var _forOf = createCommonjsModule(function (module) {
  1233. var BREAK = {};
  1234. var RETURN = {};
  1235. var exports = module.exports = function (iterable, entries, fn, that, ITERATOR) {
  1236. var iterFn = ITERATOR ? function () {
  1237. return iterable;
  1238. } : core_getIteratorMethod(iterable);
  1239. var f = _ctx(fn, that, entries ? 2 : 1);
  1240. var index = 0;
  1241. var length, step, iterator, result;
  1242. if (typeof iterFn != 'function') throw TypeError(iterable + ' is not iterable!');
  1243. // fast case for arrays with default iterator
  1244. if (_isArrayIter(iterFn)) for (length = _toLength(iterable.length); length > index; index++) {
  1245. result = entries ? f(_anObject(step = iterable[index])[0], step[1]) : f(iterable[index]);
  1246. if (result === BREAK || result === RETURN) return result;
  1247. } else for (iterator = iterFn.call(iterable); !(step = iterator.next()).done;) {
  1248. result = _iterCall(iterator, f, step.value, entries);
  1249. if (result === BREAK || result === RETURN) return result;
  1250. }
  1251. };
  1252. exports.BREAK = BREAK;
  1253. exports.RETURN = RETURN;
  1254. });
  1255. // 7.3.20 SpeciesConstructor(O, defaultConstructor)
  1256. var SPECIES = _wks('species');
  1257. var _speciesConstructor = function (O, D) {
  1258. var C = _anObject(O).constructor;
  1259. var S;
  1260. return C === undefined || (S = _anObject(C)[SPECIES]) == undefined ? D : _aFunction(S);
  1261. };
  1262. // fast apply, http://jsperf.lnkit.com/fast-apply/5
  1263. var _invoke = function (fn, args, that) {
  1264. var un = that === undefined;
  1265. switch (args.length) {
  1266. case 0:
  1267. return un ? fn()
  1268. : fn.call(that);
  1269. case 1:
  1270. return un ? fn(args[0])
  1271. : fn.call(that, args[0]);
  1272. case 2:
  1273. return un ? fn(args[0], args[1])
  1274. : fn.call(that, args[0], args[1]);
  1275. case 3:
  1276. return un ? fn(args[0], args[1], args[2])
  1277. : fn.call(that, args[0], args[1], args[2]);
  1278. case 4:
  1279. return un ? fn(args[0], args[1], args[2], args[3])
  1280. : fn.call(that, args[0], args[1], args[2], args[3]);
  1281. }
  1282. return fn.apply(that, args);
  1283. };
  1284. var process$2 = _global.process;
  1285. var setTask = _global.setImmediate;
  1286. var clearTask = _global.clearImmediate;
  1287. var MessageChannel = _global.MessageChannel;
  1288. var Dispatch = _global.Dispatch;
  1289. var counter = 0;
  1290. var queue = {};
  1291. var ONREADYSTATECHANGE = 'onreadystatechange';
  1292. var defer;
  1293. var channel;
  1294. var port;
  1295. var run = function () {
  1296. var id = +this;
  1297. // eslint-disable-next-line no-prototype-builtins
  1298. if (queue.hasOwnProperty(id)) {
  1299. var fn = queue[id];
  1300. delete queue[id];
  1301. fn();
  1302. }
  1303. };
  1304. var listener = function (event) {
  1305. run.call(event.data);
  1306. };
  1307. // Node.js 0.9+ & IE10+ has setImmediate, otherwise:
  1308. if (!setTask || !clearTask) {
  1309. setTask = function setImmediate(fn) {
  1310. var args = [];
  1311. var i = 1;
  1312. while (arguments.length > i) args.push(arguments[i++]);
  1313. queue[++counter] = function () {
  1314. // eslint-disable-next-line no-new-func
  1315. _invoke(typeof fn == 'function' ? fn : Function(fn), args);
  1316. };
  1317. defer(counter);
  1318. return counter;
  1319. };
  1320. clearTask = function clearImmediate(id) {
  1321. delete queue[id];
  1322. };
  1323. // Node.js 0.8-
  1324. if (_cof(process$2) == 'process') {
  1325. defer = function (id) {
  1326. process$2.nextTick(_ctx(run, id, 1));
  1327. };
  1328. // Sphere (JS game engine) Dispatch API
  1329. } else if (Dispatch && Dispatch.now) {
  1330. defer = function (id) {
  1331. Dispatch.now(_ctx(run, id, 1));
  1332. };
  1333. // Browsers with MessageChannel, includes WebWorkers
  1334. } else if (MessageChannel) {
  1335. channel = new MessageChannel();
  1336. port = channel.port2;
  1337. channel.port1.onmessage = listener;
  1338. defer = _ctx(port.postMessage, port, 1);
  1339. // Browsers with postMessage, skip WebWorkers
  1340. // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
  1341. } else if (_global.addEventListener && typeof postMessage == 'function' && !_global.importScripts) {
  1342. defer = function (id) {
  1343. _global.postMessage(id + '', '*');
  1344. };
  1345. _global.addEventListener('message', listener, false);
  1346. // IE8-
  1347. } else if (ONREADYSTATECHANGE in _domCreate('script')) {
  1348. defer = function (id) {
  1349. _html.appendChild(_domCreate('script'))[ONREADYSTATECHANGE] = function () {
  1350. _html.removeChild(this);
  1351. run.call(id);
  1352. };
  1353. };
  1354. // Rest old browsers
  1355. } else {
  1356. defer = function (id) {
  1357. setTimeout(_ctx(run, id, 1), 0);
  1358. };
  1359. }
  1360. }
  1361. var _task = {
  1362. set: setTask,
  1363. clear: clearTask
  1364. };
  1365. var macrotask = _task.set;
  1366. var Observer = _global.MutationObserver || _global.WebKitMutationObserver;
  1367. var process$3 = _global.process;
  1368. var Promise$1 = _global.Promise;
  1369. var isNode$1 = _cof(process$3) == 'process';
  1370. var _microtask = function () {
  1371. var head, last, notify;
  1372. var flush = function () {
  1373. var parent, fn;
  1374. if (isNode$1 && (parent = process$3.domain)) parent.exit();
  1375. while (head) {
  1376. fn = head.fn;
  1377. head = head.next;
  1378. try {
  1379. fn();
  1380. } catch (e) {
  1381. if (head) notify();
  1382. else last = undefined;
  1383. throw e;
  1384. }
  1385. }
  1386. last = undefined;
  1387. if (parent) parent.enter();
  1388. };
  1389. // Node.js
  1390. if (isNode$1) {
  1391. notify = function () {
  1392. process$3.nextTick(flush);
  1393. };
  1394. // browsers with MutationObserver, except iOS Safari - https://github.com/zloirock/core-js/issues/339
  1395. } else if (Observer && !(_global.navigator && _global.navigator.standalone)) {
  1396. var toggle = true;
  1397. var node = document.createTextNode('');
  1398. new Observer(flush).observe(node, {characterData: true}); // eslint-disable-line no-new
  1399. notify = function () {
  1400. node.data = toggle = !toggle;
  1401. };
  1402. // environments with maybe non-completely correct, but existent Promise
  1403. } else if (Promise$1 && Promise$1.resolve) {
  1404. // Promise.resolve without an argument throws an error in LG WebOS 2
  1405. var promise = Promise$1.resolve(undefined);
  1406. notify = function () {
  1407. promise.then(flush);
  1408. };
  1409. // for other environments - macrotask based on:
  1410. // - setImmediate
  1411. // - MessageChannel
  1412. // - window.postMessag
  1413. // - onreadystatechange
  1414. // - setTimeout
  1415. } else {
  1416. notify = function () {
  1417. // strange IE + webpack dev service bug - use .call(global)
  1418. macrotask.call(_global, flush);
  1419. };
  1420. }
  1421. return function (fn) {
  1422. var task = {fn: fn, next: undefined};
  1423. if (last) last.next = task;
  1424. if (!head) {
  1425. head = task;
  1426. notify();
  1427. }
  1428. last = task;
  1429. };
  1430. };
  1431. // 25.4.1.5 NewPromiseCapability(C)
  1432. function PromiseCapability(C) {
  1433. var resolve, reject;
  1434. this.promise = new C(function ($$resolve, $$reject) {
  1435. if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');
  1436. resolve = $$resolve;
  1437. reject = $$reject;
  1438. });
  1439. this.resolve = _aFunction(resolve);
  1440. this.reject = _aFunction(reject);
  1441. }
  1442. var f$1 = function (C) {
  1443. return new PromiseCapability(C);
  1444. };
  1445. var _newPromiseCapability = {
  1446. f: f$1
  1447. };
  1448. var _perform = function (exec) {
  1449. try {
  1450. return {e: false, v: exec()};
  1451. } catch (e) {
  1452. return {e: true, v: e};
  1453. }
  1454. };
  1455. var navigator$1 = _global.navigator;
  1456. var _userAgent = navigator$1 && navigator$1.userAgent || '';
  1457. var _promiseResolve = function (C, x) {
  1458. _anObject(C);
  1459. if (_isObject(x) && x.constructor === C) return x;
  1460. var promiseCapability = _newPromiseCapability.f(C);
  1461. var resolve = promiseCapability.resolve;
  1462. resolve(x);
  1463. return promiseCapability.promise;
  1464. };
  1465. var _redefineAll = function (target, src, safe) {
  1466. for (var key in src) {
  1467. if (safe && target[key]) target[key] = src[key];
  1468. else _hide(target, key, src[key]);
  1469. }
  1470. return target;
  1471. };
  1472. var SPECIES$1 = _wks('species');
  1473. var _setSpecies = function (KEY) {
  1474. var C = typeof _core[KEY] == 'function' ? _core[KEY] : _global[KEY];
  1475. if (_descriptors && C && !C[SPECIES$1]) _objectDp.f(C, SPECIES$1, {
  1476. configurable: true,
  1477. get: function () {
  1478. return this;
  1479. }
  1480. });
  1481. };
  1482. var ITERATOR$3 = _wks('iterator');
  1483. var SAFE_CLOSING = false;
  1484. try {
  1485. var riter = [7][ITERATOR$3]();
  1486. riter['return'] = function () {
  1487. SAFE_CLOSING = true;
  1488. };
  1489. // eslint-disable-next-line no-throw-literal
  1490. } catch (e) { /* empty */
  1491. }
  1492. var _iterDetect = function (exec, skipClosing) {
  1493. if (!skipClosing && !SAFE_CLOSING) return false;
  1494. var safe = false;
  1495. try {
  1496. var arr = [7];
  1497. var iter = arr[ITERATOR$3]();
  1498. iter.next = function () {
  1499. return {done: safe = true};
  1500. };
  1501. arr[ITERATOR$3] = function () {
  1502. return iter;
  1503. };
  1504. exec(arr);
  1505. } catch (e) { /* empty */
  1506. }
  1507. return safe;
  1508. };
  1509. var task = _task.set;
  1510. var microtask = _microtask();
  1511. var PROMISE = 'Promise';
  1512. var TypeError$1 = _global.TypeError;
  1513. var process$1 = _global.process;
  1514. var versions = process$1 && process$1.versions;
  1515. var v8 = versions && versions.v8 || '';
  1516. var $Promise = _global[PROMISE];
  1517. var isNode = _classof(process$1) == 'process';
  1518. var empty = function () { /* empty */
  1519. };
  1520. var Internal;
  1521. var newGenericPromiseCapability;
  1522. var OwnPromiseCapability;
  1523. var Wrapper;
  1524. var newPromiseCapability = newGenericPromiseCapability = _newPromiseCapability.f;
  1525. var USE_NATIVE = !!function () {
  1526. try {
  1527. // correct subclassing with @@species support
  1528. var promise = $Promise.resolve(1);
  1529. var FakePromise = (promise.constructor = {})[_wks('species')] = function (exec) {
  1530. exec(empty, empty);
  1531. };
  1532. // unhandled rejections tracking support, NodeJS Promise without it fails @@species test
  1533. return (isNode || typeof PromiseRejectionEvent == 'function')
  1534. && promise.then(empty) instanceof FakePromise
  1535. // v8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
  1536. // https://bugs.chromium.org/p/chromium/issues/detail?id=830565
  1537. // we can't detect it synchronously, so just check versions
  1538. && v8.indexOf('6.6') !== 0
  1539. && _userAgent.indexOf('Chrome/66') === -1;
  1540. } catch (e) { /* empty */
  1541. }
  1542. }();
  1543. // helpers
  1544. var isThenable = function (it) {
  1545. var then;
  1546. return _isObject(it) && typeof (then = it.then) == 'function' ? then : false;
  1547. };
  1548. var notify = function (promise, isReject) {
  1549. if (promise._n) return;
  1550. promise._n = true;
  1551. var chain = promise._c;
  1552. microtask(function () {
  1553. var value = promise._v;
  1554. var ok = promise._s == 1;
  1555. var i = 0;
  1556. var run = function (reaction) {
  1557. var handler = ok ? reaction.ok : reaction.fail;
  1558. var resolve = reaction.resolve;
  1559. var reject = reaction.reject;
  1560. var domain = reaction.domain;
  1561. var result, then, exited;
  1562. try {
  1563. if (handler) {
  1564. if (!ok) {
  1565. if (promise._h == 2) onHandleUnhandled(promise);
  1566. promise._h = 1;
  1567. }
  1568. if (handler === true) result = value;
  1569. else {
  1570. if (domain) domain.enter();
  1571. result = handler(value); // may throw
  1572. if (domain) {
  1573. domain.exit();
  1574. exited = true;
  1575. }
  1576. }
  1577. if (result === reaction.promise) {
  1578. reject(TypeError$1('Promise-chain cycle'));
  1579. } else if (then = isThenable(result)) {
  1580. then.call(result, resolve, reject);
  1581. } else resolve(result);
  1582. } else reject(value);
  1583. } catch (e) {
  1584. if (domain && !exited) domain.exit();
  1585. reject(e);
  1586. }
  1587. };
  1588. while (chain.length > i) run(chain[i++]); // variable length - can't use forEach
  1589. promise._c = [];
  1590. promise._n = false;
  1591. if (isReject && !promise._h) onUnhandled(promise);
  1592. });
  1593. };
  1594. var onUnhandled = function (promise) {
  1595. task.call(_global, function () {
  1596. var value = promise._v;
  1597. var unhandled = isUnhandled(promise);
  1598. var result, handler, console;
  1599. if (unhandled) {
  1600. result = _perform(function () {
  1601. if (isNode) {
  1602. process$1.emit('unhandledRejection', value, promise);
  1603. } else if (handler = _global.onunhandledrejection) {
  1604. handler({promise: promise, reason: value});
  1605. } else if ((console = _global.console) && console.error) {
  1606. console.error('Unhandled promise rejection', value);
  1607. }
  1608. });
  1609. // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
  1610. promise._h = isNode || isUnhandled(promise) ? 2 : 1;
  1611. }
  1612. promise._a = undefined;
  1613. if (unhandled && result.e) throw result.v;
  1614. });
  1615. };
  1616. var isUnhandled = function (promise) {
  1617. return promise._h !== 1 && (promise._a || promise._c).length === 0;
  1618. };
  1619. var onHandleUnhandled = function (promise) {
  1620. task.call(_global, function () {
  1621. var handler;
  1622. if (isNode) {
  1623. process$1.emit('rejectionHandled', promise);
  1624. } else if (handler = _global.onrejectionhandled) {
  1625. handler({promise: promise, reason: promise._v});
  1626. }
  1627. });
  1628. };
  1629. var $reject = function (value) {
  1630. var promise = this;
  1631. if (promise._d) return;
  1632. promise._d = true;
  1633. promise = promise._w || promise; // unwrap
  1634. promise._v = value;
  1635. promise._s = 2;
  1636. if (!promise._a) promise._a = promise._c.slice();
  1637. notify(promise, true);
  1638. };
  1639. var $resolve = function (value) {
  1640. var promise = this;
  1641. var then;
  1642. if (promise._d) return;
  1643. promise._d = true;
  1644. promise = promise._w || promise; // unwrap
  1645. try {
  1646. if (promise === value) throw TypeError$1("Promise can't be resolved itself");
  1647. if (then = isThenable(value)) {
  1648. microtask(function () {
  1649. var wrapper = {_w: promise, _d: false}; // wrap
  1650. try {
  1651. then.call(value, _ctx($resolve, wrapper, 1), _ctx($reject, wrapper, 1));
  1652. } catch (e) {
  1653. $reject.call(wrapper, e);
  1654. }
  1655. });
  1656. } else {
  1657. promise._v = value;
  1658. promise._s = 1;
  1659. notify(promise, false);
  1660. }
  1661. } catch (e) {
  1662. $reject.call({_w: promise, _d: false}, e); // wrap
  1663. }
  1664. };
  1665. // constructor polyfill
  1666. if (!USE_NATIVE) {
  1667. // 25.4.3.1 Promise(executor)
  1668. $Promise = function Promise(executor) {
  1669. _anInstance(this, $Promise, PROMISE, '_h');
  1670. _aFunction(executor);
  1671. Internal.call(this);
  1672. try {
  1673. executor(_ctx($resolve, this, 1), _ctx($reject, this, 1));
  1674. } catch (err) {
  1675. $reject.call(this, err);
  1676. }
  1677. };
  1678. // eslint-disable-next-line no-unused-vars
  1679. Internal = function Promise(executor) {
  1680. this._c = []; // <- awaiting reactions
  1681. this._a = undefined; // <- checked in isUnhandled reactions
  1682. this._s = 0; // <- state
  1683. this._d = false; // <- done
  1684. this._v = undefined; // <- value
  1685. this._h = 0; // <- rejection state, 0 - default, 1 - handled, 2 - unhandled
  1686. this._n = false; // <- notify
  1687. };
  1688. Internal.prototype = _redefineAll($Promise.prototype, {
  1689. // 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected)
  1690. then: function then(onFulfilled, onRejected) {
  1691. var reaction = newPromiseCapability(_speciesConstructor(this, $Promise));
  1692. reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true;
  1693. reaction.fail = typeof onRejected == 'function' && onRejected;
  1694. reaction.domain = isNode ? process$1.domain : undefined;
  1695. this._c.push(reaction);
  1696. if (this._a) this._a.push(reaction);
  1697. if (this._s) notify(this, false);
  1698. return reaction.promise;
  1699. },
  1700. // 25.4.5.1 Promise.prototype.catch(onRejected)
  1701. 'catch': function (onRejected) {
  1702. return this.then(undefined, onRejected);
  1703. }
  1704. });
  1705. OwnPromiseCapability = function () {
  1706. var promise = new Internal();
  1707. this.promise = promise;
  1708. this.resolve = _ctx($resolve, promise, 1);
  1709. this.reject = _ctx($reject, promise, 1);
  1710. };
  1711. _newPromiseCapability.f = newPromiseCapability = function (C) {
  1712. return C === $Promise || C === Wrapper
  1713. ? new OwnPromiseCapability(C)
  1714. : newGenericPromiseCapability(C);
  1715. };
  1716. }
  1717. _export(_export.G + _export.W + _export.F * !USE_NATIVE, {Promise: $Promise});
  1718. _setToStringTag($Promise, PROMISE);
  1719. _setSpecies(PROMISE);
  1720. Wrapper = _core[PROMISE];
  1721. // statics
  1722. _export(_export.S + _export.F * !USE_NATIVE, PROMISE, {
  1723. // 25.4.4.5 Promise.reject(r)
  1724. reject: function reject(r) {
  1725. var capability = newPromiseCapability(this);
  1726. var $$reject = capability.reject;
  1727. $$reject(r);
  1728. return capability.promise;
  1729. }
  1730. });
  1731. _export(_export.S + _export.F * (_library || !USE_NATIVE), PROMISE, {
  1732. // 25.4.4.6 Promise.resolve(x)
  1733. resolve: function resolve(x) {
  1734. return _promiseResolve(_library && this === Wrapper ? $Promise : this, x);
  1735. }
  1736. });
  1737. _export(_export.S + _export.F * !(USE_NATIVE && _iterDetect(function (iter) {
  1738. $Promise.all(iter)['catch'](empty);
  1739. })), PROMISE, {
  1740. // 25.4.4.1 Promise.all(iterable)
  1741. all: function all(iterable) {
  1742. var C = this;
  1743. var capability = newPromiseCapability(C);
  1744. var resolve = capability.resolve;
  1745. var reject = capability.reject;
  1746. var result = _perform(function () {
  1747. var values = [];
  1748. var index = 0;
  1749. var remaining = 1;
  1750. _forOf(iterable, false, function (promise) {
  1751. var $index = index++;
  1752. var alreadyCalled = false;
  1753. values.push(undefined);
  1754. remaining++;
  1755. C.resolve(promise).then(function (value) {
  1756. if (alreadyCalled) return;
  1757. alreadyCalled = true;
  1758. values[$index] = value;
  1759. --remaining || resolve(values);
  1760. }, reject);
  1761. });
  1762. --remaining || resolve(values);
  1763. });
  1764. if (result.e) reject(result.v);
  1765. return capability.promise;
  1766. },
  1767. // 25.4.4.4 Promise.race(iterable)
  1768. race: function race(iterable) {
  1769. var C = this;
  1770. var capability = newPromiseCapability(C);
  1771. var reject = capability.reject;
  1772. var result = _perform(function () {
  1773. _forOf(iterable, false, function (promise) {
  1774. C.resolve(promise).then(capability.resolve, reject);
  1775. });
  1776. });
  1777. if (result.e) reject(result.v);
  1778. return capability.promise;
  1779. }
  1780. });
  1781. _export(_export.P + _export.R, 'Promise', {
  1782. 'finally': function (onFinally) {
  1783. var C = _speciesConstructor(this, _core.Promise || _global.Promise);
  1784. var isFunction = typeof onFinally == 'function';
  1785. return this.then(
  1786. isFunction ? function (x) {
  1787. return _promiseResolve(C, onFinally()).then(function () {
  1788. return x;
  1789. });
  1790. } : onFinally,
  1791. isFunction ? function (e) {
  1792. return _promiseResolve(C, onFinally()).then(function () {
  1793. throw e;
  1794. });
  1795. } : onFinally
  1796. );
  1797. }
  1798. });
  1799. // https://github.com/tc39/proposal-promise-try
  1800. _export(_export.S, 'Promise', {
  1801. 'try': function (callbackfn) {
  1802. var promiseCapability = _newPromiseCapability.f(this);
  1803. var result = _perform(callbackfn);
  1804. (result.e ? promiseCapability.reject : promiseCapability.resolve)(result.v);
  1805. return promiseCapability.promise;
  1806. }
  1807. });
  1808. var promise$1 = _core.Promise;
  1809. var promise = createCommonjsModule(function (module) {
  1810. module.exports = {"default": promise$1, __esModule: true};
  1811. });
  1812. var _Promise = unwrapExports(promise);
  1813. var asyncToGenerator = createCommonjsModule(function (module, exports) {
  1814. exports.__esModule = true;
  1815. var _promise2 = _interopRequireDefault(promise);
  1816. function _interopRequireDefault(obj) {
  1817. return obj && obj.__esModule ? obj : {default: obj};
  1818. }
  1819. exports.default = function (fn) {
  1820. return function () {
  1821. var gen = fn.apply(this, arguments);
  1822. return new _promise2.default(function (resolve, reject) {
  1823. function step(key, arg) {
  1824. try {
  1825. var info = gen[key](arg);
  1826. var value = info.value;
  1827. } catch (error) {
  1828. reject(error);
  1829. return;
  1830. }
  1831. if (info.done) {
  1832. resolve(value);
  1833. } else {
  1834. return _promise2.default.resolve(value).then(function (value) {
  1835. step("next", value);
  1836. }, function (err) {
  1837. step("throw", err);
  1838. });
  1839. }
  1840. }
  1841. return step("next");
  1842. });
  1843. };
  1844. };
  1845. });
  1846. var _asyncToGenerator = unwrapExports(asyncToGenerator);
  1847. // import vConsole from "vconsole";
  1848. // todo 动态加载vconsole
  1849. function loadVConsole(isLoad) {
  1850. // if (isLoad) new vConsole()
  1851. }
  1852. var auth = {};
  1853. /** @授权成功后挂载API */
  1854. auth.requestLib = function () {
  1855. return new _Promise(function (resolve, reject) {
  1856. var appType = pageConfig.appType || pageConfig.appKey;
  1857. setTimeout(function () {
  1858. var resp = {
  1859. success: true,
  1860. code: 200,
  1861. message: "请求成功",
  1862. msg: "success",
  1863. data: {
  1864. appType: appType,
  1865. desc: "产品授权"
  1866. }
  1867. };
  1868. resolve(resp);
  1869. // const msg = `static load failure. ♨ 访问应用: ${resp.data.appType} ${resp.message} ©️ 版权请请联系: https://www.aliwork.com/o/mc`;
  1870. // reject(msg);
  1871. }, 750);
  1872. });
  1873. };
  1874. /** @打开钉钉名片 */
  1875. auth.contactNoDing = function (noDing) {
  1876. window.open("dingtalk://dingtalkclient/action/sendmsg?dingtalk_id=" + noDing, // 燕江钉钉号
  1877. "_self");
  1878. };
  1879. /** @钉钉名片牧语 */
  1880. auth.contactUs = function () {
  1881. window.open("dingtalk://dingtalkclient/action/sendmsg?dingtalk_id=yanjiangboy", // 燕江钉钉号
  1882. "_self");
  1883. };
  1884. /** @钉钉商务名片 */
  1885. auth.contactBusiness = function () {
  1886. window.open("dingtalk://dingtalkclient/action/sendmsg?dingtalk_id=ipoduvc", // 曹龙英钉钉号
  1887. "_self");
  1888. };
  1889. var com = {};
  1890. // 页面环境: 0提交(其它),1查看,2编辑(审批)
  1891. com.checkEnv = function () {
  1892. var instanceData = mjs.$this.utils.getFormInstanceData();
  1893. var _instanceData$flowDat = instanceData.flowData,
  1894. flowData = _instanceData$flowDat === undefined ? {} : _instanceData$flowDat;
  1895. var editMode = flowData.editMode,
  1896. viewMode = flowData.viewMode;
  1897. if (editMode) return 2; // 审批页面为2, 编辑状态
  1898. if (viewMode) return 1;
  1899. return 0;
  1900. };
  1901. // 冗余Toast提示方法
  1902. com.showMessage = function (title) {
  1903. var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "success";
  1904. var size = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "medium";
  1905. var duration = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "750";
  1906. if (!title) return;
  1907. mjs.$this.utils.toast({type: type, title: title, size: size, duration: duration});
  1908. };
  1909. // type: 'success', 'warning', 'error', 'notice', 'help', 'loading'
  1910. com.showErrorMessage = function (title) {
  1911. this.showMessage(title, "error");
  1912. };
  1913. // size: large, medium
  1914. com.showSuccessMessage = function (title) {
  1915. this.showMessage(title);
  1916. };
  1917. // 冗余显示全屏loading: 全局对象
  1918. var G_DIALOG = void 0;
  1919. com.showLoading = function () {
  1920. var title = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "拼命加载中...";
  1921. if (G_DIALOG) return; // 避免多次闪屏
  1922. G_DIALOG = mjs.$this.utils.toast({
  1923. type: "loading",
  1924. title: title,
  1925. closeable: false,
  1926. footer: false,
  1927. messageProps: {type: "loading"}
  1928. });
  1929. };
  1930. // 冗余隐藏全屏loading: 全局对象
  1931. com.hideLoading = function () {
  1932. G_DIALOG && G_DIALOG();
  1933. G_DIALOG = null;
  1934. };
  1935. // 弹出确认框
  1936. com.showConfirm = function (title, content) {
  1937. var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "confirm";
  1938. if (!title && !content) {
  1939. throw new Error(type + " => The title and content are empty.");
  1940. }
  1941. return new _Promise(function (resolve, reject) {
  1942. mjs.$this.utils.dialog({
  1943. type: type, title: title, content: content, /* 如需换行可传入 HTML/JSX 来实现 */
  1944. onOk: function onOk() {
  1945. return resolve();
  1946. },
  1947. onCancel: function onCancel() {
  1948. return reject("用户取消了");
  1949. }
  1950. });
  1951. });
  1952. };
  1953. // 获取当前地址的表单实例ID
  1954. com.getFormInstIdByUrl = function () {
  1955. if (mjs.$this) {
  1956. // 智障的设计:流程从管理页面进入是 formInstId ,流程提交完成是 procInsId
  1957. var query = mjs.$this.utils.router.getQuery();
  1958. return query.procInsId || query.formInstId;
  1959. }
  1960. var url = window.location.href;
  1961. if (url.includes("procInsId=")) {
  1962. return url.split("procInsId=")[1].split("&")[0];
  1963. }
  1964. return url.split("formInstId=")[1].split("&")[0];
  1965. };
  1966. // const dom = {};
  1967. // // 异常打印和评论按钮: 兼容BUG, 平台设置不生效
  1968. // dom.removeMobInvalid = function (that) {
  1969. // const doms = document.querySelectorAll(".flow-operation-button");
  1970. // doms.forEach((ele) => {
  1971. // if (["评论", "打印"].includes(ele.textContent)) ele.remove();
  1972. // });
  1973. // };
  1974. // // 设置iframe组件, 并且加载;链接
  1975. // dom.iframeLoadFullScreen = function (that, { compId, link, bottom = 44 }) {
  1976. // document.getElementById(`frame_${compId}`).style.height =
  1977. // window.screen.height - bottom + "px";
  1978. // that.$(compId).set("src", link);
  1979. // };
  1980. // // 去除tab间距样式调整
  1981. // dom.removeLayoutSpace = function (that) {
  1982. // const doms = document.querySelectorAll(".next-tabs-content");
  1983. // doms.forEach((elem) => elem.remove());
  1984. // };
  1985. // import ding from "../vendor/dingApi";
  1986. // import bus from "../com.mcli.mcli.utils/bus";
  1987. // // 审批页面: button事件的3种绑定方式以及触发逻辑:https://www.cnblogs.com/ooo0/p/7742214.html
  1988. // dom.closeCurrentTabForApprove = function (that) {
  1989. // if (zTool.env != 2) return;
  1990. // // 关闭页面: 延迟体验
  1991. // function closeTab (title) {
  1992. // // 特别说明:在审批情况下,若实现了DOM_CALLBACK_APPROVE,将关闭决定移交
  1993. // if (bus.DOM_CALLBACK_APPROVE) {
  1994. // bus.DOM_CALLBACK_APPROVE(that, title);
  1995. // return;
  1996. // }
  1997. // ding.closeNavigationForDomEvent(that);
  1998. // }
  1999. // // PC端
  2000. // let doms = document.querySelectorAll(".next-btn.next-medium"); // 使用getElementsByClassName拿不到dom实体
  2001. // if (doms.length) {
  2002. // // 读取弹出框按钮: 延迟体验
  2003. // const listenerDialog = function (title) {
  2004. // setTimeout(() => {
  2005. // const doms = document.querySelectorAll(".next-btn.next-small"); // 多个使用不需要添加空格
  2006. // doms.forEach((ele) => {
  2007. // if ("确认" == ele.innerText) {
  2008. // ele.onclick = function () {
  2009. // closeTab(title);
  2010. // };
  2011. // }
  2012. // });
  2013. // }, 200);
  2014. // };
  2015. // doms.forEach((ele) => {
  2016. // // 目前退回为加签逻辑 ==> 退回页面环境为编辑态值2
  2017. // if (["同意", "拒绝", "退回", "转交", "提交"].includes(ele.innerText)) {
  2018. // ele.onclick = function () {
  2019. // listenerDialog(ele.innerText);
  2020. // };
  2021. // }
  2022. // });
  2023. // return;
  2024. // }
  2025. // // 移动端
  2026. // doms = document.querySelectorAll(".flow-operation-button");
  2027. // // 读取弹出框按钮: 延迟体验
  2028. // const listenerDialog = function (title) {
  2029. // setTimeout(() => {
  2030. // let doms = document.querySelectorAll(".t-button"); // 其它
  2031. // if (!doms.length) doms = document.querySelectorAll(".mt-button"); // 退回
  2032. // doms.forEach((ele) => {
  2033. // if (["提交", "确认退回"] == ele.innerText) {
  2034. // ele.onclick = function () {
  2035. // closeTab(title);
  2036. // };
  2037. // }
  2038. // });
  2039. // }, 200);
  2040. // };
  2041. // doms.forEach((ele) => {
  2042. // // 目前退回为加签逻辑 ==> 退回页面环境为编辑态值2
  2043. // if (["同意", "拒绝", "退回", "转交", "提交"].includes(ele.innerText)) {
  2044. // ele.onclick = function () {
  2045. // listenerDialog(ele.innerText);
  2046. // };
  2047. // }
  2048. // });
  2049. // };
  2050. // // 提交页面: button事件的3种绑定方式以及触发逻辑:https://www.cnblogs.com/ooo0/p/7742214.html
  2051. // dom.closeCurrentTabForSubmit = function (that) {
  2052. // // 退回再提交走审批事件, 目前退回为加签逻辑 ==> 退回页面环境为编辑态值2
  2053. // if (static.env) return;
  2054. // function closeTab () {
  2055. // // 执行顺序: onclick > addEventListener > beforeSubmit
  2056. // // 特别说明:在提交情况下,页面存在beforeSubmit,相关的逻辑在beforeSubmit下要手动调用,因为这里是直接触发若是有判断情况下决定权交给beforeSubmit处理
  2057. // if (that.beforeSubmit) return;
  2058. // // 异步不会等待
  2059. // dom.closeTabCompatibilityBeforeSubmit(that);
  2060. // }
  2061. // // PC端 & 移动端
  2062. // let doms = document.querySelectorAll(".deep-form-submit");
  2063. // if (!doms.length) return
  2064. // doms[0].addEventListener("click", closeTab, false);
  2065. // };
  2066. // // 兼容 beforeSubmit 情况下, 异步且在按钮事件之后的问题 执行顺序: onclick > addEventListener > beforeSubmit
  2067. // dom.closeTabCompatibilityBeforeSubmit = function (that) {
  2068. // bus.DOM_CALLBACK_SUBMIT(that);
  2069. // // 关闭页面: 延迟体验
  2070. // ding.closeNavigationForDomEvent(that);
  2071. // };
  2072. // export default dom;
  2073. var dom = {
  2074. // 隐藏tab空白
  2075. removeTabLayoutContainer: function removeTabLayoutContainer() {
  2076. var elemP = document.querySelectorAll(".next-tabs-content")[0];
  2077. if (elemP) elemP.remove();
  2078. },
  2079. // 自定义页面全屏: pc
  2080. removeSpaceForCustomPage: function removeSpaceForCustomPage() {
  2081. var page = document.getElementsByClassName("vc-rootcontent");
  2082. if (page.length) {
  2083. page[0].style.margin = "0px";
  2084. page[0].className = "";
  2085. }
  2086. }
  2087. };
  2088. // 公共配置 //
  2089. /** mjava path: 开发dev, 生产prod, 测试test */
  2090. var api = "";
  2091. /** 设置为不超时 */
  2092. var timeout = 0;
  2093. /** 授权 */
  2094. var token = "";
  2095. /** 宜搭分页上限*/
  2096. var pageSize = 100;
  2097. /** 宜搭明细数据上限 */
  2098. var detailCount = 500;
  2099. /** 宜搭数据查询上限 */
  2100. var upperLimit = 30000;
  2101. /** 导出配置信息 */
  2102. var config = {
  2103. api: api,
  2104. timeout: timeout,
  2105. token: token,
  2106. pageSize: pageSize,
  2107. detailCount: detailCount,
  2108. upperLimit: upperLimit
  2109. };
  2110. var f$2 = Object.getOwnPropertySymbols;
  2111. var _objectGops = {
  2112. f: f$2
  2113. };
  2114. var f$3 = {}.propertyIsEnumerable;
  2115. var _objectPie = {
  2116. f: f$3
  2117. };
  2118. // 19.1.2.1 Object.assign(target, source, ...)
  2119. var $assign = Object.assign;
  2120. // should work with symbols and should have deterministic property order (V8 bug)
  2121. var _objectAssign = !$assign || _fails(function () {
  2122. var A = {};
  2123. var B = {};
  2124. // eslint-disable-next-line no-undef
  2125. var S = Symbol();
  2126. var K = 'abcdefghijklmnopqrst';
  2127. A[S] = 7;
  2128. K.split('').forEach(function (k) {
  2129. B[k] = k;
  2130. });
  2131. return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K;
  2132. }) ? function assign(target, source) { // eslint-disable-line no-unused-vars
  2133. var T = _toObject(target);
  2134. var aLen = arguments.length;
  2135. var index = 1;
  2136. var getSymbols = _objectGops.f;
  2137. var isEnum = _objectPie.f;
  2138. while (aLen > index) {
  2139. var S = _iobject(arguments[index++]);
  2140. var keys = getSymbols ? _objectKeys(S).concat(getSymbols(S)) : _objectKeys(S);
  2141. var length = keys.length;
  2142. var j = 0;
  2143. var key;
  2144. while (length > j) {
  2145. key = keys[j++];
  2146. if (!_descriptors || isEnum.call(S, key)) T[key] = S[key];
  2147. }
  2148. }
  2149. return T;
  2150. } : $assign;
  2151. // 19.1.3.1 Object.assign(target, source)
  2152. _export(_export.S + _export.F, 'Object', {assign: _objectAssign});
  2153. var assign$2 = _core.Object.assign;
  2154. var assign = createCommonjsModule(function (module) {
  2155. module.exports = {"default": assign$2, __esModule: true};
  2156. });
  2157. unwrapExports(assign);
  2158. var _extends = createCommonjsModule(function (module, exports) {
  2159. exports.__esModule = true;
  2160. var _assign2 = _interopRequireDefault(assign);
  2161. function _interopRequireDefault(obj) {
  2162. return obj && obj.__esModule ? obj : {default: obj};
  2163. }
  2164. exports.default = _assign2.default || function (target) {
  2165. for (var i = 1; i < arguments.length; i++) {
  2166. var source = arguments[i];
  2167. for (var key in source) {
  2168. if (Object.prototype.hasOwnProperty.call(source, key)) {
  2169. target[key] = source[key];
  2170. }
  2171. }
  2172. }
  2173. return target;
  2174. };
  2175. });
  2176. var _extends$1 = unwrapExports(_extends);
  2177. // 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes)
  2178. _export(_export.S + _export.F * !_descriptors, 'Object', {defineProperty: _objectDp.f});
  2179. var $Object = _core.Object;
  2180. var defineProperty$3 = function defineProperty(it, key, desc) {
  2181. return $Object.defineProperty(it, key, desc);
  2182. };
  2183. var defineProperty$1 = createCommonjsModule(function (module) {
  2184. module.exports = {"default": defineProperty$3, __esModule: true};
  2185. });
  2186. unwrapExports(defineProperty$1);
  2187. var defineProperty = createCommonjsModule(function (module, exports) {
  2188. exports.__esModule = true;
  2189. var _defineProperty2 = _interopRequireDefault(defineProperty$1);
  2190. function _interopRequireDefault(obj) {
  2191. return obj && obj.__esModule ? obj : {default: obj};
  2192. }
  2193. exports.default = function (obj, key, value) {
  2194. if (key in obj) {
  2195. (0, _defineProperty2.default)(obj, key, {
  2196. value: value,
  2197. enumerable: true,
  2198. configurable: true,
  2199. writable: true
  2200. });
  2201. } else {
  2202. obj[key] = value;
  2203. }
  2204. return obj;
  2205. };
  2206. });
  2207. var _defineProperty = unwrapExports(defineProperty);
  2208. // most Object methods by ES6 should accept primitives
  2209. var _objectSap = function (KEY, exec) {
  2210. var fn = (_core.Object || {})[KEY] || Object[KEY];
  2211. var exp = {};
  2212. exp[KEY] = exec(fn);
  2213. _export(_export.S + _export.F * _fails(function () {
  2214. fn(1);
  2215. }), 'Object', exp);
  2216. };
  2217. // 19.1.2.14 Object.keys(O)
  2218. _objectSap('keys', function () {
  2219. return function keys(it) {
  2220. return _objectKeys(_toObject(it));
  2221. };
  2222. });
  2223. var keys$1 = _core.Object.keys;
  2224. var keys = createCommonjsModule(function (module) {
  2225. module.exports = {"default": keys$1, __esModule: true};
  2226. });
  2227. var _Object$keys = unwrapExports(keys);
  2228. var bind = function bind(fn, thisArg) {
  2229. return function wrap() {
  2230. var args = new Array(arguments.length);
  2231. for (var i = 0; i < args.length; i++) {
  2232. args[i] = arguments[i];
  2233. }
  2234. return fn.apply(thisArg, args);
  2235. };
  2236. };
  2237. /*global toString:true*/
  2238. // com.mcli.mcli.utils is a library of generic helper functions non-specific to axios
  2239. var toString$1 = Object.prototype.toString;
  2240. /**
  2241. * Determine if a value is an Array
  2242. *
  2243. * @param {Object} val The value to test
  2244. * @returns {boolean} True if value is an Array, otherwise false
  2245. */
  2246. function isArray(val) {
  2247. return toString$1.call(val) === '[object Array]';
  2248. }
  2249. /**
  2250. * Determine if a value is undefined
  2251. *
  2252. * @param {Object} val The value to test
  2253. * @returns {boolean} True if the value is undefined, otherwise false
  2254. */
  2255. function isUndefined(val) {
  2256. return typeof val === 'undefined';
  2257. }
  2258. /**
  2259. * Determine if a value is a Buffer
  2260. *
  2261. * @param {Object} val The value to test
  2262. * @returns {boolean} True if value is a Buffer, otherwise false
  2263. */
  2264. function isBuffer(val) {
  2265. return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
  2266. && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);
  2267. }
  2268. /**
  2269. * Determine if a value is an ArrayBuffer
  2270. *
  2271. * @param {Object} val The value to test
  2272. * @returns {boolean} True if value is an ArrayBuffer, otherwise false
  2273. */
  2274. function isArrayBuffer(val) {
  2275. return toString$1.call(val) === '[object ArrayBuffer]';
  2276. }
  2277. /**
  2278. * Determine if a value is a FormData
  2279. *
  2280. * @param {Object} val The value to test
  2281. * @returns {boolean} True if value is an FormData, otherwise false
  2282. */
  2283. function isFormData(val) {
  2284. return (typeof FormData !== 'undefined') && (val instanceof FormData);
  2285. }
  2286. /**
  2287. * Determine if a value is a view on an ArrayBuffer
  2288. *
  2289. * @param {Object} val The value to test
  2290. * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
  2291. */
  2292. function isArrayBufferView(val) {
  2293. var result;
  2294. if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
  2295. result = ArrayBuffer.isView(val);
  2296. } else {
  2297. result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
  2298. }
  2299. return result;
  2300. }
  2301. /**
  2302. * Determine if a value is a String
  2303. *
  2304. * @param {Object} val The value to test
  2305. * @returns {boolean} True if value is a String, otherwise false
  2306. */
  2307. function isString(val) {
  2308. return typeof val === 'string';
  2309. }
  2310. /**
  2311. * Determine if a value is a Number
  2312. *
  2313. * @param {Object} val The value to test
  2314. * @returns {boolean} True if value is a Number, otherwise false
  2315. */
  2316. function isNumber(val) {
  2317. return typeof val === 'number';
  2318. }
  2319. /**
  2320. * Determine if a value is an Object
  2321. *
  2322. * @param {Object} val The value to test
  2323. * @returns {boolean} True if value is an Object, otherwise false
  2324. */
  2325. function isObject$1(val) {
  2326. return val !== null && typeof val === 'object';
  2327. }
  2328. /**
  2329. * Determine if a value is a Date
  2330. *
  2331. * @param {Object} val The value to test
  2332. * @returns {boolean} True if value is a Date, otherwise false
  2333. */
  2334. function isDate(val) {
  2335. return toString$1.call(val) === '[object Date]';
  2336. }
  2337. /**
  2338. * Determine if a value is a File
  2339. *
  2340. * @param {Object} val The value to test
  2341. * @returns {boolean} True if value is a File, otherwise false
  2342. */
  2343. function isFile(val) {
  2344. return toString$1.call(val) === '[object File]';
  2345. }
  2346. /**
  2347. * Determine if a value is a Blob
  2348. *
  2349. * @param {Object} val The value to test
  2350. * @returns {boolean} True if value is a Blob, otherwise false
  2351. */
  2352. function isBlob(val) {
  2353. return toString$1.call(val) === '[object Blob]';
  2354. }
  2355. /**
  2356. * Determine if a value is a Function
  2357. *
  2358. * @param {Object} val The value to test
  2359. * @returns {boolean} True if value is a Function, otherwise false
  2360. */
  2361. function isFunction(val) {
  2362. return toString$1.call(val) === '[object Function]';
  2363. }
  2364. /**
  2365. * Determine if a value is a Stream
  2366. *
  2367. * @param {Object} val The value to test
  2368. * @returns {boolean} True if value is a Stream, otherwise false
  2369. */
  2370. function isStream(val) {
  2371. return isObject$1(val) && isFunction(val.pipe);
  2372. }
  2373. /**
  2374. * Determine if a value is a URLSearchParams object
  2375. *
  2376. * @param {Object} val The value to test
  2377. * @returns {boolean} True if value is a URLSearchParams object, otherwise false
  2378. */
  2379. function isURLSearchParams(val) {
  2380. return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
  2381. }
  2382. /**
  2383. * Trim excess whitespace off the beginning and end of a string
  2384. *
  2385. * @param {String} str The String to trim
  2386. * @returns {String} The String freed of excess whitespace
  2387. */
  2388. function trim(str) {
  2389. return str.replace(/^\s*/, '').replace(/\s*$/, '');
  2390. }
  2391. /**
  2392. * Determine if we're running in a standard browser environment
  2393. *
  2394. * This allows axios to run in a web worker, and react-native.
  2395. * Both environments support XMLHttpRequest, but not fully standard globals.
  2396. *
  2397. * web workers:
  2398. * typeof window -> undefined
  2399. * typeof document -> undefined
  2400. *
  2401. * react-native:
  2402. * navigator.product -> 'ReactNative'
  2403. * nativescript
  2404. * navigator.product -> 'NativeScript' or 'NS'
  2405. */
  2406. function isStandardBrowserEnv() {
  2407. if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||
  2408. navigator.product === 'NativeScript' ||
  2409. navigator.product === 'NS')) {
  2410. return false;
  2411. }
  2412. return (
  2413. typeof window !== 'undefined' &&
  2414. typeof document !== 'undefined'
  2415. );
  2416. }
  2417. /**
  2418. * Iterate over an Array or an Object invoking a function for each item.
  2419. *
  2420. * If `obj` is an Array callback will be called passing
  2421. * the value, index, and complete array for each item.
  2422. *
  2423. * If 'obj' is an Object callback will be called passing
  2424. * the value, key, and complete object for each property.
  2425. *
  2426. * @param {Object|Array} obj The object to iterate
  2427. * @param {Function} fn The callback to invoke for each item
  2428. */
  2429. function forEach(obj, fn) {
  2430. // Don't bother if no value provided
  2431. if (obj === null || typeof obj === 'undefined') {
  2432. return;
  2433. }
  2434. // Force an array if not already something iterable
  2435. if (typeof obj !== 'object') {
  2436. /*eslint no-param-reassign:0*/
  2437. obj = [obj];
  2438. }
  2439. if (isArray(obj)) {
  2440. // Iterate over array values
  2441. for (var i = 0, l = obj.length; i < l; i++) {
  2442. fn.call(null, obj[i], i, obj);
  2443. }
  2444. } else {
  2445. // Iterate over object keys
  2446. for (var key in obj) {
  2447. if (Object.prototype.hasOwnProperty.call(obj, key)) {
  2448. fn.call(null, obj[key], key, obj);
  2449. }
  2450. }
  2451. }
  2452. }
  2453. /**
  2454. * Accepts varargs expecting each argument to be an object, then
  2455. * immutably merges the properties of each object and returns result.
  2456. *
  2457. * When multiple objects contain the same key the later object in
  2458. * the arguments list will take precedence.
  2459. *
  2460. * Example:
  2461. *
  2462. * ```js
  2463. * var result = merge({foo: 123}, {foo: 456});
  2464. * console.log(result.foo); // outputs 456
  2465. * ```
  2466. *
  2467. * @param {Object} obj1 Object to merge
  2468. * @returns {Object} Result of all merge properties
  2469. */
  2470. function merge(/* obj1, obj2, obj3, ... */) {
  2471. var result = {};
  2472. function assignValue(val, key) {
  2473. if (typeof result[key] === 'object' && typeof val === 'object') {
  2474. result[key] = merge(result[key], val);
  2475. } else {
  2476. result[key] = val;
  2477. }
  2478. }
  2479. for (var i = 0, l = arguments.length; i < l; i++) {
  2480. forEach(arguments[i], assignValue);
  2481. }
  2482. return result;
  2483. }
  2484. /**
  2485. * Function equal to merge with the difference being that no reference
  2486. * to original objects is kept.
  2487. *
  2488. * @see merge
  2489. * @param {Object} obj1 Object to merge
  2490. * @returns {Object} Result of all merge properties
  2491. */
  2492. function deepMerge(/* obj1, obj2, obj3, ... */) {
  2493. var result = {};
  2494. function assignValue(val, key) {
  2495. if (typeof result[key] === 'object' && typeof val === 'object') {
  2496. result[key] = deepMerge(result[key], val);
  2497. } else if (typeof val === 'object') {
  2498. result[key] = deepMerge({}, val);
  2499. } else {
  2500. result[key] = val;
  2501. }
  2502. }
  2503. for (var i = 0, l = arguments.length; i < l; i++) {
  2504. forEach(arguments[i], assignValue);
  2505. }
  2506. return result;
  2507. }
  2508. /**
  2509. * Extends object a by mutably adding to it the properties of object b.
  2510. *
  2511. * @param {Object} a The object to be extended
  2512. * @param {Object} b The object to copy properties from
  2513. * @param {Object} thisArg The object to bind function to
  2514. * @return {Object} The resulting value of object a
  2515. */
  2516. function extend(a, b, thisArg) {
  2517. forEach(b, function assignValue(val, key) {
  2518. if (thisArg && typeof val === 'function') {
  2519. a[key] = bind(val, thisArg);
  2520. } else {
  2521. a[key] = val;
  2522. }
  2523. });
  2524. return a;
  2525. }
  2526. var utils = {
  2527. isArray: isArray,
  2528. isArrayBuffer: isArrayBuffer,
  2529. isBuffer: isBuffer,
  2530. isFormData: isFormData,
  2531. isArrayBufferView: isArrayBufferView,
  2532. isString: isString,
  2533. isNumber: isNumber,
  2534. isObject: isObject$1,
  2535. isUndefined: isUndefined,
  2536. isDate: isDate,
  2537. isFile: isFile,
  2538. isBlob: isBlob,
  2539. isFunction: isFunction,
  2540. isStream: isStream,
  2541. isURLSearchParams: isURLSearchParams,
  2542. isStandardBrowserEnv: isStandardBrowserEnv,
  2543. forEach: forEach,
  2544. merge: merge,
  2545. deepMerge: deepMerge,
  2546. extend: extend,
  2547. trim: trim
  2548. };
  2549. function encode(val) {
  2550. return encodeURIComponent(val).replace(/%40/gi, '@').replace(/%3A/gi, ':').replace(/%24/g, '$').replace(/%2C/gi, ',').replace(/%20/g, '+').replace(/%5B/gi, '[').replace(/%5D/gi, ']');
  2551. }
  2552. /**
  2553. * Build a URL by appending params to the end
  2554. *
  2555. * @param {string} url The base of the url (e.g., http://www.google.com)
  2556. * @param {object} [params] The params to be appended
  2557. * @returns {string} The formatted url
  2558. */
  2559. var buildURL = function buildURL(url, params, paramsSerializer) {
  2560. /*eslint no-param-reassign:0*/
  2561. if (!params) {
  2562. return url;
  2563. }
  2564. var serializedParams;
  2565. if (paramsSerializer) {
  2566. serializedParams = paramsSerializer(params);
  2567. } else if (utils.isURLSearchParams(params)) {
  2568. serializedParams = params.toString();
  2569. } else {
  2570. var parts = [];
  2571. utils.forEach(params, function serialize(val, key) {
  2572. if (val === null || typeof val === 'undefined') {
  2573. return;
  2574. }
  2575. if (utils.isArray(val)) {
  2576. key = key + '[]';
  2577. } else {
  2578. val = [val];
  2579. }
  2580. utils.forEach(val, function parseValue(v) {
  2581. if (utils.isDate(v)) {
  2582. v = v.toISOString();
  2583. } else if (utils.isObject(v)) {
  2584. v = JSON.stringify(v);
  2585. }
  2586. parts.push(encode(key) + '=' + encode(v));
  2587. });
  2588. });
  2589. serializedParams = parts.join('&');
  2590. }
  2591. if (serializedParams) {
  2592. var hashmarkIndex = url.indexOf('#');
  2593. if (hashmarkIndex !== -1) {
  2594. url = url.slice(0, hashmarkIndex);
  2595. }
  2596. url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
  2597. }
  2598. return url;
  2599. };
  2600. function InterceptorManager() {
  2601. this.handlers = [];
  2602. }
  2603. /**
  2604. * Add a new interceptor to the stack
  2605. *
  2606. * @param {Function} fulfilled The function to handle `then` for a `Promise`
  2607. * @param {Function} rejected The function to handle `reject` for a `Promise`
  2608. *
  2609. * @return {Number} An ID used to remove interceptor later
  2610. */
  2611. InterceptorManager.prototype.use = function use(fulfilled, rejected) {
  2612. this.handlers.push({
  2613. fulfilled: fulfilled,
  2614. rejected: rejected
  2615. });
  2616. return this.handlers.length - 1;
  2617. };
  2618. /**
  2619. * Remove an interceptor from the stack
  2620. *
  2621. * @param {Number} id The ID that was returned by `use`
  2622. */
  2623. InterceptorManager.prototype.eject = function eject(id) {
  2624. if (this.handlers[id]) {
  2625. this.handlers[id] = null;
  2626. }
  2627. };
  2628. /**
  2629. * Iterate over all the registered interceptors
  2630. *
  2631. * This method is particularly useful for skipping over any
  2632. * interceptors that may have become `null` calling `eject`.
  2633. *
  2634. * @param {Function} fn The function to call for each interceptor
  2635. */
  2636. InterceptorManager.prototype.forEach = function forEach(fn) {
  2637. utils.forEach(this.handlers, function forEachHandler(h) {
  2638. if (h !== null) {
  2639. fn(h);
  2640. }
  2641. });
  2642. };
  2643. var InterceptorManager_1 = InterceptorManager;
  2644. /**
  2645. * Transform the data for a request or a response
  2646. *
  2647. * @param {Object|String} data The data to be transformed
  2648. * @param {Array} headers The headers for the request or response
  2649. * @param {Array|Function} fns A single function or Array of functions
  2650. * @returns {*} The resulting transformed data
  2651. */
  2652. var transformData = function transformData(data, headers, fns) {
  2653. /*eslint no-param-reassign:0*/
  2654. utils.forEach(fns, function transform(fn) {
  2655. data = fn(data, headers);
  2656. });
  2657. return data;
  2658. };
  2659. var isCancel = function isCancel(value) {
  2660. return !!(value && value.__CANCEL__);
  2661. };
  2662. var normalizeHeaderName = function normalizeHeaderName(headers, normalizedName) {
  2663. utils.forEach(headers, function processHeader(value, name) {
  2664. if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
  2665. headers[normalizedName] = value;
  2666. delete headers[name];
  2667. }
  2668. });
  2669. };
  2670. /**
  2671. * Update an Error with the specified config, error code, and response.
  2672. *
  2673. * @param {Error} error The error to update.
  2674. * @param {Object} config The config.
  2675. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  2676. * @param {Object} [request] The request.
  2677. * @param {Object} [response] The response.
  2678. * @returns {Error} The error.
  2679. */
  2680. var enhanceError = function enhanceError(error, config, code, request, response) {
  2681. error.config = config;
  2682. if (code) {
  2683. error.code = code;
  2684. }
  2685. error.request = request;
  2686. error.response = response;
  2687. error.isAxiosError = true;
  2688. error.toJSON = function () {
  2689. return {
  2690. // Standard
  2691. message: this.message,
  2692. name: this.name,
  2693. // Microsoft
  2694. description: this.description,
  2695. number: this.number,
  2696. // Mozilla
  2697. fileName: this.fileName,
  2698. lineNumber: this.lineNumber,
  2699. columnNumber: this.columnNumber,
  2700. stack: this.stack,
  2701. // Axios
  2702. config: this.config,
  2703. code: this.code
  2704. };
  2705. };
  2706. return error;
  2707. };
  2708. /**
  2709. * Create an Error with the specified message, config, error code, request and response.
  2710. *
  2711. * @param {string} message The error message.
  2712. * @param {Object} config The config.
  2713. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  2714. * @param {Object} [request] The request.
  2715. * @param {Object} [response] The response.
  2716. * @returns {Error} The created error.
  2717. */
  2718. var createError = function createError(message, config, code, request, response) {
  2719. var error = new Error(message);
  2720. return enhanceError(error, config, code, request, response);
  2721. };
  2722. /**
  2723. * Resolve or reject a Promise based on response status.
  2724. *
  2725. * @param {Function} resolve A function that resolves the promise.
  2726. * @param {Function} reject A function that rejects the promise.
  2727. * @param {object} response The response.
  2728. */
  2729. var settle = function settle(resolve, reject, response) {
  2730. var validateStatus = response.config.validateStatus;
  2731. if (!validateStatus || validateStatus(response.status)) {
  2732. resolve(response);
  2733. } else {
  2734. reject(createError(
  2735. 'Request failed with status code ' + response.status,
  2736. response.config,
  2737. null,
  2738. response.request,
  2739. response
  2740. ));
  2741. }
  2742. };
  2743. /**
  2744. * Determines whether the specified URL is absolute
  2745. *
  2746. * @param {string} url The URL to test
  2747. * @returns {boolean} True if the specified URL is absolute, otherwise false
  2748. */
  2749. var isAbsoluteURL = function isAbsoluteURL(url) {
  2750. // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
  2751. // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
  2752. // by any combination of letters, digits, plus, period, or hyphen.
  2753. return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
  2754. };
  2755. /**
  2756. * Creates a new URL by combining the specified URLs
  2757. *
  2758. * @param {string} baseURL The base URL
  2759. * @param {string} relativeURL The relative URL
  2760. * @returns {string} The combined URL
  2761. */
  2762. var combineURLs = function combineURLs(baseURL, relativeURL) {
  2763. return relativeURL
  2764. ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
  2765. : baseURL;
  2766. };
  2767. /**
  2768. * Creates a new URL by combining the baseURL with the requestedURL,
  2769. * only when the requestedURL is not already an absolute URL.
  2770. * If the requestURL is absolute, this function returns the requestedURL untouched.
  2771. *
  2772. * @param {string} baseURL The base URL
  2773. * @param {string} requestedURL Absolute or relative URL to combine
  2774. * @returns {string} The combined full path
  2775. */
  2776. var buildFullPath = function buildFullPath(baseURL, requestedURL) {
  2777. if (baseURL && !isAbsoluteURL(requestedURL)) {
  2778. return combineURLs(baseURL, requestedURL);
  2779. }
  2780. return requestedURL;
  2781. };
  2782. // Headers whose duplicates are ignored by node
  2783. // c.f. https://nodejs.org/api/http.html#http_message_headers
  2784. var ignoreDuplicateOf = [
  2785. 'age', 'authorization', 'content-length', 'content-type', 'etag',
  2786. 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
  2787. 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
  2788. 'referer', 'retry-after', 'user-agent'
  2789. ];
  2790. /**
  2791. * Parse headers into an object
  2792. *
  2793. * ```
  2794. * Date: Wed, 27 Aug 2014 08:58:49 GMT
  2795. * Content-Type: application/json
  2796. * Connection: keep-alive
  2797. * Transfer-Encoding: chunked
  2798. * ```
  2799. *
  2800. * @param {String} headers Headers needing to be parsed
  2801. * @returns {Object} Headers parsed into an object
  2802. */
  2803. var parseHeaders = function parseHeaders(headers) {
  2804. var parsed = {};
  2805. var key;
  2806. var val;
  2807. var i;
  2808. if (!headers) {
  2809. return parsed;
  2810. }
  2811. utils.forEach(headers.split('\n'), function parser(line) {
  2812. i = line.indexOf(':');
  2813. key = utils.trim(line.substr(0, i)).toLowerCase();
  2814. val = utils.trim(line.substr(i + 1));
  2815. if (key) {
  2816. if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
  2817. return;
  2818. }
  2819. if (key === 'set-cookie') {
  2820. parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
  2821. } else {
  2822. parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
  2823. }
  2824. }
  2825. });
  2826. return parsed;
  2827. };
  2828. var isURLSameOrigin = (
  2829. utils.isStandardBrowserEnv() ?
  2830. // Standard browser envs have full support of the APIs needed to test
  2831. // whether the request URL is of the same origin as current location.
  2832. (function standardBrowserEnv() {
  2833. var msie = /(msie|trident)/i.test(navigator.userAgent);
  2834. var urlParsingNode = document.createElement('a');
  2835. var originURL;
  2836. /**
  2837. * Parse a URL to discover it's components
  2838. *
  2839. * @param {String} url The URL to be parsed
  2840. * @returns {Object}
  2841. */
  2842. function resolveURL(url) {
  2843. var href = url;
  2844. if (msie) {
  2845. // IE needs attribute set twice to normalize properties
  2846. urlParsingNode.setAttribute('href', href);
  2847. href = urlParsingNode.href;
  2848. }
  2849. urlParsingNode.setAttribute('href', href);
  2850. // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
  2851. return {
  2852. href: urlParsingNode.href,
  2853. protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
  2854. host: urlParsingNode.host,
  2855. search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
  2856. hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
  2857. hostname: urlParsingNode.hostname,
  2858. port: urlParsingNode.port,
  2859. pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
  2860. urlParsingNode.pathname :
  2861. '/' + urlParsingNode.pathname
  2862. };
  2863. }
  2864. originURL = resolveURL(window.location.href);
  2865. /**
  2866. * Determine if a URL shares the same origin as the current location
  2867. *
  2868. * @param {String} requestURL The URL to test
  2869. * @returns {boolean} True if URL shares the same origin, otherwise false
  2870. */
  2871. return function isURLSameOrigin(requestURL) {
  2872. var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
  2873. return (parsed.protocol === originURL.protocol &&
  2874. parsed.host === originURL.host);
  2875. };
  2876. })() :
  2877. // Non standard browser envs (web workers, react-native) lack needed support.
  2878. (function nonStandardBrowserEnv() {
  2879. return function isURLSameOrigin() {
  2880. return true;
  2881. };
  2882. })()
  2883. );
  2884. var cookies = (
  2885. utils.isStandardBrowserEnv() ?
  2886. // Standard browser envs support document.cookie
  2887. (function standardBrowserEnv() {
  2888. return {
  2889. write: function write(name, value, expires, path, domain, secure) {
  2890. var cookie = [];
  2891. cookie.push(name + '=' + encodeURIComponent(value));
  2892. if (utils.isNumber(expires)) {
  2893. cookie.push('expires=' + new Date(expires).toGMTString());
  2894. }
  2895. if (utils.isString(path)) {
  2896. cookie.push('path=' + path);
  2897. }
  2898. if (utils.isString(domain)) {
  2899. cookie.push('domain=' + domain);
  2900. }
  2901. if (secure === true) {
  2902. cookie.push('secure');
  2903. }
  2904. document.cookie = cookie.join('; ');
  2905. },
  2906. read: function read(name) {
  2907. var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
  2908. return (match ? decodeURIComponent(match[3]) : null);
  2909. },
  2910. remove: function remove(name) {
  2911. this.write(name, '', Date.now() - 86400000);
  2912. }
  2913. };
  2914. })() :
  2915. // Non standard browser env (web workers, react-native) lack needed support.
  2916. (function nonStandardBrowserEnv() {
  2917. return {
  2918. write: function write() {
  2919. },
  2920. read: function read() {
  2921. return null;
  2922. },
  2923. remove: function remove() {
  2924. }
  2925. };
  2926. })()
  2927. );
  2928. var xhr$1 = function xhrAdapter(config) {
  2929. return new Promise(function dispatchXhrRequest(resolve, reject) {
  2930. var requestData = config.data;
  2931. var requestHeaders = config.headers;
  2932. if (utils.isFormData(requestData)) {
  2933. delete requestHeaders['Content-Type']; // Let the browser set it
  2934. }
  2935. var request = new XMLHttpRequest();
  2936. // HTTP basic authentication
  2937. if (config.auth) {
  2938. var username = config.auth.username || '';
  2939. var password = config.auth.password || '';
  2940. requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
  2941. }
  2942. var fullPath = buildFullPath(config.baseURL, config.url);
  2943. request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
  2944. // Set the request timeout in MS
  2945. request.timeout = config.timeout;
  2946. // Listen for ready state
  2947. request.onreadystatechange = function handleLoad() {
  2948. if (!request || request.readyState !== 4) {
  2949. return;
  2950. }
  2951. // The request errored out and we didn't get a response, this will be
  2952. // handled by onerror instead
  2953. // With one exception: request that using file: protocol, most browsers
  2954. // will return status as 0 even though it's a successful request
  2955. if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
  2956. return;
  2957. }
  2958. // Prepare the response
  2959. var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
  2960. var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
  2961. var response = {
  2962. data: responseData,
  2963. status: request.status,
  2964. statusText: request.statusText,
  2965. headers: responseHeaders,
  2966. config: config,
  2967. request: request
  2968. };
  2969. settle(resolve, reject, response);
  2970. // Clean up request
  2971. request = null;
  2972. };
  2973. // Handle browser request cancellation (as opposed to a manual cancellation)
  2974. request.onabort = function handleAbort() {
  2975. if (!request) {
  2976. return;
  2977. }
  2978. reject(createError('Request aborted', config, 'ECONNABORTED', request));
  2979. // Clean up request
  2980. request = null;
  2981. };
  2982. // Handle low level network errors
  2983. request.onerror = function handleError() {
  2984. // Real errors are hidden from us by the browser
  2985. // onerror should only fire if it's a network error
  2986. reject(createError('Network Error', config, null, request));
  2987. // Clean up request
  2988. request = null;
  2989. };
  2990. // Handle timeout
  2991. request.ontimeout = function handleTimeout() {
  2992. var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';
  2993. if (config.timeoutErrorMessage) {
  2994. timeoutErrorMessage = config.timeoutErrorMessage;
  2995. }
  2996. reject(createError(timeoutErrorMessage, config, 'ECONNABORTED',
  2997. request));
  2998. // Clean up request
  2999. request = null;
  3000. };
  3001. // Add xsrf header
  3002. // This is only done if running in a standard browser environment.
  3003. // Specifically not if we're in a web worker, or react-native.
  3004. if (utils.isStandardBrowserEnv()) {
  3005. var cookies$$1 = cookies;
  3006. // Add xsrf header
  3007. var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ?
  3008. cookies$$1.read(config.xsrfCookieName) :
  3009. undefined;
  3010. if (xsrfValue) {
  3011. requestHeaders[config.xsrfHeaderName] = xsrfValue;
  3012. }
  3013. }
  3014. // Add headers to the request
  3015. if ('setRequestHeader' in request) {
  3016. utils.forEach(requestHeaders, function setRequestHeader(val, key) {
  3017. if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
  3018. // Remove Content-Type if data is undefined
  3019. delete requestHeaders[key];
  3020. } else {
  3021. // Otherwise add header to the request
  3022. request.setRequestHeader(key, val);
  3023. }
  3024. });
  3025. }
  3026. // Add withCredentials to request if needed
  3027. if (!utils.isUndefined(config.withCredentials)) {
  3028. request.withCredentials = !!config.withCredentials;
  3029. }
  3030. // Add responseType to request if needed
  3031. if (config.responseType) {
  3032. try {
  3033. request.responseType = config.responseType;
  3034. } catch (e) {
  3035. // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.
  3036. // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.
  3037. if (config.responseType !== 'json') {
  3038. throw e;
  3039. }
  3040. }
  3041. }
  3042. // Handle progress if needed
  3043. if (typeof config.onDownloadProgress === 'function') {
  3044. request.addEventListener('progress', config.onDownloadProgress);
  3045. }
  3046. // Not all browsers support upload events
  3047. if (typeof config.onUploadProgress === 'function' && request.upload) {
  3048. request.upload.addEventListener('progress', config.onUploadProgress);
  3049. }
  3050. if (config.cancelToken) {
  3051. // Handle cancellation
  3052. config.cancelToken.promise.then(function onCanceled(cancel) {
  3053. if (!request) {
  3054. return;
  3055. }
  3056. request.abort();
  3057. reject(cancel);
  3058. // Clean up request
  3059. request = null;
  3060. });
  3061. }
  3062. if (requestData === undefined) {
  3063. requestData = null;
  3064. }
  3065. // Send the request
  3066. request.send(requestData);
  3067. });
  3068. };
  3069. var DEFAULT_CONTENT_TYPE = {
  3070. 'Content-Type': 'application/x-www-form-urlencoded'
  3071. };
  3072. function setContentTypeIfUnset(headers, value) {
  3073. if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
  3074. headers['Content-Type'] = value;
  3075. }
  3076. }
  3077. function getDefaultAdapter() {
  3078. var adapter;
  3079. if (typeof XMLHttpRequest !== 'undefined') {
  3080. // For browsers use XHR adapter
  3081. adapter = xhr$1;
  3082. } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
  3083. // For node use HTTP adapter
  3084. adapter = xhr$1;
  3085. }
  3086. return adapter;
  3087. }
  3088. var defaults = {
  3089. adapter: getDefaultAdapter(),
  3090. transformRequest: [function transformRequest(data, headers) {
  3091. normalizeHeaderName(headers, 'Accept');
  3092. normalizeHeaderName(headers, 'Content-Type');
  3093. if (utils.isFormData(data) ||
  3094. utils.isArrayBuffer(data) ||
  3095. utils.isBuffer(data) ||
  3096. utils.isStream(data) ||
  3097. utils.isFile(data) ||
  3098. utils.isBlob(data)
  3099. ) {
  3100. return data;
  3101. }
  3102. if (utils.isArrayBufferView(data)) {
  3103. return data.buffer;
  3104. }
  3105. if (utils.isURLSearchParams(data)) {
  3106. setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
  3107. return data.toString();
  3108. }
  3109. if (utils.isObject(data)) {
  3110. setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
  3111. return JSON.stringify(data);
  3112. }
  3113. return data;
  3114. }],
  3115. transformResponse: [function transformResponse(data) {
  3116. /*eslint no-param-reassign:0*/
  3117. if (typeof data === 'string') {
  3118. try {
  3119. data = JSON.parse(data);
  3120. } catch (e) { /* Ignore */
  3121. }
  3122. }
  3123. return data;
  3124. }],
  3125. /**
  3126. * A timeout in milliseconds to abort a request. If set to 0 (default) a
  3127. * timeout is not created.
  3128. */
  3129. timeout: 0,
  3130. xsrfCookieName: 'XSRF-TOKEN',
  3131. xsrfHeaderName: 'X-XSRF-TOKEN',
  3132. maxContentLength: -1,
  3133. validateStatus: function validateStatus(status) {
  3134. return status >= 200 && status < 300;
  3135. }
  3136. };
  3137. defaults.headers = {
  3138. common: {
  3139. 'Accept': 'application/json, text/plain, */*'
  3140. }
  3141. };
  3142. utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
  3143. defaults.headers[method] = {};
  3144. });
  3145. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  3146. defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
  3147. });
  3148. var defaults_1 = defaults;
  3149. /**
  3150. * Throws a `Cancel` if cancellation has been requested.
  3151. */
  3152. function throwIfCancellationRequested(config) {
  3153. if (config.cancelToken) {
  3154. config.cancelToken.throwIfRequested();
  3155. }
  3156. }
  3157. /**
  3158. * Dispatch a request to the service using the configured adapter.
  3159. *
  3160. * @param {object} config The config that is to be used for the request
  3161. * @returns {Promise} The Promise to be fulfilled
  3162. */
  3163. var dispatchRequest = function dispatchRequest(config) {
  3164. throwIfCancellationRequested(config);
  3165. // Ensure headers exist
  3166. config.headers = config.headers || {};
  3167. // Transform request data
  3168. config.data = transformData(
  3169. config.data,
  3170. config.headers,
  3171. config.transformRequest
  3172. );
  3173. // Flatten headers
  3174. config.headers = utils.merge(
  3175. config.headers.common || {},
  3176. config.headers[config.method] || {},
  3177. config.headers
  3178. );
  3179. utils.forEach(
  3180. ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
  3181. function cleanHeaderConfig(method) {
  3182. delete config.headers[method];
  3183. }
  3184. );
  3185. var adapter = config.adapter || defaults_1.adapter;
  3186. return adapter(config).then(function onAdapterResolution(response) {
  3187. throwIfCancellationRequested(config);
  3188. // Transform response data
  3189. response.data = transformData(
  3190. response.data,
  3191. response.headers,
  3192. config.transformResponse
  3193. );
  3194. return response;
  3195. }, function onAdapterRejection(reason) {
  3196. if (!isCancel(reason)) {
  3197. throwIfCancellationRequested(config);
  3198. // Transform response data
  3199. if (reason && reason.response) {
  3200. reason.response.data = transformData(
  3201. reason.response.data,
  3202. reason.response.headers,
  3203. config.transformResponse
  3204. );
  3205. }
  3206. }
  3207. return Promise.reject(reason);
  3208. });
  3209. };
  3210. /**
  3211. * Config-specific merge-function which creates a new config-object
  3212. * by merging two configuration objects together.
  3213. *
  3214. * @param {Object} config1
  3215. * @param {Object} config2
  3216. * @returns {Object} New object resulting from merging config2 to config1
  3217. */
  3218. var mergeConfig = function mergeConfig(config1, config2) {
  3219. // eslint-disable-next-line no-param-reassign
  3220. config2 = config2 || {};
  3221. var config = {};
  3222. var valueFromConfig2Keys = ['url', 'method', 'params', 'data'];
  3223. var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy'];
  3224. var defaultToConfig2Keys = [
  3225. 'baseURL', 'url', 'transformRequest', 'transformResponse', 'paramsSerializer',
  3226. 'timeout', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',
  3227. 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress',
  3228. 'maxContentLength', 'validateStatus', 'maxRedirects', 'httpAgent',
  3229. 'httpsAgent', 'cancelToken', 'socketPath'
  3230. ];
  3231. utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) {
  3232. if (typeof config2[prop] !== 'undefined') {
  3233. config[prop] = config2[prop];
  3234. }
  3235. });
  3236. utils.forEach(mergeDeepPropertiesKeys, function mergeDeepProperties(prop) {
  3237. if (utils.isObject(config2[prop])) {
  3238. config[prop] = utils.deepMerge(config1[prop], config2[prop]);
  3239. } else if (typeof config2[prop] !== 'undefined') {
  3240. config[prop] = config2[prop];
  3241. } else if (utils.isObject(config1[prop])) {
  3242. config[prop] = utils.deepMerge(config1[prop]);
  3243. } else if (typeof config1[prop] !== 'undefined') {
  3244. config[prop] = config1[prop];
  3245. }
  3246. });
  3247. utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) {
  3248. if (typeof config2[prop] !== 'undefined') {
  3249. config[prop] = config2[prop];
  3250. } else if (typeof config1[prop] !== 'undefined') {
  3251. config[prop] = config1[prop];
  3252. }
  3253. });
  3254. var axiosKeys = valueFromConfig2Keys
  3255. .concat(mergeDeepPropertiesKeys)
  3256. .concat(defaultToConfig2Keys);
  3257. var otherKeys = Object
  3258. .keys(config2)
  3259. .filter(function filterAxiosKeys(key) {
  3260. return axiosKeys.indexOf(key) === -1;
  3261. });
  3262. utils.forEach(otherKeys, function otherKeysDefaultToConfig2(prop) {
  3263. if (typeof config2[prop] !== 'undefined') {
  3264. config[prop] = config2[prop];
  3265. } else if (typeof config1[prop] !== 'undefined') {
  3266. config[prop] = config1[prop];
  3267. }
  3268. });
  3269. return config;
  3270. };
  3271. /**
  3272. * Create a new instance of Axios
  3273. *
  3274. * @param {Object} instanceConfig The default config for the instance
  3275. */
  3276. function Axios(instanceConfig) {
  3277. this.defaults = instanceConfig;
  3278. this.interceptors = {
  3279. request: new InterceptorManager_1(),
  3280. response: new InterceptorManager_1()
  3281. };
  3282. }
  3283. /**
  3284. * Dispatch a request
  3285. *
  3286. * @param {Object} config The config specific for this request (merged with this.defaults)
  3287. */
  3288. Axios.prototype.request = function request(config) {
  3289. /*eslint no-param-reassign:0*/
  3290. // Allow for axios('example/url'[, config]) a la fetch API
  3291. if (typeof config === 'string') {
  3292. config = arguments[1] || {};
  3293. config.url = arguments[0];
  3294. } else {
  3295. config = config || {};
  3296. }
  3297. config = mergeConfig(this.defaults, config);
  3298. // Set config.method
  3299. if (config.method) {
  3300. config.method = config.method.toLowerCase();
  3301. } else if (this.defaults.method) {
  3302. config.method = this.defaults.method.toLowerCase();
  3303. } else {
  3304. config.method = 'get';
  3305. }
  3306. // Hook up interceptors middleware
  3307. var chain = [dispatchRequest, undefined];
  3308. var promise = Promise.resolve(config);
  3309. this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
  3310. chain.unshift(interceptor.fulfilled, interceptor.rejected);
  3311. });
  3312. this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
  3313. chain.push(interceptor.fulfilled, interceptor.rejected);
  3314. });
  3315. while (chain.length) {
  3316. promise = promise.then(chain.shift(), chain.shift());
  3317. }
  3318. return promise;
  3319. };
  3320. Axios.prototype.getUri = function getUri(config) {
  3321. config = mergeConfig(this.defaults, config);
  3322. return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, '');
  3323. };
  3324. // Provide aliases for supported request methods
  3325. utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
  3326. /*eslint func-names:0*/
  3327. Axios.prototype[method] = function (url, config) {
  3328. return this.request(utils.merge(config || {}, {
  3329. method: method,
  3330. url: url
  3331. }));
  3332. };
  3333. });
  3334. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  3335. /*eslint func-names:0*/
  3336. Axios.prototype[method] = function (url, data, config) {
  3337. return this.request(utils.merge(config || {}, {
  3338. method: method,
  3339. url: url,
  3340. data: data
  3341. }));
  3342. };
  3343. });
  3344. var Axios_1 = Axios;
  3345. /**
  3346. * A `Cancel` is an object that is thrown when an operation is canceled.
  3347. *
  3348. * @class
  3349. * @param {string=} message The message.
  3350. */
  3351. function Cancel(message) {
  3352. this.message = message;
  3353. }
  3354. Cancel.prototype.toString = function toString() {
  3355. return 'Cancel' + (this.message ? ': ' + this.message : '');
  3356. };
  3357. Cancel.prototype.__CANCEL__ = true;
  3358. var Cancel_1 = Cancel;
  3359. /**
  3360. * A `CancelToken` is an object that can be used to request cancellation of an operation.
  3361. *
  3362. * @class
  3363. * @param {Function} executor The executor function.
  3364. */
  3365. function CancelToken(executor) {
  3366. if (typeof executor !== 'function') {
  3367. throw new TypeError('executor must be a function.');
  3368. }
  3369. var resolvePromise;
  3370. this.promise = new Promise(function promiseExecutor(resolve) {
  3371. resolvePromise = resolve;
  3372. });
  3373. var token = this;
  3374. executor(function cancel(message) {
  3375. if (token.reason) {
  3376. // Cancellation has already been requested
  3377. return;
  3378. }
  3379. token.reason = new Cancel_1(message);
  3380. resolvePromise(token.reason);
  3381. });
  3382. }
  3383. /**
  3384. * Throws a `Cancel` if cancellation has been requested.
  3385. */
  3386. CancelToken.prototype.throwIfRequested = function throwIfRequested() {
  3387. if (this.reason) {
  3388. throw this.reason;
  3389. }
  3390. };
  3391. /**
  3392. * Returns an object that contains a new `CancelToken` and a function that, when called,
  3393. * cancels the `CancelToken`.
  3394. */
  3395. CancelToken.source = function source() {
  3396. var cancel;
  3397. var token = new CancelToken(function executor(c) {
  3398. cancel = c;
  3399. });
  3400. return {
  3401. token: token,
  3402. cancel: cancel
  3403. };
  3404. };
  3405. var CancelToken_1 = CancelToken;
  3406. /**
  3407. * Syntactic sugar for invoking a function and expanding an array for arguments.
  3408. *
  3409. * Common use case would be to use `Function.prototype.apply`.
  3410. *
  3411. * ```js
  3412. * function f(x, y, z) {}
  3413. * var args = [1, 2, 3];
  3414. * f.apply(null, args);
  3415. * ```
  3416. *
  3417. * With `spread` this example can be re-written.
  3418. *
  3419. * ```js
  3420. * spread(function(x, y, z) {})([1, 2, 3]);
  3421. * ```
  3422. *
  3423. * @param {Function} callback
  3424. * @returns {Function}
  3425. */
  3426. var spread = function spread(callback) {
  3427. return function wrap(arr) {
  3428. return callback.apply(null, arr);
  3429. };
  3430. };
  3431. /**
  3432. * Create an instance of Axios
  3433. *
  3434. * @param {Object} defaultConfig The default config for the instance
  3435. * @return {Axios} A new instance of Axios
  3436. */
  3437. function createInstance(defaultConfig) {
  3438. var context = new Axios_1(defaultConfig);
  3439. var instance = bind(Axios_1.prototype.request, context);
  3440. // Copy axios.prototype to instance
  3441. utils.extend(instance, Axios_1.prototype, context);
  3442. // Copy context to instance
  3443. utils.extend(instance, context);
  3444. return instance;
  3445. }
  3446. // Create the default instance to be exported
  3447. var axios$2 = createInstance(defaults_1);
  3448. // Expose Axios class to allow class inheritance
  3449. axios$2.Axios = Axios_1;
  3450. // Factory for creating new instances
  3451. axios$2.create = function create(instanceConfig) {
  3452. return createInstance(mergeConfig(axios$2.defaults, instanceConfig));
  3453. };
  3454. // Expose Cancel & CancelToken
  3455. axios$2.Cancel = Cancel_1;
  3456. axios$2.CancelToken = CancelToken_1;
  3457. axios$2.isCancel = isCancel;
  3458. // Expose all/spread
  3459. axios$2.all = function all(promises) {
  3460. return Promise.all(promises);
  3461. };
  3462. axios$2.spread = spread;
  3463. var axios_1 = axios$2;
  3464. // Allow use of default import syntax in TypeScript
  3465. var default_1 = axios$2;
  3466. axios_1.default = default_1;
  3467. var axios = axios_1;
  3468. var has$2 = Object.prototype.hasOwnProperty;
  3469. var isArray$2 = Array.isArray;
  3470. var hexTable = (function () {
  3471. var array = [];
  3472. for (var i = 0; i < 256; ++i) {
  3473. array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase());
  3474. }
  3475. return array;
  3476. }());
  3477. var compactQueue = function compactQueue(queue) {
  3478. while (queue.length > 1) {
  3479. var item = queue.pop();
  3480. var obj = item.obj[item.prop];
  3481. if (isArray$2(obj)) {
  3482. var compacted = [];
  3483. for (var j = 0; j < obj.length; ++j) {
  3484. if (typeof obj[j] !== 'undefined') {
  3485. compacted.push(obj[j]);
  3486. }
  3487. }
  3488. item.obj[item.prop] = compacted;
  3489. }
  3490. }
  3491. };
  3492. var arrayToObject = function arrayToObject(source, options) {
  3493. var obj = options && options.plainObjects ? Object.create(null) : {};
  3494. for (var i = 0; i < source.length; ++i) {
  3495. if (typeof source[i] !== 'undefined') {
  3496. obj[i] = source[i];
  3497. }
  3498. }
  3499. return obj;
  3500. };
  3501. var merge$1 = function merge(target, source, options) {
  3502. /* eslint no-param-reassign: 0 */
  3503. if (!source) {
  3504. return target;
  3505. }
  3506. if (typeof source !== 'object') {
  3507. if (isArray$2(target)) {
  3508. target.push(source);
  3509. } else if (target && typeof target === 'object') {
  3510. if ((options && (options.plainObjects || options.allowPrototypes)) || !has$2.call(Object.prototype, source)) {
  3511. target[source] = true;
  3512. }
  3513. } else {
  3514. return [target, source];
  3515. }
  3516. return target;
  3517. }
  3518. if (!target || typeof target !== 'object') {
  3519. return [target].concat(source);
  3520. }
  3521. var mergeTarget = target;
  3522. if (isArray$2(target) && !isArray$2(source)) {
  3523. mergeTarget = arrayToObject(target, options);
  3524. }
  3525. if (isArray$2(target) && isArray$2(source)) {
  3526. source.forEach(function (item, i) {
  3527. if (has$2.call(target, i)) {
  3528. var targetItem = target[i];
  3529. if (targetItem && typeof targetItem === 'object' && item && typeof item === 'object') {
  3530. target[i] = merge(targetItem, item, options);
  3531. } else {
  3532. target.push(item);
  3533. }
  3534. } else {
  3535. target[i] = item;
  3536. }
  3537. });
  3538. return target;
  3539. }
  3540. return Object.keys(source).reduce(function (acc, key) {
  3541. var value = source[key];
  3542. if (has$2.call(acc, key)) {
  3543. acc[key] = merge(acc[key], value, options);
  3544. } else {
  3545. acc[key] = value;
  3546. }
  3547. return acc;
  3548. }, mergeTarget);
  3549. };
  3550. var assign$4 = function assignSingleSource(target, source) {
  3551. return Object.keys(source).reduce(function (acc, key) {
  3552. acc[key] = source[key];
  3553. return acc;
  3554. }, target);
  3555. };
  3556. var decode = function (str, decoder, charset) {
  3557. var strWithoutPlus = str.replace(/\+/g, ' ');
  3558. if (charset === 'iso-8859-1') {
  3559. // unescape never throws, no try...catch needed:
  3560. return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape);
  3561. }
  3562. // utf-8
  3563. try {
  3564. return decodeURIComponent(strWithoutPlus);
  3565. } catch (e) {
  3566. return strWithoutPlus;
  3567. }
  3568. };
  3569. var encode$1 = function encode(str, defaultEncoder, charset) {
  3570. // This code was originally written by Brian White (mscdex) for the io.js core querystring library.
  3571. // It has been adapted here for stricter adherence to RFC 3986
  3572. if (str.length === 0) {
  3573. return str;
  3574. }
  3575. var string = str;
  3576. if (typeof str === 'symbol') {
  3577. string = Symbol.prototype.toString.call(str);
  3578. } else if (typeof str !== 'string') {
  3579. string = String(str);
  3580. }
  3581. if (charset === 'iso-8859-1') {
  3582. return escape(string).replace(/%u[0-9a-f]{4}/gi, function ($0) {
  3583. return '%26%23' + parseInt($0.slice(2), 16) + '%3B';
  3584. });
  3585. }
  3586. var out = '';
  3587. for (var i = 0; i < string.length; ++i) {
  3588. var c = string.charCodeAt(i);
  3589. if (
  3590. c === 0x2D // -
  3591. || c === 0x2E // .
  3592. || c === 0x5F // _
  3593. || c === 0x7E // ~
  3594. || (c >= 0x30 && c <= 0x39) // 0-9
  3595. || (c >= 0x41 && c <= 0x5A) // a-z
  3596. || (c >= 0x61 && c <= 0x7A) // A-Z
  3597. ) {
  3598. out += string.charAt(i);
  3599. continue;
  3600. }
  3601. if (c < 0x80) {
  3602. out = out + hexTable[c];
  3603. continue;
  3604. }
  3605. if (c < 0x800) {
  3606. out = out + (hexTable[0xC0 | (c >> 6)] + hexTable[0x80 | (c & 0x3F)]);
  3607. continue;
  3608. }
  3609. if (c < 0xD800 || c >= 0xE000) {
  3610. out = out + (hexTable[0xE0 | (c >> 12)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]);
  3611. continue;
  3612. }
  3613. i += 1;
  3614. c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF));
  3615. out += hexTable[0xF0 | (c >> 18)]
  3616. + hexTable[0x80 | ((c >> 12) & 0x3F)]
  3617. + hexTable[0x80 | ((c >> 6) & 0x3F)]
  3618. + hexTable[0x80 | (c & 0x3F)];
  3619. }
  3620. return out;
  3621. };
  3622. var compact = function compact(value) {
  3623. var queue = [{obj: {o: value}, prop: 'o'}];
  3624. var refs = [];
  3625. for (var i = 0; i < queue.length; ++i) {
  3626. var item = queue[i];
  3627. var obj = item.obj[item.prop];
  3628. var keys = Object.keys(obj);
  3629. for (var j = 0; j < keys.length; ++j) {
  3630. var key = keys[j];
  3631. var val = obj[key];
  3632. if (typeof val === 'object' && val !== null && refs.indexOf(val) === -1) {
  3633. queue.push({obj: obj, prop: key});
  3634. refs.push(val);
  3635. }
  3636. }
  3637. }
  3638. compactQueue(queue);
  3639. return value;
  3640. };
  3641. var isRegExp = function isRegExp(obj) {
  3642. return Object.prototype.toString.call(obj) === '[object RegExp]';
  3643. };
  3644. var isBuffer$1 = function isBuffer(obj) {
  3645. if (!obj || typeof obj !== 'object') {
  3646. return false;
  3647. }
  3648. return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
  3649. };
  3650. var combine = function combine(a, b) {
  3651. return [].concat(a, b);
  3652. };
  3653. var maybeMap = function maybeMap(val, fn) {
  3654. if (isArray$2(val)) {
  3655. var mapped = [];
  3656. for (var i = 0; i < val.length; i += 1) {
  3657. mapped.push(fn(val[i]));
  3658. }
  3659. return mapped;
  3660. }
  3661. return fn(val);
  3662. };
  3663. var utils$3 = {
  3664. arrayToObject: arrayToObject,
  3665. assign: assign$4,
  3666. combine: combine,
  3667. compact: compact,
  3668. decode: decode,
  3669. encode: encode$1,
  3670. isBuffer: isBuffer$1,
  3671. isRegExp: isRegExp,
  3672. maybeMap: maybeMap,
  3673. merge: merge$1
  3674. };
  3675. var replace = String.prototype.replace;
  3676. var percentTwenties = /%20/g;
  3677. var Format = {
  3678. RFC1738: 'RFC1738',
  3679. RFC3986: 'RFC3986'
  3680. };
  3681. var formats = utils$3.assign(
  3682. {
  3683. 'default': Format.RFC3986,
  3684. formatters: {
  3685. RFC1738: function (value) {
  3686. return replace.call(value, percentTwenties, '+');
  3687. },
  3688. RFC3986: function (value) {
  3689. return String(value);
  3690. }
  3691. }
  3692. },
  3693. Format
  3694. );
  3695. var has$1 = Object.prototype.hasOwnProperty;
  3696. var arrayPrefixGenerators = {
  3697. brackets: function brackets(prefix) {
  3698. return prefix + '[]';
  3699. },
  3700. comma: 'comma',
  3701. indices: function indices(prefix, key) {
  3702. return prefix + '[' + key + ']';
  3703. },
  3704. repeat: function repeat(prefix) {
  3705. return prefix;
  3706. }
  3707. };
  3708. var isArray$1 = Array.isArray;
  3709. var push = Array.prototype.push;
  3710. var pushToArray = function (arr, valueOrArray) {
  3711. push.apply(arr, isArray$1(valueOrArray) ? valueOrArray : [valueOrArray]);
  3712. };
  3713. var toISO = Date.prototype.toISOString;
  3714. var defaultFormat = formats['default'];
  3715. var defaults$2 = {
  3716. addQueryPrefix: false,
  3717. allowDots: false,
  3718. charset: 'utf-8',
  3719. charsetSentinel: false,
  3720. delimiter: '&',
  3721. encode: true,
  3722. encoder: utils$3.encode,
  3723. encodeValuesOnly: false,
  3724. format: defaultFormat,
  3725. formatter: formats.formatters[defaultFormat],
  3726. // deprecated
  3727. indices: false,
  3728. serializeDate: function serializeDate(date) {
  3729. return toISO.call(date);
  3730. },
  3731. skipNulls: false,
  3732. strictNullHandling: false
  3733. };
  3734. var isNonNullishPrimitive = function isNonNullishPrimitive(v) {
  3735. return typeof v === 'string'
  3736. || typeof v === 'number'
  3737. || typeof v === 'boolean'
  3738. || typeof v === 'symbol'
  3739. || typeof v === 'bigint';
  3740. };
  3741. var stringify = function stringify(
  3742. object,
  3743. prefix,
  3744. generateArrayPrefix,
  3745. strictNullHandling,
  3746. skipNulls,
  3747. encoder,
  3748. filter,
  3749. sort,
  3750. allowDots,
  3751. serializeDate,
  3752. formatter,
  3753. encodeValuesOnly,
  3754. charset
  3755. ) {
  3756. var obj = object;
  3757. if (typeof filter === 'function') {
  3758. obj = filter(prefix, obj);
  3759. } else if (obj instanceof Date) {
  3760. obj = serializeDate(obj);
  3761. } else if (generateArrayPrefix === 'comma' && isArray$1(obj)) {
  3762. obj = utils$3.maybeMap(obj, function (value) {
  3763. if (value instanceof Date) {
  3764. return serializeDate(value);
  3765. }
  3766. return value;
  3767. }).join(',');
  3768. }
  3769. if (obj === null) {
  3770. if (strictNullHandling) {
  3771. return encoder && !encodeValuesOnly ? encoder(prefix, defaults$2.encoder, charset, 'key') : prefix;
  3772. }
  3773. obj = '';
  3774. }
  3775. if (isNonNullishPrimitive(obj) || utils$3.isBuffer(obj)) {
  3776. if (encoder) {
  3777. var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults$2.encoder, charset, 'key');
  3778. return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults$2.encoder, charset, 'value'))];
  3779. }
  3780. return [formatter(prefix) + '=' + formatter(String(obj))];
  3781. }
  3782. var values = [];
  3783. if (typeof obj === 'undefined') {
  3784. return values;
  3785. }
  3786. var objKeys;
  3787. if (isArray$1(filter)) {
  3788. objKeys = filter;
  3789. } else {
  3790. var keys = Object.keys(obj);
  3791. objKeys = sort ? keys.sort(sort) : keys;
  3792. }
  3793. for (var i = 0; i < objKeys.length; ++i) {
  3794. var key = objKeys[i];
  3795. var value = obj[key];
  3796. if (skipNulls && value === null) {
  3797. continue;
  3798. }
  3799. var keyPrefix = isArray$1(obj)
  3800. ? typeof generateArrayPrefix === 'function' ? generateArrayPrefix(prefix, key) : prefix
  3801. : prefix + (allowDots ? '.' + key : '[' + key + ']');
  3802. pushToArray(values, stringify(
  3803. value,
  3804. keyPrefix,
  3805. generateArrayPrefix,
  3806. strictNullHandling,
  3807. skipNulls,
  3808. encoder,
  3809. filter,
  3810. sort,
  3811. allowDots,
  3812. serializeDate,
  3813. formatter,
  3814. encodeValuesOnly,
  3815. charset
  3816. ));
  3817. }
  3818. return values;
  3819. };
  3820. var normalizeStringifyOptions = function normalizeStringifyOptions(opts) {
  3821. if (!opts) {
  3822. return defaults$2;
  3823. }
  3824. if (opts.encoder !== null && opts.encoder !== undefined && typeof opts.encoder !== 'function') {
  3825. throw new TypeError('Encoder has to be a function.');
  3826. }
  3827. var charset = opts.charset || defaults$2.charset;
  3828. if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') {
  3829. throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined');
  3830. }
  3831. var format = formats['default'];
  3832. if (typeof opts.format !== 'undefined') {
  3833. if (!has$1.call(formats.formatters, opts.format)) {
  3834. throw new TypeError('Unknown format option provided.');
  3835. }
  3836. format = opts.format;
  3837. }
  3838. var formatter = formats.formatters[format];
  3839. var filter = defaults$2.filter;
  3840. if (typeof opts.filter === 'function' || isArray$1(opts.filter)) {
  3841. filter = opts.filter;
  3842. }
  3843. return {
  3844. addQueryPrefix: typeof opts.addQueryPrefix === 'boolean' ? opts.addQueryPrefix : defaults$2.addQueryPrefix,
  3845. allowDots: typeof opts.allowDots === 'undefined' ? defaults$2.allowDots : !!opts.allowDots,
  3846. charset: charset,
  3847. charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults$2.charsetSentinel,
  3848. delimiter: typeof opts.delimiter === 'undefined' ? defaults$2.delimiter : opts.delimiter,
  3849. encode: typeof opts.encode === 'boolean' ? opts.encode : defaults$2.encode,
  3850. encoder: typeof opts.encoder === 'function' ? opts.encoder : defaults$2.encoder,
  3851. encodeValuesOnly: typeof opts.encodeValuesOnly === 'boolean' ? opts.encodeValuesOnly : defaults$2.encodeValuesOnly,
  3852. filter: filter,
  3853. formatter: formatter,
  3854. serializeDate: typeof opts.serializeDate === 'function' ? opts.serializeDate : defaults$2.serializeDate,
  3855. skipNulls: typeof opts.skipNulls === 'boolean' ? opts.skipNulls : defaults$2.skipNulls,
  3856. sort: typeof opts.sort === 'function' ? opts.sort : null,
  3857. strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults$2.strictNullHandling
  3858. };
  3859. };
  3860. var stringify_1 = function (object, opts) {
  3861. var obj = object;
  3862. var options = normalizeStringifyOptions(opts);
  3863. var objKeys;
  3864. var filter;
  3865. if (typeof options.filter === 'function') {
  3866. filter = options.filter;
  3867. obj = filter('', obj);
  3868. } else if (isArray$1(options.filter)) {
  3869. filter = options.filter;
  3870. objKeys = filter;
  3871. }
  3872. var keys = [];
  3873. if (typeof obj !== 'object' || obj === null) {
  3874. return '';
  3875. }
  3876. var arrayFormat;
  3877. if (opts && opts.arrayFormat in arrayPrefixGenerators) {
  3878. arrayFormat = opts.arrayFormat;
  3879. } else if (opts && 'indices' in opts) {
  3880. arrayFormat = opts.indices ? 'indices' : 'repeat';
  3881. } else {
  3882. arrayFormat = 'indices';
  3883. }
  3884. var generateArrayPrefix = arrayPrefixGenerators[arrayFormat];
  3885. if (!objKeys) {
  3886. objKeys = Object.keys(obj);
  3887. }
  3888. if (options.sort) {
  3889. objKeys.sort(options.sort);
  3890. }
  3891. for (var i = 0; i < objKeys.length; ++i) {
  3892. var key = objKeys[i];
  3893. if (options.skipNulls && obj[key] === null) {
  3894. continue;
  3895. }
  3896. pushToArray(keys, stringify(
  3897. obj[key],
  3898. key,
  3899. generateArrayPrefix,
  3900. options.strictNullHandling,
  3901. options.skipNulls,
  3902. options.encode ? options.encoder : null,
  3903. options.filter,
  3904. options.sort,
  3905. options.allowDots,
  3906. options.serializeDate,
  3907. options.formatter,
  3908. options.encodeValuesOnly,
  3909. options.charset
  3910. ));
  3911. }
  3912. var joined = keys.join(options.delimiter);
  3913. var prefix = options.addQueryPrefix === true ? '?' : '';
  3914. if (options.charsetSentinel) {
  3915. if (options.charset === 'iso-8859-1') {
  3916. // encodeURIComponent('&#10003;'), the "numeric entity" representation of a checkmark
  3917. prefix += 'utf8=%26%2310003%3B&';
  3918. } else {
  3919. // encodeURIComponent('✓')
  3920. prefix += 'utf8=%E2%9C%93&';
  3921. }
  3922. }
  3923. return joined.length > 0 ? prefix + joined : '';
  3924. };
  3925. var has$3 = Object.prototype.hasOwnProperty;
  3926. var isArray$3 = Array.isArray;
  3927. var defaults$3 = {
  3928. allowDots: false,
  3929. allowPrototypes: false,
  3930. arrayLimit: 20,
  3931. charset: 'utf-8',
  3932. charsetSentinel: false,
  3933. comma: false,
  3934. decoder: utils$3.decode,
  3935. delimiter: '&',
  3936. depth: 5,
  3937. ignoreQueryPrefix: false,
  3938. interpretNumericEntities: false,
  3939. parameterLimit: 1000,
  3940. parseArrays: true,
  3941. plainObjects: false,
  3942. strictNullHandling: false
  3943. };
  3944. var interpretNumericEntities = function (str) {
  3945. return str.replace(/&#(\d+);/g, function ($0, numberStr) {
  3946. return String.fromCharCode(parseInt(numberStr, 10));
  3947. });
  3948. };
  3949. var parseArrayValue = function (val, options) {
  3950. if (val && typeof val === 'string' && options.comma && val.indexOf(',') > -1) {
  3951. return val.split(',');
  3952. }
  3953. return val;
  3954. };
  3955. // This is what browsers will submit when the ✓ character occurs in an
  3956. // application/x-www-form-urlencoded body and the encoding of the page containing
  3957. // the form is iso-8859-1, or when the submitted form has an accept-charset
  3958. // attribute of iso-8859-1. Presumably also with other charsets that do not contain
  3959. // the ✓ character, such as us-ascii.
  3960. var isoSentinel = 'utf8=%26%2310003%3B'; // encodeURIComponent('&#10003;')
  3961. // These are the percent-encoded utf-8 octets representing a checkmark, indicating that the request actually is utf-8 encoded.
  3962. var charsetSentinel = 'utf8=%E2%9C%93'; // encodeURIComponent('✓')
  3963. var parseValues = function parseQueryStringValues(str, options) {
  3964. var obj = {};
  3965. var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, '') : str;
  3966. var limit = options.parameterLimit === Infinity ? undefined : options.parameterLimit;
  3967. var parts = cleanStr.split(options.delimiter, limit);
  3968. var skipIndex = -1; // Keep track of where the utf8 sentinel was found
  3969. var i;
  3970. var charset = options.charset;
  3971. if (options.charsetSentinel) {
  3972. for (i = 0; i < parts.length; ++i) {
  3973. if (parts[i].indexOf('utf8=') === 0) {
  3974. if (parts[i] === charsetSentinel) {
  3975. charset = 'utf-8';
  3976. } else if (parts[i] === isoSentinel) {
  3977. charset = 'iso-8859-1';
  3978. }
  3979. skipIndex = i;
  3980. i = parts.length; // The eslint settings do not allow break;
  3981. }
  3982. }
  3983. }
  3984. for (i = 0; i < parts.length; ++i) {
  3985. if (i === skipIndex) {
  3986. continue;
  3987. }
  3988. var part = parts[i];
  3989. var bracketEqualsPos = part.indexOf(']=');
  3990. var pos = bracketEqualsPos === -1 ? part.indexOf('=') : bracketEqualsPos + 1;
  3991. var key, val;
  3992. if (pos === -1) {
  3993. key = options.decoder(part, defaults$3.decoder, charset, 'key');
  3994. val = options.strictNullHandling ? null : '';
  3995. } else {
  3996. key = options.decoder(part.slice(0, pos), defaults$3.decoder, charset, 'key');
  3997. val = utils$3.maybeMap(
  3998. parseArrayValue(part.slice(pos + 1), options),
  3999. function (encodedVal) {
  4000. return options.decoder(encodedVal, defaults$3.decoder, charset, 'value');
  4001. }
  4002. );
  4003. }
  4004. if (val && options.interpretNumericEntities && charset === 'iso-8859-1') {
  4005. val = interpretNumericEntities(val);
  4006. }
  4007. if (part.indexOf('[]=') > -1) {
  4008. val = isArray$3(val) ? [val] : val;
  4009. }
  4010. if (has$3.call(obj, key)) {
  4011. obj[key] = utils$3.combine(obj[key], val);
  4012. } else {
  4013. obj[key] = val;
  4014. }
  4015. }
  4016. return obj;
  4017. };
  4018. var parseObject = function (chain, val, options, valuesParsed) {
  4019. var leaf = valuesParsed ? val : parseArrayValue(val, options);
  4020. for (var i = chain.length - 1; i >= 0; --i) {
  4021. var obj;
  4022. var root = chain[i];
  4023. if (root === '[]' && options.parseArrays) {
  4024. obj = [].concat(leaf);
  4025. } else {
  4026. obj = options.plainObjects ? Object.create(null) : {};
  4027. var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root;
  4028. var index = parseInt(cleanRoot, 10);
  4029. if (!options.parseArrays && cleanRoot === '') {
  4030. obj = {0: leaf};
  4031. } else if (
  4032. !isNaN(index)
  4033. && root !== cleanRoot
  4034. && String(index) === cleanRoot
  4035. && index >= 0
  4036. && (options.parseArrays && index <= options.arrayLimit)
  4037. ) {
  4038. obj = [];
  4039. obj[index] = leaf;
  4040. } else {
  4041. obj[cleanRoot] = leaf;
  4042. }
  4043. }
  4044. leaf = obj; // eslint-disable-line no-param-reassign
  4045. }
  4046. return leaf;
  4047. };
  4048. var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesParsed) {
  4049. if (!givenKey) {
  4050. return;
  4051. }
  4052. // Transform dot notation to bracket notation
  4053. var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, '[$1]') : givenKey;
  4054. // The regex chunks
  4055. var brackets = /(\[[^[\]]*])/;
  4056. var child = /(\[[^[\]]*])/g;
  4057. // Get the parent
  4058. var segment = options.depth > 0 && brackets.exec(key);
  4059. var parent = segment ? key.slice(0, segment.index) : key;
  4060. // Stash the parent if it exists
  4061. var keys = [];
  4062. if (parent) {
  4063. // If we aren't using plain objects, optionally prefix keys that would overwrite object prototype properties
  4064. if (!options.plainObjects && has$3.call(Object.prototype, parent)) {
  4065. if (!options.allowPrototypes) {
  4066. return;
  4067. }
  4068. }
  4069. keys.push(parent);
  4070. }
  4071. // Loop through children appending to the array until we hit depth
  4072. var i = 0;
  4073. while (options.depth > 0 && (segment = child.exec(key)) !== null && i < options.depth) {
  4074. i += 1;
  4075. if (!options.plainObjects && has$3.call(Object.prototype, segment[1].slice(1, -1))) {
  4076. if (!options.allowPrototypes) {
  4077. return;
  4078. }
  4079. }
  4080. keys.push(segment[1]);
  4081. }
  4082. // If there's a remainder, just add whatever is left
  4083. if (segment) {
  4084. keys.push('[' + key.slice(segment.index) + ']');
  4085. }
  4086. return parseObject(keys, val, options, valuesParsed);
  4087. };
  4088. var normalizeParseOptions = function normalizeParseOptions(opts) {
  4089. if (!opts) {
  4090. return defaults$3;
  4091. }
  4092. if (opts.decoder !== null && opts.decoder !== undefined && typeof opts.decoder !== 'function') {
  4093. throw new TypeError('Decoder has to be a function.');
  4094. }
  4095. if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') {
  4096. throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined');
  4097. }
  4098. var charset = typeof opts.charset === 'undefined' ? defaults$3.charset : opts.charset;
  4099. return {
  4100. allowDots: typeof opts.allowDots === 'undefined' ? defaults$3.allowDots : !!opts.allowDots,
  4101. allowPrototypes: typeof opts.allowPrototypes === 'boolean' ? opts.allowPrototypes : defaults$3.allowPrototypes,
  4102. arrayLimit: typeof opts.arrayLimit === 'number' ? opts.arrayLimit : defaults$3.arrayLimit,
  4103. charset: charset,
  4104. charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults$3.charsetSentinel,
  4105. comma: typeof opts.comma === 'boolean' ? opts.comma : defaults$3.comma,
  4106. decoder: typeof opts.decoder === 'function' ? opts.decoder : defaults$3.decoder,
  4107. delimiter: typeof opts.delimiter === 'string' || utils$3.isRegExp(opts.delimiter) ? opts.delimiter : defaults$3.delimiter,
  4108. // eslint-disable-next-line no-implicit-coercion, no-extra-parens
  4109. depth: (typeof opts.depth === 'number' || opts.depth === false) ? +opts.depth : defaults$3.depth,
  4110. ignoreQueryPrefix: opts.ignoreQueryPrefix === true,
  4111. interpretNumericEntities: typeof opts.interpretNumericEntities === 'boolean' ? opts.interpretNumericEntities : defaults$3.interpretNumericEntities,
  4112. parameterLimit: typeof opts.parameterLimit === 'number' ? opts.parameterLimit : defaults$3.parameterLimit,
  4113. parseArrays: opts.parseArrays !== false,
  4114. plainObjects: typeof opts.plainObjects === 'boolean' ? opts.plainObjects : defaults$3.plainObjects,
  4115. strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults$3.strictNullHandling
  4116. };
  4117. };
  4118. var parse = function (str, opts) {
  4119. var options = normalizeParseOptions(opts);
  4120. if (str === '' || str === null || typeof str === 'undefined') {
  4121. return options.plainObjects ? Object.create(null) : {};
  4122. }
  4123. var tempObj = typeof str === 'string' ? parseValues(str, options) : str;
  4124. var obj = options.plainObjects ? Object.create(null) : {};
  4125. // Iterate over the keys and setup the new object
  4126. var keys = Object.keys(tempObj);
  4127. for (var i = 0; i < keys.length; ++i) {
  4128. var key = keys[i];
  4129. var newObj = parseKeys(key, tempObj[key], options, typeof str === 'string');
  4130. obj = utils$3.merge(obj, newObj, options);
  4131. }
  4132. return utils$3.compact(obj);
  4133. };
  4134. var lib = {
  4135. formats: formats,
  4136. parse: parse,
  4137. stringify: stringify_1
  4138. };
  4139. var _this = undefined;
  4140. var CODE_SUCCESS = 200; // 状态正常
  4141. var CODE_TOKEN_INVALID = 4002; // 登录失效
  4142. // 没有权限
  4143. ///////////////////////////////////////////////// 基础参数 /////////////////////////////////////////////////
  4144. var request = {};
  4145. // 默认配置: 内部变量, 兼容reject不能获取到请求conf配置, 设置全局变量记录
  4146. var _conf = {
  4147. mContentType: false, // 记录默认请求头格式
  4148. countLoading: 0 // 使用计数 [拦截器失败重置]
  4149. };
  4150. // 网络请求
  4151. var ContentType = ["application/json;charset=UTF-8", "application/x-www-form-urlencoded"];
  4152. var http = axios.create({
  4153. timeout: config.timeout,
  4154. baseURL: ""
  4155. });
  4156. http.defaults.headers["Content-Type"] = ContentType[Number(_conf.mContentType)]; // 默认 Content-Type
  4157. // 拦截器专用: 处理loading状态, 避免出现闪屏; 处理是否显示错误提示
  4158. function _interceptorsError(error) {
  4159. _conf.countLoading = 0;
  4160. com.hideLoading();
  4161. var errMsg = error ? error.message || "系统错误" : null;
  4162. com.showErrorMessage(errMsg);
  4163. return error;
  4164. }
  4165. // 请求拦截器
  4166. http.interceptors.request.use(function (config$$1) {
  4167. if (!config$$1.url.includes("http")) {
  4168. config$$1.url = mjs.conf.api + config$$1.url;
  4169. }
  4170. // 无需删除conf属性: 不会提交到请求
  4171. var conf = config$$1.conf;
  4172. if (!conf[KEY_NO_LOADING]) {
  4173. _conf.countLoading += 1;
  4174. com.showLoading();
  4175. }
  4176. if (conf[KEY_M_CONTENT_TYPE]) {
  4177. config$$1.headers["Content-Type"] = ContentType[Number(!_conf.mContentType)]; // // 修改 Content-Type: 取反
  4178. }
  4179. config$$1.headers["Authorization"] = mjs.conf.token;
  4180. console.log('请求入参', config$$1);
  4181. return config$$1;
  4182. }, function (error) {
  4183. return _interceptorsError(error);
  4184. });
  4185. // 将blob对象转化为json(文件类型调用ajax 取后端的返回值做特殊处理)
  4186. function _fileToJson(file) {
  4187. var data = {},
  4188. message = "";
  4189. function formatReturn() {
  4190. return {data: data, message: message};
  4191. }
  4192. return new _Promise(function (resolve) {
  4193. var reader = new FileReader();
  4194. reader.onload = function (res) {
  4195. var result = res.target.result; // 得到字符串
  4196. try {
  4197. // 解析成json对象
  4198. data = JSON.parse(result);
  4199. } catch (err) {
  4200. message = err.message || err;
  4201. }
  4202. resolve(formatReturn());
  4203. }; // 成功回调
  4204. reader.onerror = function (err) {
  4205. message = err.message || err;
  4206. resolve(formatReturn());
  4207. }; // 失败回调
  4208. reader.readAsText(new Blob([file]), "utf-8"); // 按照utf-8编码解析
  4209. });
  4210. }
  4211. // 响应拦截器
  4212. http.interceptors.response.use(function () {
  4213. var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(response) {
  4214. var conf, rsp, fileName, msg, code, tip;
  4215. return regenerator.wrap(function _callee$(_context) {
  4216. while (1) {
  4217. switch (_context.prev = _context.next) {
  4218. case 0:
  4219. console.log('请求响应', response);
  4220. conf = response.config.conf;
  4221. // loading处理
  4222. if (!conf[KEY_NO_LOADING]) {
  4223. _conf.countLoading -= 1;
  4224. }
  4225. if (!_conf.countLoading) {
  4226. com.hideLoading();
  4227. }
  4228. if (!conf[KEY_IGNORE_RESPONSE]) {
  4229. _context.next = 6;
  4230. break;
  4231. }
  4232. return _context.abrupt("return", response);
  4233. case 6:
  4234. if (!response.config.conf[KEY_EXPORT_TYPE]) {
  4235. _context.next = 15;
  4236. break;
  4237. }
  4238. _context.next = 9;
  4239. return _fileToJson(response.data);
  4240. case 9:
  4241. rsp = _context.sent;
  4242. if (rsp.data.code) {
  4243. _context.next = 14;
  4244. break;
  4245. }
  4246. // 文件名称: 需要后端设置为可见, 否则 header 有, 但 js 取不到值
  4247. fileName = void 0;
  4248. if (response.headers["content-disposition"]) {
  4249. fileName = decodeURIComponent(response.headers["content-disposition"].replace("attachment;filename=", "").replace("attachment;filename*=utf-8", ""));
  4250. }
  4251. return _context.abrupt("return", {data: response.data, fileName: fileName});
  4252. case 14:
  4253. // 赋值, 触发失败弹出框
  4254. response.data = rsp.data;
  4255. case 15:
  4256. msg = response.data.msg || response.data.message;
  4257. code = Number(response.data.code);
  4258. if (!(code === CODE_SUCCESS || response.data.success)) {
  4259. _context.next = 21;
  4260. break;
  4261. }
  4262. tip = conf[KEY_SHOW_MESSAGE];
  4263. if (tip) {
  4264. // 需要show成功Message信息
  4265. com.showSuccessMessage(typeof tip == "boolean" ? msg || "请求成功" : tip);
  4266. }
  4267. return _context.abrupt("return", response.data);
  4268. case 21:
  4269. // 登录失效跳转登录页面. NOTE: 注意可能导致循环调用
  4270. if (code === CODE_TOKEN_INVALID) {
  4271. com.showErrorMessage(msg);
  4272. setTimeout(function () {
  4273. com.invalidToken(msg);
  4274. }, 350);
  4275. }
  4276. // 请求结束忽略error
  4277. if (!conf[KEY_NO_ERROR_TIP]) {
  4278. com.showErrorMessage(msg || '未知异常');
  4279. }
  4280. return _context.abrupt("return", _Promise.reject(msg));
  4281. case 24:
  4282. case "end":
  4283. return _context.stop();
  4284. }
  4285. }
  4286. }, _callee, _this);
  4287. }));
  4288. return function (_x) {
  4289. return _ref.apply(this, arguments);
  4290. };
  4291. }(), function (error) {
  4292. return _interceptorsError(error);
  4293. });
  4294. ///////////////////////////////////////////////// 请求配置 /////////////////////////////////////////////////
  4295. /** @param Boolean: noLoading => 是否显示loading */
  4296. var KEY_NO_LOADING = "noLoading";
  4297. /** @param Boolean: noErrorTip => 是否显示错误提示框; */
  4298. var KEY_NO_ERROR_TIP = "noErrorTip";
  4299. /** @param Boolean: mContentType => 是否修改请求头类型 */
  4300. var KEY_M_CONTENT_TYPE = "mContentType";
  4301. /** @param Boolean: showMessage => 是否显示提示 */
  4302. var KEY_SHOW_MESSAGE = "showMessage";
  4303. /** @param Boolean: responseType => 导出文件流类型 */
  4304. var KEY_EXPORT_TYPE = "responseType";
  4305. /** @param Boolean: ignoreResponse => 返回数据不校验 */
  4306. var KEY_IGNORE_RESPONSE = "ignoreResponse";
  4307. /** @param Boolean: noLoadToken => 不传递token */
  4308. /** 1.get: url上param, 后端取值@requestParam,也可用request.getParameterMap().get(“key”), 参数会被放入一个集合 */
  4309. request.doGet = function (url) {
  4310. var param = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  4311. var conf = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  4312. var params = lib.stringify(param);
  4313. if (params) {
  4314. var joint = url.includes("?") ? "&" : "?";
  4315. url += joint + params;
  4316. }
  4317. return http({
  4318. url: url,
  4319. method: "GET",
  4320. conf: conf
  4321. });
  4322. };
  4323. /** 2.post: body内json, 后端取值@requestBody, Map 或转为实体 */
  4324. request.doPost = function (url) {
  4325. var param = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  4326. var data = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  4327. var conf = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
  4328. var params = lib.stringify(param);
  4329. if (params) {
  4330. var joint = url.includes("?") ? "&" : "?";
  4331. url += joint + params;
  4332. }
  4333. return http({
  4334. url: url,
  4335. method: "POST",
  4336. data: data,
  4337. conf: conf,
  4338. responseType: conf[KEY_EXPORT_TYPE]
  4339. });
  4340. };
  4341. /** 3.form: body内格式为form, 和content-type有关系, 需要为form格式后端才能读取: 不能使用@RequestBody,参数会自动解析到实体; 若不是实体通过方法转Map */
  4342. request.doForm = function (url, param) {
  4343. var data = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  4344. var conf = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
  4345. // 变更请求头类型, 传递form
  4346. conf[KEY_M_CONTENT_TYPE] = true;
  4347. return this.doPost(url, param, data, conf);
  4348. };
  4349. /** 4.upload: body-formData, 一般用于文件上传, 追加数据流 */
  4350. request.doUpload = function (url, param) {
  4351. var data = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  4352. var conf = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
  4353. var formData = new FormData();
  4354. _Object$keys(data).forEach(function (prop) {
  4355. formData.append(prop, data[prop]);
  4356. });
  4357. return this.doPost(url, param, formData, conf);
  4358. };
  4359. /** 5.并发多个请求优先(类方法) */
  4360. request.doSpread = function (arrReq) {
  4361. return axios.spread(arrReq);
  4362. };
  4363. /** 6.并发多个请求全部(类方法) */
  4364. request.doAll = function (arrReq) {
  4365. return axios.all(arrReq);
  4366. };
  4367. ///////////////////////////////////////////////// 服务配置 /////////////////////////////////////////////////
  4368. /** 1.excel: 下载blob数据 */
  4369. request.doDownload = function (blobData, fileName) {
  4370. fileName = fileName || "导出文件_" + Date.now();
  4371. var blob = new Blob([blobData], {
  4372. type: "application/vnd.ms-excel;charset=UTF-8"
  4373. });
  4374. var link = document.createElement("a");
  4375. link.style.display = "none";
  4376. link.href = URL.createObjectURL(blob);
  4377. link.download = fileName;
  4378. document.body.appendChild(link);
  4379. link.click();
  4380. URL.revokeObjectURL(link.href);
  4381. document.body.removeChild(link);
  4382. };
  4383. /** 2.Excel: 导出并下载blob数据 */
  4384. request.doExport = function () {
  4385. var _ref2 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee2(url, param) {
  4386. var data = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  4387. var rsp;
  4388. return regenerator.wrap(function _callee2$(_context2) {
  4389. while (1) {
  4390. switch (_context2.prev = _context2.next) {
  4391. case 0:
  4392. _context2.next = 2;
  4393. return request.doPost(url, param, data, _defineProperty({}, KEY_EXPORT_TYPE, "blob"));
  4394. case 2:
  4395. rsp = _context2.sent;
  4396. // 若响应数据为流
  4397. if (!rsp.code) {
  4398. this.doDownload(rsp.data, rsp.fileName);
  4399. }
  4400. case 4:
  4401. case "end":
  4402. return _context2.stop();
  4403. }
  4404. }
  4405. }, _callee2, this);
  4406. }));
  4407. return function (_x11, _x12) {
  4408. return _ref2.apply(this, arguments);
  4409. };
  4410. }();
  4411. /** 3.Excel: 自定义导入, 自动下载失败记录 */
  4412. request.doImport = function () {
  4413. var _ref3 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee3(url, file, param, data) {
  4414. var rsp;
  4415. return regenerator.wrap(function _callee3$(_context3) {
  4416. while (1) {
  4417. switch (_context3.prev = _context3.next) {
  4418. case 0:
  4419. _context3.next = 2;
  4420. return request.doPostFormData(url, param, _extends$1({file: file}, data), _defineProperty({}, KEY_EXPORT_TYPE, "blob"));
  4421. case 2:
  4422. rsp = _context3.sent;
  4423. if (rsp.code) {
  4424. _context3.next = 7;
  4425. break;
  4426. }
  4427. com.showErrorMessage("部分导入失败");
  4428. this.doDownload(rsp.data, rsp.fileName);
  4429. return _context3.abrupt("return");
  4430. case 7:
  4431. com.showSuccessMessage("全部导入成功");
  4432. case 8:
  4433. case "end":
  4434. return _context3.stop();
  4435. }
  4436. }
  4437. }, _callee3, this);
  4438. }));
  4439. return function (_x14, _x15, _x16, _x17) {
  4440. return _ref3.apply(this, arguments);
  4441. };
  4442. }();
  4443. /** 4.Excel:导入数据el-upload组件 */
  4444. request.doElementUI = function (url) {
  4445. var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  4446. var successHandle = arguments[2];
  4447. return {
  4448. action: url,
  4449. fileList: [],
  4450. data: data,
  4451. onReady: function onReady() {
  4452. com.showLoading();
  4453. },
  4454. success: function success(rsp) {
  4455. com.hideLoading();
  4456. if (rsp.code == CODE_SUCCESS) {
  4457. com.showSuccessMessage("导入成功");
  4458. successHandle && successHandle(rsp);
  4459. } else {
  4460. com.showErrorMessage(rsp.msg);
  4461. }
  4462. },
  4463. failure: function failure() {
  4464. com.hideLoading();
  4465. com.showErrorMessage("导入失败");
  4466. }
  4467. };
  4468. };
  4469. var _createProperty = function (object, index, value) {
  4470. if (index in object) _objectDp.f(object, index, _propertyDesc(0, value));
  4471. else object[index] = value;
  4472. };
  4473. _export(_export.S + _export.F * !_iterDetect(function (iter) {
  4474. }), 'Array', {
  4475. // 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined)
  4476. from: function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {
  4477. var O = _toObject(arrayLike);
  4478. var C = typeof this == 'function' ? this : Array;
  4479. var aLen = arguments.length;
  4480. var mapfn = aLen > 1 ? arguments[1] : undefined;
  4481. var mapping = mapfn !== undefined;
  4482. var index = 0;
  4483. var iterFn = core_getIteratorMethod(O);
  4484. var length, result, step, iterator;
  4485. if (mapping) mapfn = _ctx(mapfn, aLen > 2 ? arguments[2] : undefined, 2);
  4486. // if object isn't iterable or it's array with default iterator - use simple case
  4487. if (iterFn != undefined && !(C == Array && _isArrayIter(iterFn))) {
  4488. for (iterator = iterFn.call(O), result = new C(); !(step = iterator.next()).done; index++) {
  4489. _createProperty(result, index, mapping ? _iterCall(iterator, mapfn, [step.value, index], true) : step.value);
  4490. }
  4491. } else {
  4492. length = _toLength(O.length);
  4493. for (result = new C(length); length > index; index++) {
  4494. _createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]);
  4495. }
  4496. }
  4497. result.length = index;
  4498. return result;
  4499. }
  4500. });
  4501. var from$2 = _core.Array.from;
  4502. var from = createCommonjsModule(function (module) {
  4503. module.exports = {"default": from$2, __esModule: true};
  4504. });
  4505. unwrapExports(from);
  4506. var toConsumableArray = createCommonjsModule(function (module, exports) {
  4507. exports.__esModule = true;
  4508. var _from2 = _interopRequireDefault(from);
  4509. function _interopRequireDefault(obj) {
  4510. return obj && obj.__esModule ? obj : {default: obj};
  4511. }
  4512. exports.default = function (arr) {
  4513. if (Array.isArray(arr)) {
  4514. for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) {
  4515. arr2[i] = arr[i];
  4516. }
  4517. return arr2;
  4518. } else {
  4519. return (0, _from2.default)(arr);
  4520. }
  4521. };
  4522. });
  4523. var _toConsumableArray = unwrapExports(toConsumableArray);
  4524. var $JSON = _core.JSON || (_core.JSON = {stringify: JSON.stringify});
  4525. var stringify$3 = function stringify(it) { // eslint-disable-line no-unused-vars
  4526. return $JSON.stringify.apply($JSON, arguments);
  4527. };
  4528. var stringify$2 = createCommonjsModule(function (module) {
  4529. module.exports = {"default": stringify$3, __esModule: true};
  4530. });
  4531. var _JSON$stringify = unwrapExports(stringify$2);
  4532. // 组件数据处理
  4533. // 接口返回取值到组件, 人员搜索框需要对象类型
  4534. // 明细组件数据格式化, 接口服务人员搜索框需要集合的 json string
  4535. // 查询条件兼容各种组件形式
  4536. function __redundancy_query__(that, cur) {
  4537. var value = "cur" in cur ? that.$(cur.cur).getValue() || cur.def : cur.def;
  4538. // 兼容人员搜索框, 单选 + 多选
  4539. if (cur.cur && cur.cur.includes("employeeField_")) {
  4540. var arrEmp = [];
  4541. var state = that.$(cur.cur).getValue() || [];
  4542. // 单选
  4543. if (state.length === undefined) {
  4544. arrEmp.push(state.value);
  4545. }
  4546. // 多选且有值
  4547. if (state.length) {
  4548. arrEmp.push.apply(arrEmp, _toConsumableArray(state.map(function (emp) {
  4549. return emp.value;
  4550. })));
  4551. }
  4552. value = arrEmp;
  4553. // 兼容匹配isAll, 避免被忽略
  4554. if (!value.length) value = undefined;
  4555. }
  4556. // 兼容日期查询: 时间戳, cur为开始, end为默认, 若无则传def
  4557. if (cur.src.includes("dateField_")) {
  4558. var end = "end" in cur ? that.$(cur.end).getValue() || cur.def : cur.def;
  4559. value = [value, end];
  4560. // 兼容匹配isAll, 避免被忽略
  4561. if (!value || !end) value = undefined;
  4562. }
  4563. // 兼容部门, 精确匹配, 兼容多选
  4564. if (cur.cur && cur.cur.includes("departmentSelectField_")) {
  4565. var depart = that.$(cur.cur).getValue();
  4566. // 兼容匹配isAll, 避免被忽略
  4567. if (!depart.length) {
  4568. value = undefined;
  4569. } else {
  4570. value = depart.map(function (item) {
  4571. return item.value;
  4572. }).join(",");
  4573. }
  4574. }
  4575. // 20.8.20 关联表单
  4576. if (cur.cur && cur.cur.includes("associationFormField_") && value.length) {
  4577. value = value.shift().title;
  4578. }
  4579. return value;
  4580. }
  4581. // 前端接口
  4582. var dp = {};
  4583. // 更新数据逻辑: 相对路径 `/${window.pageConfig.appType}/v1/form/searchFormDatas.json`
  4584. dp.updateForm = function () {
  4585. var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee() {
  4586. var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  4587. formInstId = _ref2.formInstId,
  4588. updateData = _ref2.updateData,
  4589. _ref2$dpRemote = _ref2.dpRemote,
  4590. dpRemote = _ref2$dpRemote === undefined ? "updateForm" : _ref2$dpRemote,
  4591. _ref2$isLoading = _ref2.isLoading,
  4592. isLoading = _ref2$isLoading === undefined ? true : _ref2$isLoading,
  4593. hideToast = _ref2.hideToast,
  4594. _ref2$message = _ref2.message,
  4595. message = _ref2$message === undefined ? "操作成功" : _ref2$message;
  4596. var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
  4597. title = _ref3.title,
  4598. content = _ref3.content;
  4599. var rsp;
  4600. return regenerator.wrap(function _callee$(_context) {
  4601. while (1) {
  4602. switch (_context.prev = _context.next) {
  4603. case 0:
  4604. if (formInstId) {
  4605. _context.next = 2;
  4606. break;
  4607. }
  4608. throw new Error("The params of formInstId is empty.");
  4609. case 2:
  4610. if (!(title || content)) {
  4611. _context.next = 5;
  4612. break;
  4613. }
  4614. _context.next = 5;
  4615. return mjs.com.showConfirm(title, content);
  4616. case 5:
  4617. if (isLoading) mjs.com.showLoading();
  4618. _context.next = 8;
  4619. return mjs.$this.dataSourceMap[dpRemote].load({
  4620. formInstId: formInstId,
  4621. updateFormDataJson: _JSON$stringify(updateData)
  4622. }).catch(function (error) {
  4623. if (!hideToast) mjs.com.showErrorMessage(error.message);
  4624. });
  4625. case 8:
  4626. rsp = _context.sent;
  4627. if (isLoading) mjs.com.hideLoading();
  4628. if (rsp) {
  4629. _context.next = 12;
  4630. break;
  4631. }
  4632. return _context.abrupt("return");
  4633. case 12:
  4634. if (rsp && !hideToast) mjs.com.showMessage(message);
  4635. case 13:
  4636. case "end":
  4637. return _context.stop();
  4638. }
  4639. }
  4640. }, _callee, this);
  4641. }));
  4642. return function () {
  4643. return _ref.apply(this, arguments);
  4644. };
  4645. }();
  4646. // 查询实例列表逻辑: 相对路径 `/${window.pageConfig.appType}/v1/form/searchFormDatas.json`
  4647. dp.queryForm = function () {
  4648. var _ref4 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee3() {
  4649. var _this = this;
  4650. var _ref5 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  4651. formUuid = _ref5.formUuid,
  4652. _ref5$conditions = _ref5.conditions,
  4653. conditions = _ref5$conditions === undefined ? [] : _ref5$conditions,
  4654. _ref5$dpRemote = _ref5.dpRemote,
  4655. dpRemote = _ref5$dpRemote === undefined ? "queryForm" : _ref5$dpRemote,
  4656. _ref5$isLoading = _ref5.isLoading,
  4657. isLoading = _ref5$isLoading === undefined ? true : _ref5$isLoading,
  4658. _ref5$hideToast = _ref5.hideToast,
  4659. hideToast = _ref5$hideToast === undefined ? true : _ref5$hideToast,
  4660. _ref5$matchAllConditi = _ref5.matchAllCondition,
  4661. matchAllCondition = _ref5$matchAllConditi === undefined ? false : _ref5$matchAllConditi,
  4662. _ref5$message = _ref5.message,
  4663. message = _ref5$message === undefined ? "查询成功" : _ref5$message;
  4664. var _ref6 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
  4665. _ref6$currentPage = _ref6.currentPage,
  4666. currentPage = _ref6$currentPage === undefined ? 1 : _ref6$currentPage,
  4667. _ref6$pageSize = _ref6.pageSize,
  4668. pageSize = _ref6$pageSize === undefined ? config.pageSize : _ref6$pageSize,
  4669. queryAll = _ref6.queryAll;
  4670. var searchCondition, searchLength, queryFunc, resp, list, pages, promiseReq, pageCount, index, respArr;
  4671. return regenerator.wrap(function _callee3$(_context3) {
  4672. while (1) {
  4673. switch (_context3.prev = _context3.next) {
  4674. case 0:
  4675. // 查询条件格式化
  4676. searchCondition = conditions.reduce(function (acc, cur) {
  4677. var value = __redundancy_query__(mjs.$this, cur);
  4678. if (value) {
  4679. acc[cur.src] = value;
  4680. }
  4681. return acc;
  4682. }, {});
  4683. searchLength = _Object$keys(searchCondition).length;
  4684. if (!(conditions.length && !searchLength)) {
  4685. _context3.next = 4;
  4686. break;
  4687. }
  4688. return _context3.abrupt("return", []);
  4689. case 4:
  4690. if (!(matchAllCondition && searchLength != conditions.length)) {
  4691. _context3.next = 6;
  4692. break;
  4693. }
  4694. return _context3.abrupt("return", []);
  4695. case 6:
  4696. queryFunc = function () {
  4697. var _ref7 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee2(currentPage) {
  4698. var params;
  4699. return regenerator.wrap(function _callee2$(_context2) {
  4700. while (1) {
  4701. switch (_context2.prev = _context2.next) {
  4702. case 0:
  4703. params = {
  4704. searchFieldJson: _JSON$stringify(searchCondition),
  4705. currentPage: currentPage,
  4706. pageSize: pageSize
  4707. };
  4708. // 兼容默认参数已设置FormUuid, 为空会被覆盖
  4709. if (formUuid) params.formUuid = formUuid;
  4710. _context2.next = 4;
  4711. return mjs.$this.dataSourceMap[dpRemote].load(params).catch(function (error) {
  4712. if (!hideToast) mjs.com.showErrorMessage(error.message);
  4713. });
  4714. case 4:
  4715. return _context2.abrupt("return", _context2.sent);
  4716. case 5:
  4717. case "end":
  4718. return _context2.stop();
  4719. }
  4720. }
  4721. }, _callee2, _this);
  4722. }));
  4723. return function queryFunc(_x5) {
  4724. return _ref7.apply(this, arguments);
  4725. };
  4726. }();
  4727. if (isLoading) mjs.com.showLoading();
  4728. _context3.next = 10;
  4729. return queryFunc(currentPage);
  4730. case 10:
  4731. resp = _context3.sent;
  4732. list = resp.data;
  4733. pages = Math.ceil(resp.totalCount / pageSize);
  4734. if (!(queryAll && pages > currentPage)) {
  4735. _context3.next = 21;
  4736. break;
  4737. }
  4738. promiseReq = [];
  4739. pageCount = Math.ceil(config.upperLimit / pageSize);
  4740. for (index = currentPage + 1; index < pageCount + currentPage && index <= pages; index++) {
  4741. promiseReq.push(queryFunc(index));
  4742. }
  4743. _context3.next = 19;
  4744. return _Promise.all(promiseReq);
  4745. case 19:
  4746. respArr = _context3.sent;
  4747. respArr.forEach(function (rsp) {
  4748. list.push.apply(list, _toConsumableArray(rsp.data));
  4749. });
  4750. case 21:
  4751. if (isLoading) mjs.com.hideLoading();
  4752. if (resp && !hideToast) mjs.com.showMessage(message);
  4753. return _context3.abrupt("return", {totalCount: resp.totalCount, data: list});
  4754. case 24:
  4755. case "end":
  4756. return _context3.stop();
  4757. }
  4758. }
  4759. }, _callee3, this);
  4760. }));
  4761. return function () {
  4762. return _ref4.apply(this, arguments);
  4763. };
  4764. }();
  4765. // 明细全量查询: Promise并发
  4766. dp.queryDetail = function () {
  4767. var _ref8 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee5() {
  4768. var _this2 = this;
  4769. var _ref9 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  4770. formUuid = _ref9.formUuid,
  4771. _ref9$conditions = _ref9.conditions,
  4772. conditions = _ref9$conditions === undefined ? {} : _ref9$conditions,
  4773. _ref9$dpRemote = _ref9.dpRemote,
  4774. dpRemote = _ref9$dpRemote === undefined ? "queryForm" : _ref9$dpRemote;
  4775. var _ref10 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
  4776. _ref10$currentPage = _ref10.currentPage,
  4777. currentPage = _ref10$currentPage === undefined ? 1 : _ref10$currentPage,
  4778. _ref10$pageSize = _ref10.pageSize,
  4779. pageSize = _ref10$pageSize === undefined ? config.pageSize : _ref10$pageSize,
  4780. _ref10$detailCount = _ref10.detailCount,
  4781. detailCount = _ref10$detailCount === undefined ? config.detailCount : _ref10$detailCount;
  4782. var searchCondition, queryFunc, resp, list, pages, promiseReq, pageCount, index, respArr;
  4783. return regenerator.wrap(function _callee5$(_context5) {
  4784. while (1) {
  4785. switch (_context5.prev = _context5.next) {
  4786. case 0:
  4787. searchCondition = conditions.reduce(function (acc, cur) {
  4788. var value = __redundancy_query__(mjs.$this, cur);
  4789. if (value) {
  4790. acc[cur.src] = value;
  4791. }
  4792. return acc;
  4793. }, {});
  4794. queryFunc = function () {
  4795. var _ref11 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee4(currentPage) {
  4796. var params;
  4797. return regenerator.wrap(function _callee4$(_context4) {
  4798. while (1) {
  4799. switch (_context4.prev = _context4.next) {
  4800. case 0:
  4801. params = {
  4802. searchFieldJson: _JSON$stringify(searchCondition),
  4803. currentPage: currentPage,
  4804. pageSize: pageSize
  4805. };
  4806. // 兼容默认参数已设置FormUuid, 为空会被覆盖
  4807. if (formUuid) params.formUuid = formUuid;
  4808. _context4.next = 4;
  4809. return mjs.$this.dataSourceMap[dpRemote].load(params);
  4810. case 4:
  4811. return _context4.abrupt("return", _context4.sent);
  4812. case 5:
  4813. case "end":
  4814. return _context4.stop();
  4815. }
  4816. }
  4817. }, _callee4, _this2);
  4818. }));
  4819. return function queryFunc(_x8) {
  4820. return _ref11.apply(this, arguments);
  4821. };
  4822. }();
  4823. mjs.com.showLoading();
  4824. _context5.next = 5;
  4825. return queryFunc(currentPage);
  4826. case 5:
  4827. resp = _context5.sent;
  4828. list = resp.data;
  4829. pages = Math.ceil(resp.totalCount / pageSize);
  4830. if (!(pages > currentPage)) {
  4831. _context5.next = 16;
  4832. break;
  4833. }
  4834. promiseReq = [];
  4835. pageCount = Math.ceil(detailCount / pageSize);
  4836. for (index = currentPage + 1; index < pageCount + currentPage && index <= pages; index++) {
  4837. promiseReq.push(queryFunc(index));
  4838. }
  4839. _context5.next = 14;
  4840. return _Promise.all(promiseReq);
  4841. case 14:
  4842. respArr = _context5.sent;
  4843. respArr.forEach(function (res) {
  4844. list.push.apply(list, _toConsumableArray(res.data));
  4845. });
  4846. case 16:
  4847. mjs.com.hideLoading();
  4848. return _context5.abrupt("return", {totalCount: resp.totalCount, data: list});
  4849. case 18:
  4850. case "end":
  4851. return _context5.stop();
  4852. }
  4853. }
  4854. }, _callee5, this);
  4855. }));
  4856. return function () {
  4857. return _ref8.apply(this, arguments);
  4858. };
  4859. }();
  4860. /**
  4861. * @exports 返回变量型跨域
  4862. * @returns 如获取ip: https://pv.sohu.com/cityjson?ie=utf-8, 返回值:var returnCitySN = {"cip": "124.79.25.204", "cid": "310101", "cname": "上海市黄浦区"};
  4863. **/
  4864. function crossDomainByScript(src, prop) {
  4865. if (!src) _Promise.reject("地址不能为空");
  4866. return new _Promise(function (resolve) {
  4867. var script = document.createElement("script");
  4868. script.setAttribute("type", "text/javascript");
  4869. script.setAttribute("src", src);
  4870. document.body.appendChild(script);
  4871. script.onload = function () {
  4872. resolve(window[prop]);
  4873. };
  4874. });
  4875. }
  4876. var core_getIterator = _core.getIterator = function (it) {
  4877. var iterFn = core_getIteratorMethod(it);
  4878. if (typeof iterFn != 'function') throw TypeError(it + ' is not iterable!');
  4879. return _anObject(iterFn.call(it));
  4880. };
  4881. var getIterator$1 = core_getIterator;
  4882. var getIterator = createCommonjsModule(function (module) {
  4883. module.exports = {"default": getIterator$1, __esModule: true};
  4884. });
  4885. var _getIterator = unwrapExports(getIterator);
  4886. /// 自定义页面bom展示效果 ///
  4887. var bom = {
  4888. compId: {
  4889. parent: "",
  4890. child: "",
  4891. top: "", // 第一层
  4892. name: ""
  4893. },
  4894. collectChildren: function collectChildren(dto, baseList) {
  4895. var _this = this;
  4896. var tempList = baseList.filter(function (d) {
  4897. return dto[_this.compId.child] == d[_this.compId.parent];
  4898. });
  4899. if (tempList.length > 0) dto.children = tempList;
  4900. var _iteratorNormalCompletion = true;
  4901. var _didIteratorError = false;
  4902. var _iteratorError = undefined;
  4903. try {
  4904. for (var _iterator = _getIterator(tempList), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
  4905. var child = _step.value;
  4906. this.collectChildren(child, baseList);
  4907. }
  4908. } catch (err) {
  4909. _didIteratorError = true;
  4910. _iteratorError = err;
  4911. } finally {
  4912. try {
  4913. if (!_iteratorNormalCompletion && _iterator.return) {
  4914. _iterator.return();
  4915. }
  4916. } finally {
  4917. if (_didIteratorError) {
  4918. throw _iteratorError;
  4919. }
  4920. }
  4921. }
  4922. },
  4923. // 查询bom
  4924. queryHierarchy: function queryHierarchy(_ref) {
  4925. var _this2 = this;
  4926. var dpRemote = _ref.dpRemote,
  4927. formUuid = _ref.formUuid,
  4928. conditions = _ref.conditions,
  4929. compId_tree = _ref.compId_tree;
  4930. return _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee() {
  4931. var rsp, dataList, topList, _iteratorNormalCompletion2, _didIteratorError2, _iteratorError2, _iterator2,
  4932. _step2, dto;
  4933. return regenerator.wrap(function _callee$(_context) {
  4934. while (1) {
  4935. switch (_context.prev = _context.next) {
  4936. case 0:
  4937. _context.next = 2;
  4938. return mjs.request.dp.queryForm({
  4939. formUuid: formUuid,
  4940. conditions: conditions,
  4941. dpRemote: dpRemote
  4942. }, {queryAll: true});
  4943. case 2:
  4944. rsp = _context.sent;
  4945. dataList = rsp.data.map(function (item) {
  4946. return _extends$1({}, item.formData, {
  4947. label: item.formData[_this2.compId.name],
  4948. key: item.formData[_this2.compId.child],
  4949. formInstId: item.formInstId
  4950. });
  4951. });
  4952. topList = dataList.filter(function (d) {
  4953. return _this2.compId.top == d[_this2.compId.parent];
  4954. });
  4955. _iteratorNormalCompletion2 = true;
  4956. _didIteratorError2 = false;
  4957. _iteratorError2 = undefined;
  4958. _context.prev = 8;
  4959. for (_iterator2 = _getIterator(topList); !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
  4960. dto = _step2.value;
  4961. _this2.collectChildren(dto, dataList);
  4962. }
  4963. _context.next = 16;
  4964. break;
  4965. case 12:
  4966. _context.prev = 12;
  4967. _context.t0 = _context["catch"](8);
  4968. _didIteratorError2 = true;
  4969. _iteratorError2 = _context.t0;
  4970. case 16:
  4971. _context.prev = 16;
  4972. _context.prev = 17;
  4973. if (!_iteratorNormalCompletion2 && _iterator2.return) {
  4974. _iterator2.return();
  4975. }
  4976. case 19:
  4977. _context.prev = 19;
  4978. if (!_didIteratorError2) {
  4979. _context.next = 22;
  4980. break;
  4981. }
  4982. throw _iteratorError2;
  4983. case 22:
  4984. return _context.finish(19);
  4985. case 23:
  4986. return _context.finish(16);
  4987. case 24:
  4988. if (compId_tree) mjs.$this.$(compId_tree).set("dataSource", topList);
  4989. return _context.abrupt("return", dataList);
  4990. case 26:
  4991. case "end":
  4992. return _context.stop();
  4993. }
  4994. }
  4995. }, _callee, _this2, [[8, 12, 16, 24], [17, , 19, 23]]);
  4996. }))();
  4997. }
  4998. };
  4999. /*** static 之 福氏钉钉SAP接口对接
  5000. * 对接宜搭公共JavaScript库
  5001. * 版权请联系:https://www.aliwork.com/o/mjs
  5002. * 项目库地址: https://ding.practek.cn:38080/api/mjs/mjs.min.js
  5003. ***/
  5004. var fushi = {
  5005. // 公共配置
  5006. init: function init() {
  5007. mjs.conf.api = "https://ding.practek.cn:38080/api/fushi";
  5008. return this; // this 指向当前项目本身
  5009. },
  5010. // 定制配置
  5011. SYNC_SUC_ALL: "全部成功",
  5012. // 获取申请人部门层级
  5013. getDepartmentCascade: function getDepartmentCascade(userId, compId) {
  5014. var _this = this;
  5015. return _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee() {
  5016. var rsp;
  5017. return regenerator.wrap(function _callee$(_context) {
  5018. while (1) {
  5019. switch (_context.prev = _context.next) {
  5020. case 0:
  5021. _context.next = 2;
  5022. return mjs.request.xhr.doPost("/user/department", {userId: userId}, null, _defineProperty({}, KEY_NO_LOADING, true));
  5023. case 2:
  5024. rsp = _context.sent;
  5025. mjs.$this.$(compId).setValue(rsp.data.map(function (item) {
  5026. return item.name;
  5027. }).join(" / "));
  5028. case 4:
  5029. case "end":
  5030. return _context.stop();
  5031. }
  5032. }
  5033. }, _callee, _this);
  5034. }))();
  5035. },
  5036. // mjs加载完成: 加载推送按钮
  5037. purchaseLoad: function purchaseLoad() {
  5038. var status = mjs.$this.$("textField_l2uot27h").getValue() == "同意" && mjs.$this.$('textareaField_l2lgyawc').getValue() != this.SYNC_SUC_ALL;
  5039. mjs.$this.$('pageSection_l2uoi3fr').setBehavior(status ? "NORMAL" : "HIDDEN");
  5040. },
  5041. // mjs加载完成: 加载推送按钮
  5042. paymentLoad: function paymentLoad() {
  5043. var status = mjs.$this.$('radioField_l2og167t').getValue() == "是" && mjs.$this.$("textField_l2uot27h").getValue() == "同意" && mjs.$this.$('textareaField_l2lgyawc').getValue() != this.SYNC_SUC_ALL;
  5044. mjs.$this.$('pageSection_l2uoi3fr').setBehavior(status ? "NORMAL" : "HIDDEN");
  5045. },
  5046. // 推送采购订单
  5047. sapPurchase: function sapPurchase(compId) {
  5048. var _this2 = this;
  5049. return _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee2() {
  5050. return regenerator.wrap(function _callee2$(_context2) {
  5051. while (1) {
  5052. switch (_context2.prev = _context2.next) {
  5053. case 0:
  5054. _this2.doSap("/sap/purchase", compId);
  5055. case 1:
  5056. case "end":
  5057. return _context2.stop();
  5058. }
  5059. }
  5060. }, _callee2, _this2);
  5061. }))();
  5062. },
  5063. // 推送付款申请
  5064. sapPayment: function sapPayment(compId) {
  5065. this.doSap("/sap/payment", compId);
  5066. },
  5067. // 推送SAP
  5068. doSap: function doSap(path, compId) {
  5069. var _this3 = this;
  5070. return _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee3() {
  5071. var button, rsp;
  5072. return regenerator.wrap(function _callee3$(_context3) {
  5073. while (1) {
  5074. switch (_context3.prev = _context3.next) {
  5075. case 0:
  5076. button = mjs.$this.$(compId);
  5077. button.set("loading", true);
  5078. _context3.next = 4;
  5079. return mjs.request.xhr.doPost(path, {processInstanceId: mjs.com.getFormInstIdByUrl()}, null, _defineProperty({}, KEY_SHOW_MESSAGE, true));
  5080. case 4:
  5081. rsp = _context3.sent;
  5082. if (!(rsp.message == _this3.SYNC_SUC_ALL)) {
  5083. _context3.next = 8;
  5084. break;
  5085. }
  5086. button.set("behavior", "HIDDEN");
  5087. return _context3.abrupt("return");
  5088. case 8:
  5089. setTimeout(function () {
  5090. location.reload();
  5091. }, 750);
  5092. case 9:
  5093. case "end":
  5094. return _context3.stop();
  5095. }
  5096. }
  5097. }, _callee3, _this3);
  5098. }))();
  5099. }
  5100. };
  5101. /*** mc 系列之 static
  5102. * 对接宜搭公共JavaScript库
  5103. * 版权请联系:https://www.aliwork.com/o/mjs
  5104. * 公共库地址:https://aliwork.zitoo.com.cn/mc/js/bom/mjs.min.js
  5105. * 本地库地址: http://127.0.0.1:7001/dist/mjs.js
  5106. ***/
  5107. var init = function () {
  5108. var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(_this) {
  5109. var config$$1 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  5110. var msg;
  5111. return regenerator.wrap(function _callee$(_context) {
  5112. while (1) {
  5113. switch (_context.prev = _context.next) {
  5114. case 0:
  5115. this.$this = _this; // this全局化
  5116. this.env = com.checkEnv(); // 环境: 0提交(其它),1查看,2编辑(审批)
  5117. loadVConsole(config$$1.vconsole);
  5118. this.auth = auth; // 授权
  5119. this.dom = dom; // 样式
  5120. this.com = com; // 通用
  5121. this.conf = config; // 配置
  5122. this.request = {dp: dp, xhr: request, net: {crossDomainByScript: crossDomainByScript}}; // 请求
  5123. this.bom = bom;
  5124. this.corp = {
  5125. fushi: fushi.init() // 福氏
  5126. // 输出日志;
  5127. };
  5128. msg = "static load success. \u2668 \u8BBF\u95EE\u5E94\u7528: " + pageConfig.appType + " " + pageConfig.appName + " \xA9\uFE0F \u7248\u6743\u8BF7\u8BF7\u8054\u7CFB: https://www.aliwork.com/o/mc";
  5129. console.log(msg, mjs, config$$1);
  5130. case 12:
  5131. case "end":
  5132. return _context.stop();
  5133. }
  5134. }
  5135. }, _callee, this);
  5136. }));
  5137. return function init(_x) {
  5138. return _ref.apply(this, arguments);
  5139. };
  5140. }();
  5141. exports.init = init;
  5142. Object.defineProperty(exports, '__esModule', {value: true});
  5143. })));
  5144. //# sourceMappingURL=static.js.map