mjs.js 177 KB

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