ivprog.bundle.js 2.3 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024440254402644027440284402944030440314403244033440344403544036440374403844039440404404144042440434404444045440464404744048440494405044051440524405344054440554405644057440584405944060440614406244063440644406544066440674406844069440704407144072440734407444075440764407744078440794408044081440824408344084440854408644087440884408944090440914409244093440944409544096440974409844099441004410144102441034410444105441064410744108441094411044111441124411344114441154411644117441184411944120441214412244123441244412544126441274412844129441304413144132441334413444135441364413744138441394414044141441424414344144441454414644147441484414944150441514415244153441544415544156441574415844159441604416144162441634416444165441664416744168441694417044171441724417344174441754417644177441784417944180441814418244183441844418544186441874418844189441904419144192441934419444195441964419744198441994420044201442024420344204442054420644207442084420944210442114421244213442144421544216442174421844219442204422144222442234422444225442264422744228442294423044231442324423344234442354423644237442384423944240442414424244243442444424544246442474424844249442504425144252442534425444255442564425744258442594426044261442624426344264442654426644267442684426944270442714427244273442744427544276442774427844279442804428144282442834428444285442864428744288442894429044291442924429344294442954429644297442984429944300443014430244303443044430544306443074430844309443104431144312443134431444315443164431744318443194432044321443224432344324443254432644327443284432944330443314433244333443344433544336443374433844339443404434144342443434434444345443464434744348443494435044351443524435344354443554435644357443584435944360443614436244363443644436544366443674436844369443704437144372443734437444375443764437744378443794438044381443824438344384443854438644387443884438944390443914439244393443944439544396443974439844399444004440144402444034440444405444064440744408444094441044411444124441344414444154441644417444184441944420444214442244423444244442544426444274442844429444304443144432444334443444435444364443744438444394444044441444424444344444444454444644447444484444944450444514445244453444544445544456444574445844459444604446144462444634446444465444664446744468444694447044471444724447344474444754447644477444784447944480444814448244483444844448544486444874448844489444904449144492444934449444495444964449744498444994450044501445024450344504445054450644507445084450944510445114451244513445144451544516445174451844519445204452144522445234452444525445264452744528445294453044531445324453344534445354453644537445384453944540445414454244543445444454544546445474454844549445504455144552445534455444555445564455744558445594456044561445624456344564445654456644567445684456944570445714457244573445744457544576445774457844579445804458144582445834458444585445864458744588445894459044591445924459344594445954459644597445984459944600446014460244603446044460544606446074460844609446104461144612446134461444615446164461744618446194462044621446224462344624446254462644627446284462944630446314463244633446344463544636446374463844639446404464144642446434464444645446464464744648446494465044651446524465344654446554465644657446584465944660446614466244663446644466544666446674466844669446704467144672446734467444675446764467744678446794468044681446824468344684446854468644687446884468944690446914469244693446944469544696446974469844699447004470144702447034470444705447064470744708447094471044711447124471344714447154471644717447184471944720447214472244723447244472544726447274472844729447304473144732447334473444735447364473744738447394474044741447424474344744447454474644747447484474944750447514475244753447544475544756447574475844759447604476144762447634476444765447664476744768447694477044771447724477344774447754477644777447784477944780447814478244783447844478544786447874478844789447904479144792447934479444795447964479744798447994480044801448024480344804448054480644807448084480944810448114481244813448144481544816448174481844819448204482144822448234482444825448264482744828448294483044831448324483344834448354483644837448384483944840448414484244843448444484544846448474484844849448504485144852448534485444855448564485744858448594486044861448624486344864448654486644867448684486944870448714487244873448744487544876448774487844879448804488144882448834488444885448864488744888448894489044891448924489344894448954489644897448984489944900449014490244903449044490544906449074490844909449104491144912449134491444915449164491744918449194492044921449224492344924449254492644927449284492944930449314493244933449344493544936449374493844939449404494144942449434494444945449464494744948449494495044951449524495344954449554495644957449584495944960449614496244963449644496544966449674496844969449704497144972449734497444975449764497744978449794498044981449824498344984449854498644987449884498944990449914499244993449944499544996449974499844999450004500145002450034500445005450064500745008450094501045011450124501345014450154501645017450184501945020450214502245023450244502545026450274502845029450304503145032450334503445035450364503745038450394504045041450424504345044450454504645047450484504945050450514505245053450544505545056450574505845059450604506145062450634506445065450664506745068450694507045071450724507345074450754507645077450784507945080450814508245083450844508545086450874508845089450904509145092450934509445095450964509745098450994510045101451024510345104451054510645107451084510945110451114511245113451144511545116451174511845119451204512145122451234512445125451264512745128451294513045131451324513345134451354513645137451384513945140451414514245143451444514545146451474514845149451504515145152451534515445155451564515745158451594516045161451624516345164451654516645167451684516945170451714517245173451744517545176451774517845179451804518145182451834518445185451864518745188451894519045191451924519345194451954519645197451984519945200452014520245203452044520545206452074520845209452104521145212452134521445215452164521745218452194522045221452224522345224452254522645227452284522945230452314523245233452344523545236452374523845239452404524145242452434524445245452464524745248452494525045251452524525345254452554525645257452584525945260452614526245263452644526545266452674526845269452704527145272452734527445275452764527745278452794528045281452824528345284452854528645287452884528945290452914529245293452944529545296452974529845299453004530145302453034530445305453064530745308453094531045311453124531345314453154531645317453184531945320453214532245323453244532545326453274532845329453304533145332453334533445335453364533745338453394534045341453424534345344453454534645347453484534945350453514535245353453544535545356453574535845359453604536145362453634536445365453664536745368453694537045371453724537345374453754537645377453784537945380453814538245383453844538545386453874538845389453904539145392453934539445395453964539745398453994540045401454024540345404454054540645407454084540945410454114541245413454144541545416454174541845419454204542145422454234542445425454264542745428454294543045431454324543345434454354543645437454384543945440454414544245443454444544545446454474544845449454504545145452454534545445455454564545745458454594546045461454624546345464454654546645467454684546945470454714547245473454744547545476454774547845479454804548145482454834548445485454864548745488454894549045491454924549345494454954549645497454984549945500455014550245503455044550545506455074550845509455104551145512455134551445515455164551745518455194552045521455224552345524455254552645527455284552945530455314553245533455344553545536455374553845539455404554145542455434554445545455464554745548455494555045551455524555345554455554555645557455584555945560455614556245563455644556545566455674556845569455704557145572455734557445575455764557745578455794558045581455824558345584455854558645587455884558945590455914559245593455944559545596455974559845599456004560145602456034560445605456064560745608456094561045611456124561345614456154561645617456184561945620456214562245623456244562545626456274562845629456304563145632456334563445635456364563745638456394564045641456424564345644456454564645647456484564945650456514565245653456544565545656456574565845659456604566145662456634566445665456664566745668456694567045671456724567345674456754567645677456784567945680456814568245683456844568545686456874568845689456904569145692456934569445695456964569745698456994570045701457024570345704457054570645707457084570945710457114571245713457144571545716457174571845719457204572145722457234572445725457264572745728457294573045731457324573345734457354573645737457384573945740457414574245743457444574545746457474574845749457504575145752457534575445755457564575745758457594576045761457624576345764457654576645767457684576945770457714577245773457744577545776457774577845779457804578145782457834578445785457864578745788457894579045791457924579345794457954579645797457984579945800458014580245803458044580545806458074580845809458104581145812458134581445815458164581745818458194582045821458224582345824458254582645827458284582945830458314583245833458344583545836458374583845839458404584145842458434584445845458464584745848458494585045851458524585345854458554585645857458584585945860458614586245863458644586545866458674586845869458704587145872458734587445875458764587745878458794588045881458824588345884458854588645887458884588945890458914589245893458944589545896458974589845899459004590145902459034590445905459064590745908459094591045911459124591345914459154591645917459184591945920459214592245923459244592545926459274592845929459304593145932459334593445935459364593745938459394594045941459424594345944459454594645947459484594945950459514595245953459544595545956459574595845959459604596145962459634596445965459664596745968459694597045971459724597345974459754597645977459784597945980459814598245983459844598545986459874598845989459904599145992459934599445995459964599745998459994600046001460024600346004460054600646007460084600946010460114601246013460144601546016460174601846019460204602146022460234602446025460264602746028460294603046031460324603346034460354603646037460384603946040460414604246043460444604546046460474604846049460504605146052460534605446055460564605746058460594606046061460624606346064460654606646067460684606946070460714607246073460744607546076460774607846079460804608146082460834608446085460864608746088460894609046091460924609346094460954609646097460984609946100461014610246103461044610546106461074610846109461104611146112461134611446115461164611746118461194612046121461224612346124461254612646127461284612946130461314613246133461344613546136461374613846139461404614146142461434614446145461464614746148461494615046151461524615346154461554615646157461584615946160461614616246163461644616546166461674616846169461704617146172461734617446175461764617746178461794618046181461824618346184461854618646187461884618946190461914619246193461944619546196461974619846199462004620146202462034620446205462064620746208462094621046211462124621346214462154621646217462184621946220462214622246223462244622546226462274622846229462304623146232462334623446235462364623746238462394624046241462424624346244462454624646247462484624946250462514625246253462544625546256462574625846259462604626146262462634626446265462664626746268462694627046271462724627346274462754627646277462784627946280462814628246283462844628546286462874628846289462904629146292462934629446295462964629746298462994630046301463024630346304463054630646307463084630946310463114631246313463144631546316463174631846319463204632146322463234632446325463264632746328463294633046331463324633346334463354633646337463384633946340463414634246343463444634546346463474634846349463504635146352463534635446355463564635746358463594636046361463624636346364463654636646367463684636946370463714637246373463744637546376463774637846379463804638146382463834638446385463864638746388463894639046391463924639346394463954639646397463984639946400464014640246403464044640546406464074640846409464104641146412464134641446415464164641746418464194642046421464224642346424464254642646427464284642946430464314643246433464344643546436464374643846439464404644146442464434644446445464464644746448464494645046451464524645346454464554645646457464584645946460464614646246463464644646546466464674646846469464704647146472464734647446475464764647746478464794648046481464824648346484464854648646487464884648946490464914649246493464944649546496464974649846499465004650146502465034650446505465064650746508465094651046511465124651346514465154651646517465184651946520465214652246523465244652546526465274652846529465304653146532465334653446535465364653746538465394654046541465424654346544465454654646547465484654946550465514655246553465544655546556465574655846559465604656146562465634656446565465664656746568465694657046571465724657346574465754657646577465784657946580465814658246583465844658546586465874658846589465904659146592465934659446595465964659746598465994660046601466024660346604466054660646607466084660946610466114661246613466144661546616466174661846619466204662146622466234662446625466264662746628466294663046631466324663346634466354663646637466384663946640466414664246643466444664546646466474664846649466504665146652466534665446655466564665746658466594666046661466624666346664466654666646667466684666946670466714667246673466744667546676466774667846679466804668146682466834668446685466864668746688466894669046691466924669346694466954669646697466984669946700467014670246703467044670546706467074670846709467104671146712467134671446715467164671746718467194672046721467224672346724467254672646727467284672946730467314673246733467344673546736467374673846739467404674146742467434674446745467464674746748467494675046751467524675346754467554675646757467584675946760467614676246763467644676546766467674676846769467704677146772467734677446775467764677746778467794678046781467824678346784467854678646787467884678946790467914679246793467944679546796467974679846799468004680146802468034680446805468064680746808468094681046811468124681346814468154681646817468184681946820468214682246823468244682546826468274682846829468304683146832468334683446835468364683746838468394684046841468424684346844468454684646847468484684946850468514685246853468544685546856468574685846859468604686146862468634686446865468664686746868468694687046871468724687346874468754687646877468784687946880468814688246883468844688546886468874688846889468904689146892468934689446895468964689746898468994690046901469024690346904469054690646907469084690946910469114691246913469144691546916469174691846919469204692146922469234692446925469264692746928469294693046931469324693346934469354693646937469384693946940469414694246943469444694546946469474694846949469504695146952469534695446955469564695746958469594696046961469624696346964469654696646967469684696946970469714697246973469744697546976469774697846979469804698146982469834698446985469864698746988469894699046991469924699346994469954699646997469984699947000470014700247003470044700547006470074700847009470104701147012470134701447015470164701747018470194702047021470224702347024470254702647027470284702947030470314703247033470344703547036470374703847039470404704147042470434704447045470464704747048470494705047051470524705347054470554705647057470584705947060470614706247063470644706547066470674706847069470704707147072470734707447075470764707747078470794708047081470824708347084470854708647087470884708947090470914709247093470944709547096470974709847099471004710147102471034710447105471064710747108471094711047111471124711347114471154711647117471184711947120471214712247123471244712547126471274712847129471304713147132471334713447135471364713747138471394714047141471424714347144471454714647147471484714947150471514715247153471544715547156471574715847159471604716147162471634716447165471664716747168471694717047171471724717347174471754717647177471784717947180471814718247183471844718547186471874718847189471904719147192471934719447195471964719747198471994720047201472024720347204472054720647207472084720947210472114721247213472144721547216472174721847219472204722147222472234722447225472264722747228472294723047231472324723347234472354723647237472384723947240472414724247243472444724547246472474724847249472504725147252472534725447255472564725747258472594726047261472624726347264472654726647267472684726947270472714727247273472744727547276472774727847279472804728147282472834728447285472864728747288472894729047291472924729347294472954729647297472984729947300473014730247303473044730547306473074730847309473104731147312473134731447315473164731747318473194732047321473224732347324473254732647327473284732947330473314733247333473344733547336473374733847339473404734147342473434734447345473464734747348473494735047351473524735347354473554735647357473584735947360473614736247363473644736547366473674736847369473704737147372473734737447375473764737747378473794738047381473824738347384473854738647387473884738947390473914739247393473944739547396473974739847399474004740147402474034740447405474064740747408474094741047411474124741347414474154741647417474184741947420474214742247423474244742547426474274742847429474304743147432474334743447435474364743747438474394744047441474424744347444474454744647447474484744947450474514745247453474544745547456474574745847459474604746147462474634746447465474664746747468474694747047471474724747347474474754747647477474784747947480474814748247483474844748547486474874748847489474904749147492474934749447495474964749747498474994750047501475024750347504475054750647507475084750947510475114751247513475144751547516475174751847519475204752147522475234752447525475264752747528475294753047531475324753347534475354753647537475384753947540475414754247543475444754547546475474754847549475504755147552475534755447555475564755747558475594756047561475624756347564475654756647567475684756947570475714757247573475744757547576475774757847579475804758147582475834758447585475864758747588475894759047591475924759347594475954759647597475984759947600476014760247603476044760547606476074760847609476104761147612476134761447615476164761747618476194762047621476224762347624476254762647627476284762947630476314763247633476344763547636476374763847639476404764147642476434764447645476464764747648476494765047651476524765347654476554765647657476584765947660476614766247663476644766547666476674766847669476704767147672476734767447675476764767747678476794768047681476824768347684476854768647687476884768947690476914769247693476944769547696476974769847699477004770147702477034770447705477064770747708477094771047711477124771347714477154771647717477184771947720477214772247723477244772547726477274772847729477304773147732477334773447735477364773747738477394774047741477424774347744477454774647747477484774947750477514775247753477544775547756477574775847759477604776147762477634776447765477664776747768477694777047771477724777347774477754777647777477784777947780477814778247783477844778547786477874778847789477904779147792477934779447795477964779747798477994780047801478024780347804478054780647807478084780947810478114781247813478144781547816478174781847819478204782147822478234782447825478264782747828478294783047831478324783347834478354783647837478384783947840478414784247843478444784547846478474784847849478504785147852478534785447855478564785747858478594786047861478624786347864478654786647867478684786947870478714787247873478744787547876478774787847879478804788147882478834788447885478864788747888478894789047891478924789347894478954789647897478984789947900479014790247903479044790547906479074790847909479104791147912479134791447915479164791747918479194792047921479224792347924479254792647927479284792947930479314793247933479344793547936479374793847939479404794147942479434794447945479464794747948479494795047951479524795347954479554795647957479584795947960479614796247963479644796547966479674796847969479704797147972479734797447975479764797747978479794798047981479824798347984479854798647987479884798947990479914799247993479944799547996479974799847999480004800148002480034800448005480064800748008480094801048011480124801348014480154801648017480184801948020480214802248023480244802548026480274802848029480304803148032480334803448035480364803748038480394804048041480424804348044480454804648047480484804948050480514805248053480544805548056480574805848059480604806148062480634806448065480664806748068480694807048071480724807348074480754807648077480784807948080480814808248083480844808548086480874808848089480904809148092480934809448095480964809748098480994810048101481024810348104481054810648107481084810948110481114811248113481144811548116481174811848119481204812148122481234812448125481264812748128481294813048131481324813348134481354813648137481384813948140481414814248143481444814548146481474814848149481504815148152481534815448155481564815748158481594816048161481624816348164481654816648167481684816948170481714817248173481744817548176481774817848179481804818148182481834818448185481864818748188481894819048191481924819348194481954819648197481984819948200482014820248203482044820548206482074820848209482104821148212482134821448215482164821748218482194822048221482224822348224482254822648227482284822948230482314823248233482344823548236482374823848239482404824148242482434824448245482464824748248482494825048251482524825348254482554825648257482584825948260482614826248263482644826548266482674826848269482704827148272482734827448275482764827748278482794828048281482824828348284482854828648287482884828948290482914829248293482944829548296482974829848299483004830148302483034830448305483064830748308483094831048311483124831348314483154831648317483184831948320483214832248323483244832548326483274832848329483304833148332483334833448335483364833748338483394834048341483424834348344483454834648347483484834948350483514835248353483544835548356483574835848359483604836148362483634836448365483664836748368483694837048371483724837348374483754837648377483784837948380483814838248383483844838548386483874838848389483904839148392483934839448395483964839748398483994840048401484024840348404484054840648407484084840948410484114841248413484144841548416484174841848419484204842148422484234842448425484264842748428484294843048431484324843348434484354843648437484384843948440484414844248443484444844548446484474844848449484504845148452484534845448455484564845748458484594846048461484624846348464484654846648467484684846948470484714847248473484744847548476484774847848479484804848148482484834848448485484864848748488484894849048491484924849348494484954849648497484984849948500485014850248503485044850548506485074850848509485104851148512485134851448515485164851748518485194852048521485224852348524485254852648527485284852948530485314853248533485344853548536485374853848539485404854148542485434854448545485464854748548485494855048551485524855348554485554855648557485584855948560485614856248563485644856548566485674856848569485704857148572485734857448575485764857748578485794858048581485824858348584485854858648587485884858948590485914859248593485944859548596485974859848599486004860148602486034860448605486064860748608486094861048611486124861348614486154861648617486184861948620486214862248623486244862548626486274862848629486304863148632486334863448635486364863748638486394864048641486424864348644486454864648647486484864948650486514865248653486544865548656486574865848659486604866148662486634866448665486664866748668486694867048671486724867348674486754867648677486784867948680486814868248683486844868548686486874868848689486904869148692486934869448695486964869748698486994870048701487024870348704487054870648707487084870948710487114871248713487144871548716487174871848719487204872148722487234872448725487264872748728487294873048731487324873348734487354873648737487384873948740487414874248743487444874548746487474874848749487504875148752487534875448755487564875748758487594876048761487624876348764487654876648767487684876948770487714877248773487744877548776487774877848779487804878148782487834878448785487864878748788487894879048791487924879348794487954879648797487984879948800488014880248803488044880548806488074880848809488104881148812488134881448815488164881748818488194882048821488224882348824488254882648827488284882948830488314883248833488344883548836488374883848839488404884148842488434884448845488464884748848488494885048851488524885348854488554885648857488584885948860488614886248863488644886548866488674886848869488704887148872488734887448875488764887748878488794888048881488824888348884488854888648887488884888948890488914889248893488944889548896488974889848899489004890148902489034890448905489064890748908489094891048911489124891348914489154891648917489184891948920489214892248923489244892548926489274892848929489304893148932489334893448935489364893748938489394894048941489424894348944489454894648947489484894948950489514895248953489544895548956489574895848959489604896148962489634896448965489664896748968489694897048971489724897348974489754897648977489784897948980489814898248983489844898548986489874898848989489904899148992489934899448995489964899748998489994900049001490024900349004490054900649007490084900949010490114901249013490144901549016490174901849019490204902149022490234902449025490264902749028490294903049031490324903349034490354903649037490384903949040490414904249043490444904549046490474904849049490504905149052490534905449055490564905749058490594906049061490624906349064490654906649067490684906949070490714907249073490744907549076490774907849079490804908149082490834908449085490864908749088490894909049091490924909349094490954909649097490984909949100491014910249103491044910549106491074910849109491104911149112491134911449115491164911749118491194912049121491224912349124491254912649127491284912949130491314913249133491344913549136491374913849139491404914149142491434914449145491464914749148491494915049151491524915349154491554915649157491584915949160491614916249163491644916549166491674916849169491704917149172491734917449175491764917749178491794918049181491824918349184491854918649187491884918949190491914919249193491944919549196491974919849199492004920149202492034920449205492064920749208492094921049211492124921349214492154921649217492184921949220492214922249223492244922549226492274922849229492304923149232492334923449235492364923749238492394924049241492424924349244492454924649247492484924949250492514925249253492544925549256492574925849259492604926149262492634926449265492664926749268492694927049271492724927349274492754927649277492784927949280492814928249283492844928549286492874928849289492904929149292492934929449295492964929749298492994930049301493024930349304493054930649307493084930949310493114931249313493144931549316493174931849319493204932149322493234932449325493264932749328493294933049331493324933349334493354933649337493384933949340493414934249343493444934549346493474934849349493504935149352493534935449355493564935749358493594936049361493624936349364493654936649367493684936949370493714937249373493744937549376493774937849379493804938149382493834938449385493864938749388493894939049391493924939349394493954939649397493984939949400494014940249403494044940549406494074940849409494104941149412494134941449415494164941749418494194942049421494224942349424494254942649427494284942949430494314943249433494344943549436494374943849439494404944149442494434944449445494464944749448494494945049451494524945349454494554945649457494584945949460494614946249463494644946549466494674946849469494704947149472494734947449475494764947749478494794948049481494824948349484494854948649487494884948949490494914949249493494944949549496494974949849499495004950149502495034950449505495064950749508495094951049511495124951349514495154951649517495184951949520495214952249523495244952549526495274952849529495304953149532495334953449535495364953749538495394954049541495424954349544495454954649547495484954949550495514955249553495544955549556495574955849559495604956149562495634956449565495664956749568495694957049571495724957349574495754957649577495784957949580495814958249583495844958549586495874958849589495904959149592495934959449595495964959749598495994960049601496024960349604496054960649607496084960949610496114961249613496144961549616496174961849619496204962149622496234962449625496264962749628496294963049631496324963349634496354963649637496384963949640496414964249643496444964549646496474964849649496504965149652496534965449655496564965749658496594966049661496624966349664496654966649667496684966949670496714967249673496744967549676496774967849679496804968149682496834968449685496864968749688496894969049691496924969349694496954969649697496984969949700497014970249703497044970549706497074970849709497104971149712497134971449715497164971749718497194972049721497224972349724497254972649727497284972949730497314973249733497344973549736497374973849739497404974149742497434974449745497464974749748497494975049751497524975349754497554975649757497584975949760497614976249763497644976549766497674976849769497704977149772497734977449775497764977749778497794978049781497824978349784497854978649787497884978949790497914979249793497944979549796497974979849799498004980149802498034980449805498064980749808498094981049811498124981349814498154981649817498184981949820498214982249823498244982549826498274982849829498304983149832498334983449835498364983749838498394984049841498424984349844498454984649847498484984949850498514985249853498544985549856498574985849859498604986149862498634986449865498664986749868498694987049871498724987349874498754987649877498784987949880498814988249883498844988549886498874988849889498904989149892498934989449895498964989749898498994990049901499024990349904499054990649907499084990949910499114991249913499144991549916499174991849919499204992149922499234992449925499264992749928499294993049931499324993349934499354993649937499384993949940499414994249943499444994549946499474994849949499504995149952499534995449955499564995749958499594996049961499624996349964499654996649967499684996949970499714997249973499744997549976499774997849979499804998149982499834998449985499864998749988499894999049991499924999349994499954999649997499984999950000500015000250003500045000550006500075000850009500105001150012500135001450015500165001750018500195002050021500225002350024500255002650027500285002950030500315003250033500345003550036500375003850039500405004150042500435004450045500465004750048500495005050051500525005350054500555005650057500585005950060500615006250063500645006550066500675006850069500705007150072500735007450075500765007750078500795008050081500825008350084500855008650087500885008950090500915009250093500945009550096500975009850099501005010150102501035010450105501065010750108501095011050111501125011350114501155011650117501185011950120501215012250123501245012550126501275012850129501305013150132501335013450135501365013750138501395014050141501425014350144501455014650147501485014950150501515015250153501545015550156501575015850159501605016150162501635016450165501665016750168501695017050171501725017350174501755017650177501785017950180501815018250183501845018550186501875018850189501905019150192501935019450195501965019750198501995020050201502025020350204502055020650207502085020950210502115021250213502145021550216502175021850219502205022150222502235022450225502265022750228502295023050231502325023350234502355023650237502385023950240502415024250243502445024550246502475024850249502505025150252502535025450255502565025750258502595026050261502625026350264502655026650267502685026950270502715027250273502745027550276502775027850279502805028150282502835028450285502865028750288502895029050291502925029350294502955029650297502985029950300503015030250303503045030550306503075030850309503105031150312503135031450315503165031750318503195032050321503225032350324503255032650327503285032950330503315033250333503345033550336503375033850339503405034150342503435034450345503465034750348503495035050351503525035350354503555035650357503585035950360503615036250363503645036550366503675036850369503705037150372503735037450375503765037750378503795038050381503825038350384503855038650387503885038950390503915039250393503945039550396503975039850399504005040150402504035040450405504065040750408504095041050411504125041350414504155041650417504185041950420504215042250423504245042550426504275042850429504305043150432504335043450435504365043750438504395044050441504425044350444504455044650447504485044950450504515045250453504545045550456504575045850459504605046150462504635046450465504665046750468504695047050471504725047350474504755047650477504785047950480504815048250483504845048550486504875048850489504905049150492504935049450495504965049750498504995050050501505025050350504505055050650507505085050950510505115051250513505145051550516505175051850519505205052150522505235052450525505265052750528505295053050531505325053350534505355053650537505385053950540505415054250543505445054550546505475054850549505505055150552505535055450555505565055750558505595056050561505625056350564505655056650567505685056950570505715057250573505745057550576505775057850579505805058150582505835058450585505865058750588505895059050591505925059350594505955059650597505985059950600506015060250603506045060550606506075060850609506105061150612506135061450615506165061750618506195062050621506225062350624506255062650627506285062950630506315063250633506345063550636506375063850639506405064150642506435064450645506465064750648506495065050651506525065350654506555065650657506585065950660506615066250663506645066550666506675066850669506705067150672506735067450675506765067750678506795068050681506825068350684506855068650687506885068950690506915069250693506945069550696506975069850699507005070150702507035070450705507065070750708507095071050711507125071350714507155071650717507185071950720507215072250723507245072550726507275072850729507305073150732507335073450735507365073750738507395074050741507425074350744507455074650747507485074950750507515075250753507545075550756507575075850759507605076150762507635076450765507665076750768507695077050771507725077350774507755077650777507785077950780507815078250783507845078550786507875078850789507905079150792507935079450795507965079750798507995080050801508025080350804508055080650807508085080950810508115081250813508145081550816508175081850819508205082150822508235082450825508265082750828508295083050831508325083350834508355083650837508385083950840508415084250843508445084550846508475084850849508505085150852508535085450855508565085750858508595086050861508625086350864508655086650867508685086950870508715087250873508745087550876508775087850879508805088150882508835088450885508865088750888508895089050891508925089350894508955089650897508985089950900509015090250903509045090550906509075090850909509105091150912509135091450915509165091750918509195092050921509225092350924509255092650927509285092950930509315093250933509345093550936509375093850939509405094150942509435094450945509465094750948509495095050951509525095350954509555095650957509585095950960509615096250963509645096550966509675096850969509705097150972509735097450975509765097750978509795098050981509825098350984509855098650987509885098950990509915099250993509945099550996509975099850999510005100151002510035100451005510065100751008510095101051011510125101351014510155101651017510185101951020510215102251023510245102551026510275102851029510305103151032510335103451035510365103751038510395104051041510425104351044510455104651047510485104951050510515105251053510545105551056510575105851059510605106151062510635106451065510665106751068510695107051071510725107351074510755107651077510785107951080510815108251083510845108551086510875108851089510905109151092510935109451095510965109751098510995110051101511025110351104511055110651107511085110951110511115111251113511145111551116511175111851119511205112151122511235112451125511265112751128511295113051131511325113351134511355113651137511385113951140511415114251143511445114551146511475114851149511505115151152511535115451155511565115751158511595116051161511625116351164511655116651167511685116951170511715117251173511745117551176511775117851179511805118151182511835118451185511865118751188511895119051191511925119351194511955119651197511985119951200512015120251203512045120551206512075120851209512105121151212512135121451215512165121751218512195122051221512225122351224512255122651227512285122951230512315123251233512345123551236512375123851239512405124151242512435124451245512465124751248512495125051251512525125351254512555125651257512585125951260512615126251263512645126551266512675126851269512705127151272512735127451275512765127751278512795128051281512825128351284512855128651287512885128951290512915129251293512945129551296512975129851299513005130151302513035130451305513065130751308513095131051311513125131351314513155131651317513185131951320513215132251323513245132551326513275132851329513305133151332513335133451335513365133751338513395134051341513425134351344513455134651347513485134951350513515135251353513545135551356513575135851359513605136151362513635136451365513665136751368513695137051371513725137351374513755137651377513785137951380513815138251383513845138551386513875138851389513905139151392513935139451395513965139751398513995140051401514025140351404514055140651407514085140951410514115141251413514145141551416514175141851419514205142151422514235142451425514265142751428514295143051431514325143351434514355143651437514385143951440514415144251443514445144551446514475144851449514505145151452514535145451455514565145751458514595146051461514625146351464514655146651467514685146951470514715147251473514745147551476514775147851479514805148151482514835148451485514865148751488514895149051491514925149351494514955149651497514985149951500515015150251503515045150551506515075150851509515105151151512515135151451515515165151751518515195152051521515225152351524515255152651527515285152951530515315153251533515345153551536515375153851539515405154151542515435154451545515465154751548515495155051551515525155351554515555155651557515585155951560515615156251563515645156551566515675156851569515705157151572515735157451575515765157751578515795158051581515825158351584515855158651587515885158951590515915159251593515945159551596515975159851599516005160151602516035160451605516065160751608516095161051611516125161351614516155161651617516185161951620516215162251623516245162551626516275162851629516305163151632516335163451635516365163751638516395164051641516425164351644516455164651647516485164951650516515165251653516545165551656516575165851659516605166151662516635166451665516665166751668516695167051671516725167351674516755167651677516785167951680516815168251683516845168551686516875168851689516905169151692516935169451695516965169751698516995170051701517025170351704517055170651707517085170951710517115171251713517145171551716517175171851719517205172151722517235172451725517265172751728517295173051731517325173351734517355173651737517385173951740517415174251743517445174551746517475174851749517505175151752517535175451755517565175751758517595176051761517625176351764517655176651767517685176951770517715177251773517745177551776517775177851779517805178151782517835178451785517865178751788517895179051791517925179351794517955179651797517985179951800518015180251803518045180551806518075180851809518105181151812518135181451815518165181751818518195182051821518225182351824518255182651827518285182951830518315183251833518345183551836518375183851839518405184151842518435184451845518465184751848518495185051851518525185351854518555185651857518585185951860518615186251863518645186551866518675186851869518705187151872518735187451875518765187751878518795188051881518825188351884518855188651887518885188951890518915189251893518945189551896518975189851899519005190151902519035190451905519065190751908519095191051911519125191351914519155191651917519185191951920519215192251923519245192551926519275192851929519305193151932519335193451935519365193751938519395194051941519425194351944519455194651947519485194951950519515195251953519545195551956519575195851959519605196151962519635196451965519665196751968519695197051971519725197351974519755197651977519785197951980519815198251983519845198551986519875198851989519905199151992519935199451995519965199751998519995200052001520025200352004520055200652007520085200952010520115201252013520145201552016520175201852019520205202152022520235202452025520265202752028520295203052031520325203352034520355203652037520385203952040520415204252043520445204552046520475204852049520505205152052520535205452055520565205752058520595206052061520625206352064520655206652067520685206952070520715207252073520745207552076520775207852079520805208152082520835208452085520865208752088520895209052091520925209352094520955209652097520985209952100521015210252103521045210552106521075210852109521105211152112521135211452115521165211752118521195212052121521225212352124521255212652127521285212952130521315213252133521345213552136521375213852139521405214152142521435214452145521465214752148521495215052151521525215352154521555215652157521585215952160521615216252163521645216552166521675216852169521705217152172521735217452175521765217752178521795218052181521825218352184521855218652187521885218952190521915219252193521945219552196521975219852199522005220152202522035220452205522065220752208522095221052211522125221352214522155221652217522185221952220522215222252223522245222552226522275222852229522305223152232522335223452235522365223752238522395224052241522425224352244522455224652247522485224952250522515225252253522545225552256522575225852259522605226152262522635226452265522665226752268522695227052271522725227352274522755227652277522785227952280522815228252283522845228552286522875228852289522905229152292522935229452295522965229752298522995230052301523025230352304523055230652307523085230952310523115231252313523145231552316523175231852319523205232152322523235232452325523265232752328523295233052331523325233352334523355233652337523385233952340523415234252343523445234552346523475234852349523505235152352523535235452355523565235752358523595236052361523625236352364523655236652367523685236952370523715237252373523745237552376523775237852379523805238152382523835238452385523865238752388523895239052391523925239352394523955239652397523985239952400524015240252403524045240552406524075240852409524105241152412524135241452415524165241752418524195242052421524225242352424524255242652427524285242952430524315243252433524345243552436524375243852439524405244152442524435244452445524465244752448524495245052451524525245352454524555245652457524585245952460524615246252463524645246552466524675246852469524705247152472524735247452475524765247752478524795248052481524825248352484524855248652487524885248952490524915249252493524945249552496524975249852499525005250152502525035250452505525065250752508525095251052511525125251352514525155251652517525185251952520525215252252523525245252552526525275252852529525305253152532525335253452535525365253752538525395254052541525425254352544525455254652547525485254952550525515255252553525545255552556525575255852559525605256152562525635256452565525665256752568525695257052571525725257352574525755257652577525785257952580525815258252583525845258552586525875258852589525905259152592525935259452595525965259752598525995260052601526025260352604526055260652607526085260952610526115261252613526145261552616526175261852619526205262152622526235262452625526265262752628526295263052631526325263352634526355263652637526385263952640526415264252643526445264552646526475264852649526505265152652526535265452655526565265752658526595266052661526625266352664526655266652667526685266952670526715267252673526745267552676526775267852679526805268152682526835268452685526865268752688526895269052691526925269352694526955269652697526985269952700527015270252703527045270552706527075270852709527105271152712527135271452715527165271752718527195272052721527225272352724527255272652727527285272952730527315273252733527345273552736527375273852739527405274152742527435274452745527465274752748527495275052751527525275352754527555275652757527585275952760527615276252763527645276552766527675276852769527705277152772527735277452775527765277752778527795278052781527825278352784527855278652787527885278952790527915279252793527945279552796527975279852799528005280152802528035280452805528065280752808528095281052811528125281352814528155281652817528185281952820528215282252823528245282552826528275282852829528305283152832528335283452835528365283752838528395284052841528425284352844528455284652847528485284952850528515285252853528545285552856528575285852859528605286152862528635286452865528665286752868528695287052871528725287352874528755287652877528785287952880528815288252883528845288552886528875288852889528905289152892528935289452895528965289752898528995290052901529025290352904529055290652907529085290952910529115291252913529145291552916529175291852919529205292152922529235292452925529265292752928529295293052931529325293352934529355293652937529385293952940529415294252943529445294552946529475294852949529505295152952529535295452955529565295752958529595296052961529625296352964529655296652967529685296952970529715297252973529745297552976529775297852979529805298152982529835298452985529865298752988529895299052991529925299352994529955299652997529985299953000530015300253003530045300553006530075300853009530105301153012530135301453015530165301753018530195302053021530225302353024530255302653027530285302953030530315303253033530345303553036530375303853039530405304153042530435304453045530465304753048530495305053051530525305353054530555305653057530585305953060530615306253063530645306553066530675306853069530705307153072530735307453075530765307753078530795308053081530825308353084530855308653087530885308953090530915309253093530945309553096530975309853099531005310153102531035310453105531065310753108531095311053111531125311353114531155311653117531185311953120531215312253123531245312553126531275312853129531305313153132531335313453135531365313753138531395314053141531425314353144531455314653147531485314953150531515315253153531545315553156531575315853159531605316153162531635316453165531665316753168531695317053171531725317353174531755317653177531785317953180531815318253183531845318553186531875318853189531905319153192531935319453195531965319753198531995320053201532025320353204532055320653207532085320953210532115321253213532145321553216532175321853219532205322153222532235322453225532265322753228532295323053231532325323353234532355323653237532385323953240532415324253243532445324553246532475324853249532505325153252532535325453255532565325753258532595326053261532625326353264532655326653267532685326953270532715327253273532745327553276532775327853279532805328153282532835328453285532865328753288532895329053291532925329353294532955329653297532985329953300533015330253303533045330553306533075330853309533105331153312533135331453315533165331753318533195332053321533225332353324533255332653327533285332953330533315333253333533345333553336533375333853339533405334153342533435334453345533465334753348533495335053351533525335353354533555335653357533585335953360533615336253363533645336553366533675336853369533705337153372533735337453375533765337753378533795338053381533825338353384533855338653387533885338953390533915339253393533945339553396533975339853399534005340153402534035340453405534065340753408534095341053411534125341353414534155341653417534185341953420534215342253423534245342553426534275342853429534305343153432534335343453435534365343753438534395344053441534425344353444534455344653447534485344953450534515345253453534545345553456534575345853459534605346153462534635346453465534665346753468534695347053471534725347353474534755347653477534785347953480534815348253483534845348553486534875348853489534905349153492534935349453495534965349753498534995350053501535025350353504535055350653507535085350953510535115351253513535145351553516535175351853519535205352153522535235352453525535265352753528535295353053531535325353353534535355353653537535385353953540535415354253543535445354553546535475354853549535505355153552535535355453555535565355753558535595356053561535625356353564535655356653567535685356953570535715357253573535745357553576535775357853579535805358153582535835358453585535865358753588535895359053591535925359353594535955359653597535985359953600536015360253603536045360553606536075360853609536105361153612536135361453615536165361753618536195362053621536225362353624536255362653627536285362953630536315363253633536345363553636536375363853639536405364153642536435364453645536465364753648536495365053651536525365353654536555365653657536585365953660536615366253663536645366553666536675366853669536705367153672536735367453675536765367753678536795368053681536825368353684536855368653687536885368953690536915369253693536945369553696536975369853699537005370153702537035370453705537065370753708537095371053711537125371353714537155371653717537185371953720537215372253723537245372553726537275372853729537305373153732537335373453735537365373753738537395374053741537425374353744537455374653747537485374953750537515375253753537545375553756537575375853759537605376153762537635376453765537665376753768537695377053771537725377353774537755377653777537785377953780537815378253783537845378553786537875378853789537905379153792537935379453795537965379753798537995380053801538025380353804538055380653807538085380953810538115381253813538145381553816538175381853819538205382153822538235382453825538265382753828538295383053831538325383353834538355383653837538385383953840538415384253843538445384553846538475384853849538505385153852538535385453855538565385753858538595386053861538625386353864538655386653867538685386953870538715387253873538745387553876538775387853879538805388153882538835388453885538865388753888538895389053891538925389353894538955389653897538985389953900539015390253903539045390553906539075390853909539105391153912539135391453915539165391753918539195392053921539225392353924539255392653927539285392953930539315393253933539345393553936539375393853939539405394153942539435394453945539465394753948539495395053951539525395353954539555395653957539585395953960539615396253963539645396553966539675396853969539705397153972539735397453975539765397753978539795398053981539825398353984539855398653987539885398953990539915399253993539945399553996539975399853999540005400154002540035400454005540065400754008540095401054011540125401354014540155401654017540185401954020540215402254023540245402554026540275402854029540305403154032540335403454035540365403754038540395404054041540425404354044540455404654047540485404954050540515405254053540545405554056540575405854059540605406154062540635406454065540665406754068540695407054071540725407354074540755407654077540785407954080540815408254083540845408554086540875408854089540905409154092540935409454095540965409754098540995410054101541025410354104541055410654107541085410954110541115411254113541145411554116541175411854119541205412154122541235412454125541265412754128541295413054131541325413354134541355413654137541385413954140541415414254143541445414554146541475414854149541505415154152541535415454155541565415754158541595416054161541625416354164541655416654167541685416954170541715417254173541745417554176541775417854179541805418154182541835418454185541865418754188541895419054191541925419354194541955419654197541985419954200542015420254203542045420554206542075420854209542105421154212542135421454215542165421754218542195422054221542225422354224542255422654227542285422954230542315423254233542345423554236542375423854239542405424154242542435424454245542465424754248542495425054251542525425354254542555425654257542585425954260542615426254263542645426554266542675426854269542705427154272542735427454275542765427754278542795428054281542825428354284542855428654287542885428954290542915429254293542945429554296542975429854299543005430154302543035430454305543065430754308543095431054311543125431354314543155431654317543185431954320543215432254323543245432554326543275432854329543305433154332543335433454335543365433754338543395434054341543425434354344543455434654347543485434954350543515435254353543545435554356543575435854359543605436154362543635436454365543665436754368543695437054371543725437354374543755437654377543785437954380543815438254383543845438554386543875438854389543905439154392543935439454395543965439754398543995440054401544025440354404544055440654407544085440954410544115441254413544145441554416544175441854419544205442154422544235442454425544265442754428544295443054431544325443354434544355443654437544385443954440544415444254443544445444554446544475444854449544505445154452544535445454455544565445754458544595446054461544625446354464544655446654467544685446954470544715447254473544745447554476544775447854479544805448154482544835448454485544865448754488544895449054491544925449354494544955449654497544985449954500545015450254503545045450554506545075450854509545105451154512545135451454515545165451754518545195452054521545225452354524545255452654527545285452954530545315453254533545345453554536545375453854539545405454154542545435454454545545465454754548545495455054551545525455354554545555455654557545585455954560545615456254563545645456554566545675456854569545705457154572545735457454575545765457754578545795458054581545825458354584545855458654587545885458954590545915459254593545945459554596545975459854599546005460154602546035460454605546065460754608546095461054611546125461354614546155461654617546185461954620546215462254623546245462554626546275462854629546305463154632546335463454635546365463754638546395464054641546425464354644546455464654647546485464954650546515465254653546545465554656546575465854659546605466154662546635466454665546665466754668546695467054671546725467354674546755467654677546785467954680546815468254683546845468554686546875468854689546905469154692546935469454695546965469754698546995470054701547025470354704547055470654707547085470954710547115471254713547145471554716547175471854719547205472154722547235472454725547265472754728547295473054731547325473354734547355473654737547385473954740547415474254743547445474554746547475474854749547505475154752547535475454755547565475754758547595476054761547625476354764547655476654767547685476954770547715477254773547745477554776547775477854779547805478154782547835478454785547865478754788547895479054791547925479354794547955479654797547985479954800548015480254803548045480554806548075480854809548105481154812548135481454815548165481754818548195482054821548225482354824548255482654827548285482954830548315483254833548345483554836548375483854839548405484154842548435484454845548465484754848548495485054851548525485354854548555485654857548585485954860548615486254863548645486554866548675486854869548705487154872548735487454875548765487754878548795488054881548825488354884548855488654887548885488954890548915489254893548945489554896548975489854899549005490154902549035490454905549065490754908549095491054911549125491354914549155491654917549185491954920549215492254923549245492554926549275492854929549305493154932549335493454935549365493754938549395494054941549425494354944549455494654947549485494954950549515495254953549545495554956549575495854959549605496154962549635496454965549665496754968549695497054971549725497354974549755497654977549785497954980549815498254983549845498554986549875498854989549905499154992549935499454995549965499754998549995500055001550025500355004550055500655007550085500955010550115501255013550145501555016550175501855019550205502155022550235502455025550265502755028550295503055031550325503355034550355503655037550385503955040550415504255043550445504555046550475504855049550505505155052550535505455055550565505755058550595506055061550625506355064550655506655067550685506955070550715507255073550745507555076550775507855079550805508155082550835508455085550865508755088550895509055091550925509355094550955509655097550985509955100551015510255103551045510555106551075510855109551105511155112551135511455115551165511755118551195512055121551225512355124551255512655127551285512955130551315513255133551345513555136551375513855139551405514155142551435514455145551465514755148551495515055151551525515355154551555515655157551585515955160551615516255163551645516555166551675516855169551705517155172551735517455175551765517755178551795518055181551825518355184551855518655187551885518955190551915519255193551945519555196551975519855199552005520155202552035520455205552065520755208552095521055211552125521355214552155521655217552185521955220552215522255223552245522555226552275522855229552305523155232552335523455235552365523755238552395524055241552425524355244552455524655247552485524955250552515525255253552545525555256552575525855259552605526155262552635526455265552665526755268552695527055271552725527355274552755527655277552785527955280552815528255283552845528555286552875528855289552905529155292552935529455295552965529755298552995530055301553025530355304553055530655307553085530955310553115531255313553145531555316553175531855319553205532155322553235532455325553265532755328553295533055331553325533355334553355533655337553385533955340553415534255343553445534555346553475534855349553505535155352553535535455355553565535755358553595536055361553625536355364553655536655367553685536955370553715537255373553745537555376553775537855379553805538155382553835538455385553865538755388553895539055391553925539355394553955539655397553985539955400554015540255403554045540555406554075540855409554105541155412554135541455415554165541755418554195542055421554225542355424554255542655427554285542955430554315543255433554345543555436554375543855439554405544155442554435544455445554465544755448554495545055451554525545355454554555545655457554585545955460554615546255463554645546555466554675546855469554705547155472554735547455475554765547755478554795548055481554825548355484554855548655487554885548955490554915549255493554945549555496554975549855499555005550155502555035550455505555065550755508555095551055511555125551355514555155551655517555185551955520555215552255523555245552555526555275552855529555305553155532555335553455535555365553755538555395554055541555425554355544555455554655547555485554955550555515555255553555545555555556555575555855559555605556155562555635556455565555665556755568555695557055571555725557355574555755557655577555785557955580555815558255583555845558555586555875558855589555905559155592555935559455595555965559755598555995560055601556025560355604556055560655607556085560955610556115561255613556145561555616556175561855619556205562155622556235562455625556265562755628556295563055631556325563355634556355563655637556385563955640556415564255643556445564555646556475564855649556505565155652556535565455655556565565755658556595566055661556625566355664556655566655667556685566955670556715567255673556745567555676556775567855679556805568155682556835568455685556865568755688556895569055691556925569355694556955569655697556985569955700557015570255703557045570555706557075570855709557105571155712557135571455715557165571755718557195572055721557225572355724557255572655727557285572955730557315573255733557345573555736557375573855739557405574155742557435574455745557465574755748557495575055751557525575355754557555575655757557585575955760557615576255763557645576555766557675576855769557705577155772557735577455775557765577755778557795578055781557825578355784557855578655787557885578955790557915579255793557945579555796557975579855799558005580155802558035580455805558065580755808558095581055811558125581355814558155581655817558185581955820558215582255823558245582555826558275582855829558305583155832558335583455835558365583755838558395584055841558425584355844558455584655847558485584955850558515585255853558545585555856558575585855859558605586155862558635586455865558665586755868558695587055871558725587355874558755587655877558785587955880558815588255883558845588555886558875588855889558905589155892558935589455895558965589755898558995590055901559025590355904559055590655907559085590955910559115591255913559145591555916559175591855919559205592155922559235592455925559265592755928559295593055931559325593355934559355593655937559385593955940559415594255943559445594555946559475594855949559505595155952559535595455955559565595755958559595596055961559625596355964559655596655967559685596955970559715597255973559745597555976559775597855979559805598155982559835598455985559865598755988559895599055991559925599355994559955599655997559985599956000560015600256003560045600556006560075600856009560105601156012560135601456015560165601756018560195602056021560225602356024560255602656027560285602956030560315603256033560345603556036560375603856039560405604156042560435604456045560465604756048560495605056051560525605356054560555605656057560585605956060560615606256063560645606556066560675606856069560705607156072560735607456075560765607756078560795608056081560825608356084560855608656087560885608956090560915609256093560945609556096560975609856099561005610156102561035610456105561065610756108561095611056111561125611356114561155611656117561185611956120561215612256123561245612556126561275612856129561305613156132561335613456135561365613756138561395614056141561425614356144561455614656147561485614956150561515615256153561545615556156561575615856159561605616156162561635616456165561665616756168561695617056171561725617356174561755617656177561785617956180561815618256183561845618556186561875618856189561905619156192561935619456195561965619756198561995620056201562025620356204562055620656207562085620956210562115621256213562145621556216562175621856219562205622156222562235622456225562265622756228562295623056231562325623356234562355623656237562385623956240562415624256243562445624556246562475624856249562505625156252562535625456255562565625756258562595626056261562625626356264562655626656267562685626956270562715627256273562745627556276562775627856279562805628156282562835628456285562865628756288562895629056291562925629356294562955629656297562985629956300563015630256303563045630556306563075630856309563105631156312563135631456315563165631756318563195632056321563225632356324563255632656327563285632956330563315633256333563345633556336563375633856339563405634156342563435634456345563465634756348563495635056351563525635356354563555635656357563585635956360563615636256363563645636556366563675636856369563705637156372563735637456375563765637756378563795638056381563825638356384563855638656387563885638956390563915639256393563945639556396563975639856399564005640156402564035640456405564065640756408564095641056411564125641356414564155641656417564185641956420564215642256423564245642556426564275642856429564305643156432564335643456435564365643756438564395644056441564425644356444564455644656447564485644956450564515645256453564545645556456564575645856459564605646156462564635646456465564665646756468564695647056471564725647356474564755647656477564785647956480564815648256483564845648556486564875648856489564905649156492564935649456495564965649756498564995650056501565025650356504565055650656507565085650956510565115651256513565145651556516565175651856519565205652156522565235652456525565265652756528565295653056531565325653356534565355653656537565385653956540565415654256543565445654556546565475654856549565505655156552565535655456555565565655756558565595656056561565625656356564565655656656567565685656956570565715657256573565745657556576565775657856579565805658156582565835658456585565865658756588565895659056591565925659356594565955659656597565985659956600566015660256603566045660556606566075660856609566105661156612566135661456615566165661756618566195662056621566225662356624566255662656627566285662956630566315663256633566345663556636566375663856639566405664156642566435664456645566465664756648566495665056651566525665356654566555665656657566585665956660566615666256663566645666556666566675666856669566705667156672566735667456675566765667756678566795668056681566825668356684566855668656687566885668956690566915669256693566945669556696566975669856699567005670156702567035670456705567065670756708567095671056711567125671356714567155671656717567185671956720567215672256723567245672556726567275672856729567305673156732567335673456735567365673756738567395674056741567425674356744567455674656747567485674956750567515675256753567545675556756567575675856759567605676156762567635676456765567665676756768567695677056771567725677356774567755677656777567785677956780567815678256783567845678556786567875678856789567905679156792567935679456795567965679756798567995680056801568025680356804568055680656807568085680956810568115681256813568145681556816568175681856819568205682156822568235682456825568265682756828568295683056831568325683356834568355683656837568385683956840568415684256843568445684556846568475684856849568505685156852568535685456855568565685756858568595686056861568625686356864568655686656867568685686956870568715687256873568745687556876568775687856879568805688156882568835688456885568865688756888568895689056891568925689356894568955689656897568985689956900569015690256903569045690556906569075690856909569105691156912569135691456915569165691756918569195692056921569225692356924569255692656927569285692956930569315693256933569345693556936569375693856939569405694156942569435694456945569465694756948569495695056951569525695356954569555695656957569585695956960569615696256963569645696556966569675696856969569705697156972569735697456975569765697756978569795698056981569825698356984569855698656987569885698956990569915699256993569945699556996569975699856999570005700157002570035700457005570065700757008570095701057011570125701357014570155701657017570185701957020570215702257023570245702557026570275702857029570305703157032570335703457035570365703757038570395704057041570425704357044570455704657047570485704957050570515705257053570545705557056570575705857059570605706157062570635706457065570665706757068570695707057071570725707357074570755707657077570785707957080570815708257083570845708557086570875708857089570905709157092570935709457095570965709757098570995710057101571025710357104571055710657107571085710957110571115711257113571145711557116571175711857119571205712157122571235712457125571265712757128571295713057131571325713357134571355713657137571385713957140571415714257143571445714557146571475714857149571505715157152571535715457155571565715757158571595716057161571625716357164571655716657167571685716957170571715717257173571745717557176571775717857179571805718157182571835718457185571865718757188571895719057191571925719357194571955719657197571985719957200572015720257203572045720557206572075720857209572105721157212572135721457215572165721757218572195722057221572225722357224572255722657227572285722957230572315723257233572345723557236572375723857239572405724157242572435724457245572465724757248572495725057251572525725357254572555725657257572585725957260572615726257263572645726557266572675726857269572705727157272572735727457275572765727757278572795728057281572825728357284572855728657287572885728957290572915729257293572945729557296572975729857299573005730157302573035730457305573065730757308573095731057311573125731357314573155731657317573185731957320573215732257323573245732557326573275732857329573305733157332573335733457335573365733757338573395734057341573425734357344573455734657347573485734957350573515735257353573545735557356573575735857359573605736157362573635736457365573665736757368573695737057371573725737357374573755737657377573785737957380573815738257383573845738557386573875738857389573905739157392573935739457395573965739757398573995740057401574025740357404574055740657407574085740957410574115741257413574145741557416574175741857419574205742157422574235742457425574265742757428574295743057431574325743357434574355743657437574385743957440574415744257443574445744557446574475744857449574505745157452574535745457455574565745757458574595746057461574625746357464574655746657467574685746957470574715747257473574745747557476574775747857479574805748157482574835748457485574865748757488574895749057491574925749357494574955749657497574985749957500575015750257503575045750557506575075750857509575105751157512575135751457515575165751757518575195752057521575225752357524575255752657527575285752957530575315753257533575345753557536575375753857539575405754157542575435754457545575465754757548575495755057551575525755357554575555755657557575585755957560575615756257563575645756557566575675756857569575705757157572575735757457575575765757757578575795758057581575825758357584575855758657587575885758957590575915759257593575945759557596575975759857599576005760157602576035760457605576065760757608576095761057611576125761357614576155761657617576185761957620576215762257623576245762557626576275762857629576305763157632576335763457635576365763757638576395764057641576425764357644576455764657647576485764957650576515765257653576545765557656576575765857659576605766157662576635766457665576665766757668576695767057671576725767357674576755767657677576785767957680576815768257683576845768557686576875768857689576905769157692576935769457695576965769757698576995770057701577025770357704577055770657707577085770957710577115771257713577145771557716577175771857719577205772157722577235772457725577265772757728577295773057731577325773357734577355773657737577385773957740577415774257743577445774557746577475774857749577505775157752577535775457755577565775757758577595776057761577625776357764577655776657767577685776957770577715777257773577745777557776577775777857779577805778157782577835778457785577865778757788577895779057791577925779357794577955779657797577985779957800578015780257803578045780557806578075780857809578105781157812578135781457815578165781757818578195782057821578225782357824578255782657827578285782957830578315783257833578345783557836578375783857839578405784157842578435784457845578465784757848578495785057851578525785357854578555785657857578585785957860578615786257863578645786557866578675786857869578705787157872578735787457875578765787757878578795788057881578825788357884578855788657887578885788957890578915789257893578945789557896578975789857899579005790157902579035790457905579065790757908579095791057911579125791357914579155791657917579185791957920579215792257923579245792557926579275792857929579305793157932579335793457935579365793757938579395794057941579425794357944579455794657947579485794957950579515795257953579545795557956579575795857959579605796157962579635796457965579665796757968579695797057971579725797357974579755797657977579785797957980579815798257983579845798557986579875798857989579905799157992579935799457995579965799757998579995800058001580025800358004580055800658007580085800958010580115801258013580145801558016580175801858019580205802158022580235802458025580265802758028580295803058031580325803358034580355803658037580385803958040580415804258043580445804558046580475804858049580505805158052580535805458055580565805758058580595806058061580625806358064580655806658067580685806958070580715807258073580745807558076580775807858079580805808158082580835808458085580865808758088580895809058091580925809358094580955809658097580985809958100581015810258103581045810558106581075810858109581105811158112581135811458115581165811758118581195812058121581225812358124581255812658127581285812958130581315813258133581345813558136581375813858139581405814158142581435814458145581465814758148581495815058151581525815358154581555815658157581585815958160581615816258163581645816558166581675816858169581705817158172581735817458175581765817758178581795818058181581825818358184581855818658187581885818958190581915819258193581945819558196581975819858199582005820158202582035820458205582065820758208582095821058211582125821358214582155821658217582185821958220582215822258223582245822558226582275822858229582305823158232582335823458235582365823758238582395824058241582425824358244582455824658247582485824958250582515825258253582545825558256582575825858259582605826158262582635826458265582665826758268582695827058271582725827358274582755827658277582785827958280582815828258283582845828558286582875828858289582905829158292582935829458295582965829758298582995830058301583025830358304583055830658307583085830958310583115831258313583145831558316583175831858319583205832158322583235832458325583265832758328583295833058331583325833358334583355833658337583385833958340583415834258343583445834558346583475834858349583505835158352583535835458355583565835758358583595836058361583625836358364583655836658367583685836958370583715837258373583745837558376583775837858379583805838158382583835838458385583865838758388583895839058391583925839358394583955839658397583985839958400584015840258403584045840558406584075840858409584105841158412584135841458415584165841758418584195842058421584225842358424584255842658427584285842958430584315843258433584345843558436584375843858439584405844158442584435844458445584465844758448584495845058451584525845358454584555845658457584585845958460584615846258463584645846558466584675846858469584705847158472584735847458475584765847758478584795848058481584825848358484584855848658487584885848958490584915849258493584945849558496584975849858499585005850158502585035850458505585065850758508585095851058511585125851358514585155851658517585185851958520585215852258523585245852558526585275852858529585305853158532585335853458535585365853758538585395854058541585425854358544585455854658547585485854958550585515855258553585545855558556585575855858559585605856158562585635856458565585665856758568585695857058571585725857358574585755857658577585785857958580585815858258583585845858558586585875858858589585905859158592585935859458595585965859758598585995860058601586025860358604586055860658607586085860958610586115861258613586145861558616586175861858619586205862158622586235862458625586265862758628586295863058631586325863358634586355863658637586385863958640586415864258643586445864558646586475864858649586505865158652586535865458655586565865758658586595866058661586625866358664586655866658667586685866958670586715867258673586745867558676586775867858679586805868158682586835868458685586865868758688586895869058691586925869358694586955869658697586985869958700587015870258703587045870558706587075870858709587105871158712587135871458715587165871758718587195872058721587225872358724587255872658727587285872958730587315873258733587345873558736587375873858739587405874158742587435874458745587465874758748587495875058751587525875358754587555875658757587585875958760587615876258763587645876558766587675876858769587705877158772587735877458775587765877758778587795878058781587825878358784587855878658787587885878958790587915879258793587945879558796587975879858799588005880158802588035880458805588065880758808588095881058811588125881358814588155881658817588185881958820588215882258823588245882558826588275882858829588305883158832588335883458835588365883758838588395884058841588425884358844588455884658847588485884958850588515885258853588545885558856588575885858859588605886158862588635886458865588665886758868588695887058871588725887358874588755887658877588785887958880588815888258883588845888558886588875888858889588905889158892588935889458895588965889758898588995890058901589025890358904589055890658907589085890958910589115891258913589145891558916589175891858919589205892158922589235892458925589265892758928589295893058931589325893358934589355893658937589385893958940589415894258943589445894558946589475894858949589505895158952589535895458955589565895758958589595896058961589625896358964589655896658967589685896958970589715897258973589745897558976589775897858979589805898158982589835898458985589865898758988589895899058991589925899358994589955899658997589985899959000590015900259003590045900559006590075900859009590105901159012590135901459015590165901759018590195902059021590225902359024590255902659027590285902959030590315903259033590345903559036590375903859039590405904159042590435904459045590465904759048590495905059051590525905359054590555905659057590585905959060590615906259063590645906559066590675906859069590705907159072590735907459075590765907759078590795908059081590825908359084590855908659087590885908959090590915909259093590945909559096590975909859099591005910159102591035910459105591065910759108591095911059111591125911359114591155911659117591185911959120591215912259123591245912559126591275912859129591305913159132591335913459135591365913759138591395914059141591425914359144591455914659147591485914959150591515915259153591545915559156591575915859159591605916159162591635916459165591665916759168591695917059171591725917359174591755917659177591785917959180591815918259183591845918559186591875918859189591905919159192591935919459195591965919759198591995920059201592025920359204592055920659207592085920959210592115921259213592145921559216592175921859219592205922159222592235922459225592265922759228592295923059231592325923359234592355923659237592385923959240592415924259243592445924559246592475924859249592505925159252592535925459255592565925759258592595926059261592625926359264592655926659267592685926959270592715927259273592745927559276592775927859279592805928159282592835928459285592865928759288592895929059291592925929359294592955929659297592985929959300593015930259303593045930559306593075930859309593105931159312593135931459315593165931759318593195932059321593225932359324593255932659327593285932959330593315933259333593345933559336593375933859339593405934159342593435934459345593465934759348593495935059351593525935359354593555935659357593585935959360593615936259363593645936559366593675936859369593705937159372593735937459375593765937759378593795938059381593825938359384593855938659387593885938959390593915939259393593945939559396593975939859399594005940159402594035940459405594065940759408594095941059411594125941359414594155941659417594185941959420594215942259423594245942559426594275942859429594305943159432594335943459435594365943759438594395944059441594425944359444594455944659447594485944959450594515945259453594545945559456594575945859459594605946159462594635946459465594665946759468594695947059471594725947359474594755947659477594785947959480594815948259483594845948559486594875948859489594905949159492594935949459495594965949759498594995950059501595025950359504595055950659507595085950959510595115951259513595145951559516595175951859519595205952159522595235952459525595265952759528595295953059531595325953359534595355953659537595385953959540595415954259543595445954559546595475954859549595505955159552595535955459555595565955759558595595956059561595625956359564595655956659567595685956959570595715957259573595745957559576
  1. (function webpackUniversalModuleDefinition(root, factory) {
  2. if(typeof exports === 'object' && typeof module === 'object')
  3. module.exports = factory();
  4. else if(typeof define === 'function' && define.amd)
  5. define([], factory);
  6. else if(typeof exports === 'object')
  7. exports["ivprogCore"] = factory();
  8. else
  9. root["ivprogCore"] = factory();
  10. })(window, function() {
  11. return /******/ (function(modules) { // webpackBootstrap
  12. /******/ // The module cache
  13. /******/ var installedModules = {};
  14. /******/
  15. /******/ // The require function
  16. /******/ function __webpack_require__(moduleId) {
  17. /******/
  18. /******/ // Check if module is in cache
  19. /******/ if(installedModules[moduleId]) {
  20. /******/ return installedModules[moduleId].exports;
  21. /******/ }
  22. /******/ // Create a new module (and put it into the cache)
  23. /******/ var module = installedModules[moduleId] = {
  24. /******/ i: moduleId,
  25. /******/ l: false,
  26. /******/ exports: {}
  27. /******/ };
  28. /******/
  29. /******/ // Execute the module function
  30. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  31. /******/
  32. /******/ // Flag the module as loaded
  33. /******/ module.l = true;
  34. /******/
  35. /******/ // Return the exports of the module
  36. /******/ return module.exports;
  37. /******/ }
  38. /******/
  39. /******/
  40. /******/ // expose the modules object (__webpack_modules__)
  41. /******/ __webpack_require__.m = modules;
  42. /******/
  43. /******/ // expose the module cache
  44. /******/ __webpack_require__.c = installedModules;
  45. /******/
  46. /******/ // define getter function for harmony exports
  47. /******/ __webpack_require__.d = function(exports, name, getter) {
  48. /******/ if(!__webpack_require__.o(exports, name)) {
  49. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  50. /******/ }
  51. /******/ };
  52. /******/
  53. /******/ // define __esModule on exports
  54. /******/ __webpack_require__.r = function(exports) {
  55. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  56. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  57. /******/ }
  58. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  59. /******/ };
  60. /******/
  61. /******/ // create a fake namespace object
  62. /******/ // mode & 1: value is a module id, require it
  63. /******/ // mode & 2: merge all properties of value into the ns
  64. /******/ // mode & 4: return value when already ns object
  65. /******/ // mode & 8|1: behave like require
  66. /******/ __webpack_require__.t = function(value, mode) {
  67. /******/ if(mode & 1) value = __webpack_require__(value);
  68. /******/ if(mode & 8) return value;
  69. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  70. /******/ var ns = Object.create(null);
  71. /******/ __webpack_require__.r(ns);
  72. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  73. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  74. /******/ return ns;
  75. /******/ };
  76. /******/
  77. /******/ // getDefaultExport function for compatibility with non-harmony modules
  78. /******/ __webpack_require__.n = function(module) {
  79. /******/ var getter = module && module.__esModule ?
  80. /******/ function getDefault() { return module['default']; } :
  81. /******/ function getModuleExports() { return module; };
  82. /******/ __webpack_require__.d(getter, 'a', getter);
  83. /******/ return getter;
  84. /******/ };
  85. /******/
  86. /******/ // Object.prototype.hasOwnProperty.call
  87. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  88. /******/
  89. /******/ // __webpack_public_path__
  90. /******/ __webpack_require__.p = "";
  91. /******/
  92. /******/
  93. /******/ // Load entry module and return exports
  94. /******/ return __webpack_require__(__webpack_require__.s = "./js/main.js");
  95. /******/ })
  96. /************************************************************************/
  97. /******/ ({
  98. /***/ "./.ima_version.json":
  99. /*!***************************!*\
  100. !*** ./.ima_version.json ***!
  101. \***************************/
  102. /*! exports provided: version, default */
  103. /***/ (function(module) {
  104. module.exports = {"version":"2019_03_04 11_00"};
  105. /***/ }),
  106. /***/ "./grammar/en/ivprog.g4":
  107. /*!******************************!*\
  108. !*** ./grammar/en/ivprog.g4 ***!
  109. \******************************/
  110. /*! no static exports found */
  111. /***/ (function(module, exports, __webpack_require__) {
  112. module.exports =
  113. /******/ (function(modules) { // webpackBootstrap
  114. /******/ // The module cache
  115. /******/ var installedModules = {};
  116. /******/
  117. /******/ // The require function
  118. /******/ function __webpack_require__(moduleId) {
  119. /******/
  120. /******/ // Check if module is in cache
  121. /******/ if(installedModules[moduleId]) {
  122. /******/ return installedModules[moduleId].exports;
  123. /******/ }
  124. /******/ // Create a new module (and put it into the cache)
  125. /******/ var module = installedModules[moduleId] = {
  126. /******/ i: moduleId,
  127. /******/ l: false,
  128. /******/ exports: {}
  129. /******/ };
  130. /******/
  131. /******/ // Execute the module function
  132. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  133. /******/
  134. /******/ // Flag the module as loaded
  135. /******/ module.l = true;
  136. /******/
  137. /******/ // Return the exports of the module
  138. /******/ return module.exports;
  139. /******/ }
  140. /******/
  141. /******/
  142. /******/ // expose the modules object (__webpack_modules__)
  143. /******/ __webpack_require__.m = modules;
  144. /******/
  145. /******/ // expose the module cache
  146. /******/ __webpack_require__.c = installedModules;
  147. /******/
  148. /******/ // identity function for calling harmony imports with the correct context
  149. /******/ __webpack_require__.i = function(value) { return value; };
  150. /******/
  151. /******/ // define getter function for harmony exports
  152. /******/ __webpack_require__.d = function(exports, name, getter) {
  153. /******/ if(!__webpack_require__.o(exports, name)) {
  154. /******/ Object.defineProperty(exports, name, {
  155. /******/ configurable: false,
  156. /******/ enumerable: true,
  157. /******/ get: getter
  158. /******/ });
  159. /******/ }
  160. /******/ };
  161. /******/
  162. /******/ // getDefaultExport function for compatibility with non-harmony modules
  163. /******/ __webpack_require__.n = function(module) {
  164. /******/ var getter = module && module.__esModule ?
  165. /******/ function getDefault() { return module['default']; } :
  166. /******/ function getModuleExports() { return module; };
  167. /******/ __webpack_require__.d(getter, 'a', getter);
  168. /******/ return getter;
  169. /******/ };
  170. /******/
  171. /******/ // Object.prototype.hasOwnProperty.call
  172. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  173. /******/
  174. /******/ // __webpack_public_path__
  175. /******/ __webpack_require__.p = "";
  176. /******/
  177. /******/ // Load entry module and return exports
  178. /******/ return __webpack_require__(__webpack_require__.s = 1);
  179. /******/ })
  180. /************************************************************************/
  181. /******/ ([
  182. /* 0 */
  183. /***/ (function(module, exports, __webpack_require__) {
  184. // Generated from /tmp/tmp-7216faoN8USqhOOg/ivprog.g4 by ANTLR 4.7
  185. // jshint ignore: start
  186. var antlr4 = __webpack_require__(2);
  187. var serializedATN = ["\u0003\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964",
  188. "\u0002/\u01d1\b\u0001\u0004\u0002\t\u0002\u0004\u0003\t\u0003\u0004",
  189. "\u0004\t\u0004\u0004\u0005\t\u0005\u0004\u0006\t\u0006\u0004\u0007\t",
  190. "\u0007\u0004\b\t\b\u0004\t\t\t\u0004\n\t\n\u0004\u000b\t\u000b\u0004",
  191. "\f\t\f\u0004\r\t\r\u0004\u000e\t\u000e\u0004\u000f\t\u000f\u0004\u0010",
  192. "\t\u0010\u0004\u0011\t\u0011\u0004\u0012\t\u0012\u0004\u0013\t\u0013",
  193. "\u0004\u0014\t\u0014\u0004\u0015\t\u0015\u0004\u0016\t\u0016\u0004\u0017",
  194. "\t\u0017\u0004\u0018\t\u0018\u0004\u0019\t\u0019\u0004\u001a\t\u001a",
  195. "\u0004\u001b\t\u001b\u0004\u001c\t\u001c\u0004\u001d\t\u001d\u0004\u001e",
  196. "\t\u001e\u0004\u001f\t\u001f\u0004 \t \u0004!\t!\u0004\"\t\"\u0004#",
  197. "\t#\u0004$\t$\u0004%\t%\u0004&\t&\u0004\'\t\'\u0004(\t(\u0004)\t)\u0004",
  198. "*\t*\u0004+\t+\u0004,\t,\u0004-\t-\u0004.\t.\u0004/\t/\u00040\t0\u0004",
  199. "1\t1\u00042\t2\u00043\t3\u00044\t4\u00045\t5\u00046\t6\u00047\t7\u0004",
  200. "8\t8\u00049\t9\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003",
  201. "\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0003\u0003\u0003\u0003",
  202. "\u0003\u0003\u0003\u0003\u0003\u0003\u0004\u0003\u0004\u0003\u0004\u0003",
  203. "\u0004\u0003\u0004\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003",
  204. "\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0006\u0003\u0006\u0003",
  205. "\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0007\u0003",
  206. "\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003",
  207. "\u0007\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003",
  208. "\b\u0003\b\u0003\b\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0003",
  209. "\t\u0003\n\u0003\n\u0003\n\u0003\n\u0003\n\u0003\u000b\u0003\u000b\u0003",
  210. "\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003",
  211. "\u000b\u0003\u000b\u0003\f\u0003\f\u0003\f\u0003\f\u0003\f\u0003\f\u0003",
  212. "\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003",
  213. "\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003",
  214. "\u000e\u0003\u000f\u0003\u000f\u0003\u000f\u0003\u000f\u0003\u0010\u0003",
  215. "\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0011\u0003",
  216. "\u0011\u0003\u0011\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003",
  217. "\u0012\u0003\u0012\u0003\u0013\u0003\u0013\u0003\u0013\u0003\u0014\u0003",
  218. "\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0015\u0003\u0015\u0003",
  219. "\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0016\u0003\u0016\u0003",
  220. "\u0016\u0003\u0016\u0003\u0016\u0003\u0017\u0003\u0017\u0003\u0017\u0003",
  221. "\u0017\u0003\u0018\u0003\u0018\u0003\u0018\u0003\u0018\u0003\u0019\u0003",
  222. "\u0019\u0003\u0019\u0003\u001a\u0003\u001a\u0003\u001b\u0003\u001b\u0003",
  223. "\u001c\u0003\u001c\u0003\u001d\u0003\u001d\u0003\u001e\u0003\u001e\u0003",
  224. "\u001f\u0003\u001f\u0003 \u0003 \u0003!\u0003!\u0003\"\u0003\"\u0003",
  225. "#\u0003#\u0003$\u0003$\u0003%\u0003%\u0003&\u0003&\u0003&\u0003&\u0003",
  226. "&\u0003&\u0003&\u0003&\u0003&\u0005&\u0125\n&\u0003\'\u0003\'\u0003",
  227. "(\u0003(\u0003)\u0003)\u0007)\u012d\n)\f)\u000e)\u0130\u000b)\u0003",
  228. "*\u0003*\u0003*\u0003*\u0003+\u0006+\u0137\n+\r+\u000e+\u0138\u0003",
  229. "+\u0003+\u0003+\u0003+\u0005+\u013f\n+\u0003+\u0006+\u0142\n+\r+\u000e",
  230. "+\u0143\u0003+\u0003+\u0003+\u0003+\u0005+\u014a\n+\u0003+\u0006+\u014d",
  231. "\n+\r+\u000e+\u014e\u0005+\u0151\n+\u0003,\u0006,\u0154\n,\r,\u000e",
  232. ",\u0155\u0003,\u0003,\u0006,\u015a\n,\r,\u000e,\u015b\u0003,\u0006,",
  233. "\u015f\n,\r,\u000e,\u0160\u0003,\u0003,\u0007,\u0165\n,\f,\u000e,\u0168",
  234. "\u000b,\u0003,\u0005,\u016b\n,\u0003-\u0003-\u0005-\u016f\n-\u0003-",
  235. "\u0006-\u0172\n-\r-\u000e-\u0173\u0003.\u0003.\u0007.\u0178\n.\f.\u000e",
  236. ".\u017b\u000b.\u0003.\u0003.\u0003/\u0003/\u0005/\u0181\n/\u00030\u0003",
  237. "0\u00030\u00050\u0186\n0\u00030\u00030\u00031\u00031\u00031\u00031\u0003",
  238. "2\u00032\u00033\u00063\u0191\n3\r3\u000e3\u0192\u00033\u00053\u0196",
  239. "\n3\u00034\u00034\u00035\u00035\u00036\u00036\u00036\u00036\u00056\u01a0",
  240. "\n6\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u0003",
  241. "7\u00037\u00057\u01ad\n7\u00038\u00038\u00038\u00038\u00038\u00038\u0003",
  242. "8\u00039\u00039\u00039\u00039\u00079\u01ba\n9\f9\u000e9\u01bd\u000b",
  243. "9\u00039\u00059\u01c0\n9\u00039\u00039\u00039\u00039\u00039\u00079\u01c7",
  244. "\n9\f9\u000e9\u01ca\u000b9\u00039\u00039\u00059\u01ce\n9\u00039\u0003",
  245. "9\u0003\u01c8\u0002:\u0003\u0003\u0005\u0004\u0007\u0005\t\u0006\u000b",
  246. "\u0007\r\b\u000f\t\u0011\n\u0013\u000b\u0015\f\u0017\r\u0019\u000e\u001b",
  247. "\u000f\u001d\u0010\u001f\u0011!\u0012#\u0013%\u0014\'\u0015)\u0016+",
  248. "\u0017-\u0002/\u00021\u00023\u00185\u00197\u001a9\u001b;\u001c=\u001d",
  249. "?\u001eA\u001fC E!G\"I#K$M%O&Q\'S(U)W*Y\u0002[+]\u0002_,a-c\u0002e.",
  250. "g\u0002i\u0002k\u0002m\u0002o\u0002q/\u0003\u0002\u0012\u0004\u0002",
  251. "--//\u0005\u0002\'\',,11\u0004\u0002>>@@\u0005\u0002C\\aac|\u0006\u0002",
  252. "2;C\\aac|\u0003\u00022;\u0003\u000223\u0004\u0002GGgg\u0006\u0002\f",
  253. "\f\u000f\u000f$$^^\u0006\u0002\f\f\u000f\u000f))^^\u0004\u0002\u000b",
  254. "\u000b\"\"\u0004\u0002\f\f\u000f\u000f\u0005\u00022;CHch\u0003\u0002",
  255. "29\n\u0002$$))^^ddhhppttvv\u0003\u000225\u0002\u01e5\u0002\u0003\u0003",
  256. "\u0002\u0002\u0002\u0002\u0005\u0003\u0002\u0002\u0002\u0002\u0007\u0003",
  257. "\u0002\u0002\u0002\u0002\t\u0003\u0002\u0002\u0002\u0002\u000b\u0003",
  258. "\u0002\u0002\u0002\u0002\r\u0003\u0002\u0002\u0002\u0002\u000f\u0003",
  259. "\u0002\u0002\u0002\u0002\u0011\u0003\u0002\u0002\u0002\u0002\u0013\u0003",
  260. "\u0002\u0002\u0002\u0002\u0015\u0003\u0002\u0002\u0002\u0002\u0017\u0003",
  261. "\u0002\u0002\u0002\u0002\u0019\u0003\u0002\u0002\u0002\u0002\u001b\u0003",
  262. "\u0002\u0002\u0002\u0002\u001d\u0003\u0002\u0002\u0002\u0002\u001f\u0003",
  263. "\u0002\u0002\u0002\u0002!\u0003\u0002\u0002\u0002\u0002#\u0003\u0002",
  264. "\u0002\u0002\u0002%\u0003\u0002\u0002\u0002\u0002\'\u0003\u0002\u0002",
  265. "\u0002\u0002)\u0003\u0002\u0002\u0002\u0002+\u0003\u0002\u0002\u0002",
  266. "\u00023\u0003\u0002\u0002\u0002\u00025\u0003\u0002\u0002\u0002\u0002",
  267. "7\u0003\u0002\u0002\u0002\u00029\u0003\u0002\u0002\u0002\u0002;\u0003",
  268. "\u0002\u0002\u0002\u0002=\u0003\u0002\u0002\u0002\u0002?\u0003\u0002",
  269. "\u0002\u0002\u0002A\u0003\u0002\u0002\u0002\u0002C\u0003\u0002\u0002",
  270. "\u0002\u0002E\u0003\u0002\u0002\u0002\u0002G\u0003\u0002\u0002\u0002",
  271. "\u0002I\u0003\u0002\u0002\u0002\u0002K\u0003\u0002\u0002\u0002\u0002",
  272. "M\u0003\u0002\u0002\u0002\u0002O\u0003\u0002\u0002\u0002\u0002Q\u0003",
  273. "\u0002\u0002\u0002\u0002S\u0003\u0002\u0002\u0002\u0002U\u0003\u0002",
  274. "\u0002\u0002\u0002W\u0003\u0002\u0002\u0002\u0002[\u0003\u0002\u0002",
  275. "\u0002\u0002_\u0003\u0002\u0002\u0002\u0002a\u0003\u0002\u0002\u0002",
  276. "\u0002e\u0003\u0002\u0002\u0002\u0002q\u0003\u0002\u0002\u0002\u0003",
  277. "s\u0003\u0002\u0002\u0002\u0005{\u0003\u0002\u0002\u0002\u0007\u0080",
  278. "\u0003\u0002\u0002\u0002\t\u0085\u0003\u0002\u0002\u0002\u000b\u008d",
  279. "\u0003\u0002\u0002\u0002\r\u0094\u0003\u0002\u0002\u0002\u000f\u009c",
  280. "\u0003\u0002\u0002\u0002\u0011\u00a6\u0003\u0002\u0002\u0002\u0013\u00ad",
  281. "\u0003\u0002\u0002\u0002\u0015\u00b2\u0003\u0002\u0002\u0002\u0017\u00bc",
  282. "\u0003\u0002\u0002\u0002\u0019\u00c2\u0003\u0002\u0002\u0002\u001b\u00cb",
  283. "\u0003\u0002\u0002\u0002\u001d\u00d2\u0003\u0002\u0002\u0002\u001f\u00d6",
  284. "\u0003\u0002\u0002\u0002!\u00dc\u0003\u0002\u0002\u0002#\u00df\u0003",
  285. "\u0002\u0002\u0002%\u00e5\u0003\u0002\u0002\u0002\'\u00e8\u0003\u0002",
  286. "\u0002\u0002)\u00ed\u0003\u0002\u0002\u0002+\u00f3\u0003\u0002\u0002",
  287. "\u0002-\u00f8\u0003\u0002\u0002\u0002/\u00fc\u0003\u0002\u0002\u0002",
  288. "1\u0100\u0003\u0002\u0002\u00023\u0103\u0003\u0002\u0002\u00025\u0105",
  289. "\u0003\u0002\u0002\u00027\u0107\u0003\u0002\u0002\u00029\u0109\u0003",
  290. "\u0002\u0002\u0002;\u010b\u0003\u0002\u0002\u0002=\u010d\u0003\u0002",
  291. "\u0002\u0002?\u010f\u0003\u0002\u0002\u0002A\u0111\u0003\u0002\u0002",
  292. "\u0002C\u0113\u0003\u0002\u0002\u0002E\u0115\u0003\u0002\u0002\u0002",
  293. "G\u0117\u0003\u0002\u0002\u0002I\u0119\u0003\u0002\u0002\u0002K\u0124",
  294. "\u0003\u0002\u0002\u0002M\u0126\u0003\u0002\u0002\u0002O\u0128\u0003",
  295. "\u0002\u0002\u0002Q\u012a\u0003\u0002\u0002\u0002S\u0131\u0003\u0002",
  296. "\u0002\u0002U\u0150\u0003\u0002\u0002\u0002W\u016a\u0003\u0002\u0002",
  297. "\u0002Y\u016c\u0003\u0002\u0002\u0002[\u0175\u0003\u0002\u0002\u0002",
  298. "]\u0180\u0003\u0002\u0002\u0002_\u0182\u0003\u0002\u0002\u0002a\u0189",
  299. "\u0003\u0002\u0002\u0002c\u018d\u0003\u0002\u0002\u0002e\u0195\u0003",
  300. "\u0002\u0002\u0002g\u0197\u0003\u0002\u0002\u0002i\u0199\u0003\u0002",
  301. "\u0002\u0002k\u019f\u0003\u0002\u0002\u0002m\u01ac\u0003\u0002\u0002",
  302. "\u0002o\u01ae\u0003\u0002\u0002\u0002q\u01cd\u0003\u0002\u0002\u0002",
  303. "st\u0007r\u0002\u0002tu\u0007t\u0002\u0002uv\u0007q\u0002\u0002vw\u0007",
  304. "i\u0002\u0002wx\u0007t\u0002\u0002xy\u0007c\u0002\u0002yz\u0007o\u0002",
  305. "\u0002z\u0004\u0003\u0002\u0002\u0002{|\u0007t\u0002\u0002|}\u0007g",
  306. "\u0002\u0002}~\u0007c\u0002\u0002~\u007f\u0007n\u0002\u0002\u007f\u0006",
  307. "\u0003\u0002\u0002\u0002\u0080\u0081\u0007x\u0002\u0002\u0081\u0082",
  308. "\u0007q\u0002\u0002\u0082\u0083\u0007k\u0002\u0002\u0083\u0084\u0007",
  309. "f\u0002\u0002\u0084\b\u0003\u0002\u0002\u0002\u0085\u0086\u0007d\u0002",
  310. "\u0002\u0086\u0087\u0007q\u0002\u0002\u0087\u0088\u0007q\u0002\u0002",
  311. "\u0088\u0089\u0007n\u0002\u0002\u0089\u008a\u0007g\u0002\u0002\u008a",
  312. "\u008b\u0007c\u0002\u0002\u008b\u008c\u0007p\u0002\u0002\u008c\n\u0003",
  313. "\u0002\u0002\u0002\u008d\u008e\u0007u\u0002\u0002\u008e\u008f\u0007",
  314. "v\u0002\u0002\u008f\u0090\u0007t\u0002\u0002\u0090\u0091\u0007k\u0002",
  315. "\u0002\u0091\u0092\u0007p\u0002\u0002\u0092\u0093\u0007i\u0002\u0002",
  316. "\u0093\f\u0003\u0002\u0002\u0002\u0094\u0095\u0007k\u0002\u0002\u0095",
  317. "\u0096\u0007p\u0002\u0002\u0096\u0097\u0007v\u0002\u0002\u0097\u0098",
  318. "\u0007g\u0002\u0002\u0098\u0099\u0007i\u0002\u0002\u0099\u009a\u0007",
  319. "g\u0002\u0002\u009a\u009b\u0007t\u0002\u0002\u009b\u000e\u0003\u0002",
  320. "\u0002\u0002\u009c\u009d\u0007e\u0002\u0002\u009d\u009e\u0007j\u0002",
  321. "\u0002\u009e\u009f\u0007c\u0002\u0002\u009f\u00a0\u0007t\u0002\u0002",
  322. "\u00a0\u00a1\u0007c\u0002\u0002\u00a1\u00a2\u0007e\u0002\u0002\u00a2",
  323. "\u00a3\u0007v\u0002\u0002\u00a3\u00a4\u0007g\u0002\u0002\u00a4\u00a5",
  324. "\u0007t\u0002\u0002\u00a5\u0010\u0003\u0002\u0002\u0002\u00a6\u00a7",
  325. "\u0007u\u0002\u0002\u00a7\u00a8\u0007y\u0002\u0002\u00a8\u00a9\u0007",
  326. "k\u0002\u0002\u00a9\u00aa\u0007v\u0002\u0002\u00aa\u00ab\u0007e\u0002",
  327. "\u0002\u00ab\u00ac\u0007j\u0002\u0002\u00ac\u0012\u0003\u0002\u0002",
  328. "\u0002\u00ad\u00ae\u0007e\u0002\u0002\u00ae\u00af\u0007c\u0002\u0002",
  329. "\u00af\u00b0\u0007u\u0002\u0002\u00b0\u00b1\u0007g\u0002\u0002\u00b1",
  330. "\u0014\u0003\u0002\u0002\u0002\u00b2\u00b3\u0007q\u0002\u0002\u00b3",
  331. "\u00b4\u0007v\u0002\u0002\u00b4\u00b5\u0007j\u0002\u0002\u00b5\u00b6",
  332. "\u0007g\u0002\u0002\u00b6\u00b7\u0007t\u0002\u0002\u00b7\u00b8\u0007",
  333. "y\u0002\u0002\u00b8\u00b9\u0007k\u0002\u0002\u00b9\u00ba\u0007u\u0002",
  334. "\u0002\u00ba\u00bb\u0007g\u0002\u0002\u00bb\u0016\u0003\u0002\u0002",
  335. "\u0002\u00bc\u00bd\u0007e\u0002\u0002\u00bd\u00be\u0007q\u0002\u0002",
  336. "\u00be\u00bf\u0007p\u0002\u0002\u00bf\u00c0\u0007u\u0002\u0002\u00c0",
  337. "\u00c1\u0007v\u0002\u0002\u00c1\u0018\u0003\u0002\u0002\u0002\u00c2",
  338. "\u00c3\u0007h\u0002\u0002\u00c3\u00c4\u0007w\u0002\u0002\u00c4\u00c5",
  339. "\u0007p\u0002\u0002\u00c5\u00c6\u0007e\u0002\u0002\u00c6\u00c7\u0007",
  340. "v\u0002\u0002\u00c7\u00c8\u0007k\u0002\u0002\u00c8\u00c9\u0007q\u0002",
  341. "\u0002\u00c9\u00ca\u0007p\u0002\u0002\u00ca\u001a\u0003\u0002\u0002",
  342. "\u0002\u00cb\u00cc\u0007t\u0002\u0002\u00cc\u00cd\u0007g\u0002\u0002",
  343. "\u00cd\u00ce\u0007v\u0002\u0002\u00ce\u00cf\u0007w\u0002\u0002\u00cf",
  344. "\u00d0\u0007t\u0002\u0002\u00d0\u00d1\u0007p\u0002\u0002\u00d1\u001c",
  345. "\u0003\u0002\u0002\u0002\u00d2\u00d3\u0007h\u0002\u0002\u00d3\u00d4",
  346. "\u0007q\u0002\u0002\u00d4\u00d5\u0007t\u0002\u0002\u00d5\u001e\u0003",
  347. "\u0002\u0002\u0002\u00d6\u00d7\u0007d\u0002\u0002\u00d7\u00d8\u0007",
  348. "t\u0002\u0002\u00d8\u00d9\u0007g\u0002\u0002\u00d9\u00da\u0007c\u0002",
  349. "\u0002\u00da\u00db\u0007m\u0002\u0002\u00db \u0003\u0002\u0002\u0002",
  350. "\u00dc\u00dd\u0007f\u0002\u0002\u00dd\u00de\u0007q\u0002\u0002\u00de",
  351. "\"\u0003\u0002\u0002\u0002\u00df\u00e0\u0007y\u0002\u0002\u00e0\u00e1",
  352. "\u0007j\u0002\u0002\u00e1\u00e2\u0007k\u0002\u0002\u00e2\u00e3\u0007",
  353. "n\u0002\u0002\u00e3\u00e4\u0007g\u0002\u0002\u00e4$\u0003\u0002\u0002",
  354. "\u0002\u00e5\u00e6\u0007k\u0002\u0002\u00e6\u00e7\u0007h\u0002\u0002",
  355. "\u00e7&\u0003\u0002\u0002\u0002\u00e8\u00e9\u0007g\u0002\u0002\u00e9",
  356. "\u00ea\u0007n\u0002\u0002\u00ea\u00eb\u0007u\u0002\u0002\u00eb\u00ec",
  357. "\u0007g\u0002\u0002\u00ec(\u0003\u0002\u0002\u0002\u00ed\u00ee\u0007",
  358. "h\u0002\u0002\u00ee\u00ef\u0007c\u0002\u0002\u00ef\u00f0\u0007n\u0002",
  359. "\u0002\u00f0\u00f1\u0007u\u0002\u0002\u00f1\u00f2\u0007g\u0002\u0002",
  360. "\u00f2*\u0003\u0002\u0002\u0002\u00f3\u00f4\u0007v\u0002\u0002\u00f4",
  361. "\u00f5\u0007t\u0002\u0002\u00f5\u00f6\u0007w\u0002\u0002\u00f6\u00f7",
  362. "\u0007g\u0002\u0002\u00f7,\u0003\u0002\u0002\u0002\u00f8\u00f9\u0007",
  363. "p\u0002\u0002\u00f9\u00fa\u0007q\u0002\u0002\u00fa\u00fb\u0007v\u0002",
  364. "\u0002\u00fb.\u0003\u0002\u0002\u0002\u00fc\u00fd\u0007C\u0002\u0002",
  365. "\u00fd\u00fe\u0007P\u0002\u0002\u00fe\u00ff\u0007F\u0002\u0002\u00ff",
  366. "0\u0003\u0002\u0002\u0002\u0100\u0101\u0007Q\u0002\u0002\u0101\u0102",
  367. "\u0007T\u0002\u0002\u01022\u0003\u0002\u0002\u0002\u0103\u0104\u0007",
  368. "*\u0002\u0002\u01044\u0003\u0002\u0002\u0002\u0105\u0106\u0007+\u0002",
  369. "\u0002\u01066\u0003\u0002\u0002\u0002\u0107\u0108\u0007]\u0002\u0002",
  370. "\u01088\u0003\u0002\u0002\u0002\u0109\u010a\u0007_\u0002\u0002\u010a",
  371. ":\u0003\u0002\u0002\u0002\u010b\u010c\u0007}\u0002\u0002\u010c<\u0003",
  372. "\u0002\u0002\u0002\u010d\u010e\u0007\u007f\u0002\u0002\u010e>\u0003",
  373. "\u0002\u0002\u0002\u010f\u0110\u0007.\u0002\u0002\u0110@\u0003\u0002",
  374. "\u0002\u0002\u0111\u0112\u0007?\u0002\u0002\u0112B\u0003\u0002\u0002",
  375. "\u0002\u0113\u0114\t\u0002\u0002\u0002\u0114D\u0003\u0002\u0002\u0002",
  376. "\u0115\u0116\t\u0003\u0002\u0002\u0116F\u0003\u0002\u0002\u0002\u0117",
  377. "\u0118\u0005/\u0018\u0002\u0118H\u0003\u0002\u0002\u0002\u0119\u011a",
  378. "\u00051\u0019\u0002\u011aJ\u0003\u0002\u0002\u0002\u011b\u011c\u0007",
  379. "@\u0002\u0002\u011c\u0125\u0007?\u0002\u0002\u011d\u011e\u0007?\u0002",
  380. "\u0002\u011e\u0125\u0007?\u0002\u0002\u011f\u0120\u0007>\u0002\u0002",
  381. "\u0120\u0125\u0007?\u0002\u0002\u0121\u0125\t\u0004\u0002\u0002\u0122",
  382. "\u0123\u0007#\u0002\u0002\u0123\u0125\u0007?\u0002\u0002\u0124\u011b",
  383. "\u0003\u0002\u0002\u0002\u0124\u011d\u0003\u0002\u0002\u0002\u0124\u011f",
  384. "\u0003\u0002\u0002\u0002\u0124\u0121\u0003\u0002\u0002\u0002\u0124\u0122",
  385. "\u0003\u0002\u0002\u0002\u0125L\u0003\u0002\u0002\u0002\u0126\u0127",
  386. "\u0007<\u0002\u0002\u0127N\u0003\u0002\u0002\u0002\u0128\u0129\u0005",
  387. "-\u0017\u0002\u0129P\u0003\u0002\u0002\u0002\u012a\u012e\t\u0005\u0002",
  388. "\u0002\u012b\u012d\t\u0006\u0002\u0002\u012c\u012b\u0003\u0002\u0002",
  389. "\u0002\u012d\u0130\u0003\u0002\u0002\u0002\u012e\u012c\u0003\u0002\u0002",
  390. "\u0002\u012e\u012f\u0003\u0002\u0002\u0002\u012fR\u0003\u0002\u0002",
  391. "\u0002\u0130\u012e\u0003\u0002\u0002\u0002\u0131\u0132\u0005Q)\u0002",
  392. "\u0132\u0133\u00070\u0002\u0002\u0133\u0134\u0005Q)\u0002\u0134T\u0003",
  393. "\u0002\u0002\u0002\u0135\u0137\t\u0007\u0002\u0002\u0136\u0135\u0003",
  394. "\u0002\u0002\u0002\u0137\u0138\u0003\u0002\u0002\u0002\u0138\u0136\u0003",
  395. "\u0002\u0002\u0002\u0138\u0139\u0003\u0002\u0002\u0002\u0139\u0151\u0003",
  396. "\u0002\u0002\u0002\u013a\u013b\u00072\u0002\u0002\u013b\u013f\u0007",
  397. "z\u0002\u0002\u013c\u013d\u00072\u0002\u0002\u013d\u013f\u0007Z\u0002",
  398. "\u0002\u013e\u013a\u0003\u0002\u0002\u0002\u013e\u013c\u0003\u0002\u0002",
  399. "\u0002\u013f\u0141\u0003\u0002\u0002\u0002\u0140\u0142\u0005g4\u0002",
  400. "\u0141\u0140\u0003\u0002\u0002\u0002\u0142\u0143\u0003\u0002\u0002\u0002",
  401. "\u0143\u0141\u0003\u0002\u0002\u0002\u0143\u0144\u0003\u0002\u0002\u0002",
  402. "\u0144\u0151\u0003\u0002\u0002\u0002\u0145\u0146\u00072\u0002\u0002",
  403. "\u0146\u014a\u0007d\u0002\u0002\u0147\u0148\u00072\u0002\u0002\u0148",
  404. "\u014a\u0007D\u0002\u0002\u0149\u0145\u0003\u0002\u0002\u0002\u0149",
  405. "\u0147\u0003\u0002\u0002\u0002\u014a\u014c\u0003\u0002\u0002\u0002\u014b",
  406. "\u014d\t\b\u0002\u0002\u014c\u014b\u0003\u0002\u0002\u0002\u014d\u014e",
  407. "\u0003\u0002\u0002\u0002\u014e\u014c\u0003\u0002\u0002\u0002\u014e\u014f",
  408. "\u0003\u0002\u0002\u0002\u014f\u0151\u0003\u0002\u0002\u0002\u0150\u0136",
  409. "\u0003\u0002\u0002\u0002\u0150\u013e\u0003\u0002\u0002\u0002\u0150\u0149",
  410. "\u0003\u0002\u0002\u0002\u0151V\u0003\u0002\u0002\u0002\u0152\u0154",
  411. "\t\u0007\u0002\u0002\u0153\u0152\u0003\u0002\u0002\u0002\u0154\u0155",
  412. "\u0003\u0002\u0002\u0002\u0155\u0153\u0003\u0002\u0002\u0002\u0155\u0156",
  413. "\u0003\u0002\u0002\u0002\u0156\u0157\u0003\u0002\u0002\u0002\u0157\u0159",
  414. "\u00070\u0002\u0002\u0158\u015a\t\u0007\u0002\u0002\u0159\u0158\u0003",
  415. "\u0002\u0002\u0002\u015a\u015b\u0003\u0002\u0002\u0002\u015b\u0159\u0003",
  416. "\u0002\u0002\u0002\u015b\u015c\u0003\u0002\u0002\u0002\u015c\u016b\u0003",
  417. "\u0002\u0002\u0002\u015d\u015f\t\u0007\u0002\u0002\u015e\u015d\u0003",
  418. "\u0002\u0002\u0002\u015f\u0160\u0003\u0002\u0002\u0002\u0160\u015e\u0003",
  419. "\u0002\u0002\u0002\u0160\u0161\u0003\u0002\u0002\u0002\u0161\u0162\u0003",
  420. "\u0002\u0002\u0002\u0162\u0166\u00070\u0002\u0002\u0163\u0165\t\u0007",
  421. "\u0002\u0002\u0164\u0163\u0003\u0002\u0002\u0002\u0165\u0168\u0003\u0002",
  422. "\u0002\u0002\u0166\u0164\u0003\u0002\u0002\u0002\u0166\u0167\u0003\u0002",
  423. "\u0002\u0002\u0167\u0169\u0003\u0002\u0002\u0002\u0168\u0166\u0003\u0002",
  424. "\u0002\u0002\u0169\u016b\u0005Y-\u0002\u016a\u0153\u0003\u0002\u0002",
  425. "\u0002\u016a\u015e\u0003\u0002\u0002\u0002\u016bX\u0003\u0002\u0002",
  426. "\u0002\u016c\u016e\t\t\u0002\u0002\u016d\u016f\t\u0002\u0002\u0002\u016e",
  427. "\u016d\u0003\u0002\u0002\u0002\u016e\u016f\u0003\u0002\u0002\u0002\u016f",
  428. "\u0171\u0003\u0002\u0002\u0002\u0170\u0172\t\u0007\u0002\u0002\u0171",
  429. "\u0170\u0003\u0002\u0002\u0002\u0172\u0173\u0003\u0002\u0002\u0002\u0173",
  430. "\u0171\u0003\u0002\u0002\u0002\u0173\u0174\u0003\u0002\u0002\u0002\u0174",
  431. "Z\u0003\u0002\u0002\u0002\u0175\u0179\u0007$\u0002\u0002\u0176\u0178",
  432. "\u0005]/\u0002\u0177\u0176\u0003\u0002\u0002\u0002\u0178\u017b\u0003",
  433. "\u0002\u0002\u0002\u0179\u0177\u0003\u0002\u0002\u0002\u0179\u017a\u0003",
  434. "\u0002\u0002\u0002\u017a\u017c\u0003\u0002\u0002\u0002\u017b\u0179\u0003",
  435. "\u0002\u0002\u0002\u017c\u017d\u0007$\u0002\u0002\u017d\\\u0003\u0002",
  436. "\u0002\u0002\u017e\u0181\n\n\u0002\u0002\u017f\u0181\u0005k6\u0002\u0180",
  437. "\u017e\u0003\u0002\u0002\u0002\u0180\u017f\u0003\u0002\u0002\u0002\u0181",
  438. "^\u0003\u0002\u0002\u0002\u0182\u0185\u0007)\u0002\u0002\u0183\u0186",
  439. "\u0005k6\u0002\u0184\u0186\n\u000b\u0002\u0002\u0185\u0183\u0003\u0002",
  440. "\u0002\u0002\u0185\u0184\u0003\u0002\u0002\u0002\u0186\u0187\u0003\u0002",
  441. "\u0002\u0002\u0187\u0188\u0007)\u0002\u0002\u0188`\u0003\u0002\u0002",
  442. "\u0002\u0189\u018a\t\f\u0002\u0002\u018a\u018b\u0003\u0002\u0002\u0002",
  443. "\u018b\u018c\b1\u0002\u0002\u018cb\u0003\u0002\u0002\u0002\u018d\u018e",
  444. "\u0007=\u0002\u0002\u018ed\u0003\u0002\u0002\u0002\u018f\u0191\t\r\u0002",
  445. "\u0002\u0190\u018f\u0003\u0002\u0002\u0002\u0191\u0192\u0003\u0002\u0002",
  446. "\u0002\u0192\u0190\u0003\u0002\u0002\u0002\u0192\u0193\u0003\u0002\u0002",
  447. "\u0002\u0193\u0196\u0003\u0002\u0002\u0002\u0194\u0196\u0005c2\u0002",
  448. "\u0195\u0190\u0003\u0002\u0002\u0002\u0195\u0194\u0003\u0002\u0002\u0002",
  449. "\u0196f\u0003\u0002\u0002\u0002\u0197\u0198\t\u000e\u0002\u0002\u0198",
  450. "h\u0003\u0002\u0002\u0002\u0199\u019a\t\u000f\u0002\u0002\u019aj\u0003",
  451. "\u0002\u0002\u0002\u019b\u019c\u0007^\u0002\u0002\u019c\u01a0\t\u0010",
  452. "\u0002\u0002\u019d\u01a0\u0005o8\u0002\u019e\u01a0\u0005m7\u0002\u019f",
  453. "\u019b\u0003\u0002\u0002\u0002\u019f\u019d\u0003\u0002\u0002\u0002\u019f",
  454. "\u019e\u0003\u0002\u0002\u0002\u01a0l\u0003\u0002\u0002\u0002\u01a1",
  455. "\u01a2\u0007^\u0002\u0002\u01a2\u01a3\t\u0011\u0002\u0002\u01a3\u01a4",
  456. "\u0005i5\u0002\u01a4\u01a5\u0005i5\u0002\u01a5\u01ad\u0003\u0002\u0002",
  457. "\u0002\u01a6\u01a7\u0007^\u0002\u0002\u01a7\u01a8\u0005i5\u0002\u01a8",
  458. "\u01a9\u0005i5\u0002\u01a9\u01ad\u0003\u0002\u0002\u0002\u01aa\u01ab",
  459. "\u0007^\u0002\u0002\u01ab\u01ad\u0005i5\u0002\u01ac\u01a1\u0003\u0002",
  460. "\u0002\u0002\u01ac\u01a6\u0003\u0002\u0002\u0002\u01ac\u01aa\u0003\u0002",
  461. "\u0002\u0002\u01adn\u0003\u0002\u0002\u0002\u01ae\u01af\u0007^\u0002",
  462. "\u0002\u01af\u01b0\u0007w\u0002\u0002\u01b0\u01b1\u0005g4\u0002\u01b1",
  463. "\u01b2\u0005g4\u0002\u01b2\u01b3\u0005g4\u0002\u01b3\u01b4\u0005g4\u0002",
  464. "\u01b4p\u0003\u0002\u0002\u0002\u01b5\u01b6\u00071\u0002\u0002\u01b6",
  465. "\u01b7\u00071\u0002\u0002\u01b7\u01bb\u0003\u0002\u0002\u0002\u01b8",
  466. "\u01ba\n\r\u0002\u0002\u01b9\u01b8\u0003\u0002\u0002\u0002\u01ba\u01bd",
  467. "\u0003\u0002\u0002\u0002\u01bb\u01b9\u0003\u0002\u0002\u0002\u01bb\u01bc",
  468. "\u0003\u0002\u0002\u0002\u01bc\u01bf\u0003\u0002\u0002\u0002\u01bd\u01bb",
  469. "\u0003\u0002\u0002\u0002\u01be\u01c0\u0007\u000f\u0002\u0002\u01bf\u01be",
  470. "\u0003\u0002\u0002\u0002\u01bf\u01c0\u0003\u0002\u0002\u0002\u01c0\u01c1",
  471. "\u0003\u0002\u0002\u0002\u01c1\u01ce\u0007\f\u0002\u0002\u01c2\u01c3",
  472. "\u00071\u0002\u0002\u01c3\u01c4\u0007,\u0002\u0002\u01c4\u01c8\u0003",
  473. "\u0002\u0002\u0002\u01c5\u01c7\u000b\u0002\u0002\u0002\u01c6\u01c5\u0003",
  474. "\u0002\u0002\u0002\u01c7\u01ca\u0003\u0002\u0002\u0002\u01c8\u01c9\u0003",
  475. "\u0002\u0002\u0002\u01c8\u01c6\u0003\u0002\u0002\u0002\u01c9\u01cb\u0003",
  476. "\u0002\u0002\u0002\u01ca\u01c8\u0003\u0002\u0002\u0002\u01cb\u01cc\u0007",
  477. ",\u0002\u0002\u01cc\u01ce\u00071\u0002\u0002\u01cd\u01b5\u0003\u0002",
  478. "\u0002\u0002\u01cd\u01c2\u0003\u0002\u0002\u0002\u01ce\u01cf\u0003\u0002",
  479. "\u0002\u0002\u01cf\u01d0\b9\u0003\u0002\u01d0r\u0003\u0002\u0002\u0002",
  480. "\u001d\u0002\u0124\u012e\u0138\u013e\u0143\u0149\u014e\u0150\u0155\u015b",
  481. "\u0160\u0166\u016a\u016e\u0173\u0179\u0180\u0185\u0192\u0195\u019f\u01ac",
  482. "\u01bb\u01bf\u01c8\u01cd\u0004\b\u0002\u0002\u0002\u0003\u0002"].join("");
  483. var atn = new antlr4.atn.ATNDeserializer().deserialize(serializedATN);
  484. var decisionsToDFA = atn.decisionToState.map( function(ds, index) { return new antlr4.dfa.DFA(ds, index); });
  485. function ivprog(input) {
  486. antlr4.Lexer.call(this, input);
  487. this._interp = new antlr4.atn.LexerATNSimulator(this, atn, decisionsToDFA, new antlr4.PredictionContextCache());
  488. return this;
  489. }
  490. ivprog.prototype = Object.create(antlr4.Lexer.prototype);
  491. ivprog.prototype.constructor = ivprog;
  492. ivprog.EOF = antlr4.Token.EOF;
  493. ivprog.RK_PROGRAM = 1;
  494. ivprog.RK_REAL = 2;
  495. ivprog.RK_VOID = 3;
  496. ivprog.RK_BOOLEAN = 4;
  497. ivprog.RK_STRING = 5;
  498. ivprog.RK_INTEGER = 6;
  499. ivprog.RK_CHARACTER = 7;
  500. ivprog.RK_SWITCH = 8;
  501. ivprog.RK_CASE = 9;
  502. ivprog.RK_DEFAULT = 10;
  503. ivprog.RK_CONST = 11;
  504. ivprog.RK_FUNCTION = 12;
  505. ivprog.RK_RETURN = 13;
  506. ivprog.RK_FOR = 14;
  507. ivprog.RK_BREAK = 15;
  508. ivprog.RK_DO = 16;
  509. ivprog.RK_WHILE = 17;
  510. ivprog.RK_IF = 18;
  511. ivprog.RK_ELSE = 19;
  512. ivprog.RK_FALSE = 20;
  513. ivprog.RK_TRUE = 21;
  514. ivprog.OPEN_PARENTHESIS = 22;
  515. ivprog.CLOSE_PARENTHESIS = 23;
  516. ivprog.OPEN_BRACE = 24;
  517. ivprog.CLOSE_BRACE = 25;
  518. ivprog.OPEN_CURLY = 26;
  519. ivprog.CLOSE_CURLY = 27;
  520. ivprog.COMMA = 28;
  521. ivprog.EQUAL = 29;
  522. ivprog.SUM_OP = 30;
  523. ivprog.MULTI_OP = 31;
  524. ivprog.AND_OPERATOR = 32;
  525. ivprog.OR_OPERATOR = 33;
  526. ivprog.RELATIONAL_OPERATOR = 34;
  527. ivprog.COLON = 35;
  528. ivprog.NOT_OPERATOR = 36;
  529. ivprog.ID = 37;
  530. ivprog.LIB_ID = 38;
  531. ivprog.INTEGER = 39;
  532. ivprog.REAL = 40;
  533. ivprog.STRING = 41;
  534. ivprog.CHARACTER = 42;
  535. ivprog.WHITESPACE = 43;
  536. ivprog.EOS = 44;
  537. ivprog.COMMENTS = 45;
  538. ivprog.prototype.channelNames = [ "DEFAULT_TOKEN_CHANNEL", "HIDDEN" ];
  539. ivprog.prototype.modeNames = [ "DEFAULT_MODE" ];
  540. ivprog.prototype.literalNames = [ null, "'program'", "'real'", "'void'",
  541. "'boolean'", "'string'", "'integer'",
  542. "'character'", "'switch'", "'case'", "'otherwise'",
  543. "'const'", "'function'", "'return'", "'for'",
  544. "'break'", "'do'", "'while'", "'if'",
  545. "'else'", "'false'", "'true'", "'('",
  546. "')'", "'['", "']'", "'{'", "'}'", "','",
  547. "'='", null, null, null, null, null, "':'" ];
  548. ivprog.prototype.symbolicNames = [ null, "RK_PROGRAM", "RK_REAL", "RK_VOID",
  549. "RK_BOOLEAN", "RK_STRING", "RK_INTEGER",
  550. "RK_CHARACTER", "RK_SWITCH", "RK_CASE",
  551. "RK_DEFAULT", "RK_CONST", "RK_FUNCTION",
  552. "RK_RETURN", "RK_FOR", "RK_BREAK", "RK_DO",
  553. "RK_WHILE", "RK_IF", "RK_ELSE", "RK_FALSE",
  554. "RK_TRUE", "OPEN_PARENTHESIS", "CLOSE_PARENTHESIS",
  555. "OPEN_BRACE", "CLOSE_BRACE", "OPEN_CURLY",
  556. "CLOSE_CURLY", "COMMA", "EQUAL", "SUM_OP",
  557. "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  558. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  559. "ID", "LIB_ID", "INTEGER", "REAL", "STRING",
  560. "CHARACTER", "WHITESPACE", "EOS", "COMMENTS" ];
  561. ivprog.prototype.ruleNames = [ "RK_PROGRAM", "RK_REAL", "RK_VOID", "RK_BOOLEAN",
  562. "RK_STRING", "RK_INTEGER", "RK_CHARACTER",
  563. "RK_SWITCH", "RK_CASE", "RK_DEFAULT", "RK_CONST",
  564. "RK_FUNCTION", "RK_RETURN", "RK_FOR", "RK_BREAK",
  565. "RK_DO", "RK_WHILE", "RK_IF", "RK_ELSE",
  566. "RK_FALSE", "RK_TRUE", "RK_LOGICAL_NOT",
  567. "RK_LOGICAL_AND", "RK_LOGICAL_OR", "OPEN_PARENTHESIS",
  568. "CLOSE_PARENTHESIS", "OPEN_BRACE", "CLOSE_BRACE",
  569. "OPEN_CURLY", "CLOSE_CURLY", "COMMA", "EQUAL",
  570. "SUM_OP", "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  571. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  572. "ID", "LIB_ID", "INTEGER", "REAL", "ExponentPart",
  573. "STRING", "STRING_CHARACTER", "CHARACTER",
  574. "WHITESPACE", "SEMICOLON", "EOS", "HEX_DIGIT",
  575. "OCTAL_DIGIT", "ESC_SEQ", "ESC_OCTAL", "ESC_UNICODE",
  576. "COMMENTS" ];
  577. ivprog.prototype.grammarFileName = "ivprog.g4";
  578. exports.ivprog = ivprog;
  579. /***/ }),
  580. /* 1 */
  581. /***/ (function(module, exports, __webpack_require__) {
  582. module.exports = {
  583. ivprog: __webpack_require__(0).ivprog
  584. };
  585. /***/ }),
  586. /* 2 */
  587. /***/ (function(module, exports) {
  588. module.exports = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js");
  589. /***/ })
  590. /******/ ]);
  591. /***/ }),
  592. /***/ "./grammar/en/langFunctions.js":
  593. /*!*************************************!*\
  594. !*** ./grammar/en/langFunctions.js ***!
  595. \*************************************/
  596. /*! exports provided: default */
  597. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  598. "use strict";
  599. __webpack_require__.r(__webpack_exports__);
  600. /* This is a dictionary of the language defined functions
  601. **/
  602. /* harmony default export */ __webpack_exports__["default"] = ({
  603. main_function: "start",
  604. $read: "read",
  605. $write: "write",
  606. $numElements: "total_of_elements",
  607. $matrixLines: "total_of_lines",
  608. $matrixColumns: "total_of_columns",
  609. $substring: "subcadeia",
  610. $length: "comprimento",
  611. $uppercase: "caixa_alta",
  612. $lowercase: "caixa_baixa",
  613. $charAt: "char_at",
  614. $isReal: "is_real",
  615. $isInt: "is_integer",
  616. $isBool: "is_logic",
  617. $castReal: "to_real",
  618. $castInt: "to_integer",
  619. $castBool: "to_logic",
  620. $castString: "to_string",
  621. $sin: "sin",
  622. $cos: "cos",
  623. $tan: "tan",
  624. $sqrt: "sqrt",
  625. $pow: "pow",
  626. $log: "log",
  627. $abs: "abs",
  628. $negate: "negate",
  629. $invert: "invert",
  630. $max: "maximum",
  631. $min: "minimum"
  632. });
  633. /***/ }),
  634. /***/ "./grammar/en/langLibs.js":
  635. /*!********************************!*\
  636. !*** ./grammar/en/langLibs.js ***!
  637. \********************************/
  638. /*! exports provided: default */
  639. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  640. "use strict";
  641. __webpack_require__.r(__webpack_exports__);
  642. /**
  643. * This is the dictionary of the language defined libraries
  644. */
  645. /* harmony default export */ __webpack_exports__["default"] = ({
  646. $mathLib: "Mathematic",
  647. $ioLib: "ES",
  648. $strLib: "Texto",
  649. $arrayLib: "Arranjo",
  650. $langLib: "Conversion"
  651. });
  652. /***/ }),
  653. /***/ "./grammar/es/ivprog.g4":
  654. /*!******************************!*\
  655. !*** ./grammar/es/ivprog.g4 ***!
  656. \******************************/
  657. /*! no static exports found */
  658. /***/ (function(module, exports, __webpack_require__) {
  659. module.exports =
  660. /******/ (function(modules) { // webpackBootstrap
  661. /******/ // The module cache
  662. /******/ var installedModules = {};
  663. /******/
  664. /******/ // The require function
  665. /******/ function __webpack_require__(moduleId) {
  666. /******/
  667. /******/ // Check if module is in cache
  668. /******/ if(installedModules[moduleId]) {
  669. /******/ return installedModules[moduleId].exports;
  670. /******/ }
  671. /******/ // Create a new module (and put it into the cache)
  672. /******/ var module = installedModules[moduleId] = {
  673. /******/ i: moduleId,
  674. /******/ l: false,
  675. /******/ exports: {}
  676. /******/ };
  677. /******/
  678. /******/ // Execute the module function
  679. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  680. /******/
  681. /******/ // Flag the module as loaded
  682. /******/ module.l = true;
  683. /******/
  684. /******/ // Return the exports of the module
  685. /******/ return module.exports;
  686. /******/ }
  687. /******/
  688. /******/
  689. /******/ // expose the modules object (__webpack_modules__)
  690. /******/ __webpack_require__.m = modules;
  691. /******/
  692. /******/ // expose the module cache
  693. /******/ __webpack_require__.c = installedModules;
  694. /******/
  695. /******/ // identity function for calling harmony imports with the correct context
  696. /******/ __webpack_require__.i = function(value) { return value; };
  697. /******/
  698. /******/ // define getter function for harmony exports
  699. /******/ __webpack_require__.d = function(exports, name, getter) {
  700. /******/ if(!__webpack_require__.o(exports, name)) {
  701. /******/ Object.defineProperty(exports, name, {
  702. /******/ configurable: false,
  703. /******/ enumerable: true,
  704. /******/ get: getter
  705. /******/ });
  706. /******/ }
  707. /******/ };
  708. /******/
  709. /******/ // getDefaultExport function for compatibility with non-harmony modules
  710. /******/ __webpack_require__.n = function(module) {
  711. /******/ var getter = module && module.__esModule ?
  712. /******/ function getDefault() { return module['default']; } :
  713. /******/ function getModuleExports() { return module; };
  714. /******/ __webpack_require__.d(getter, 'a', getter);
  715. /******/ return getter;
  716. /******/ };
  717. /******/
  718. /******/ // Object.prototype.hasOwnProperty.call
  719. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  720. /******/
  721. /******/ // __webpack_public_path__
  722. /******/ __webpack_require__.p = "";
  723. /******/
  724. /******/ // Load entry module and return exports
  725. /******/ return __webpack_require__(__webpack_require__.s = 1);
  726. /******/ })
  727. /************************************************************************/
  728. /******/ ([
  729. /* 0 */
  730. /***/ (function(module, exports, __webpack_require__) {
  731. // Generated from /tmp/tmp-721664w1agw7QR9g/ivprog.g4 by ANTLR 4.7
  732. // jshint ignore: start
  733. var antlr4 = __webpack_require__(2);
  734. var serializedATN = ["\u0003\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964",
  735. "\u0002/\u01dc\b\u0001\u0004\u0002\t\u0002\u0004\u0003\t\u0003\u0004",
  736. "\u0004\t\u0004\u0004\u0005\t\u0005\u0004\u0006\t\u0006\u0004\u0007\t",
  737. "\u0007\u0004\b\t\b\u0004\t\t\t\u0004\n\t\n\u0004\u000b\t\u000b\u0004",
  738. "\f\t\f\u0004\r\t\r\u0004\u000e\t\u000e\u0004\u000f\t\u000f\u0004\u0010",
  739. "\t\u0010\u0004\u0011\t\u0011\u0004\u0012\t\u0012\u0004\u0013\t\u0013",
  740. "\u0004\u0014\t\u0014\u0004\u0015\t\u0015\u0004\u0016\t\u0016\u0004\u0017",
  741. "\t\u0017\u0004\u0018\t\u0018\u0004\u0019\t\u0019\u0004\u001a\t\u001a",
  742. "\u0004\u001b\t\u001b\u0004\u001c\t\u001c\u0004\u001d\t\u001d\u0004\u001e",
  743. "\t\u001e\u0004\u001f\t\u001f\u0004 \t \u0004!\t!\u0004\"\t\"\u0004#",
  744. "\t#\u0004$\t$\u0004%\t%\u0004&\t&\u0004\'\t\'\u0004(\t(\u0004)\t)\u0004",
  745. "*\t*\u0004+\t+\u0004,\t,\u0004-\t-\u0004.\t.\u0004/\t/\u00040\t0\u0004",
  746. "1\t1\u00042\t2\u00043\t3\u00044\t4\u00045\t5\u00046\t6\u00047\t7\u0004",
  747. "8\t8\u00049\t9\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003",
  748. "\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0003\u0003",
  749. "\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0004\u0003\u0004\u0003",
  750. "\u0004\u0003\u0004\u0003\u0004\u0003\u0004\u0003\u0005\u0003\u0005\u0003",
  751. "\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0006\u0003",
  752. "\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003",
  753. "\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003",
  754. "\u0007\u0003\u0007\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003",
  755. "\b\u0003\b\u0003\b\u0003\b\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0003",
  756. "\t\u0003\t\u0003\t\u0003\n\u0003\n\u0003\n\u0003\n\u0003\n\u0003\u000b",
  757. "\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b",
  758. "\u0003\u000b\u0003\u000b\u0003\u000b\u0003\f\u0003\f\u0003\f\u0003\f",
  759. "\u0003\f\u0003\f\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003",
  760. "\r\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003",
  761. "\u000e\u0003\u000e\u0003\u000e\u0003\u000f\u0003\u000f\u0003\u000f\u0003",
  762. "\u000f\u0003\u000f\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003",
  763. "\u0010\u0003\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0003",
  764. "\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003",
  765. "\u0012\u0003\u0012\u0003\u0012\u0003\u0013\u0003\u0013\u0003\u0013\u0003",
  766. "\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003",
  767. "\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003",
  768. "\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003",
  769. "\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0017\u0003",
  770. "\u0017\u0003\u0017\u0003\u0017\u0003\u0018\u0003\u0018\u0003\u0019\u0003",
  771. "\u0019\u0003\u0019\u0003\u001a\u0003\u001a\u0003\u001b\u0003\u001b\u0003",
  772. "\u001c\u0003\u001c\u0003\u001d\u0003\u001d\u0003\u001e\u0003\u001e\u0003",
  773. "\u001f\u0003\u001f\u0003 \u0003 \u0003!\u0003!\u0003\"\u0003\"\u0003",
  774. "#\u0003#\u0003$\u0003$\u0003%\u0003%\u0003&\u0003&\u0003&\u0003&\u0003",
  775. "&\u0003&\u0003&\u0003&\u0003&\u0005&\u0130\n&\u0003\'\u0003\'\u0003",
  776. "(\u0003(\u0003)\u0003)\u0007)\u0138\n)\f)\u000e)\u013b\u000b)\u0003",
  777. "*\u0003*\u0003*\u0003*\u0003+\u0006+\u0142\n+\r+\u000e+\u0143\u0003",
  778. "+\u0003+\u0003+\u0003+\u0005+\u014a\n+\u0003+\u0006+\u014d\n+\r+\u000e",
  779. "+\u014e\u0003+\u0003+\u0003+\u0003+\u0005+\u0155\n+\u0003+\u0006+\u0158",
  780. "\n+\r+\u000e+\u0159\u0005+\u015c\n+\u0003,\u0006,\u015f\n,\r,\u000e",
  781. ",\u0160\u0003,\u0003,\u0006,\u0165\n,\r,\u000e,\u0166\u0003,\u0006,",
  782. "\u016a\n,\r,\u000e,\u016b\u0003,\u0003,\u0007,\u0170\n,\f,\u000e,\u0173",
  783. "\u000b,\u0003,\u0005,\u0176\n,\u0003-\u0003-\u0005-\u017a\n-\u0003-",
  784. "\u0006-\u017d\n-\r-\u000e-\u017e\u0003.\u0003.\u0007.\u0183\n.\f.\u000e",
  785. ".\u0186\u000b.\u0003.\u0003.\u0003/\u0003/\u0005/\u018c\n/\u00030\u0003",
  786. "0\u00030\u00050\u0191\n0\u00030\u00030\u00031\u00031\u00031\u00031\u0003",
  787. "2\u00032\u00033\u00063\u019c\n3\r3\u000e3\u019d\u00033\u00053\u01a1",
  788. "\n3\u00034\u00034\u00035\u00035\u00036\u00036\u00036\u00036\u00056\u01ab",
  789. "\n6\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u0003",
  790. "7\u00037\u00057\u01b8\n7\u00038\u00038\u00038\u00038\u00038\u00038\u0003",
  791. "8\u00039\u00039\u00039\u00039\u00079\u01c5\n9\f9\u000e9\u01c8\u000b",
  792. "9\u00039\u00059\u01cb\n9\u00039\u00039\u00039\u00039\u00039\u00079\u01d2",
  793. "\n9\f9\u000e9\u01d5\u000b9\u00039\u00039\u00059\u01d9\n9\u00039\u0003",
  794. "9\u0003\u01d3\u0002:\u0003\u0003\u0005\u0004\u0007\u0005\t\u0006\u000b",
  795. "\u0007\r\b\u000f\t\u0011\n\u0013\u000b\u0015\f\u0017\r\u0019\u000e\u001b",
  796. "\u000f\u001d\u0010\u001f\u0011!\u0012#\u0013%\u0014\'\u0015)\u0016+",
  797. "\u0017-\u0002/\u00021\u00023\u00185\u00197\u001a9\u001b;\u001c=\u001d",
  798. "?\u001eA\u001fC E!G\"I#K$M%O&Q\'S(U)W*Y\u0002[+]\u0002_,a-c\u0002e.",
  799. "g\u0002i\u0002k\u0002m\u0002o\u0002q/\u0003\u0002\u0012\u0004\u0002",
  800. "--//\u0005\u0002\'\',,11\u0004\u0002>>@@\u0005\u0002C\\aac|\u0006\u0002",
  801. "2;C\\aac|\u0003\u00022;\u0003\u000223\u0004\u0002GGgg\u0006\u0002\f",
  802. "\f\u000f\u000f$$^^\u0006\u0002\f\f\u000f\u000f))^^\u0004\u0002\u000b",
  803. "\u000b\"\"\u0004\u0002\f\f\u000f\u000f\u0005\u00022;CHch\u0003\u0002",
  804. "29\n\u0002$$))^^ddhhppttvv\u0003\u000225\u0002\u01f0\u0002\u0003\u0003",
  805. "\u0002\u0002\u0002\u0002\u0005\u0003\u0002\u0002\u0002\u0002\u0007\u0003",
  806. "\u0002\u0002\u0002\u0002\t\u0003\u0002\u0002\u0002\u0002\u000b\u0003",
  807. "\u0002\u0002\u0002\u0002\r\u0003\u0002\u0002\u0002\u0002\u000f\u0003",
  808. "\u0002\u0002\u0002\u0002\u0011\u0003\u0002\u0002\u0002\u0002\u0013\u0003",
  809. "\u0002\u0002\u0002\u0002\u0015\u0003\u0002\u0002\u0002\u0002\u0017\u0003",
  810. "\u0002\u0002\u0002\u0002\u0019\u0003\u0002\u0002\u0002\u0002\u001b\u0003",
  811. "\u0002\u0002\u0002\u0002\u001d\u0003\u0002\u0002\u0002\u0002\u001f\u0003",
  812. "\u0002\u0002\u0002\u0002!\u0003\u0002\u0002\u0002\u0002#\u0003\u0002",
  813. "\u0002\u0002\u0002%\u0003\u0002\u0002\u0002\u0002\'\u0003\u0002\u0002",
  814. "\u0002\u0002)\u0003\u0002\u0002\u0002\u0002+\u0003\u0002\u0002\u0002",
  815. "\u00023\u0003\u0002\u0002\u0002\u00025\u0003\u0002\u0002\u0002\u0002",
  816. "7\u0003\u0002\u0002\u0002\u00029\u0003\u0002\u0002\u0002\u0002;\u0003",
  817. "\u0002\u0002\u0002\u0002=\u0003\u0002\u0002\u0002\u0002?\u0003\u0002",
  818. "\u0002\u0002\u0002A\u0003\u0002\u0002\u0002\u0002C\u0003\u0002\u0002",
  819. "\u0002\u0002E\u0003\u0002\u0002\u0002\u0002G\u0003\u0002\u0002\u0002",
  820. "\u0002I\u0003\u0002\u0002\u0002\u0002K\u0003\u0002\u0002\u0002\u0002",
  821. "M\u0003\u0002\u0002\u0002\u0002O\u0003\u0002\u0002\u0002\u0002Q\u0003",
  822. "\u0002\u0002\u0002\u0002S\u0003\u0002\u0002\u0002\u0002U\u0003\u0002",
  823. "\u0002\u0002\u0002W\u0003\u0002\u0002\u0002\u0002[\u0003\u0002\u0002",
  824. "\u0002\u0002_\u0003\u0002\u0002\u0002\u0002a\u0003\u0002\u0002\u0002",
  825. "\u0002e\u0003\u0002\u0002\u0002\u0002q\u0003\u0002\u0002\u0002\u0003",
  826. "s\u0003\u0002\u0002\u0002\u0005|\u0003\u0002\u0002\u0002\u0007\u0081",
  827. "\u0003\u0002\u0002\u0002\t\u0087\u0003\u0002\u0002\u0002\u000b\u008e",
  828. "\u0003\u0002\u0002\u0002\r\u0095\u0003\u0002\u0002\u0002\u000f\u009d",
  829. "\u0003\u0002\u0002\u0002\u0011\u00a7\u0003\u0002\u0002\u0002\u0013\u00af",
  830. "\u0003\u0002\u0002\u0002\u0015\u00b4\u0003\u0002\u0002\u0002\u0017\u00be",
  831. "\u0003\u0002\u0002\u0002\u0019\u00c4\u0003\u0002\u0002\u0002\u001b\u00cb",
  832. "\u0003\u0002\u0002\u0002\u001d\u00d3\u0003\u0002\u0002\u0002\u001f\u00d8",
  833. "\u0003\u0002\u0002\u0002!\u00dd\u0003\u0002\u0002\u0002#\u00e2\u0003",
  834. "\u0002\u0002\u0002%\u00eb\u0003\u0002\u0002\u0002\'\u00ee\u0003\u0002",
  835. "\u0002\u0002)\u00f4\u0003\u0002\u0002\u0002+\u00fa\u0003\u0002\u0002",
  836. "\u0002-\u0105\u0003\u0002\u0002\u0002/\u0109\u0003\u0002\u0002\u0002",
  837. "1\u010b\u0003\u0002\u0002\u00023\u010e\u0003\u0002\u0002\u00025\u0110",
  838. "\u0003\u0002\u0002\u00027\u0112\u0003\u0002\u0002\u00029\u0114\u0003",
  839. "\u0002\u0002\u0002;\u0116\u0003\u0002\u0002\u0002=\u0118\u0003\u0002",
  840. "\u0002\u0002?\u011a\u0003\u0002\u0002\u0002A\u011c\u0003\u0002\u0002",
  841. "\u0002C\u011e\u0003\u0002\u0002\u0002E\u0120\u0003\u0002\u0002\u0002",
  842. "G\u0122\u0003\u0002\u0002\u0002I\u0124\u0003\u0002\u0002\u0002K\u012f",
  843. "\u0003\u0002\u0002\u0002M\u0131\u0003\u0002\u0002\u0002O\u0133\u0003",
  844. "\u0002\u0002\u0002Q\u0135\u0003\u0002\u0002\u0002S\u013c\u0003\u0002",
  845. "\u0002\u0002U\u015b\u0003\u0002\u0002\u0002W\u0175\u0003\u0002\u0002",
  846. "\u0002Y\u0177\u0003\u0002\u0002\u0002[\u0180\u0003\u0002\u0002\u0002",
  847. "]\u018b\u0003\u0002\u0002\u0002_\u018d\u0003\u0002\u0002\u0002a\u0194",
  848. "\u0003\u0002\u0002\u0002c\u0198\u0003\u0002\u0002\u0002e\u01a0\u0003",
  849. "\u0002\u0002\u0002g\u01a2\u0003\u0002\u0002\u0002i\u01a4\u0003\u0002",
  850. "\u0002\u0002k\u01aa\u0003\u0002\u0002\u0002m\u01b7\u0003\u0002\u0002",
  851. "\u0002o\u01b9\u0003\u0002\u0002\u0002q\u01d8\u0003\u0002\u0002\u0002",
  852. "st\u0007r\u0002\u0002tu\u0007t\u0002\u0002uv\u0007q\u0002\u0002vw\u0007",
  853. "i\u0002\u0002wx\u0007t\u0002\u0002xy\u0007c\u0002\u0002yz\u0007o\u0002",
  854. "\u0002z{\u0007c\u0002\u0002{\u0004\u0003\u0002\u0002\u0002|}\u0007t",
  855. "\u0002\u0002}~\u0007g\u0002\u0002~\u007f\u0007c\u0002\u0002\u007f\u0080",
  856. "\u0007n\u0002\u0002\u0080\u0006\u0003\u0002\u0002\u0002\u0081\u0082",
  857. "\u0007x\u0002\u0002\u0082\u0083\u0007c\u0002\u0002\u0083\u0084\u0007",
  858. "|\u0002\u0002\u0084\u0085\u0007k\u0002\u0002\u0085\u0086\u0007q\u0002",
  859. "\u0002\u0086\b\u0003\u0002\u0002\u0002\u0087\u0088\u0007n\u0002\u0002",
  860. "\u0088\u0089\u0007q\u0002\u0002\u0089\u008a\u0007i\u0002\u0002\u008a",
  861. "\u008b\u0007k\u0002\u0002\u008b\u008c\u0007e\u0002\u0002\u008c\u008d",
  862. "\u0007q\u0002\u0002\u008d\n\u0003\u0002\u0002\u0002\u008e\u008f\u0007",
  863. "e\u0002\u0002\u008f\u0090\u0007c\u0002\u0002\u0090\u0091\u0007f\u0002",
  864. "\u0002\u0091\u0092\u0007g\u0002\u0002\u0092\u0093\u0007k\u0002\u0002",
  865. "\u0093\u0094\u0007c\u0002\u0002\u0094\f\u0003\u0002\u0002\u0002\u0095",
  866. "\u0096\u0007k\u0002\u0002\u0096\u0097\u0007p\u0002\u0002\u0097\u0098",
  867. "\u0007v\u0002\u0002\u0098\u0099\u0007g\u0002\u0002\u0099\u009a\u0007",
  868. "k\u0002\u0002\u009a\u009b\u0007t\u0002\u0002\u009b\u009c\u0007q\u0002",
  869. "\u0002\u009c\u000e\u0003\u0002\u0002\u0002\u009d\u009e\u0007e\u0002",
  870. "\u0002\u009e\u009f\u0007c\u0002\u0002\u009f\u00a0\u0007t\u0002\u0002",
  871. "\u00a0\u00a1\u0007c\u0002\u0002\u00a1\u00a2\u0007e\u0002\u0002\u00a2",
  872. "\u00a3\u0007v\u0002\u0002\u00a3\u00a4\u0007g\u0002\u0002\u00a4\u00a5",
  873. "\u0007t\u0002\u0002\u00a5\u00a6\u0007g\u0002\u0002\u00a6\u0010\u0003",
  874. "\u0002\u0002\u0002\u00a7\u00a8\u0007g\u0002\u0002\u00a8\u00a9\u0007",
  875. "u\u0002\u0002\u00a9\u00aa\u0007e\u0002\u0002\u00aa\u00ab\u0007q\u0002",
  876. "\u0002\u00ab\u00ac\u0007n\u0002\u0002\u00ac\u00ad\u0007j\u0002\u0002",
  877. "\u00ad\u00ae\u0007c\u0002\u0002\u00ae\u0012\u0003\u0002\u0002\u0002",
  878. "\u00af\u00b0\u0007e\u0002\u0002\u00b0\u00b1\u0007c\u0002\u0002\u00b1",
  879. "\u00b2\u0007u\u0002\u0002\u00b2\u00b3\u0007q\u0002\u0002\u00b3\u0014",
  880. "\u0003\u0002\u0002\u0002\u00b4\u00b5\u0007e\u0002\u0002\u00b5\u00b6",
  881. "\u0007q\u0002\u0002\u00b6\u00b7\u0007p\u0002\u0002\u00b7\u00b8\u0007",
  882. "v\u0002\u0002\u00b8\u00b9\u0007t\u0002\u0002\u00b9\u00ba\u0007c\u0002",
  883. "\u0002\u00ba\u00bb\u0007t\u0002\u0002\u00bb\u00bc\u0007k\u0002\u0002",
  884. "\u00bc\u00bd\u0007q\u0002\u0002\u00bd\u0016\u0003\u0002\u0002\u0002",
  885. "\u00be\u00bf\u0007e\u0002\u0002\u00bf\u00c0\u0007q\u0002\u0002\u00c0",
  886. "\u00c1\u0007p\u0002\u0002\u00c1\u00c2\u0007u\u0002\u0002\u00c2\u00c3",
  887. "\u0007v\u0002\u0002\u00c3\u0018\u0003\u0002\u0002\u0002\u00c4\u00c5",
  888. "\u0007h\u0002\u0002\u00c5\u00c6\u0007w\u0002\u0002\u00c6\u00c7\u0007",
  889. "p\u0002\u0002\u00c7\u00c8\u0007e\u0002\u0002\u00c8\u00c9\u0007c\u0002",
  890. "\u0002\u00c9\u00ca\u0007q\u0002\u0002\u00ca\u001a\u0003\u0002\u0002",
  891. "\u0002\u00cb\u00cc\u0007t\u0002\u0002\u00cc\u00cd\u0007g\u0002\u0002",
  892. "\u00cd\u00ce\u0007v\u0002\u0002\u00ce\u00cf\u0007q\u0002\u0002\u00cf",
  893. "\u00d0\u0007t\u0002\u0002\u00d0\u00d1\u0007p\u0002\u0002\u00d1\u00d2",
  894. "\u0007g\u0002\u0002\u00d2\u001c\u0003\u0002\u0002\u0002\u00d3\u00d4",
  895. "\u0007r\u0002\u0002\u00d4\u00d5\u0007c\u0002\u0002\u00d5\u00d6\u0007",
  896. "t\u0002\u0002\u00d6\u00d7\u0007c\u0002\u0002\u00d7\u001e\u0003\u0002",
  897. "\u0002\u0002\u00d8\u00d9\u0007r\u0002\u0002\u00d9\u00da\u0007c\u0002",
  898. "\u0002\u00da\u00db\u0007t\u0002\u0002\u00db\u00dc\u0007g\u0002\u0002",
  899. "\u00dc \u0003\u0002\u0002\u0002\u00dd\u00de\u0007h\u0002\u0002\u00de",
  900. "\u00df\u0007c\u0002\u0002\u00df\u00e0\u0007e\u0002\u0002\u00e0\u00e1",
  901. "\u0007c\u0002\u0002\u00e1\"\u0003\u0002\u0002\u0002\u00e2\u00e3\u0007",
  902. "g\u0002\u0002\u00e3\u00e4\u0007p\u0002\u0002\u00e4\u00e5\u0007s\u0002",
  903. "\u0002\u00e5\u00e6\u0007w\u0002\u0002\u00e6\u00e7\u0007c\u0002\u0002",
  904. "\u00e7\u00e8\u0007p\u0002\u0002\u00e8\u00e9\u0007v\u0002\u0002\u00e9",
  905. "\u00ea\u0007q\u0002\u0002\u00ea$\u0003\u0002\u0002\u0002\u00eb\u00ec",
  906. "\u0007u\u0002\u0002\u00ec\u00ed\u0007g\u0002\u0002\u00ed&\u0003\u0002",
  907. "\u0002\u0002\u00ee\u00ef\u0007u\u0002\u0002\u00ef\u00f0\u0007g\u0002",
  908. "\u0002\u00f0\u00f1\u0007p\u0002\u0002\u00f1\u00f2\u0007c\u0002\u0002",
  909. "\u00f2\u00f3\u0007q\u0002\u0002\u00f3(\u0003\u0002\u0002\u0002\u00f4",
  910. "\u00f5\u0007h\u0002\u0002\u00f5\u00f6\u0007c\u0002\u0002\u00f6\u00f7",
  911. "\u0007n\u0002\u0002\u00f7\u00f8\u0007u\u0002\u0002\u00f8\u00f9\u0007",
  912. "q\u0002\u0002\u00f9*\u0003\u0002\u0002\u0002\u00fa\u00fb\u0007x\u0002",
  913. "\u0002\u00fb\u00fc\u0007g\u0002\u0002\u00fc\u00fd\u0007t\u0002\u0002",
  914. "\u00fd\u00fe\u0007f\u0002\u0002\u00fe\u00ff\u0007c\u0002\u0002\u00ff",
  915. "\u0100\u0007f\u0002\u0002\u0100\u0101\u0007g\u0002\u0002\u0101\u0102",
  916. "\u0007k\u0002\u0002\u0102\u0103\u0007t\u0002\u0002\u0103\u0104\u0007",
  917. "q\u0002\u0002\u0104,\u0003\u0002\u0002\u0002\u0105\u0106\u0007p\u0002",
  918. "\u0002\u0106\u0107\u0007c\u0002\u0002\u0107\u0108\u0007q\u0002\u0002",
  919. "\u0108.\u0003\u0002\u0002\u0002\u0109\u010a\u0007G\u0002\u0002\u010a",
  920. "0\u0003\u0002\u0002\u0002\u010b\u010c\u0007Q\u0002\u0002\u010c\u010d",
  921. "\u0007W\u0002\u0002\u010d2\u0003\u0002\u0002\u0002\u010e\u010f\u0007",
  922. "*\u0002\u0002\u010f4\u0003\u0002\u0002\u0002\u0110\u0111\u0007+\u0002",
  923. "\u0002\u01116\u0003\u0002\u0002\u0002\u0112\u0113\u0007]\u0002\u0002",
  924. "\u01138\u0003\u0002\u0002\u0002\u0114\u0115\u0007_\u0002\u0002\u0115",
  925. ":\u0003\u0002\u0002\u0002\u0116\u0117\u0007}\u0002\u0002\u0117<\u0003",
  926. "\u0002\u0002\u0002\u0118\u0119\u0007\u007f\u0002\u0002\u0119>\u0003",
  927. "\u0002\u0002\u0002\u011a\u011b\u0007.\u0002\u0002\u011b@\u0003\u0002",
  928. "\u0002\u0002\u011c\u011d\u0007?\u0002\u0002\u011dB\u0003\u0002\u0002",
  929. "\u0002\u011e\u011f\t\u0002\u0002\u0002\u011fD\u0003\u0002\u0002\u0002",
  930. "\u0120\u0121\t\u0003\u0002\u0002\u0121F\u0003\u0002\u0002\u0002\u0122",
  931. "\u0123\u0005/\u0018\u0002\u0123H\u0003\u0002\u0002\u0002\u0124\u0125",
  932. "\u00051\u0019\u0002\u0125J\u0003\u0002\u0002\u0002\u0126\u0127\u0007",
  933. "@\u0002\u0002\u0127\u0130\u0007?\u0002\u0002\u0128\u0129\u0007?\u0002",
  934. "\u0002\u0129\u0130\u0007?\u0002\u0002\u012a\u012b\u0007>\u0002\u0002",
  935. "\u012b\u0130\u0007?\u0002\u0002\u012c\u0130\t\u0004\u0002\u0002\u012d",
  936. "\u012e\u0007#\u0002\u0002\u012e\u0130\u0007?\u0002\u0002\u012f\u0126",
  937. "\u0003\u0002\u0002\u0002\u012f\u0128\u0003\u0002\u0002\u0002\u012f\u012a",
  938. "\u0003\u0002\u0002\u0002\u012f\u012c\u0003\u0002\u0002\u0002\u012f\u012d",
  939. "\u0003\u0002\u0002\u0002\u0130L\u0003\u0002\u0002\u0002\u0131\u0132",
  940. "\u0007<\u0002\u0002\u0132N\u0003\u0002\u0002\u0002\u0133\u0134\u0005",
  941. "-\u0017\u0002\u0134P\u0003\u0002\u0002\u0002\u0135\u0139\t\u0005\u0002",
  942. "\u0002\u0136\u0138\t\u0006\u0002\u0002\u0137\u0136\u0003\u0002\u0002",
  943. "\u0002\u0138\u013b\u0003\u0002\u0002\u0002\u0139\u0137\u0003\u0002\u0002",
  944. "\u0002\u0139\u013a\u0003\u0002\u0002\u0002\u013aR\u0003\u0002\u0002",
  945. "\u0002\u013b\u0139\u0003\u0002\u0002\u0002\u013c\u013d\u0005Q)\u0002",
  946. "\u013d\u013e\u00070\u0002\u0002\u013e\u013f\u0005Q)\u0002\u013fT\u0003",
  947. "\u0002\u0002\u0002\u0140\u0142\t\u0007\u0002\u0002\u0141\u0140\u0003",
  948. "\u0002\u0002\u0002\u0142\u0143\u0003\u0002\u0002\u0002\u0143\u0141\u0003",
  949. "\u0002\u0002\u0002\u0143\u0144\u0003\u0002\u0002\u0002\u0144\u015c\u0003",
  950. "\u0002\u0002\u0002\u0145\u0146\u00072\u0002\u0002\u0146\u014a\u0007",
  951. "z\u0002\u0002\u0147\u0148\u00072\u0002\u0002\u0148\u014a\u0007Z\u0002",
  952. "\u0002\u0149\u0145\u0003\u0002\u0002\u0002\u0149\u0147\u0003\u0002\u0002",
  953. "\u0002\u014a\u014c\u0003\u0002\u0002\u0002\u014b\u014d\u0005g4\u0002",
  954. "\u014c\u014b\u0003\u0002\u0002\u0002\u014d\u014e\u0003\u0002\u0002\u0002",
  955. "\u014e\u014c\u0003\u0002\u0002\u0002\u014e\u014f\u0003\u0002\u0002\u0002",
  956. "\u014f\u015c\u0003\u0002\u0002\u0002\u0150\u0151\u00072\u0002\u0002",
  957. "\u0151\u0155\u0007d\u0002\u0002\u0152\u0153\u00072\u0002\u0002\u0153",
  958. "\u0155\u0007D\u0002\u0002\u0154\u0150\u0003\u0002\u0002\u0002\u0154",
  959. "\u0152\u0003\u0002\u0002\u0002\u0155\u0157\u0003\u0002\u0002\u0002\u0156",
  960. "\u0158\t\b\u0002\u0002\u0157\u0156\u0003\u0002\u0002\u0002\u0158\u0159",
  961. "\u0003\u0002\u0002\u0002\u0159\u0157\u0003\u0002\u0002\u0002\u0159\u015a",
  962. "\u0003\u0002\u0002\u0002\u015a\u015c\u0003\u0002\u0002\u0002\u015b\u0141",
  963. "\u0003\u0002\u0002\u0002\u015b\u0149\u0003\u0002\u0002\u0002\u015b\u0154",
  964. "\u0003\u0002\u0002\u0002\u015cV\u0003\u0002\u0002\u0002\u015d\u015f",
  965. "\t\u0007\u0002\u0002\u015e\u015d\u0003\u0002\u0002\u0002\u015f\u0160",
  966. "\u0003\u0002\u0002\u0002\u0160\u015e\u0003\u0002\u0002\u0002\u0160\u0161",
  967. "\u0003\u0002\u0002\u0002\u0161\u0162\u0003\u0002\u0002\u0002\u0162\u0164",
  968. "\u00070\u0002\u0002\u0163\u0165\t\u0007\u0002\u0002\u0164\u0163\u0003",
  969. "\u0002\u0002\u0002\u0165\u0166\u0003\u0002\u0002\u0002\u0166\u0164\u0003",
  970. "\u0002\u0002\u0002\u0166\u0167\u0003\u0002\u0002\u0002\u0167\u0176\u0003",
  971. "\u0002\u0002\u0002\u0168\u016a\t\u0007\u0002\u0002\u0169\u0168\u0003",
  972. "\u0002\u0002\u0002\u016a\u016b\u0003\u0002\u0002\u0002\u016b\u0169\u0003",
  973. "\u0002\u0002\u0002\u016b\u016c\u0003\u0002\u0002\u0002\u016c\u016d\u0003",
  974. "\u0002\u0002\u0002\u016d\u0171\u00070\u0002\u0002\u016e\u0170\t\u0007",
  975. "\u0002\u0002\u016f\u016e\u0003\u0002\u0002\u0002\u0170\u0173\u0003\u0002",
  976. "\u0002\u0002\u0171\u016f\u0003\u0002\u0002\u0002\u0171\u0172\u0003\u0002",
  977. "\u0002\u0002\u0172\u0174\u0003\u0002\u0002\u0002\u0173\u0171\u0003\u0002",
  978. "\u0002\u0002\u0174\u0176\u0005Y-\u0002\u0175\u015e\u0003\u0002\u0002",
  979. "\u0002\u0175\u0169\u0003\u0002\u0002\u0002\u0176X\u0003\u0002\u0002",
  980. "\u0002\u0177\u0179\t\t\u0002\u0002\u0178\u017a\t\u0002\u0002\u0002\u0179",
  981. "\u0178\u0003\u0002\u0002\u0002\u0179\u017a\u0003\u0002\u0002\u0002\u017a",
  982. "\u017c\u0003\u0002\u0002\u0002\u017b\u017d\t\u0007\u0002\u0002\u017c",
  983. "\u017b\u0003\u0002\u0002\u0002\u017d\u017e\u0003\u0002\u0002\u0002\u017e",
  984. "\u017c\u0003\u0002\u0002\u0002\u017e\u017f\u0003\u0002\u0002\u0002\u017f",
  985. "Z\u0003\u0002\u0002\u0002\u0180\u0184\u0007$\u0002\u0002\u0181\u0183",
  986. "\u0005]/\u0002\u0182\u0181\u0003\u0002\u0002\u0002\u0183\u0186\u0003",
  987. "\u0002\u0002\u0002\u0184\u0182\u0003\u0002\u0002\u0002\u0184\u0185\u0003",
  988. "\u0002\u0002\u0002\u0185\u0187\u0003\u0002\u0002\u0002\u0186\u0184\u0003",
  989. "\u0002\u0002\u0002\u0187\u0188\u0007$\u0002\u0002\u0188\\\u0003\u0002",
  990. "\u0002\u0002\u0189\u018c\n\n\u0002\u0002\u018a\u018c\u0005k6\u0002\u018b",
  991. "\u0189\u0003\u0002\u0002\u0002\u018b\u018a\u0003\u0002\u0002\u0002\u018c",
  992. "^\u0003\u0002\u0002\u0002\u018d\u0190\u0007)\u0002\u0002\u018e\u0191",
  993. "\u0005k6\u0002\u018f\u0191\n\u000b\u0002\u0002\u0190\u018e\u0003\u0002",
  994. "\u0002\u0002\u0190\u018f\u0003\u0002\u0002\u0002\u0191\u0192\u0003\u0002",
  995. "\u0002\u0002\u0192\u0193\u0007)\u0002\u0002\u0193`\u0003\u0002\u0002",
  996. "\u0002\u0194\u0195\t\f\u0002\u0002\u0195\u0196\u0003\u0002\u0002\u0002",
  997. "\u0196\u0197\b1\u0002\u0002\u0197b\u0003\u0002\u0002\u0002\u0198\u0199",
  998. "\u0007=\u0002\u0002\u0199d\u0003\u0002\u0002\u0002\u019a\u019c\t\r\u0002",
  999. "\u0002\u019b\u019a\u0003\u0002\u0002\u0002\u019c\u019d\u0003\u0002\u0002",
  1000. "\u0002\u019d\u019b\u0003\u0002\u0002\u0002\u019d\u019e\u0003\u0002\u0002",
  1001. "\u0002\u019e\u01a1\u0003\u0002\u0002\u0002\u019f\u01a1\u0005c2\u0002",
  1002. "\u01a0\u019b\u0003\u0002\u0002\u0002\u01a0\u019f\u0003\u0002\u0002\u0002",
  1003. "\u01a1f\u0003\u0002\u0002\u0002\u01a2\u01a3\t\u000e\u0002\u0002\u01a3",
  1004. "h\u0003\u0002\u0002\u0002\u01a4\u01a5\t\u000f\u0002\u0002\u01a5j\u0003",
  1005. "\u0002\u0002\u0002\u01a6\u01a7\u0007^\u0002\u0002\u01a7\u01ab\t\u0010",
  1006. "\u0002\u0002\u01a8\u01ab\u0005o8\u0002\u01a9\u01ab\u0005m7\u0002\u01aa",
  1007. "\u01a6\u0003\u0002\u0002\u0002\u01aa\u01a8\u0003\u0002\u0002\u0002\u01aa",
  1008. "\u01a9\u0003\u0002\u0002\u0002\u01abl\u0003\u0002\u0002\u0002\u01ac",
  1009. "\u01ad\u0007^\u0002\u0002\u01ad\u01ae\t\u0011\u0002\u0002\u01ae\u01af",
  1010. "\u0005i5\u0002\u01af\u01b0\u0005i5\u0002\u01b0\u01b8\u0003\u0002\u0002",
  1011. "\u0002\u01b1\u01b2\u0007^\u0002\u0002\u01b2\u01b3\u0005i5\u0002\u01b3",
  1012. "\u01b4\u0005i5\u0002\u01b4\u01b8\u0003\u0002\u0002\u0002\u01b5\u01b6",
  1013. "\u0007^\u0002\u0002\u01b6\u01b8\u0005i5\u0002\u01b7\u01ac\u0003\u0002",
  1014. "\u0002\u0002\u01b7\u01b1\u0003\u0002\u0002\u0002\u01b7\u01b5\u0003\u0002",
  1015. "\u0002\u0002\u01b8n\u0003\u0002\u0002\u0002\u01b9\u01ba\u0007^\u0002",
  1016. "\u0002\u01ba\u01bb\u0007w\u0002\u0002\u01bb\u01bc\u0005g4\u0002\u01bc",
  1017. "\u01bd\u0005g4\u0002\u01bd\u01be\u0005g4\u0002\u01be\u01bf\u0005g4\u0002",
  1018. "\u01bfp\u0003\u0002\u0002\u0002\u01c0\u01c1\u00071\u0002\u0002\u01c1",
  1019. "\u01c2\u00071\u0002\u0002\u01c2\u01c6\u0003\u0002\u0002\u0002\u01c3",
  1020. "\u01c5\n\r\u0002\u0002\u01c4\u01c3\u0003\u0002\u0002\u0002\u01c5\u01c8",
  1021. "\u0003\u0002\u0002\u0002\u01c6\u01c4\u0003\u0002\u0002\u0002\u01c6\u01c7",
  1022. "\u0003\u0002\u0002\u0002\u01c7\u01ca\u0003\u0002\u0002\u0002\u01c8\u01c6",
  1023. "\u0003\u0002\u0002\u0002\u01c9\u01cb\u0007\u000f\u0002\u0002\u01ca\u01c9",
  1024. "\u0003\u0002\u0002\u0002\u01ca\u01cb\u0003\u0002\u0002\u0002\u01cb\u01cc",
  1025. "\u0003\u0002\u0002\u0002\u01cc\u01d9\u0007\f\u0002\u0002\u01cd\u01ce",
  1026. "\u00071\u0002\u0002\u01ce\u01cf\u0007,\u0002\u0002\u01cf\u01d3\u0003",
  1027. "\u0002\u0002\u0002\u01d0\u01d2\u000b\u0002\u0002\u0002\u01d1\u01d0\u0003",
  1028. "\u0002\u0002\u0002\u01d2\u01d5\u0003\u0002\u0002\u0002\u01d3\u01d4\u0003",
  1029. "\u0002\u0002\u0002\u01d3\u01d1\u0003\u0002\u0002\u0002\u01d4\u01d6\u0003",
  1030. "\u0002\u0002\u0002\u01d5\u01d3\u0003\u0002\u0002\u0002\u01d6\u01d7\u0007",
  1031. ",\u0002\u0002\u01d7\u01d9\u00071\u0002\u0002\u01d8\u01c0\u0003\u0002",
  1032. "\u0002\u0002\u01d8\u01cd\u0003\u0002\u0002\u0002\u01d9\u01da\u0003\u0002",
  1033. "\u0002\u0002\u01da\u01db\b9\u0003\u0002\u01dbr\u0003\u0002\u0002\u0002",
  1034. "\u001d\u0002\u012f\u0139\u0143\u0149\u014e\u0154\u0159\u015b\u0160\u0166",
  1035. "\u016b\u0171\u0175\u0179\u017e\u0184\u018b\u0190\u019d\u01a0\u01aa\u01b7",
  1036. "\u01c6\u01ca\u01d3\u01d8\u0004\b\u0002\u0002\u0002\u0003\u0002"].join("");
  1037. var atn = new antlr4.atn.ATNDeserializer().deserialize(serializedATN);
  1038. var decisionsToDFA = atn.decisionToState.map( function(ds, index) { return new antlr4.dfa.DFA(ds, index); });
  1039. function ivprog(input) {
  1040. antlr4.Lexer.call(this, input);
  1041. this._interp = new antlr4.atn.LexerATNSimulator(this, atn, decisionsToDFA, new antlr4.PredictionContextCache());
  1042. return this;
  1043. }
  1044. ivprog.prototype = Object.create(antlr4.Lexer.prototype);
  1045. ivprog.prototype.constructor = ivprog;
  1046. ivprog.EOF = antlr4.Token.EOF;
  1047. ivprog.RK_PROGRAM = 1;
  1048. ivprog.RK_REAL = 2;
  1049. ivprog.RK_VOID = 3;
  1050. ivprog.RK_BOOLEAN = 4;
  1051. ivprog.RK_STRING = 5;
  1052. ivprog.RK_INTEGER = 6;
  1053. ivprog.RK_CHARACTER = 7;
  1054. ivprog.RK_SWITCH = 8;
  1055. ivprog.RK_CASE = 9;
  1056. ivprog.RK_DEFAULT = 10;
  1057. ivprog.RK_CONST = 11;
  1058. ivprog.RK_FUNCTION = 12;
  1059. ivprog.RK_RETURN = 13;
  1060. ivprog.RK_FOR = 14;
  1061. ivprog.RK_BREAK = 15;
  1062. ivprog.RK_DO = 16;
  1063. ivprog.RK_WHILE = 17;
  1064. ivprog.RK_IF = 18;
  1065. ivprog.RK_ELSE = 19;
  1066. ivprog.RK_FALSE = 20;
  1067. ivprog.RK_TRUE = 21;
  1068. ivprog.OPEN_PARENTHESIS = 22;
  1069. ivprog.CLOSE_PARENTHESIS = 23;
  1070. ivprog.OPEN_BRACE = 24;
  1071. ivprog.CLOSE_BRACE = 25;
  1072. ivprog.OPEN_CURLY = 26;
  1073. ivprog.CLOSE_CURLY = 27;
  1074. ivprog.COMMA = 28;
  1075. ivprog.EQUAL = 29;
  1076. ivprog.SUM_OP = 30;
  1077. ivprog.MULTI_OP = 31;
  1078. ivprog.AND_OPERATOR = 32;
  1079. ivprog.OR_OPERATOR = 33;
  1080. ivprog.RELATIONAL_OPERATOR = 34;
  1081. ivprog.COLON = 35;
  1082. ivprog.NOT_OPERATOR = 36;
  1083. ivprog.ID = 37;
  1084. ivprog.LIB_ID = 38;
  1085. ivprog.INTEGER = 39;
  1086. ivprog.REAL = 40;
  1087. ivprog.STRING = 41;
  1088. ivprog.CHARACTER = 42;
  1089. ivprog.WHITESPACE = 43;
  1090. ivprog.EOS = 44;
  1091. ivprog.COMMENTS = 45;
  1092. ivprog.prototype.channelNames = [ "DEFAULT_TOKEN_CHANNEL", "HIDDEN" ];
  1093. ivprog.prototype.modeNames = [ "DEFAULT_MODE" ];
  1094. ivprog.prototype.literalNames = [ null, "'programa'", "'real'", "'vazio'",
  1095. "'logico'", "'cadeia'", "'inteiro'", "'caractere'",
  1096. "'escolha'", "'caso'", "'contrario'",
  1097. "'const'", "'funcao'", "'retorne'", "'para'",
  1098. "'pare'", "'faca'", "'enquanto'", "'se'",
  1099. "'senao'", "'falso'", "'verdadeiro'",
  1100. "'('", "')'", "'['", "']'", "'{'", "'}'",
  1101. "','", "'='", null, null, null, null,
  1102. null, "':'" ];
  1103. ivprog.prototype.symbolicNames = [ null, "RK_PROGRAM", "RK_REAL", "RK_VOID",
  1104. "RK_BOOLEAN", "RK_STRING", "RK_INTEGER",
  1105. "RK_CHARACTER", "RK_SWITCH", "RK_CASE",
  1106. "RK_DEFAULT", "RK_CONST", "RK_FUNCTION",
  1107. "RK_RETURN", "RK_FOR", "RK_BREAK", "RK_DO",
  1108. "RK_WHILE", "RK_IF", "RK_ELSE", "RK_FALSE",
  1109. "RK_TRUE", "OPEN_PARENTHESIS", "CLOSE_PARENTHESIS",
  1110. "OPEN_BRACE", "CLOSE_BRACE", "OPEN_CURLY",
  1111. "CLOSE_CURLY", "COMMA", "EQUAL", "SUM_OP",
  1112. "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  1113. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  1114. "ID", "LIB_ID", "INTEGER", "REAL", "STRING",
  1115. "CHARACTER", "WHITESPACE", "EOS", "COMMENTS" ];
  1116. ivprog.prototype.ruleNames = [ "RK_PROGRAM", "RK_REAL", "RK_VOID", "RK_BOOLEAN",
  1117. "RK_STRING", "RK_INTEGER", "RK_CHARACTER",
  1118. "RK_SWITCH", "RK_CASE", "RK_DEFAULT", "RK_CONST",
  1119. "RK_FUNCTION", "RK_RETURN", "RK_FOR", "RK_BREAK",
  1120. "RK_DO", "RK_WHILE", "RK_IF", "RK_ELSE",
  1121. "RK_FALSE", "RK_TRUE", "RK_LOGICAL_NOT",
  1122. "RK_LOGICAL_AND", "RK_LOGICAL_OR", "OPEN_PARENTHESIS",
  1123. "CLOSE_PARENTHESIS", "OPEN_BRACE", "CLOSE_BRACE",
  1124. "OPEN_CURLY", "CLOSE_CURLY", "COMMA", "EQUAL",
  1125. "SUM_OP", "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  1126. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  1127. "ID", "LIB_ID", "INTEGER", "REAL", "ExponentPart",
  1128. "STRING", "STRING_CHARACTER", "CHARACTER",
  1129. "WHITESPACE", "SEMICOLON", "EOS", "HEX_DIGIT",
  1130. "OCTAL_DIGIT", "ESC_SEQ", "ESC_OCTAL", "ESC_UNICODE",
  1131. "COMMENTS" ];
  1132. ivprog.prototype.grammarFileName = "ivprog.g4";
  1133. exports.ivprog = ivprog;
  1134. /***/ }),
  1135. /* 1 */
  1136. /***/ (function(module, exports, __webpack_require__) {
  1137. module.exports = {
  1138. ivprog: __webpack_require__(0).ivprog
  1139. };
  1140. /***/ }),
  1141. /* 2 */
  1142. /***/ (function(module, exports) {
  1143. module.exports = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js");
  1144. /***/ })
  1145. /******/ ]);
  1146. /***/ }),
  1147. /***/ "./grammar/es/langFunctions.js":
  1148. /*!*************************************!*\
  1149. !*** ./grammar/es/langFunctions.js ***!
  1150. \*************************************/
  1151. /*! exports provided: default */
  1152. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1153. "use strict";
  1154. __webpack_require__.r(__webpack_exports__);
  1155. /* This is a dictionary of the language defined functions
  1156. **/
  1157. /* harmony default export */ __webpack_exports__["default"] = ({
  1158. main_function: "inicio",
  1159. $read: "leia",
  1160. $write: "escreva",
  1161. $numElements: "total_of_elements",
  1162. $matrixLines: "total_of_lines",
  1163. $matrixColumns: "total_of_columns",
  1164. $substring: "subcadeia",
  1165. $length: "comprimento",
  1166. $uppercase: "caixa_alta",
  1167. $lowercase: "caixa_baixa",
  1168. $charAt: "char_at",
  1169. $isReal: "is_real",
  1170. $isInt: "is_integer",
  1171. $isBool: "is_logic",
  1172. $castReal: "to_real",
  1173. $castInt: "to_integer",
  1174. $castBool: "to_logic",
  1175. $castString: "to_string",
  1176. $sin: "sin",
  1177. $cos: "cos",
  1178. $tan: "tan",
  1179. $sqrt: "sqrt",
  1180. $pow: "pow",
  1181. $log: "log",
  1182. $abs: "abs",
  1183. $negate: "negate",
  1184. $invert: "invert",
  1185. $max: "maximum",
  1186. $min: "minimum"
  1187. });
  1188. /***/ }),
  1189. /***/ "./grammar/es/langLibs.js":
  1190. /*!********************************!*\
  1191. !*** ./grammar/es/langLibs.js ***!
  1192. \********************************/
  1193. /*! exports provided: default */
  1194. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1195. "use strict";
  1196. __webpack_require__.r(__webpack_exports__);
  1197. /**
  1198. * This is the dictionary of the language defined libraries
  1199. */
  1200. /* harmony default export */ __webpack_exports__["default"] = ({
  1201. $mathLib: "Mathematic",
  1202. $ioLib: "ES",
  1203. $strLib: "Texto",
  1204. $arrayLib: "Arranjo",
  1205. $langLib: "Conversion"
  1206. });
  1207. /***/ }),
  1208. /***/ "./grammar/index.js":
  1209. /*!**************************!*\
  1210. !*** ./grammar/index.js ***!
  1211. \**************************/
  1212. /*! exports provided: default */
  1213. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1214. "use strict";
  1215. __webpack_require__.r(__webpack_exports__);
  1216. /* harmony import */ var _pt_ivprog_g4__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./pt/ivprog.g4 */ "./grammar/pt/ivprog.g4");
  1217. /* harmony import */ var _pt_ivprog_g4__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_pt_ivprog_g4__WEBPACK_IMPORTED_MODULE_0__);
  1218. /* harmony import */ var _pt_langFunctions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./pt/langFunctions */ "./grammar/pt/langFunctions.js");
  1219. /* harmony import */ var _pt_langLibs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./pt/langLibs */ "./grammar/pt/langLibs.js");
  1220. /* harmony import */ var _en_ivprog_g4__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./en/ivprog.g4 */ "./grammar/en/ivprog.g4");
  1221. /* harmony import */ var _en_ivprog_g4__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_en_ivprog_g4__WEBPACK_IMPORTED_MODULE_3__);
  1222. /* harmony import */ var _en_langFunctions__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./en/langFunctions */ "./grammar/en/langFunctions.js");
  1223. /* harmony import */ var _en_langLibs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./en/langLibs */ "./grammar/en/langLibs.js");
  1224. /* harmony import */ var _es_ivprog_g4__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./es/ivprog.g4 */ "./grammar/es/ivprog.g4");
  1225. /* harmony import */ var _es_ivprog_g4__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_es_ivprog_g4__WEBPACK_IMPORTED_MODULE_6__);
  1226. /* harmony import */ var _es_langFunctions__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./es/langFunctions */ "./grammar/es/langFunctions.js");
  1227. /* harmony import */ var _es_langLibs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./es/langLibs */ "./grammar/es/langLibs.js");
  1228. /* harmony default export */ __webpack_exports__["default"] = ({
  1229. pt: {
  1230. lexer: _pt_ivprog_g4__WEBPACK_IMPORTED_MODULE_0__["ivprog"],
  1231. langFuncs: _pt_langFunctions__WEBPACK_IMPORTED_MODULE_1__["default"],
  1232. langLibs: _pt_langLibs__WEBPACK_IMPORTED_MODULE_2__["default"]
  1233. },
  1234. en: {
  1235. lexer: _en_ivprog_g4__WEBPACK_IMPORTED_MODULE_3__["ivprog"],
  1236. langFuncs: _en_langFunctions__WEBPACK_IMPORTED_MODULE_4__["default"],
  1237. langLibs: _en_langLibs__WEBPACK_IMPORTED_MODULE_5__["default"]
  1238. },
  1239. es: {
  1240. lexer: _es_ivprog_g4__WEBPACK_IMPORTED_MODULE_6__["ivprog"],
  1241. langFuncs: _es_langFunctions__WEBPACK_IMPORTED_MODULE_7__["default"],
  1242. langLibs: _es_langLibs__WEBPACK_IMPORTED_MODULE_8__["default"]
  1243. }
  1244. });
  1245. /***/ }),
  1246. /***/ "./grammar/pt/ivprog.g4":
  1247. /*!******************************!*\
  1248. !*** ./grammar/pt/ivprog.g4 ***!
  1249. \******************************/
  1250. /*! no static exports found */
  1251. /***/ (function(module, exports, __webpack_require__) {
  1252. module.exports =
  1253. /******/ (function(modules) { // webpackBootstrap
  1254. /******/ // The module cache
  1255. /******/ var installedModules = {};
  1256. /******/
  1257. /******/ // The require function
  1258. /******/ function __webpack_require__(moduleId) {
  1259. /******/
  1260. /******/ // Check if module is in cache
  1261. /******/ if(installedModules[moduleId]) {
  1262. /******/ return installedModules[moduleId].exports;
  1263. /******/ }
  1264. /******/ // Create a new module (and put it into the cache)
  1265. /******/ var module = installedModules[moduleId] = {
  1266. /******/ i: moduleId,
  1267. /******/ l: false,
  1268. /******/ exports: {}
  1269. /******/ };
  1270. /******/
  1271. /******/ // Execute the module function
  1272. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  1273. /******/
  1274. /******/ // Flag the module as loaded
  1275. /******/ module.l = true;
  1276. /******/
  1277. /******/ // Return the exports of the module
  1278. /******/ return module.exports;
  1279. /******/ }
  1280. /******/
  1281. /******/
  1282. /******/ // expose the modules object (__webpack_modules__)
  1283. /******/ __webpack_require__.m = modules;
  1284. /******/
  1285. /******/ // expose the module cache
  1286. /******/ __webpack_require__.c = installedModules;
  1287. /******/
  1288. /******/ // identity function for calling harmony imports with the correct context
  1289. /******/ __webpack_require__.i = function(value) { return value; };
  1290. /******/
  1291. /******/ // define getter function for harmony exports
  1292. /******/ __webpack_require__.d = function(exports, name, getter) {
  1293. /******/ if(!__webpack_require__.o(exports, name)) {
  1294. /******/ Object.defineProperty(exports, name, {
  1295. /******/ configurable: false,
  1296. /******/ enumerable: true,
  1297. /******/ get: getter
  1298. /******/ });
  1299. /******/ }
  1300. /******/ };
  1301. /******/
  1302. /******/ // getDefaultExport function for compatibility with non-harmony modules
  1303. /******/ __webpack_require__.n = function(module) {
  1304. /******/ var getter = module && module.__esModule ?
  1305. /******/ function getDefault() { return module['default']; } :
  1306. /******/ function getModuleExports() { return module; };
  1307. /******/ __webpack_require__.d(getter, 'a', getter);
  1308. /******/ return getter;
  1309. /******/ };
  1310. /******/
  1311. /******/ // Object.prototype.hasOwnProperty.call
  1312. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  1313. /******/
  1314. /******/ // __webpack_public_path__
  1315. /******/ __webpack_require__.p = "";
  1316. /******/
  1317. /******/ // Load entry module and return exports
  1318. /******/ return __webpack_require__(__webpack_require__.s = 1);
  1319. /******/ })
  1320. /************************************************************************/
  1321. /******/ ([
  1322. /* 0 */
  1323. /***/ (function(module, exports, __webpack_require__) {
  1324. // Generated from /tmp/tmp-72166QyyDqKitOY8/ivprog.g4 by ANTLR 4.7
  1325. // jshint ignore: start
  1326. var antlr4 = __webpack_require__(2);
  1327. var serializedATN = ["\u0003\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964",
  1328. "\u0002/\u01dc\b\u0001\u0004\u0002\t\u0002\u0004\u0003\t\u0003\u0004",
  1329. "\u0004\t\u0004\u0004\u0005\t\u0005\u0004\u0006\t\u0006\u0004\u0007\t",
  1330. "\u0007\u0004\b\t\b\u0004\t\t\t\u0004\n\t\n\u0004\u000b\t\u000b\u0004",
  1331. "\f\t\f\u0004\r\t\r\u0004\u000e\t\u000e\u0004\u000f\t\u000f\u0004\u0010",
  1332. "\t\u0010\u0004\u0011\t\u0011\u0004\u0012\t\u0012\u0004\u0013\t\u0013",
  1333. "\u0004\u0014\t\u0014\u0004\u0015\t\u0015\u0004\u0016\t\u0016\u0004\u0017",
  1334. "\t\u0017\u0004\u0018\t\u0018\u0004\u0019\t\u0019\u0004\u001a\t\u001a",
  1335. "\u0004\u001b\t\u001b\u0004\u001c\t\u001c\u0004\u001d\t\u001d\u0004\u001e",
  1336. "\t\u001e\u0004\u001f\t\u001f\u0004 \t \u0004!\t!\u0004\"\t\"\u0004#",
  1337. "\t#\u0004$\t$\u0004%\t%\u0004&\t&\u0004\'\t\'\u0004(\t(\u0004)\t)\u0004",
  1338. "*\t*\u0004+\t+\u0004,\t,\u0004-\t-\u0004.\t.\u0004/\t/\u00040\t0\u0004",
  1339. "1\t1\u00042\t2\u00043\t3\u00044\t4\u00045\t5\u00046\t6\u00047\t7\u0004",
  1340. "8\t8\u00049\t9\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003",
  1341. "\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0003\u0003",
  1342. "\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0004\u0003\u0004\u0003",
  1343. "\u0004\u0003\u0004\u0003\u0004\u0003\u0004\u0003\u0005\u0003\u0005\u0003",
  1344. "\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0006\u0003",
  1345. "\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003",
  1346. "\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003",
  1347. "\u0007\u0003\u0007\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003",
  1348. "\b\u0003\b\u0003\b\u0003\b\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0003",
  1349. "\t\u0003\t\u0003\t\u0003\n\u0003\n\u0003\n\u0003\n\u0003\n\u0003\u000b",
  1350. "\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b",
  1351. "\u0003\u000b\u0003\u000b\u0003\u000b\u0003\f\u0003\f\u0003\f\u0003\f",
  1352. "\u0003\f\u0003\f\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003",
  1353. "\r\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003",
  1354. "\u000e\u0003\u000e\u0003\u000e\u0003\u000f\u0003\u000f\u0003\u000f\u0003",
  1355. "\u000f\u0003\u000f\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003",
  1356. "\u0010\u0003\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0003",
  1357. "\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003",
  1358. "\u0012\u0003\u0012\u0003\u0012\u0003\u0013\u0003\u0013\u0003\u0013\u0003",
  1359. "\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003",
  1360. "\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003",
  1361. "\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003",
  1362. "\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0017\u0003",
  1363. "\u0017\u0003\u0017\u0003\u0017\u0003\u0018\u0003\u0018\u0003\u0019\u0003",
  1364. "\u0019\u0003\u0019\u0003\u001a\u0003\u001a\u0003\u001b\u0003\u001b\u0003",
  1365. "\u001c\u0003\u001c\u0003\u001d\u0003\u001d\u0003\u001e\u0003\u001e\u0003",
  1366. "\u001f\u0003\u001f\u0003 \u0003 \u0003!\u0003!\u0003\"\u0003\"\u0003",
  1367. "#\u0003#\u0003$\u0003$\u0003%\u0003%\u0003&\u0003&\u0003&\u0003&\u0003",
  1368. "&\u0003&\u0003&\u0003&\u0003&\u0005&\u0130\n&\u0003\'\u0003\'\u0003",
  1369. "(\u0003(\u0003)\u0003)\u0007)\u0138\n)\f)\u000e)\u013b\u000b)\u0003",
  1370. "*\u0003*\u0003*\u0003*\u0003+\u0006+\u0142\n+\r+\u000e+\u0143\u0003",
  1371. "+\u0003+\u0003+\u0003+\u0005+\u014a\n+\u0003+\u0006+\u014d\n+\r+\u000e",
  1372. "+\u014e\u0003+\u0003+\u0003+\u0003+\u0005+\u0155\n+\u0003+\u0006+\u0158",
  1373. "\n+\r+\u000e+\u0159\u0005+\u015c\n+\u0003,\u0006,\u015f\n,\r,\u000e",
  1374. ",\u0160\u0003,\u0003,\u0006,\u0165\n,\r,\u000e,\u0166\u0003,\u0006,",
  1375. "\u016a\n,\r,\u000e,\u016b\u0003,\u0003,\u0007,\u0170\n,\f,\u000e,\u0173",
  1376. "\u000b,\u0003,\u0005,\u0176\n,\u0003-\u0003-\u0005-\u017a\n-\u0003-",
  1377. "\u0006-\u017d\n-\r-\u000e-\u017e\u0003.\u0003.\u0007.\u0183\n.\f.\u000e",
  1378. ".\u0186\u000b.\u0003.\u0003.\u0003/\u0003/\u0005/\u018c\n/\u00030\u0003",
  1379. "0\u00030\u00050\u0191\n0\u00030\u00030\u00031\u00031\u00031\u00031\u0003",
  1380. "2\u00032\u00033\u00063\u019c\n3\r3\u000e3\u019d\u00033\u00053\u01a1",
  1381. "\n3\u00034\u00034\u00035\u00035\u00036\u00036\u00036\u00036\u00056\u01ab",
  1382. "\n6\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u0003",
  1383. "7\u00037\u00057\u01b8\n7\u00038\u00038\u00038\u00038\u00038\u00038\u0003",
  1384. "8\u00039\u00039\u00039\u00039\u00079\u01c5\n9\f9\u000e9\u01c8\u000b",
  1385. "9\u00039\u00059\u01cb\n9\u00039\u00039\u00039\u00039\u00039\u00079\u01d2",
  1386. "\n9\f9\u000e9\u01d5\u000b9\u00039\u00039\u00059\u01d9\n9\u00039\u0003",
  1387. "9\u0003\u01d3\u0002:\u0003\u0003\u0005\u0004\u0007\u0005\t\u0006\u000b",
  1388. "\u0007\r\b\u000f\t\u0011\n\u0013\u000b\u0015\f\u0017\r\u0019\u000e\u001b",
  1389. "\u000f\u001d\u0010\u001f\u0011!\u0012#\u0013%\u0014\'\u0015)\u0016+",
  1390. "\u0017-\u0002/\u00021\u00023\u00185\u00197\u001a9\u001b;\u001c=\u001d",
  1391. "?\u001eA\u001fC E!G\"I#K$M%O&Q\'S(U)W*Y\u0002[+]\u0002_,a-c\u0002e.",
  1392. "g\u0002i\u0002k\u0002m\u0002o\u0002q/\u0003\u0002\u0012\u0004\u0002",
  1393. "--//\u0005\u0002\'\',,11\u0004\u0002>>@@\u0005\u0002C\\aac|\u0006\u0002",
  1394. "2;C\\aac|\u0003\u00022;\u0003\u000223\u0004\u0002GGgg\u0006\u0002\f",
  1395. "\f\u000f\u000f$$^^\u0006\u0002\f\f\u000f\u000f))^^\u0004\u0002\u000b",
  1396. "\u000b\"\"\u0004\u0002\f\f\u000f\u000f\u0005\u00022;CHch\u0003\u0002",
  1397. "29\n\u0002$$))^^ddhhppttvv\u0003\u000225\u0002\u01f0\u0002\u0003\u0003",
  1398. "\u0002\u0002\u0002\u0002\u0005\u0003\u0002\u0002\u0002\u0002\u0007\u0003",
  1399. "\u0002\u0002\u0002\u0002\t\u0003\u0002\u0002\u0002\u0002\u000b\u0003",
  1400. "\u0002\u0002\u0002\u0002\r\u0003\u0002\u0002\u0002\u0002\u000f\u0003",
  1401. "\u0002\u0002\u0002\u0002\u0011\u0003\u0002\u0002\u0002\u0002\u0013\u0003",
  1402. "\u0002\u0002\u0002\u0002\u0015\u0003\u0002\u0002\u0002\u0002\u0017\u0003",
  1403. "\u0002\u0002\u0002\u0002\u0019\u0003\u0002\u0002\u0002\u0002\u001b\u0003",
  1404. "\u0002\u0002\u0002\u0002\u001d\u0003\u0002\u0002\u0002\u0002\u001f\u0003",
  1405. "\u0002\u0002\u0002\u0002!\u0003\u0002\u0002\u0002\u0002#\u0003\u0002",
  1406. "\u0002\u0002\u0002%\u0003\u0002\u0002\u0002\u0002\'\u0003\u0002\u0002",
  1407. "\u0002\u0002)\u0003\u0002\u0002\u0002\u0002+\u0003\u0002\u0002\u0002",
  1408. "\u00023\u0003\u0002\u0002\u0002\u00025\u0003\u0002\u0002\u0002\u0002",
  1409. "7\u0003\u0002\u0002\u0002\u00029\u0003\u0002\u0002\u0002\u0002;\u0003",
  1410. "\u0002\u0002\u0002\u0002=\u0003\u0002\u0002\u0002\u0002?\u0003\u0002",
  1411. "\u0002\u0002\u0002A\u0003\u0002\u0002\u0002\u0002C\u0003\u0002\u0002",
  1412. "\u0002\u0002E\u0003\u0002\u0002\u0002\u0002G\u0003\u0002\u0002\u0002",
  1413. "\u0002I\u0003\u0002\u0002\u0002\u0002K\u0003\u0002\u0002\u0002\u0002",
  1414. "M\u0003\u0002\u0002\u0002\u0002O\u0003\u0002\u0002\u0002\u0002Q\u0003",
  1415. "\u0002\u0002\u0002\u0002S\u0003\u0002\u0002\u0002\u0002U\u0003\u0002",
  1416. "\u0002\u0002\u0002W\u0003\u0002\u0002\u0002\u0002[\u0003\u0002\u0002",
  1417. "\u0002\u0002_\u0003\u0002\u0002\u0002\u0002a\u0003\u0002\u0002\u0002",
  1418. "\u0002e\u0003\u0002\u0002\u0002\u0002q\u0003\u0002\u0002\u0002\u0003",
  1419. "s\u0003\u0002\u0002\u0002\u0005|\u0003\u0002\u0002\u0002\u0007\u0081",
  1420. "\u0003\u0002\u0002\u0002\t\u0087\u0003\u0002\u0002\u0002\u000b\u008e",
  1421. "\u0003\u0002\u0002\u0002\r\u0095\u0003\u0002\u0002\u0002\u000f\u009d",
  1422. "\u0003\u0002\u0002\u0002\u0011\u00a7\u0003\u0002\u0002\u0002\u0013\u00af",
  1423. "\u0003\u0002\u0002\u0002\u0015\u00b4\u0003\u0002\u0002\u0002\u0017\u00be",
  1424. "\u0003\u0002\u0002\u0002\u0019\u00c4\u0003\u0002\u0002\u0002\u001b\u00cb",
  1425. "\u0003\u0002\u0002\u0002\u001d\u00d3\u0003\u0002\u0002\u0002\u001f\u00d8",
  1426. "\u0003\u0002\u0002\u0002!\u00dd\u0003\u0002\u0002\u0002#\u00e2\u0003",
  1427. "\u0002\u0002\u0002%\u00eb\u0003\u0002\u0002\u0002\'\u00ee\u0003\u0002",
  1428. "\u0002\u0002)\u00f4\u0003\u0002\u0002\u0002+\u00fa\u0003\u0002\u0002",
  1429. "\u0002-\u0105\u0003\u0002\u0002\u0002/\u0109\u0003\u0002\u0002\u0002",
  1430. "1\u010b\u0003\u0002\u0002\u00023\u010e\u0003\u0002\u0002\u00025\u0110",
  1431. "\u0003\u0002\u0002\u00027\u0112\u0003\u0002\u0002\u00029\u0114\u0003",
  1432. "\u0002\u0002\u0002;\u0116\u0003\u0002\u0002\u0002=\u0118\u0003\u0002",
  1433. "\u0002\u0002?\u011a\u0003\u0002\u0002\u0002A\u011c\u0003\u0002\u0002",
  1434. "\u0002C\u011e\u0003\u0002\u0002\u0002E\u0120\u0003\u0002\u0002\u0002",
  1435. "G\u0122\u0003\u0002\u0002\u0002I\u0124\u0003\u0002\u0002\u0002K\u012f",
  1436. "\u0003\u0002\u0002\u0002M\u0131\u0003\u0002\u0002\u0002O\u0133\u0003",
  1437. "\u0002\u0002\u0002Q\u0135\u0003\u0002\u0002\u0002S\u013c\u0003\u0002",
  1438. "\u0002\u0002U\u015b\u0003\u0002\u0002\u0002W\u0175\u0003\u0002\u0002",
  1439. "\u0002Y\u0177\u0003\u0002\u0002\u0002[\u0180\u0003\u0002\u0002\u0002",
  1440. "]\u018b\u0003\u0002\u0002\u0002_\u018d\u0003\u0002\u0002\u0002a\u0194",
  1441. "\u0003\u0002\u0002\u0002c\u0198\u0003\u0002\u0002\u0002e\u01a0\u0003",
  1442. "\u0002\u0002\u0002g\u01a2\u0003\u0002\u0002\u0002i\u01a4\u0003\u0002",
  1443. "\u0002\u0002k\u01aa\u0003\u0002\u0002\u0002m\u01b7\u0003\u0002\u0002",
  1444. "\u0002o\u01b9\u0003\u0002\u0002\u0002q\u01d8\u0003\u0002\u0002\u0002",
  1445. "st\u0007r\u0002\u0002tu\u0007t\u0002\u0002uv\u0007q\u0002\u0002vw\u0007",
  1446. "i\u0002\u0002wx\u0007t\u0002\u0002xy\u0007c\u0002\u0002yz\u0007o\u0002",
  1447. "\u0002z{\u0007c\u0002\u0002{\u0004\u0003\u0002\u0002\u0002|}\u0007t",
  1448. "\u0002\u0002}~\u0007g\u0002\u0002~\u007f\u0007c\u0002\u0002\u007f\u0080",
  1449. "\u0007n\u0002\u0002\u0080\u0006\u0003\u0002\u0002\u0002\u0081\u0082",
  1450. "\u0007x\u0002\u0002\u0082\u0083\u0007c\u0002\u0002\u0083\u0084\u0007",
  1451. "|\u0002\u0002\u0084\u0085\u0007k\u0002\u0002\u0085\u0086\u0007q\u0002",
  1452. "\u0002\u0086\b\u0003\u0002\u0002\u0002\u0087\u0088\u0007n\u0002\u0002",
  1453. "\u0088\u0089\u0007q\u0002\u0002\u0089\u008a\u0007i\u0002\u0002\u008a",
  1454. "\u008b\u0007k\u0002\u0002\u008b\u008c\u0007e\u0002\u0002\u008c\u008d",
  1455. "\u0007q\u0002\u0002\u008d\n\u0003\u0002\u0002\u0002\u008e\u008f\u0007",
  1456. "e\u0002\u0002\u008f\u0090\u0007c\u0002\u0002\u0090\u0091\u0007f\u0002",
  1457. "\u0002\u0091\u0092\u0007g\u0002\u0002\u0092\u0093\u0007k\u0002\u0002",
  1458. "\u0093\u0094\u0007c\u0002\u0002\u0094\f\u0003\u0002\u0002\u0002\u0095",
  1459. "\u0096\u0007k\u0002\u0002\u0096\u0097\u0007p\u0002\u0002\u0097\u0098",
  1460. "\u0007v\u0002\u0002\u0098\u0099\u0007g\u0002\u0002\u0099\u009a\u0007",
  1461. "k\u0002\u0002\u009a\u009b\u0007t\u0002\u0002\u009b\u009c\u0007q\u0002",
  1462. "\u0002\u009c\u000e\u0003\u0002\u0002\u0002\u009d\u009e\u0007e\u0002",
  1463. "\u0002\u009e\u009f\u0007c\u0002\u0002\u009f\u00a0\u0007t\u0002\u0002",
  1464. "\u00a0\u00a1\u0007c\u0002\u0002\u00a1\u00a2\u0007e\u0002\u0002\u00a2",
  1465. "\u00a3\u0007v\u0002\u0002\u00a3\u00a4\u0007g\u0002\u0002\u00a4\u00a5",
  1466. "\u0007t\u0002\u0002\u00a5\u00a6\u0007g\u0002\u0002\u00a6\u0010\u0003",
  1467. "\u0002\u0002\u0002\u00a7\u00a8\u0007g\u0002\u0002\u00a8\u00a9\u0007",
  1468. "u\u0002\u0002\u00a9\u00aa\u0007e\u0002\u0002\u00aa\u00ab\u0007q\u0002",
  1469. "\u0002\u00ab\u00ac\u0007n\u0002\u0002\u00ac\u00ad\u0007j\u0002\u0002",
  1470. "\u00ad\u00ae\u0007c\u0002\u0002\u00ae\u0012\u0003\u0002\u0002\u0002",
  1471. "\u00af\u00b0\u0007e\u0002\u0002\u00b0\u00b1\u0007c\u0002\u0002\u00b1",
  1472. "\u00b2\u0007u\u0002\u0002\u00b2\u00b3\u0007q\u0002\u0002\u00b3\u0014",
  1473. "\u0003\u0002\u0002\u0002\u00b4\u00b5\u0007e\u0002\u0002\u00b5\u00b6",
  1474. "\u0007q\u0002\u0002\u00b6\u00b7\u0007p\u0002\u0002\u00b7\u00b8\u0007",
  1475. "v\u0002\u0002\u00b8\u00b9\u0007t\u0002\u0002\u00b9\u00ba\u0007c\u0002",
  1476. "\u0002\u00ba\u00bb\u0007t\u0002\u0002\u00bb\u00bc\u0007k\u0002\u0002",
  1477. "\u00bc\u00bd\u0007q\u0002\u0002\u00bd\u0016\u0003\u0002\u0002\u0002",
  1478. "\u00be\u00bf\u0007e\u0002\u0002\u00bf\u00c0\u0007q\u0002\u0002\u00c0",
  1479. "\u00c1\u0007p\u0002\u0002\u00c1\u00c2\u0007u\u0002\u0002\u00c2\u00c3",
  1480. "\u0007v\u0002\u0002\u00c3\u0018\u0003\u0002\u0002\u0002\u00c4\u00c5",
  1481. "\u0007h\u0002\u0002\u00c5\u00c6\u0007w\u0002\u0002\u00c6\u00c7\u0007",
  1482. "p\u0002\u0002\u00c7\u00c8\u0007e\u0002\u0002\u00c8\u00c9\u0007c\u0002",
  1483. "\u0002\u00c9\u00ca\u0007q\u0002\u0002\u00ca\u001a\u0003\u0002\u0002",
  1484. "\u0002\u00cb\u00cc\u0007t\u0002\u0002\u00cc\u00cd\u0007g\u0002\u0002",
  1485. "\u00cd\u00ce\u0007v\u0002\u0002\u00ce\u00cf\u0007q\u0002\u0002\u00cf",
  1486. "\u00d0\u0007t\u0002\u0002\u00d0\u00d1\u0007p\u0002\u0002\u00d1\u00d2",
  1487. "\u0007g\u0002\u0002\u00d2\u001c\u0003\u0002\u0002\u0002\u00d3\u00d4",
  1488. "\u0007r\u0002\u0002\u00d4\u00d5\u0007c\u0002\u0002\u00d5\u00d6\u0007",
  1489. "t\u0002\u0002\u00d6\u00d7\u0007c\u0002\u0002\u00d7\u001e\u0003\u0002",
  1490. "\u0002\u0002\u00d8\u00d9\u0007r\u0002\u0002\u00d9\u00da\u0007c\u0002",
  1491. "\u0002\u00da\u00db\u0007t\u0002\u0002\u00db\u00dc\u0007g\u0002\u0002",
  1492. "\u00dc \u0003\u0002\u0002\u0002\u00dd\u00de\u0007h\u0002\u0002\u00de",
  1493. "\u00df\u0007c\u0002\u0002\u00df\u00e0\u0007e\u0002\u0002\u00e0\u00e1",
  1494. "\u0007c\u0002\u0002\u00e1\"\u0003\u0002\u0002\u0002\u00e2\u00e3\u0007",
  1495. "g\u0002\u0002\u00e3\u00e4\u0007p\u0002\u0002\u00e4\u00e5\u0007s\u0002",
  1496. "\u0002\u00e5\u00e6\u0007w\u0002\u0002\u00e6\u00e7\u0007c\u0002\u0002",
  1497. "\u00e7\u00e8\u0007p\u0002\u0002\u00e8\u00e9\u0007v\u0002\u0002\u00e9",
  1498. "\u00ea\u0007q\u0002\u0002\u00ea$\u0003\u0002\u0002\u0002\u00eb\u00ec",
  1499. "\u0007u\u0002\u0002\u00ec\u00ed\u0007g\u0002\u0002\u00ed&\u0003\u0002",
  1500. "\u0002\u0002\u00ee\u00ef\u0007u\u0002\u0002\u00ef\u00f0\u0007g\u0002",
  1501. "\u0002\u00f0\u00f1\u0007p\u0002\u0002\u00f1\u00f2\u0007c\u0002\u0002",
  1502. "\u00f2\u00f3\u0007q\u0002\u0002\u00f3(\u0003\u0002\u0002\u0002\u00f4",
  1503. "\u00f5\u0007h\u0002\u0002\u00f5\u00f6\u0007c\u0002\u0002\u00f6\u00f7",
  1504. "\u0007n\u0002\u0002\u00f7\u00f8\u0007u\u0002\u0002\u00f8\u00f9\u0007",
  1505. "q\u0002\u0002\u00f9*\u0003\u0002\u0002\u0002\u00fa\u00fb\u0007x\u0002",
  1506. "\u0002\u00fb\u00fc\u0007g\u0002\u0002\u00fc\u00fd\u0007t\u0002\u0002",
  1507. "\u00fd\u00fe\u0007f\u0002\u0002\u00fe\u00ff\u0007c\u0002\u0002\u00ff",
  1508. "\u0100\u0007f\u0002\u0002\u0100\u0101\u0007g\u0002\u0002\u0101\u0102",
  1509. "\u0007k\u0002\u0002\u0102\u0103\u0007t\u0002\u0002\u0103\u0104\u0007",
  1510. "q\u0002\u0002\u0104,\u0003\u0002\u0002\u0002\u0105\u0106\u0007p\u0002",
  1511. "\u0002\u0106\u0107\u0007c\u0002\u0002\u0107\u0108\u0007q\u0002\u0002",
  1512. "\u0108.\u0003\u0002\u0002\u0002\u0109\u010a\u0007G\u0002\u0002\u010a",
  1513. "0\u0003\u0002\u0002\u0002\u010b\u010c\u0007Q\u0002\u0002\u010c\u010d",
  1514. "\u0007W\u0002\u0002\u010d2\u0003\u0002\u0002\u0002\u010e\u010f\u0007",
  1515. "*\u0002\u0002\u010f4\u0003\u0002\u0002\u0002\u0110\u0111\u0007+\u0002",
  1516. "\u0002\u01116\u0003\u0002\u0002\u0002\u0112\u0113\u0007]\u0002\u0002",
  1517. "\u01138\u0003\u0002\u0002\u0002\u0114\u0115\u0007_\u0002\u0002\u0115",
  1518. ":\u0003\u0002\u0002\u0002\u0116\u0117\u0007}\u0002\u0002\u0117<\u0003",
  1519. "\u0002\u0002\u0002\u0118\u0119\u0007\u007f\u0002\u0002\u0119>\u0003",
  1520. "\u0002\u0002\u0002\u011a\u011b\u0007.\u0002\u0002\u011b@\u0003\u0002",
  1521. "\u0002\u0002\u011c\u011d\u0007?\u0002\u0002\u011dB\u0003\u0002\u0002",
  1522. "\u0002\u011e\u011f\t\u0002\u0002\u0002\u011fD\u0003\u0002\u0002\u0002",
  1523. "\u0120\u0121\t\u0003\u0002\u0002\u0121F\u0003\u0002\u0002\u0002\u0122",
  1524. "\u0123\u0005/\u0018\u0002\u0123H\u0003\u0002\u0002\u0002\u0124\u0125",
  1525. "\u00051\u0019\u0002\u0125J\u0003\u0002\u0002\u0002\u0126\u0127\u0007",
  1526. "@\u0002\u0002\u0127\u0130\u0007?\u0002\u0002\u0128\u0129\u0007?\u0002",
  1527. "\u0002\u0129\u0130\u0007?\u0002\u0002\u012a\u012b\u0007>\u0002\u0002",
  1528. "\u012b\u0130\u0007?\u0002\u0002\u012c\u0130\t\u0004\u0002\u0002\u012d",
  1529. "\u012e\u0007#\u0002\u0002\u012e\u0130\u0007?\u0002\u0002\u012f\u0126",
  1530. "\u0003\u0002\u0002\u0002\u012f\u0128\u0003\u0002\u0002\u0002\u012f\u012a",
  1531. "\u0003\u0002\u0002\u0002\u012f\u012c\u0003\u0002\u0002\u0002\u012f\u012d",
  1532. "\u0003\u0002\u0002\u0002\u0130L\u0003\u0002\u0002\u0002\u0131\u0132",
  1533. "\u0007<\u0002\u0002\u0132N\u0003\u0002\u0002\u0002\u0133\u0134\u0005",
  1534. "-\u0017\u0002\u0134P\u0003\u0002\u0002\u0002\u0135\u0139\t\u0005\u0002",
  1535. "\u0002\u0136\u0138\t\u0006\u0002\u0002\u0137\u0136\u0003\u0002\u0002",
  1536. "\u0002\u0138\u013b\u0003\u0002\u0002\u0002\u0139\u0137\u0003\u0002\u0002",
  1537. "\u0002\u0139\u013a\u0003\u0002\u0002\u0002\u013aR\u0003\u0002\u0002",
  1538. "\u0002\u013b\u0139\u0003\u0002\u0002\u0002\u013c\u013d\u0005Q)\u0002",
  1539. "\u013d\u013e\u00070\u0002\u0002\u013e\u013f\u0005Q)\u0002\u013fT\u0003",
  1540. "\u0002\u0002\u0002\u0140\u0142\t\u0007\u0002\u0002\u0141\u0140\u0003",
  1541. "\u0002\u0002\u0002\u0142\u0143\u0003\u0002\u0002\u0002\u0143\u0141\u0003",
  1542. "\u0002\u0002\u0002\u0143\u0144\u0003\u0002\u0002\u0002\u0144\u015c\u0003",
  1543. "\u0002\u0002\u0002\u0145\u0146\u00072\u0002\u0002\u0146\u014a\u0007",
  1544. "z\u0002\u0002\u0147\u0148\u00072\u0002\u0002\u0148\u014a\u0007Z\u0002",
  1545. "\u0002\u0149\u0145\u0003\u0002\u0002\u0002\u0149\u0147\u0003\u0002\u0002",
  1546. "\u0002\u014a\u014c\u0003\u0002\u0002\u0002\u014b\u014d\u0005g4\u0002",
  1547. "\u014c\u014b\u0003\u0002\u0002\u0002\u014d\u014e\u0003\u0002\u0002\u0002",
  1548. "\u014e\u014c\u0003\u0002\u0002\u0002\u014e\u014f\u0003\u0002\u0002\u0002",
  1549. "\u014f\u015c\u0003\u0002\u0002\u0002\u0150\u0151\u00072\u0002\u0002",
  1550. "\u0151\u0155\u0007d\u0002\u0002\u0152\u0153\u00072\u0002\u0002\u0153",
  1551. "\u0155\u0007D\u0002\u0002\u0154\u0150\u0003\u0002\u0002\u0002\u0154",
  1552. "\u0152\u0003\u0002\u0002\u0002\u0155\u0157\u0003\u0002\u0002\u0002\u0156",
  1553. "\u0158\t\b\u0002\u0002\u0157\u0156\u0003\u0002\u0002\u0002\u0158\u0159",
  1554. "\u0003\u0002\u0002\u0002\u0159\u0157\u0003\u0002\u0002\u0002\u0159\u015a",
  1555. "\u0003\u0002\u0002\u0002\u015a\u015c\u0003\u0002\u0002\u0002\u015b\u0141",
  1556. "\u0003\u0002\u0002\u0002\u015b\u0149\u0003\u0002\u0002\u0002\u015b\u0154",
  1557. "\u0003\u0002\u0002\u0002\u015cV\u0003\u0002\u0002\u0002\u015d\u015f",
  1558. "\t\u0007\u0002\u0002\u015e\u015d\u0003\u0002\u0002\u0002\u015f\u0160",
  1559. "\u0003\u0002\u0002\u0002\u0160\u015e\u0003\u0002\u0002\u0002\u0160\u0161",
  1560. "\u0003\u0002\u0002\u0002\u0161\u0162\u0003\u0002\u0002\u0002\u0162\u0164",
  1561. "\u00070\u0002\u0002\u0163\u0165\t\u0007\u0002\u0002\u0164\u0163\u0003",
  1562. "\u0002\u0002\u0002\u0165\u0166\u0003\u0002\u0002\u0002\u0166\u0164\u0003",
  1563. "\u0002\u0002\u0002\u0166\u0167\u0003\u0002\u0002\u0002\u0167\u0176\u0003",
  1564. "\u0002\u0002\u0002\u0168\u016a\t\u0007\u0002\u0002\u0169\u0168\u0003",
  1565. "\u0002\u0002\u0002\u016a\u016b\u0003\u0002\u0002\u0002\u016b\u0169\u0003",
  1566. "\u0002\u0002\u0002\u016b\u016c\u0003\u0002\u0002\u0002\u016c\u016d\u0003",
  1567. "\u0002\u0002\u0002\u016d\u0171\u00070\u0002\u0002\u016e\u0170\t\u0007",
  1568. "\u0002\u0002\u016f\u016e\u0003\u0002\u0002\u0002\u0170\u0173\u0003\u0002",
  1569. "\u0002\u0002\u0171\u016f\u0003\u0002\u0002\u0002\u0171\u0172\u0003\u0002",
  1570. "\u0002\u0002\u0172\u0174\u0003\u0002\u0002\u0002\u0173\u0171\u0003\u0002",
  1571. "\u0002\u0002\u0174\u0176\u0005Y-\u0002\u0175\u015e\u0003\u0002\u0002",
  1572. "\u0002\u0175\u0169\u0003\u0002\u0002\u0002\u0176X\u0003\u0002\u0002",
  1573. "\u0002\u0177\u0179\t\t\u0002\u0002\u0178\u017a\t\u0002\u0002\u0002\u0179",
  1574. "\u0178\u0003\u0002\u0002\u0002\u0179\u017a\u0003\u0002\u0002\u0002\u017a",
  1575. "\u017c\u0003\u0002\u0002\u0002\u017b\u017d\t\u0007\u0002\u0002\u017c",
  1576. "\u017b\u0003\u0002\u0002\u0002\u017d\u017e\u0003\u0002\u0002\u0002\u017e",
  1577. "\u017c\u0003\u0002\u0002\u0002\u017e\u017f\u0003\u0002\u0002\u0002\u017f",
  1578. "Z\u0003\u0002\u0002\u0002\u0180\u0184\u0007$\u0002\u0002\u0181\u0183",
  1579. "\u0005]/\u0002\u0182\u0181\u0003\u0002\u0002\u0002\u0183\u0186\u0003",
  1580. "\u0002\u0002\u0002\u0184\u0182\u0003\u0002\u0002\u0002\u0184\u0185\u0003",
  1581. "\u0002\u0002\u0002\u0185\u0187\u0003\u0002\u0002\u0002\u0186\u0184\u0003",
  1582. "\u0002\u0002\u0002\u0187\u0188\u0007$\u0002\u0002\u0188\\\u0003\u0002",
  1583. "\u0002\u0002\u0189\u018c\n\n\u0002\u0002\u018a\u018c\u0005k6\u0002\u018b",
  1584. "\u0189\u0003\u0002\u0002\u0002\u018b\u018a\u0003\u0002\u0002\u0002\u018c",
  1585. "^\u0003\u0002\u0002\u0002\u018d\u0190\u0007)\u0002\u0002\u018e\u0191",
  1586. "\u0005k6\u0002\u018f\u0191\n\u000b\u0002\u0002\u0190\u018e\u0003\u0002",
  1587. "\u0002\u0002\u0190\u018f\u0003\u0002\u0002\u0002\u0191\u0192\u0003\u0002",
  1588. "\u0002\u0002\u0192\u0193\u0007)\u0002\u0002\u0193`\u0003\u0002\u0002",
  1589. "\u0002\u0194\u0195\t\f\u0002\u0002\u0195\u0196\u0003\u0002\u0002\u0002",
  1590. "\u0196\u0197\b1\u0002\u0002\u0197b\u0003\u0002\u0002\u0002\u0198\u0199",
  1591. "\u0007=\u0002\u0002\u0199d\u0003\u0002\u0002\u0002\u019a\u019c\t\r\u0002",
  1592. "\u0002\u019b\u019a\u0003\u0002\u0002\u0002\u019c\u019d\u0003\u0002\u0002",
  1593. "\u0002\u019d\u019b\u0003\u0002\u0002\u0002\u019d\u019e\u0003\u0002\u0002",
  1594. "\u0002\u019e\u01a1\u0003\u0002\u0002\u0002\u019f\u01a1\u0005c2\u0002",
  1595. "\u01a0\u019b\u0003\u0002\u0002\u0002\u01a0\u019f\u0003\u0002\u0002\u0002",
  1596. "\u01a1f\u0003\u0002\u0002\u0002\u01a2\u01a3\t\u000e\u0002\u0002\u01a3",
  1597. "h\u0003\u0002\u0002\u0002\u01a4\u01a5\t\u000f\u0002\u0002\u01a5j\u0003",
  1598. "\u0002\u0002\u0002\u01a6\u01a7\u0007^\u0002\u0002\u01a7\u01ab\t\u0010",
  1599. "\u0002\u0002\u01a8\u01ab\u0005o8\u0002\u01a9\u01ab\u0005m7\u0002\u01aa",
  1600. "\u01a6\u0003\u0002\u0002\u0002\u01aa\u01a8\u0003\u0002\u0002\u0002\u01aa",
  1601. "\u01a9\u0003\u0002\u0002\u0002\u01abl\u0003\u0002\u0002\u0002\u01ac",
  1602. "\u01ad\u0007^\u0002\u0002\u01ad\u01ae\t\u0011\u0002\u0002\u01ae\u01af",
  1603. "\u0005i5\u0002\u01af\u01b0\u0005i5\u0002\u01b0\u01b8\u0003\u0002\u0002",
  1604. "\u0002\u01b1\u01b2\u0007^\u0002\u0002\u01b2\u01b3\u0005i5\u0002\u01b3",
  1605. "\u01b4\u0005i5\u0002\u01b4\u01b8\u0003\u0002\u0002\u0002\u01b5\u01b6",
  1606. "\u0007^\u0002\u0002\u01b6\u01b8\u0005i5\u0002\u01b7\u01ac\u0003\u0002",
  1607. "\u0002\u0002\u01b7\u01b1\u0003\u0002\u0002\u0002\u01b7\u01b5\u0003\u0002",
  1608. "\u0002\u0002\u01b8n\u0003\u0002\u0002\u0002\u01b9\u01ba\u0007^\u0002",
  1609. "\u0002\u01ba\u01bb\u0007w\u0002\u0002\u01bb\u01bc\u0005g4\u0002\u01bc",
  1610. "\u01bd\u0005g4\u0002\u01bd\u01be\u0005g4\u0002\u01be\u01bf\u0005g4\u0002",
  1611. "\u01bfp\u0003\u0002\u0002\u0002\u01c0\u01c1\u00071\u0002\u0002\u01c1",
  1612. "\u01c2\u00071\u0002\u0002\u01c2\u01c6\u0003\u0002\u0002\u0002\u01c3",
  1613. "\u01c5\n\r\u0002\u0002\u01c4\u01c3\u0003\u0002\u0002\u0002\u01c5\u01c8",
  1614. "\u0003\u0002\u0002\u0002\u01c6\u01c4\u0003\u0002\u0002\u0002\u01c6\u01c7",
  1615. "\u0003\u0002\u0002\u0002\u01c7\u01ca\u0003\u0002\u0002\u0002\u01c8\u01c6",
  1616. "\u0003\u0002\u0002\u0002\u01c9\u01cb\u0007\u000f\u0002\u0002\u01ca\u01c9",
  1617. "\u0003\u0002\u0002\u0002\u01ca\u01cb\u0003\u0002\u0002\u0002\u01cb\u01cc",
  1618. "\u0003\u0002\u0002\u0002\u01cc\u01d9\u0007\f\u0002\u0002\u01cd\u01ce",
  1619. "\u00071\u0002\u0002\u01ce\u01cf\u0007,\u0002\u0002\u01cf\u01d3\u0003",
  1620. "\u0002\u0002\u0002\u01d0\u01d2\u000b\u0002\u0002\u0002\u01d1\u01d0\u0003",
  1621. "\u0002\u0002\u0002\u01d2\u01d5\u0003\u0002\u0002\u0002\u01d3\u01d4\u0003",
  1622. "\u0002\u0002\u0002\u01d3\u01d1\u0003\u0002\u0002\u0002\u01d4\u01d6\u0003",
  1623. "\u0002\u0002\u0002\u01d5\u01d3\u0003\u0002\u0002\u0002\u01d6\u01d7\u0007",
  1624. ",\u0002\u0002\u01d7\u01d9\u00071\u0002\u0002\u01d8\u01c0\u0003\u0002",
  1625. "\u0002\u0002\u01d8\u01cd\u0003\u0002\u0002\u0002\u01d9\u01da\u0003\u0002",
  1626. "\u0002\u0002\u01da\u01db\b9\u0003\u0002\u01dbr\u0003\u0002\u0002\u0002",
  1627. "\u001d\u0002\u012f\u0139\u0143\u0149\u014e\u0154\u0159\u015b\u0160\u0166",
  1628. "\u016b\u0171\u0175\u0179\u017e\u0184\u018b\u0190\u019d\u01a0\u01aa\u01b7",
  1629. "\u01c6\u01ca\u01d3\u01d8\u0004\b\u0002\u0002\u0002\u0003\u0002"].join("");
  1630. var atn = new antlr4.atn.ATNDeserializer().deserialize(serializedATN);
  1631. var decisionsToDFA = atn.decisionToState.map( function(ds, index) { return new antlr4.dfa.DFA(ds, index); });
  1632. function ivprog(input) {
  1633. antlr4.Lexer.call(this, input);
  1634. this._interp = new antlr4.atn.LexerATNSimulator(this, atn, decisionsToDFA, new antlr4.PredictionContextCache());
  1635. return this;
  1636. }
  1637. ivprog.prototype = Object.create(antlr4.Lexer.prototype);
  1638. ivprog.prototype.constructor = ivprog;
  1639. ivprog.EOF = antlr4.Token.EOF;
  1640. ivprog.RK_PROGRAM = 1;
  1641. ivprog.RK_REAL = 2;
  1642. ivprog.RK_VOID = 3;
  1643. ivprog.RK_BOOLEAN = 4;
  1644. ivprog.RK_STRING = 5;
  1645. ivprog.RK_INTEGER = 6;
  1646. ivprog.RK_CHARACTER = 7;
  1647. ivprog.RK_SWITCH = 8;
  1648. ivprog.RK_CASE = 9;
  1649. ivprog.RK_DEFAULT = 10;
  1650. ivprog.RK_CONST = 11;
  1651. ivprog.RK_FUNCTION = 12;
  1652. ivprog.RK_RETURN = 13;
  1653. ivprog.RK_FOR = 14;
  1654. ivprog.RK_BREAK = 15;
  1655. ivprog.RK_DO = 16;
  1656. ivprog.RK_WHILE = 17;
  1657. ivprog.RK_IF = 18;
  1658. ivprog.RK_ELSE = 19;
  1659. ivprog.RK_FALSE = 20;
  1660. ivprog.RK_TRUE = 21;
  1661. ivprog.OPEN_PARENTHESIS = 22;
  1662. ivprog.CLOSE_PARENTHESIS = 23;
  1663. ivprog.OPEN_BRACE = 24;
  1664. ivprog.CLOSE_BRACE = 25;
  1665. ivprog.OPEN_CURLY = 26;
  1666. ivprog.CLOSE_CURLY = 27;
  1667. ivprog.COMMA = 28;
  1668. ivprog.EQUAL = 29;
  1669. ivprog.SUM_OP = 30;
  1670. ivprog.MULTI_OP = 31;
  1671. ivprog.AND_OPERATOR = 32;
  1672. ivprog.OR_OPERATOR = 33;
  1673. ivprog.RELATIONAL_OPERATOR = 34;
  1674. ivprog.COLON = 35;
  1675. ivprog.NOT_OPERATOR = 36;
  1676. ivprog.ID = 37;
  1677. ivprog.LIB_ID = 38;
  1678. ivprog.INTEGER = 39;
  1679. ivprog.REAL = 40;
  1680. ivprog.STRING = 41;
  1681. ivprog.CHARACTER = 42;
  1682. ivprog.WHITESPACE = 43;
  1683. ivprog.EOS = 44;
  1684. ivprog.COMMENTS = 45;
  1685. ivprog.prototype.channelNames = [ "DEFAULT_TOKEN_CHANNEL", "HIDDEN" ];
  1686. ivprog.prototype.modeNames = [ "DEFAULT_MODE" ];
  1687. ivprog.prototype.literalNames = [ null, "'programa'", "'real'", "'vazio'",
  1688. "'logico'", "'cadeia'", "'inteiro'", "'caractere'",
  1689. "'escolha'", "'caso'", "'contrario'",
  1690. "'const'", "'funcao'", "'retorne'", "'para'",
  1691. "'pare'", "'faca'", "'enquanto'", "'se'",
  1692. "'senao'", "'falso'", "'verdadeiro'",
  1693. "'('", "')'", "'['", "']'", "'{'", "'}'",
  1694. "','", "'='", null, null, null, null,
  1695. null, "':'" ];
  1696. ivprog.prototype.symbolicNames = [ null, "RK_PROGRAM", "RK_REAL", "RK_VOID",
  1697. "RK_BOOLEAN", "RK_STRING", "RK_INTEGER",
  1698. "RK_CHARACTER", "RK_SWITCH", "RK_CASE",
  1699. "RK_DEFAULT", "RK_CONST", "RK_FUNCTION",
  1700. "RK_RETURN", "RK_FOR", "RK_BREAK", "RK_DO",
  1701. "RK_WHILE", "RK_IF", "RK_ELSE", "RK_FALSE",
  1702. "RK_TRUE", "OPEN_PARENTHESIS", "CLOSE_PARENTHESIS",
  1703. "OPEN_BRACE", "CLOSE_BRACE", "OPEN_CURLY",
  1704. "CLOSE_CURLY", "COMMA", "EQUAL", "SUM_OP",
  1705. "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  1706. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  1707. "ID", "LIB_ID", "INTEGER", "REAL", "STRING",
  1708. "CHARACTER", "WHITESPACE", "EOS", "COMMENTS" ];
  1709. ivprog.prototype.ruleNames = [ "RK_PROGRAM", "RK_REAL", "RK_VOID", "RK_BOOLEAN",
  1710. "RK_STRING", "RK_INTEGER", "RK_CHARACTER",
  1711. "RK_SWITCH", "RK_CASE", "RK_DEFAULT", "RK_CONST",
  1712. "RK_FUNCTION", "RK_RETURN", "RK_FOR", "RK_BREAK",
  1713. "RK_DO", "RK_WHILE", "RK_IF", "RK_ELSE",
  1714. "RK_FALSE", "RK_TRUE", "RK_LOGICAL_NOT",
  1715. "RK_LOGICAL_AND", "RK_LOGICAL_OR", "OPEN_PARENTHESIS",
  1716. "CLOSE_PARENTHESIS", "OPEN_BRACE", "CLOSE_BRACE",
  1717. "OPEN_CURLY", "CLOSE_CURLY", "COMMA", "EQUAL",
  1718. "SUM_OP", "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  1719. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  1720. "ID", "LIB_ID", "INTEGER", "REAL", "ExponentPart",
  1721. "STRING", "STRING_CHARACTER", "CHARACTER",
  1722. "WHITESPACE", "SEMICOLON", "EOS", "HEX_DIGIT",
  1723. "OCTAL_DIGIT", "ESC_SEQ", "ESC_OCTAL", "ESC_UNICODE",
  1724. "COMMENTS" ];
  1725. ivprog.prototype.grammarFileName = "ivprog.g4";
  1726. exports.ivprog = ivprog;
  1727. /***/ }),
  1728. /* 1 */
  1729. /***/ (function(module, exports, __webpack_require__) {
  1730. module.exports = {
  1731. ivprog: __webpack_require__(0).ivprog
  1732. };
  1733. /***/ }),
  1734. /* 2 */
  1735. /***/ (function(module, exports) {
  1736. module.exports = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js");
  1737. /***/ })
  1738. /******/ ]);
  1739. /***/ }),
  1740. /***/ "./grammar/pt/langFunctions.js":
  1741. /*!*************************************!*\
  1742. !*** ./grammar/pt/langFunctions.js ***!
  1743. \*************************************/
  1744. /*! exports provided: default */
  1745. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1746. "use strict";
  1747. __webpack_require__.r(__webpack_exports__);
  1748. /* This is a dictionary of the language defined functions
  1749. **/
  1750. /* harmony default export */ __webpack_exports__["default"] = ({
  1751. main_function: "inicio",
  1752. $read: "leia",
  1753. $write: "escreva",
  1754. $numElements: "total_de_elementos",
  1755. $matrixLines: "total_de_linhas",
  1756. $matrixColumns: "total_de_colunas",
  1757. $substring: "subcadeia",
  1758. $length: "comprimento",
  1759. $uppercase: "caixa_alta",
  1760. $lowercase: "caixa_baixa",
  1761. $charAt: "char_at",
  1762. $isReal: "e_real",
  1763. $isInt: "e_inteiro",
  1764. $isBool: "e_logico",
  1765. $castReal: "como_real",
  1766. $castInt: "como_inteiro",
  1767. $castBool: "como_logico",
  1768. $castString: "como_cadeia",
  1769. $sin: "seno",
  1770. $cos: "cosseno",
  1771. $tan: "tangente",
  1772. $sqrt: "raiz_quadrada",
  1773. $pow: "potencia",
  1774. $log: "logaritmo",
  1775. $abs: "modulo",
  1776. $negate: "trocar_sinal",
  1777. $invert: "inverter_valor",
  1778. $max: "maximo",
  1779. $min: "minimo"
  1780. });
  1781. /***/ }),
  1782. /***/ "./grammar/pt/langLibs.js":
  1783. /*!********************************!*\
  1784. !*** ./grammar/pt/langLibs.js ***!
  1785. \********************************/
  1786. /*! exports provided: default */
  1787. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1788. "use strict";
  1789. __webpack_require__.r(__webpack_exports__);
  1790. /**
  1791. * This is the dictionary of the language defined libraries
  1792. */
  1793. /* harmony default export */ __webpack_exports__["default"] = ({
  1794. $mathLib: "Matematica",
  1795. $ioLib: "ES",
  1796. $strLib: "Texto",
  1797. $arrayLib: "Arranjo",
  1798. $langLib: "Conversao"
  1799. });
  1800. /***/ }),
  1801. /***/ "./i18n/en/error.json":
  1802. /*!****************************!*\
  1803. !*** ./i18n/en/error.json ***!
  1804. \****************************/
  1805. /*! exports provided: token_missing_one, token_missing_two, eos_missing, invalid_type, invalid_array_dimension, invalid_array_size, extra_lines, invalid_main_return, invalid_var_declaration, invalid_break_command, invalid_terminal, const_not_init, id_missing, invalid_id_format, main_missing, invalid_global_var, not_implemented, function_missing, function_missing_full, invalid_parameters_size_full, invalid_parameters_size, invalid_ref_full, invalid_ref, invalid_parameter_type_full, invalid_parameter_type, unknown_command_full, unknown_command, loop_condition_type_full, loop_condition_type, endless_loop_full, endless_loop, for_condition_type_full, for_condition_type, if_condition_type_full, if_condition_type, invalid_return_type_full, invalid_return_type, invalid_void_return_full, invalid_void_return, unexpected_break_command_full, unexpected_break_command, invalid_dimension, void_in_expression_full, void_in_expression, invalid_array_access_full, invalid_array_access, invalid_matrix_access_full, invalid_matrix_access, matrix_column_outbounds_full, matrix_column_outbounds, matrix_line_outbounds_full, matrix_line_outbounds, vector_line_outbounds_full, vector_line_outbounds, vector_not_matrix_full, vector_not_matrix, invalid_infix_op_full, invalid_infix_op, invalid_unary_op_full, invalid_unary_op, unknown_op, duplicate_function, duplicate_variable, main_parameters, symbol_not_found_full, symbol_not_found, array_dimension_not_int_full, array_dimension_not_int, array_dimension_not_positive_full, array_dimension_not_positive, incompatible_types_full, incompatible_types, incompatible_types_array_full, incompatible_types_array, invalid_case_type_full, invalid_case_type, function_no_return, invalid_array_literal_type_full, invalid_array_literal_type, invalid_array_literal_line_full, invalid_array_literal_line, invalid_array_literal_column_full, invalid_array_literal_column, exceeded_input_request, test_case_few_reads, test_case_failed, test_case_failed_exception, default */
  1806. /***/ (function(module) {
  1807. module.exports = {"token_missing_one":"Erro de sintaxe: Espera-se $0, mas encontrou-se $1 na linha:$2, coluna:$3","token_missing_two":"Erro de sintaxe: Esperava-se $0 ou $1 mas encontrou-se $2 na liha:$3, coluna: $4","eos_missing":"Falta uma nova linha ou ; na linha: $0, coluna: $1","invalid_type":"$0 na linha: $1, coluna: $2 é um tipo inválido. Os tipos válidos são: $3","invalid_array_dimension":"A dimensão inválida na linha: $0, coluna: $1. Insira um $2 ou identificador válido do mesmo tipo.","invalid_array_size":"O tamnho do vetor/matriz excede o máximo de 2 na linha $0","extra_lines":"Nenhum texto é permitido após '}' em 'programa {...}'","invalid_main_return":"A função $0 deve retornar $1 na linha $2","invalid_var_declaration":"Erro na linha $0. Variáveis só podem ser declarados no corpo principal da função e de preferência nas primeiras linhas.","invalid_break_command":"Erro na linha $0. O comando $1 não pode ser usado fora de uma estrutura de repetição ou 'escolha...caso'","invalid_terminal":"Não é possível utilizar $0 na expressão da linha: $1, coluna: $2. Tente um valor númerico, variável ou chamada de função.","const_not_init":"Erro na linha: $0, coluna: $1. Uma variável declarada como const deve ser inicializada","id_missing":"Esperava-se um identificador, mas encontrou-se $0 na linha: $1, coluna: $2","invalid_id_format":"$0 na linha: $1, coluna: $2 não é um identificador válido. O símbolo '.' não é permitido neste contexto.","main_missing":"A função principal não foi encontrada","invalid_global_var":"Erro crítico: Chamada inválida da função initGlobal fora do contexto BASE","not_implemented":"Erro interno crítico: A função definida pelo sistema $0 não foi implementada.","function_missing":"A função $0 não foi encontrada","function_missing_full":"A função $0 na linha: $1, coluna: $2 não foi encontrada","invalid_parameters_size_full":"Erro na linha $0: a quantidade de parâmetros fornecidos à função $1 está incorreta. Esperava-se $2, encontrou-se $3.","invalid_parameters_size":"A quantidade de parâmetros fornecidos à função $0 está incorreta. Esperava-se $1, encontrou-se $2","invalid_ref_full":"A expressão $0 fornecida como parâmetro para a função $1 na linha $2 não é válida para esta função. Use uma variável ou posição de vetor.","invalid_ref":"A expressão $0 fornecida como parâmetro para a função $1 não é válida para esta função. Use uma variável ou posição de vetor.","invalid_parameter_type_full":"A expressão $0 fornecida como parâmetro para a função $1 na linha $2 não é compatível com o tipo esperado.","invalid_parameter_type":"A expressão $0 fornecida como parâmetro para a função $1 não é compatível com o tipo esperado.","unknown_command_full":"Erro interno crítico: comando desconhecido encontrado na linha $0","unknown_command":"Erro interno crítico: comando desconhecido encontrado!","loop_condition_type_full":"Erro na linha: $0, coluna $1: a condição $2 do laço de repetição deve ser do tipo lógico","loop_condition_type":"A condição $0 do laço de repetição deve ser do tipo lógico","endless_loop_full":"Possível laço infinito detectado no seu código. Verifique a linha $0","endless_loop":"Possível laço infinito detectado no seu código.","for_condition_type_full":"Erro na linha: $0, coluna $1: a condição de parada $2 do comando para(...) deve ser do tipo lógico","for_condition_type":"A condição de parada $0 do comando para(...) deve ser do tipo lógico","if_condition_type_full":"Erro na linha: $0, coluna $1: a condição $2 do comando se...senao deve ser do tipo lógico","if_condition_type":"A condição $0 do comando se...senao deve ser do tipo lógico","invalid_return_type_full":"Erro na linha $0: a expressão não produz um tipo compatível com a função $1. Tipo esperado: $2.","invalid_return_type":"A expressão não produz um tipo compatível com a função $0. Tipo esperado: $1.","invalid_void_return_full":"Erro na linha $0: a função $1 não pode retornar uma expressão vazia, use uma espressão do tipo $2","invalid_void_return":"A função $0 não pode retornar uma expressão vazia, use uma espressão do tipo $1","unexpected_break_command_full":"Erro interno crítico: comando pare encontrado fora do contexto de um laço/escolha..caso na linha $0","unexpected_break_command":"Erro interno crítico: comando pare encontrado fora do contexto de um laço/escolha..caso","invalid_dimension":"As dimensões de um vetor/matriz devem ser do tipo inteiro","void_in_expression_full":"Erro na linha: $0, coluna: $1: a função $2 não pode ser utilizada em uma expressão pois seu tipo de retorno é vazio","void_in_expression":"A função $0 não pode ser utilizada em uma expressão pois seu tipo de retorno é vazio","invalid_array_access_full":"Identificador $0 na linha: $1, coluna: $2 não se refere a um vetor/matriz válido","invalid_array_access":"Identificador $0 não se refere a um vetor/matriz válido","invalid_matrix_access_full":"Identificador $0 na linha: $1, coluna: $2 não se refere a uma matriz válida","invalid_matrix_access":"Identificador $0 não se refere a uma matriz válida","matrix_column_outbounds_full":"Erro na linha $0: número de colunas $1 é inválido para a matriz $2 que possui $3 colunas","matrix_column_outbounds":"Número de colunas $0 é inválido para a matriz $1 que possui $2 colunas","matrix_line_outbounds_full":"Erro na linha $0: número de linhas $1 é inválido para a matriz $2 que possui $3 linhas","matrix_line_outbounds":"Número de linhas $0 é inválido para a matriz $1 que possui $2 linhas","vector_line_outbounds_full":"Erro na linha $0: número de linhas $1 é inválido para a matriz $2 que possui $3 linhas","vector_line_outbounds":"Número de linhas $0 é inválido para a matriz $1 que possui $2 linhas","vector_not_matrix_full":"Erro na linha $0: $1 não é uma matriz","vector_not_matrix":"$1 não é uma matriz","invalid_infix_op_full":"Erro na linha $0: não é possível aplicar a operação $1 entre os tipos $2 e $3","invalid_infix_op":"Não é possível aplicar a operação $0 entre os tipos $1 e $2","invalid_unary_op_full":"Erro na linha $0: não é possível aplicar a operação $1 ao tipo $2","invalid_unary_op":"Não é possível aplicar a operação $0 ao tipo $1","unknown_op":"Erro interno crítico: Operação $0 desconhecida","duplicate_function":"A função $0 na linha: $1, coluna: $2 já foi definida anteriormente.","duplicate_variable":"A variável $0 na linha: $1, coluna: $2 já foi declarada anteriormente.","main_parameters":"A função inicio não pode ter parâmetros.","symbol_not_found_full":"A variável $0 na linha: $1, coluna: $2 não foi declarada","symbol_not_found":"A variável $0 não foi declarada","array_dimension_not_int_full":"As dimensões de um vetor/matriz na linha: $0 devem ser do tipo inteiro.","array_dimension_not_int":"As dimensões de um vetor/matriz devem ser do tipo inteiro.","array_dimension_not_positive_full":"As dimensões de um vetor/matriz na linha: $0 devem ser valores positivos.","array_dimension_not_positive":"As dimensões de um vetor/matriz devem ser valores positivos.","incompatible_types_full":"O tipo $0 não é compatível com o tipo resultante da expressão na linha $1","incompatible_types":"O tipo $0 não é compatível com o tipo resultante da expressão fornecida.","incompatible_types_array_full":"A expressão $0 é incompatível com o tipo $1 na linha: $2, coluna: $3.","incompatible_types_array":"A expressão $0 é incompatível com o tipo $1.","invalid_case_type_full":"O caso $0 na linha $1 é incompatível com o tipo $2.","invalid_case_type":"O caso $0 é incompatível com o tipo $1.","function_no_return":"A função $0 não possui um retorno acessível. Toda função deve ter ao menos um retorno no seu corpo principal.","invalid_array_literal_type_full":"Erro na linha $0: a expressão $1 não resulta em um tipo compatível.","invalid_array_literal_type":"A expressão $0 não resulta em um tipo compatível.","invalid_array_literal_line_full":"Erro na linha $0: esperava-se $1 linhas mas encontrou $2.","invalid_array_literal_line":"Esperava-se $0 linhas mas encontrou $1.","invalid_array_literal_column_full":"Erro na linha $0: esperava-se $1 colunas mas encontrou $2.","invalid_array_literal_column":"Esperava-se $0 colunas mas encontrou $1.","exceeded_input_request":"A quantidade de leituras requisitadas execedeu a quantidade de entradas disponíveis.","test_case_few_reads":"Caso de teste $0 falhou: ainda restam entradas!","test_case_failed":"Caso de teste $0 falhou: entradas:<$1>; saída esperada:<$2>; saída:<$3>","test_case_failed_exception":"Caso de teste $0 falhou: $1"};
  1808. /***/ }),
  1809. /***/ "./i18n/en/index.js":
  1810. /*!**************************!*\
  1811. !*** ./i18n/en/index.js ***!
  1812. \**************************/
  1813. /*! exports provided: default */
  1814. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1815. "use strict";
  1816. __webpack_require__.r(__webpack_exports__);
  1817. /* harmony import */ var _error_json__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./error.json */ "./i18n/en/error.json");
  1818. var _error_json__WEBPACK_IMPORTED_MODULE_0___namespace = /*#__PURE__*/__webpack_require__.t(/*! ./error.json */ "./i18n/en/error.json", 1);
  1819. /* harmony import */ var _message_json__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./message.json */ "./i18n/en/message.json");
  1820. var _message_json__WEBPACK_IMPORTED_MODULE_1___namespace = /*#__PURE__*/__webpack_require__.t(/*! ./message.json */ "./i18n/en/message.json", 1);
  1821. /* harmony import */ var _ui_json__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ui.json */ "./i18n/en/ui.json");
  1822. var _ui_json__WEBPACK_IMPORTED_MODULE_2___namespace = /*#__PURE__*/__webpack_require__.t(/*! ./ui.json */ "./i18n/en/ui.json", 1);
  1823. /* harmony default export */ __webpack_exports__["default"] = ({
  1824. 'message': _message_json__WEBPACK_IMPORTED_MODULE_1__,
  1825. 'error': _error_json__WEBPACK_IMPORTED_MODULE_0__,
  1826. 'ui': _ui_json__WEBPACK_IMPORTED_MODULE_2__
  1827. });
  1828. /***/ }),
  1829. /***/ "./i18n/en/message.json":
  1830. /*!******************************!*\
  1831. !*** ./i18n/en/message.json ***!
  1832. \******************************/
  1833. /*! exports provided: test_case_success, test_case_duration, default */
  1834. /***/ (function(module) {
  1835. module.exports = {"test_case_success":"Caso de teste $0: OK","test_case_duration":"Levou $0ms"};
  1836. /***/ }),
  1837. /***/ "./i18n/en/ui.json":
  1838. /*!*************************!*\
  1839. !*** ./i18n/en/ui.json ***!
  1840. \*************************/
  1841. /*! exports provided: function, btn_clear, btn_function, btn_arithmetic_plus, btn_arithmetic_minus, btn_arithmetic_multiplication, btn_arithmetic_division, btn_arithmetic_module, btn_break, btn_case, start, void, integer, real, program, text, text_start, boolean, true, false, variable, command, new_parameter, new_variable, new_global, new_function, vector, text_comment_start, text_comment_main, text_read_var, text_write_var, text_command_read, text_command_write, text_comment, text_attribution, text_if, text_else, text_break, text_for, text_code_while, text_code_do, text_command_do, text_code_switch, text_code_case, text_logic_expression, text_arithmetic_expression, text_iftrue, text_receives, text_repeatNtimes, text_return, text_btn_return, text_whiletrue, text_dowhiletrue, text_switch, text_functioncall, text_value, text_operator, text_parentheses, text_change, text_teacher_algorithm, text_teacher_algorithm_include, text_teacher_test_case, text_teacher_config, text_teacher_data_types, text_teacher_commands, text_teacher_functions, text_teacher_create_functions, text_teacher_create_movement_functions, text_teacher_test_case_input, text_teacher_test_case_output, text_teacher_test_case_actions, text_teacher_test_case_add, text_header_ivprog_functions, text_menu_functions_math, text_menu_functions_text, text_menu_functions_arrangement, text_menu_functions_conversion, text_none_variable, text_none_variable_instruction, text_ivprog_description, tooltip_visual, tooltip_textual, tooltip_upload, tooltip_download, tooltip_undo, tooltip_redo, tooltip_run, tooltip_evaluate, tooltip_help, tooltip_add_global, tooltip_minimize, tooltip_console, var_menu_select_var, var_menu_select_all, var_menu_select_function, expression_menu_select, math, text_t, inform_valid_name, inform_valid_content, inform_valid_expression, inform_valid_name_duplicated, inform_valid_global_duplicated, inform_valid_variable_duplicated, arrangement, conversion, $sin, $cos, $tan, $sqrt, $pow, $log, $abs, $negate, $invert, $max, $min, $substring, $length, $uppercase, $lowercase, $charAt, $numElements, $matrixLines, $matrixColumns, $isReal, $isInt, $isBool, $castReal, $castInt, $castBool, $castString, text_ivprog_version, default */
  1842. /***/ (function(module) {
  1843. module.exports = {"function":"function","btn_clear":"Clear","btn_function":"Function","btn_arithmetic_plus":"Sum","btn_arithmetic_minus":"Minus","btn_arithmetic_multiplication":"Multiplication","btn_arithmetic_division":"Division","btn_arithmetic_module":"Module","btn_break":"Break","btn_case":"Case","start":"start","void":"void","integer":"integer","real":"real","program":"program","text":"string","text_start":"text","boolean":"boolean","true":"true","false":"false","variable":"Variable","command":"Command","new_parameter":"new_parameter","new_variable":"new_variable","new_global":"new_global","new_function":"new_function","vector":"vector","text_comment_start":"Initial comment of function...","text_comment_main":"This is the main function...","text_read_var":"Reading data","text_write_var":"Writing data","text_command_read":"read","text_command_write":"write","text_comment":"Comment","text_attribution":"Attribution","text_if":"if","text_else":"else","text_break":"break","text_for":"for","text_code_while":"while","text_code_do":"do","text_command_do":"do","text_code_switch":"switch","text_code_case":"case","text_logic_expression":"Logic Expression","text_arithmetic_expression":"Relational Expression","text_iftrue":"If true then","text_receives":"receives","text_repeatNtimes":"Repeat N times","text_return":"return","text_btn_return":"Return","text_whiletrue":"While true","text_dowhiletrue":"Do while true","text_switch":"Switch","text_functioncall":"Function call","text_value":"Value","text_operator":"Operator","text_parentheses":"Parentheses","text_change":"Change","text_teacher_algorithm":"Algorithm","text_teacher_algorithm_include":"Include the following algorithm in exercise","text_teacher_test_case":"Test cases","text_teacher_config":"Settings","text_teacher_data_types":"Data types","text_teacher_commands":"Commands","text_teacher_functions":"Functions","text_teacher_create_functions":"Create new functions","text_teacher_create_movement_functions":"Move functions","text_teacher_test_case_input":"Input","text_teacher_test_case_output":"Output","text_teacher_test_case_actions":"Actions","text_teacher_test_case_add":"Add test cases","text_header_ivprog_functions":"iVProg Functions","text_menu_functions_math":"Mathematic","text_menu_functions_text":"Text","text_menu_functions_arrangement":"Arrangement","text_menu_functions_conversion":"Conversion","text_none_variable":"There is no declared variable","text_none_variable_instruction":"Create a new variable to use it","text_ivprog_description":"Interactive Visual Programming on the Internet","tooltip_visual":"Visual programming","tooltip_textual":"Textual programming","tooltip_upload":"Upload code file","tooltip_download":"Download code file","tooltip_undo":"Undo","tooltip_redo":"Redo","tooltip_run":"Run program","tooltip_evaluate":"Evaluate program","tooltip_help":"Help","tooltip_add_global":"Add global variable","tooltip_minimize":"Hidde function elements","tooltip_console":"Open/Close console","var_menu_select_var":"Select a var","var_menu_select_all":"Select","var_menu_select_function":"Select a function","expression_menu_select":"Construct any logical condition","math":"Mathematic","text_t":"Text","inform_valid_name":"Inform a valid name!","inform_valid_content":"Enter some content!","inform_valid_expression":"Construct the logical condition!","inform_valid_name_duplicated":"This name is already in use by other function.","inform_valid_global_duplicated":"A global variable with this name already exists.","inform_valid_variable_duplicated":"A local variable with this name already exists.","arrangement":"Arrangement","conversion":"Conversion","$sin":"sin","$cos":"cos","$tan":"tan","$sqrt":"sqrt","$pow":"pow","$log":"log","$abs":"abs","$negate":"negate","$invert":"invert","$max":"maximum","$min":"minimum","$substring":"substring","$length":"length","$uppercase":"uppercase","$lowercase":"lowercase","$charAt":"char_at","$numElements":"total_of_elements","$matrixLines":"total_of_lines","$matrixColumns":"total_of_columns","$isReal":"is_real","$isInt":"is_integer","$isBool":"is_logic","$castReal":"to_real","$castInt":"to_integer","$castBool":"to_logic","$castString":"to_string","text_ivprog_version":"Version"};
  1844. /***/ }),
  1845. /***/ "./i18n/es/error.json":
  1846. /*!****************************!*\
  1847. !*** ./i18n/es/error.json ***!
  1848. \****************************/
  1849. /*! exports provided: token_missing_one, token_missing_two, eos_missing, invalid_type, invalid_array_dimension, invalid_array_size, extra_lines, invalid_main_return, invalid_var_declaration, invalid_break_command, invalid_terminal, const_not_init, id_missing, invalid_id_format, main_missing, invalid_global_var, not_implemented, function_missing, function_missing_full, invalid_parameters_size_full, invalid_parameters_size, invalid_ref_full, invalid_ref, invalid_parameter_type_full, invalid_parameter_type, unknown_command_full, unknown_command, loop_condition_type_full, loop_condition_type, endless_loop_full, endless_loop, for_condition_type_full, for_condition_type, if_condition_type_full, if_condition_type, invalid_return_type_full, invalid_return_type, invalid_void_return_full, invalid_void_return, unexpected_break_command_full, unexpected_break_command, invalid_dimension, void_in_expression_full, void_in_expression, invalid_array_access_full, invalid_array_access, invalid_matrix_access_full, invalid_matrix_access, matrix_column_outbounds_full, matrix_column_outbounds, matrix_line_outbounds_full, matrix_line_outbounds, vector_line_outbounds_full, vector_line_outbounds, vector_not_matrix_full, vector_not_matrix, invalid_infix_op_full, invalid_infix_op, invalid_unary_op_full, invalid_unary_op, unknown_op, duplicate_function, duplicate_variable, main_parameters, symbol_not_found_full, symbol_not_found, array_dimension_not_int_full, array_dimension_not_int, array_dimension_not_positive_full, array_dimension_not_positive, incompatible_types_full, incompatible_types, incompatible_types_array_full, incompatible_types_array, invalid_case_type_full, invalid_case_type, function_no_return, invalid_array_literal_type_full, invalid_array_literal_type, invalid_array_literal_line_full, invalid_array_literal_line, invalid_array_literal_column_full, invalid_array_literal_column, exceeded_input_request, test_case_few_reads, test_case_failed, test_case_failed_exception, default */
  1850. /***/ (function(module) {
  1851. module.exports = {"token_missing_one":"Erro de sintaxe: Espera-se $0, mas encontrou-se $1 na linha:$2, coluna:$3","token_missing_two":"Erro de sintaxe: Esperava-se $0 ou $1 mas encontrou-se $2 na liha:$3, coluna: $4","eos_missing":"Falta uma nova linha ou ; na linha: $0, coluna: $1","invalid_type":"$0 na linha: $1, coluna: $2 é um tipo inválido. Os tipos válidos são: $3","invalid_array_dimension":"A dimensão inválida na linha: $0, coluna: $1. Insira um $2 ou identificador válido do mesmo tipo.","invalid_array_size":"O tamnho do vetor/matriz excede o máximo de 2 na linha $0","extra_lines":"Nenhum texto é permitido após '}' em 'programa {...}'","invalid_main_return":"A função $0 deve retornar $1 na linha $2","invalid_var_declaration":"Erro na linha $0. Variáveis só podem ser declarados no corpo principal da função e de preferência nas primeiras linhas.","invalid_break_command":"Erro na linha $0. O comando $1 não pode ser usado fora de uma estrutura de repetição ou 'escolha...caso'","invalid_terminal":"Não é possível utilizar $0 na expressão da linha: $1, coluna: $2. Tente um valor númerico, variável ou chamada de função.","const_not_init":"Erro na linha: $0, coluna: $1. Uma variável declarada como const deve ser inicializada","id_missing":"Esperava-se um identificador, mas encontrou-se $0 na linha: $1, coluna: $2","invalid_id_format":"$0 na linha: $1, coluna: $2 não é um identificador válido. O símbolo '.' não é permitido neste contexto.","main_missing":"A função principal não foi encontrada","invalid_global_var":"Erro crítico: Chamada inválida da função initGlobal fora do contexto BASE","not_implemented":"Erro interno crítico: A função definida pelo sistema $0 não foi implementada.","function_missing":"A função $0 não foi encontrada","function_missing_full":"A função $0 na linha: $1, coluna: $2 não foi encontrada","invalid_parameters_size_full":"Erro na linha $0: a quantidade de parâmetros fornecidos à função $1 está incorreta. Esperava-se $2, encontrou-se $3.","invalid_parameters_size":"A quantidade de parâmetros fornecidos à função $0 está incorreta. Esperava-se $1, encontrou-se $2","invalid_ref_full":"A expressão $0 fornecida como parâmetro para a função $1 na linha $2 não é válida para esta função. Use uma variável ou posição de vetor.","invalid_ref":"A expressão $0 fornecida como parâmetro para a função $1 não é válida para esta função. Use uma variável ou posição de vetor.","invalid_parameter_type_full":"A expressão $0 fornecida como parâmetro para a função $1 na linha $2 não é compatível com o tipo esperado.","invalid_parameter_type":"A expressão $0 fornecida como parâmetro para a função $1 não é compatível com o tipo esperado.","unknown_command_full":"Erro interno crítico: comando desconhecido encontrado na linha $0","unknown_command":"Erro interno crítico: comando desconhecido encontrado!","loop_condition_type_full":"Erro na linha: $0, coluna $1: a condição $2 do laço de repetição deve ser do tipo lógico","loop_condition_type":"A condição $0 do laço de repetição deve ser do tipo lógico","endless_loop_full":"Possível laço infinito detectado no seu código. Verifique a linha $0","endless_loop":"Possível laço infinito detectado no seu código.","for_condition_type_full":"Erro na linha: $0, coluna $1: a condição de parada $2 do comando para(...) deve ser do tipo lógico","for_condition_type":"A condição de parada $0 do comando para(...) deve ser do tipo lógico","if_condition_type_full":"Erro na linha: $0, coluna $1: a condição $2 do comando se...senao deve ser do tipo lógico","if_condition_type":"A condição $0 do comando se...senao deve ser do tipo lógico","invalid_return_type_full":"Erro na linha $0: a expressão não produz um tipo compatível com a função $1. Tipo esperado: $2.","invalid_return_type":"A expressão não produz um tipo compatível com a função $0. Tipo esperado: $1.","invalid_void_return_full":"Erro na linha $0: a função $1 não pode retornar uma expressão vazia, use uma espressão do tipo $2","invalid_void_return":"A função $0 não pode retornar uma expressão vazia, use uma espressão do tipo $1","unexpected_break_command_full":"Erro interno crítico: comando pare encontrado fora do contexto de um laço/escolha..caso na linha $0","unexpected_break_command":"Erro interno crítico: comando pare encontrado fora do contexto de um laço/escolha..caso","invalid_dimension":"As dimensões de um vetor/matriz devem ser do tipo inteiro","void_in_expression_full":"Erro na linha: $0, coluna: $1: a função $2 não pode ser utilizada em uma expressão pois seu tipo de retorno é vazio","void_in_expression":"A função $0 não pode ser utilizada em uma expressão pois seu tipo de retorno é vazio","invalid_array_access_full":"Identificador $0 na linha: $1, coluna: $2 não se refere a um vetor/matriz válido","invalid_array_access":"Identificador $0 não se refere a um vetor/matriz válido","invalid_matrix_access_full":"Identificador $0 na linha: $1, coluna: $2 não se refere a uma matriz válida","invalid_matrix_access":"Identificador $0 não se refere a uma matriz válida","matrix_column_outbounds_full":"Erro na linha $0: número de colunas $1 é inválido para a matriz $2 que possui $3 colunas","matrix_column_outbounds":"Número de colunas $0 é inválido para a matriz $1 que possui $2 colunas","matrix_line_outbounds_full":"Erro na linha $0: número de linhas $1 é inválido para a matriz $2 que possui $3 linhas","matrix_line_outbounds":"Número de linhas $0 é inválido para a matriz $1 que possui $2 linhas","vector_line_outbounds_full":"Erro na linha $0: número de linhas $1 é inválido para a matriz $2 que possui $3 linhas","vector_line_outbounds":"Número de linhas $0 é inválido para a matriz $1 que possui $2 linhas","vector_not_matrix_full":"Erro na linha $0: $1 não é uma matriz","vector_not_matrix":"$1 não é uma matriz","invalid_infix_op_full":"Erro na linha $0: não é possível aplicar a operação $1 entre os tipos $2 e $3","invalid_infix_op":"Não é possível aplicar a operação $0 entre os tipos $1 e $2","invalid_unary_op_full":"Erro na linha $0: não é possível aplicar a operação $1 ao tipo $2","invalid_unary_op":"Não é possível aplicar a operação $0 ao tipo $1","unknown_op":"Erro interno crítico: Operação $0 desconhecida","duplicate_function":"A função $0 na linha: $1, coluna: $2 já foi definida anteriormente.","duplicate_variable":"A variável $0 na linha: $1, coluna: $2 já foi declarada anteriormente.","main_parameters":"A função inicio não pode ter parâmetros.","symbol_not_found_full":"A variável $0 na linha: $1, coluna: $2 não foi declarada","symbol_not_found":"A variável $0 não foi declarada","array_dimension_not_int_full":"As dimensões de um vetor/matriz na linha: $0 devem ser do tipo inteiro.","array_dimension_not_int":"As dimensões de um vetor/matriz devem ser do tipo inteiro.","array_dimension_not_positive_full":"As dimensões de um vetor/matriz na linha: $0 devem ser valores positivos.","array_dimension_not_positive":"As dimensões de um vetor/matriz devem ser valores positivos.","incompatible_types_full":"O tipo $0 não é compatível com o tipo resultante da expressão na linha $1","incompatible_types":"O tipo $0 não é compatível com o tipo resultante da expressão fornecida.","incompatible_types_array_full":"A expressão $0 é incompatível com o tipo $1 na linha: $2, coluna: $3.","incompatible_types_array":"A expressão $0 é incompatível com o tipo $1.","invalid_case_type_full":"O caso $0 na linha $1 é incompatível com o tipo $2.","invalid_case_type":"O caso $0 é incompatível com o tipo $1.","function_no_return":"A função $0 não possui um retorno acessível. Toda função deve ter ao menos um retorno no seu corpo principal.","invalid_array_literal_type_full":"Erro na linha $0: a expressão $1 não resulta em um tipo compatível.","invalid_array_literal_type":"A expressão $0 não resulta em um tipo compatível.","invalid_array_literal_line_full":"Erro na linha $0: esperava-se $1 linhas mas encontrou $2.","invalid_array_literal_line":"Esperava-se $0 linhas mas encontrou $1.","invalid_array_literal_column_full":"Erro na linha $0: esperava-se $1 colunas mas encontrou $2.","invalid_array_literal_column":"Esperava-se $0 colunas mas encontrou $1.","exceeded_input_request":"A quantidade de leituras requisitadas execedeu a quantidade de entradas disponíveis.","test_case_few_reads":"Caso de teste $0 falhou: ainda restam entradas!","test_case_failed":"Caso de teste $0 falhou: entradas:<$1>; saída esperada:<$2>; saída:<$3>","test_case_failed_exception":"Caso de teste $0 falhou: $1"};
  1852. /***/ }),
  1853. /***/ "./i18n/es/index.js":
  1854. /*!**************************!*\
  1855. !*** ./i18n/es/index.js ***!
  1856. \**************************/
  1857. /*! exports provided: default */
  1858. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1859. "use strict";
  1860. __webpack_require__.r(__webpack_exports__);
  1861. /* harmony import */ var _error_json__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./error.json */ "./i18n/es/error.json");
  1862. var _error_json__WEBPACK_IMPORTED_MODULE_0___namespace = /*#__PURE__*/__webpack_require__.t(/*! ./error.json */ "./i18n/es/error.json", 1);
  1863. /* harmony import */ var _message_json__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./message.json */ "./i18n/es/message.json");
  1864. var _message_json__WEBPACK_IMPORTED_MODULE_1___namespace = /*#__PURE__*/__webpack_require__.t(/*! ./message.json */ "./i18n/es/message.json", 1);
  1865. /* harmony import */ var _ui_json__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ui.json */ "./i18n/es/ui.json");
  1866. var _ui_json__WEBPACK_IMPORTED_MODULE_2___namespace = /*#__PURE__*/__webpack_require__.t(/*! ./ui.json */ "./i18n/es/ui.json", 1);
  1867. /* harmony default export */ __webpack_exports__["default"] = ({
  1868. 'message': _message_json__WEBPACK_IMPORTED_MODULE_1__,
  1869. 'error': _error_json__WEBPACK_IMPORTED_MODULE_0__,
  1870. 'ui': _ui_json__WEBPACK_IMPORTED_MODULE_2__
  1871. });
  1872. /***/ }),
  1873. /***/ "./i18n/es/message.json":
  1874. /*!******************************!*\
  1875. !*** ./i18n/es/message.json ***!
  1876. \******************************/
  1877. /*! exports provided: test_case_success, test_case_duration, default */
  1878. /***/ (function(module) {
  1879. module.exports = {"test_case_success":"Caso de teste $0: OK","test_case_duration":"Levou $0ms"};
  1880. /***/ }),
  1881. /***/ "./i18n/es/ui.json":
  1882. /*!*************************!*\
  1883. !*** ./i18n/es/ui.json ***!
  1884. \*************************/
  1885. /*! exports provided: function, btn_clear, btn_function, btn_arithmetic_plus, btn_arithmetic_minus, btn_arithmetic_multiplication, btn_arithmetic_division, btn_arithmetic_module, btn_break, btn_case, start, void, integer, real, program, text, text_start, boolean, true, false, variable, command, new_parameter, new_variable, new_global, new_function, vector, text_comment_start, text_comment_main, text_read_var, text_write_var, text_command_read, text_command_write, text_comment, text_attribution, text_if, text_else, text_break, text_for, text_code_while, text_code_do, text_command_do, text_code_switch, text_code_case, text_logic_expression, text_arithmetic_expression, text_iftrue, text_receives, text_repeatNtimes, text_return, text_btn_return, text_whiletrue, text_dowhiletrue, text_switch, text_functioncall, text_value, text_operator, text_parentheses, text_change, text_teacher_algorithm, text_teacher_algorithm_include, text_teacher_test_case, text_teacher_config, text_teacher_data_types, text_teacher_commands, text_teacher_functions, text_teacher_create_functions, text_teacher_create_movement_functions, text_teacher_test_case_input, text_teacher_test_case_output, text_teacher_test_case_actions, text_teacher_test_case_add, text_header_ivprog_functions, text_menu_functions_math, text_menu_functions_text, text_menu_functions_arrangement, text_menu_functions_conversion, text_none_variable, text_none_variable_instruction, text_ivprog_description, tooltip_visual, tooltip_textual, tooltip_upload, tooltip_download, tooltip_undo, tooltip_redo, tooltip_run, tooltip_evaluate, tooltip_help, tooltip_add_global, tooltip_minimize, tooltip_console, var_menu_select_var, var_menu_select_all, var_menu_select_function, expression_menu_select, math, text_t, inform_valid_name, inform_valid_content, inform_valid_expression, inform_valid_name_duplicated, inform_valid_global_duplicated, inform_valid_variable_duplicated, arrangement, conversion, $sin, $cos, $tan, $sqrt, $pow, $log, $abs, $negate, $invert, $max, $min, $substring, $length, $uppercase, $lowercase, $charAt, $numElements, $matrixLines, $matrixColumns, $isReal, $isInt, $isBool, $castReal, $castInt, $castBool, $castString, text_ivprog_version, default */
  1886. /***/ (function(module) {
  1887. module.exports = {"function":"function","btn_clear":"Clear","btn_function":"Function","btn_arithmetic_plus":"Sum","btn_arithmetic_minus":"Minus","btn_arithmetic_multiplication":"Multiplication","btn_arithmetic_division":"Division","btn_arithmetic_module":"Module","btn_break":"Break","btn_case":"Case","start":"start","void":"void","integer":"integer","real":"real","program":"program","text":"string","text_start":"text","boolean":"boolean","true":"true","false":"false","variable":"Variable","command":"Command","new_parameter":"new_parameter","new_variable":"new_variable","new_global":"new_global","new_function":"new_function","vector":"vector","text_comment_start":"Initial comment of function...","text_comment_main":"This is the main function...","text_read_var":"Reading data","text_write_var":"Writing data","text_command_read":"read","text_command_write":"write","text_comment":"Comment","text_attribution":"Attribution","text_if":"if","text_else":"else","text_break":"break","text_for":"for","text_code_while":"while","text_code_do":"do","text_command_do":"do","text_code_switch":"switch","text_code_case":"case","text_logic_expression":"Logic Expression","text_arithmetic_expression":"Relational Expression","text_iftrue":"If true then","text_receives":"receives","text_repeatNtimes":"Repeat N times","text_return":"return","text_btn_return":"Return","text_whiletrue":"While true","text_dowhiletrue":"Do while true","text_switch":"Switch","text_functioncall":"Function call","text_value":"Value","text_operator":"Operator","text_parentheses":"Parentheses","text_change":"Change","text_teacher_algorithm":"Algorithm","text_teacher_algorithm_include":"Include the following algorithm in exercise","text_teacher_test_case":"Test cases","text_teacher_config":"Settings","text_teacher_data_types":"Data types","text_teacher_commands":"Commands","text_teacher_functions":"Functions","text_teacher_create_functions":"Create new functions","text_teacher_create_movement_functions":"Move functions","text_teacher_test_case_input":"Input","text_teacher_test_case_output":"Output","text_teacher_test_case_actions":"Actions","text_teacher_test_case_add":"Add test cases","text_header_ivprog_functions":"iVProg Functions","text_menu_functions_math":"Mathematic","text_menu_functions_text":"Text","text_menu_functions_arrangement":"Arrangement","text_menu_functions_conversion":"Conversion","text_none_variable":"There is no declared variable","text_none_variable_instruction":"Create a new variable to use it","text_ivprog_description":"Interactive Visual Programming on the Internet","tooltip_visual":"Visual programming","tooltip_textual":"Textual programming","tooltip_upload":"Upload code file","tooltip_download":"Download code file","tooltip_undo":"Undo","tooltip_redo":"Redo","tooltip_run":"Run program","tooltip_evaluate":"Evaluate program","tooltip_help":"Help","tooltip_add_global":"Add global variable","tooltip_minimize":"Hidde function elements","tooltip_console":"Open/Close console","var_menu_select_var":"Select a var","var_menu_select_all":"Select","var_menu_select_function":"Select a function","expression_menu_select":"Construct any logical condition","math":"Mathematic","text_t":"Text","inform_valid_name":"Inform a valid name!","inform_valid_content":"Enter some content!","inform_valid_expression":"Construct the logical condition!","inform_valid_name_duplicated":"This name is already in use by other function.","inform_valid_global_duplicated":"A global variable with this name already exists.","inform_valid_variable_duplicated":"A local variable with this name already exists.","arrangement":"Arrangement","conversion":"Conversion","$sin":"sin","$cos":"cos","$tan":"tan","$sqrt":"sqrt","$pow":"pow","$log":"log","$abs":"abs","$negate":"negate","$invert":"invert","$max":"maximum","$min":"minimum","$substring":"substring","$length":"length","$uppercase":"uppercase","$lowercase":"lowercase","$charAt":"char_at","$numElements":"total_of_elements","$matrixLines":"total_of_lines","$matrixColumns":"total_of_columns","$isReal":"is_real","$isInt":"is_integer","$isBool":"is_logic","$castReal":"to_real","$castInt":"to_integer","$castBool":"to_logic","$castString":"to_string","text_ivprog_version":"Version"};
  1888. /***/ }),
  1889. /***/ "./i18n/index.js":
  1890. /*!***********************!*\
  1891. !*** ./i18n/index.js ***!
  1892. \***********************/
  1893. /*! exports provided: default */
  1894. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1895. "use strict";
  1896. __webpack_require__.r(__webpack_exports__);
  1897. /* harmony import */ var _en__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./en */ "./i18n/en/index.js");
  1898. /* harmony import */ var _pt__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./pt */ "./i18n/pt/index.js");
  1899. /* harmony import */ var _es__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./es */ "./i18n/es/index.js");
  1900. /* harmony default export */ __webpack_exports__["default"] = ({
  1901. 'en': _en__WEBPACK_IMPORTED_MODULE_0__["default"],
  1902. 'pt': _pt__WEBPACK_IMPORTED_MODULE_1__["default"],
  1903. 'es': _es__WEBPACK_IMPORTED_MODULE_2__["default"]
  1904. });
  1905. /***/ }),
  1906. /***/ "./i18n/pt/error.json":
  1907. /*!****************************!*\
  1908. !*** ./i18n/pt/error.json ***!
  1909. \****************************/
  1910. /*! exports provided: token_missing_one, token_missing_two, eos_missing, invalid_type, invalid_array_dimension, invalid_array_size, extra_lines, invalid_main_return, invalid_var_declaration, invalid_break_command, invalid_terminal, const_not_init, id_missing, invalid_id_format, main_missing, invalid_global_var, not_implemented, function_missing, function_missing_full, invalid_parameters_size_full, invalid_parameters_size, invalid_ref_full, invalid_ref, invalid_parameter_type_full, invalid_parameter_type, unknown_command_full, unknown_command, loop_condition_type_full, loop_condition_type, endless_loop_full, endless_loop, for_condition_type_full, for_condition_type, if_condition_type_full, if_condition_type, invalid_return_type_full, invalid_return_type, invalid_void_return_full, invalid_void_return, unexpected_break_command_full, unexpected_break_command, invalid_dimension, void_in_expression_full, void_in_expression, invalid_array_access_full, invalid_array_access, invalid_matrix_access_full, invalid_matrix_access, matrix_column_outbounds_full, matrix_column_outbounds, matrix_line_outbounds_full, matrix_line_outbounds, vector_line_outbounds_full, vector_line_outbounds, vector_not_matrix_full, vector_not_matrix, invalid_infix_op_full, invalid_infix_op, invalid_unary_op_full, invalid_unary_op, unknown_op, duplicate_function, duplicate_variable, main_parameters, symbol_not_found_full, symbol_not_found, array_dimension_not_int_full, array_dimension_not_int, array_dimension_not_positive_full, array_dimension_not_positive, incompatible_types_full, incompatible_types, incompatible_types_array_full, incompatible_types_array, invalid_case_type_full, invalid_case_type, function_no_return, invalid_array_literal_type_full, invalid_array_literal_type, invalid_array_literal_line_full, invalid_array_literal_line, invalid_array_literal_column_full, invalid_array_literal_column, exceeded_input_request, test_case_few_reads, test_case_failed, test_case_failed_exception, invalid_type_conversion, default */
  1911. /***/ (function(module) {
  1912. module.exports = {"token_missing_one":"Erro de sintaxe: Espera-se $0, mas encontrou-se $1 na linha:$2, coluna:$3","token_missing_two":"Erro de sintaxe: Esperava-se $0 ou $1 mas encontrou-se $2 na liha:$3, coluna: $4","eos_missing":"Falta uma nova linha ou ; na linha: $0, coluna: $1","invalid_type":"$0 na linha: $1, coluna: $2 é um tipo inválido. Os tipos válidos são: $3","invalid_array_dimension":"A dimensão inválida na linha: $0, coluna: $1. Insira um $2 ou identificador válido do mesmo tipo.","invalid_array_size":"O tamnho do vetor/matriz excede o máximo de 2 na linha $0","extra_lines":"Nenhum texto é permitido após '}' em 'programa {...}'","invalid_main_return":"A função $0 deve retornar $1 na linha $2","invalid_var_declaration":"Erro na linha $0. Variáveis só podem ser declarados no corpo principal da função e de preferência nas primeiras linhas.","invalid_break_command":"Erro na linha $0. O comando $1 não pode ser usado fora de uma estrutura de repetição ou 'escolha...caso'","invalid_terminal":"Não é possível utilizar $0 na expressão da linha: $1, coluna: $2. Tente um valor númerico, variável ou chamada de função.","const_not_init":"Erro na linha: $0, coluna: $1. Uma variável declarada como const deve ser inicializada","id_missing":"Esperava-se um identificador, mas encontrou-se $0 na linha: $1, coluna: $2","invalid_id_format":"$0 na linha: $1, coluna: $2 não é um identificador válido. O símbolo '.' não é permitido neste contexto.","main_missing":"A função principal não foi encontrada","invalid_global_var":"Erro crítico: Chamada inválida da função initGlobal fora do contexto BASE","not_implemented":"Erro interno crítico: A função definida pelo sistema $0 não foi implementada.","function_missing":"A função $0 não foi encontrada","function_missing_full":"A função $0 na linha: $1, coluna: $2 não foi encontrada","invalid_parameters_size_full":"Erro na linha $0: a quantidade de parâmetros fornecidos à função $1 está incorreta. Esperava-se $2, encontrou-se $3.","invalid_parameters_size":"A quantidade de parâmetros fornecidos à função $0 está incorreta. Esperava-se $1, encontrou-se $2","invalid_ref_full":"A expressão $0 fornecida como parâmetro para a função $1 na linha $2 não é válida para esta função. Use uma variável ou posição de vetor.","invalid_ref":"A expressão $0 fornecida como parâmetro para a função $1 não é válida para esta função. Use uma variável ou posição de vetor.","invalid_parameter_type_full":"A expressão $0 fornecida como parâmetro para a função $1 na linha $2 não é compatível com o tipo esperado.","invalid_parameter_type":"A expressão $0 fornecida como parâmetro para a função $1 não é compatível com o tipo esperado.","unknown_command_full":"Erro interno crítico: comando desconhecido encontrado na linha $0","unknown_command":"Erro interno crítico: comando desconhecido encontrado!","loop_condition_type_full":"Erro na linha: $0, coluna $1: a condição $2 do laço de repetição deve ser do tipo lógico","loop_condition_type":"A condição $0 do laço de repetição deve ser do tipo lógico","endless_loop_full":"Possível laço infinito detectado no seu código. Verifique a linha $0","endless_loop":"Possível laço infinito detectado no seu código.","for_condition_type_full":"Erro na linha: $0, coluna $1: a condição de parada $2 do comando para(...) deve ser do tipo lógico","for_condition_type":"A condição de parada $0 do comando para(...) deve ser do tipo lógico","if_condition_type_full":"Erro na linha: $0, coluna $1: a condição $2 do comando se...senao deve ser do tipo lógico","if_condition_type":"A condição $0 do comando se...senao deve ser do tipo lógico","invalid_return_type_full":"Erro na linha $0: a expressão não produz um tipo compatível com a função $1. Tipo esperado: $2.","invalid_return_type":"A expressão não produz um tipo compatível com a função $0. Tipo esperado: $1.","invalid_void_return_full":"Erro na linha $0: a função $1 não pode retornar uma expressão vazia, use uma espressão do tipo $2","invalid_void_return":"A função $0 não pode retornar uma expressão vazia, use uma espressão do tipo $1","unexpected_break_command_full":"Erro interno crítico: comando pare encontrado fora do contexto de um laço/escolha..caso na linha $0","unexpected_break_command":"Erro interno crítico: comando pare encontrado fora do contexto de um laço/escolha..caso","invalid_dimension":"As dimensões de um vetor/matriz devem ser do tipo inteiro","void_in_expression_full":"Erro na linha: $0, coluna: $1: a função $2 não pode ser utilizada em uma expressão pois seu tipo de retorno é vazio","void_in_expression":"A função $0 não pode ser utilizada em uma expressão pois seu tipo de retorno é vazio","invalid_array_access_full":"Identificador $0 na linha: $1, coluna: $2 não se refere a um vetor/matriz válido","invalid_array_access":"Identificador $0 não se refere a um vetor/matriz válido","invalid_matrix_access_full":"Identificador $0 na linha: $1, coluna: $2 não se refere a uma matriz válida","invalid_matrix_access":"Identificador $0 não se refere a uma matriz válida","matrix_column_outbounds_full":"Erro na linha $0: número de colunas $1 é inválido para a matriz $2 que possui $3 colunas","matrix_column_outbounds":"Número de colunas $0 é inválido para a matriz $1 que possui $2 colunas","matrix_line_outbounds_full":"Erro na linha $0: número de linhas $1 é inválido para a matriz $2 que possui $3 linhas","matrix_line_outbounds":"Número de linhas $0 é inválido para a matriz $1 que possui $2 linhas","vector_line_outbounds_full":"Erro na linha $0: número de linhas $1 é inválido para a matriz $2 que possui $3 linhas","vector_line_outbounds":"Número de linhas $0 é inválido para a matriz $1 que possui $2 linhas","vector_not_matrix_full":"Erro na linha $0: $1 não é uma matriz","vector_not_matrix":"$1 não é uma matriz","invalid_infix_op_full":"Erro na linha $0: não é possível aplicar a operação $1 entre os tipos $2 e $3","invalid_infix_op":"Não é possível aplicar a operação $0 entre os tipos $1 e $2","invalid_unary_op_full":"Erro na linha $0: não é possível aplicar a operação $1 ao tipo $2","invalid_unary_op":"Não é possível aplicar a operação $0 ao tipo $1","unknown_op":"Erro interno crítico: Operação $0 desconhecida","duplicate_function":"A função $0 na linha: $1, coluna: $2 já foi definida anteriormente.","duplicate_variable":"A variável $0 na linha: $1, coluna: $2 já foi declarada anteriormente.","main_parameters":"A função inicio não pode ter parâmetros.","symbol_not_found_full":"A variável $0 na linha: $1, coluna: $2 não foi declarada","symbol_not_found":"A variável $0 não foi declarada","array_dimension_not_int_full":"As dimensões de um vetor/matriz na linha: $0 devem ser do tipo inteiro.","array_dimension_not_int":"As dimensões de um vetor/matriz devem ser do tipo inteiro.","array_dimension_not_positive_full":"As dimensões de um vetor/matriz na linha: $0 devem ser valores positivos.","array_dimension_not_positive":"As dimensões de um vetor/matriz devem ser valores positivos.","incompatible_types_full":"O tipo $0 não é compatível com o tipo resultante da expressão na linha $1","incompatible_types":"O tipo $0 não é compatível com o tipo resultante da expressão fornecida.","incompatible_types_array_full":"A expressão $0 é incompatível com o tipo $1 na linha: $2, coluna: $3.","incompatible_types_array":"A expressão $0 é incompatível com o tipo $1.","invalid_case_type_full":"O caso $0 na linha $1 é incompatível com o tipo $2.","invalid_case_type":"O caso $0 é incompatível com o tipo $1.","function_no_return":"A função $0 não possui um retorno acessível. Toda função deve ter ao menos um retorno no seu corpo principal.","invalid_array_literal_type_full":"Erro na linha $0: a expressão $1 não resulta em um tipo compatível.","invalid_array_literal_type":"A expressão $0 não resulta em um tipo compatível.","invalid_array_literal_line_full":"Erro na linha $0: esperava-se $1 linhas mas encontrou $2.","invalid_array_literal_line":"Esperava-se $0 linhas mas encontrou $1.","invalid_array_literal_column_full":"Erro na linha $0: esperava-se $1 colunas mas encontrou $2.","invalid_array_literal_column":"Esperava-se $0 colunas mas encontrou $1.","exceeded_input_request":"A quantidade de leituras requisitadas execedeu a quantidade de entradas disponíveis.","test_case_few_reads":"Caso de teste $0 falhou: ainda restam entradas!","test_case_failed":"Caso de teste $0 falhou: entradas:<$1>; saída esperada:<$2>; saída:<$3>","test_case_failed_exception":"Caso de teste $0 falhou: $1","invalid_type_conversion":"O valor $0 não pode ser convertido para o tipo $1"};
  1913. /***/ }),
  1914. /***/ "./i18n/pt/index.js":
  1915. /*!**************************!*\
  1916. !*** ./i18n/pt/index.js ***!
  1917. \**************************/
  1918. /*! exports provided: default */
  1919. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1920. "use strict";
  1921. __webpack_require__.r(__webpack_exports__);
  1922. /* harmony import */ var _error_json__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./error.json */ "./i18n/pt/error.json");
  1923. var _error_json__WEBPACK_IMPORTED_MODULE_0___namespace = /*#__PURE__*/__webpack_require__.t(/*! ./error.json */ "./i18n/pt/error.json", 1);
  1924. /* harmony import */ var _message_json__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./message.json */ "./i18n/pt/message.json");
  1925. var _message_json__WEBPACK_IMPORTED_MODULE_1___namespace = /*#__PURE__*/__webpack_require__.t(/*! ./message.json */ "./i18n/pt/message.json", 1);
  1926. /* harmony import */ var _ui_json__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ui.json */ "./i18n/pt/ui.json");
  1927. var _ui_json__WEBPACK_IMPORTED_MODULE_2___namespace = /*#__PURE__*/__webpack_require__.t(/*! ./ui.json */ "./i18n/pt/ui.json", 1);
  1928. /* harmony default export */ __webpack_exports__["default"] = ({
  1929. 'message': _message_json__WEBPACK_IMPORTED_MODULE_1__,
  1930. 'error': _error_json__WEBPACK_IMPORTED_MODULE_0__,
  1931. 'ui': _ui_json__WEBPACK_IMPORTED_MODULE_2__
  1932. });
  1933. /***/ }),
  1934. /***/ "./i18n/pt/message.json":
  1935. /*!******************************!*\
  1936. !*** ./i18n/pt/message.json ***!
  1937. \******************************/
  1938. /*! exports provided: test_case_success, test_case_duration, default */
  1939. /***/ (function(module) {
  1940. module.exports = {"test_case_success":"Caso de teste $0: OK","test_case_duration":"Levou $0ms"};
  1941. /***/ }),
  1942. /***/ "./i18n/pt/ui.json":
  1943. /*!*************************!*\
  1944. !*** ./i18n/pt/ui.json ***!
  1945. \*************************/
  1946. /*! exports provided: function, btn_clear, btn_function, btn_arithmetic_plus, btn_arithmetic_minus, btn_arithmetic_multiplication, btn_arithmetic_division, btn_arithmetic_module, btn_break, btn_case, start, void, integer, and, or, not, real, program, text, text_start, boolean, true, false, variable, command, new_parameter, new_variable, new_global, new_function, vector, text_comment_start, text_comment_main, text_read_var, text_write_var, text_command_read, text_command_write, text_return, text_btn_return, text_comment, join_or, matrix_string, vector_string, text_attribution, text_if, text_break, text_else, text_for, text_code_while, text_code_do, text_command_do, text_code_switch, text_code_case, text_logic_expression, text_arithmetic_expression, text_iftrue, text_repeatNtimes, text_receives, text_whiletrue, text_dowhiletrue, text_switch, text_functioncall, text_value, text_operator, text_parentheses, text_change, text_teacher_algorithm, text_teacher_algorithm_include, text_teacher_test_case, text_teacher_config, text_teacher_data_types, text_teacher_commands, text_teacher_functions, text_teacher_create_functions, text_teacher_create_movement_functions, text_teacher_test_case_input, text_teacher_test_case_output, text_teacher_test_case_actions, text_teacher_test_case_add, text_header_ivprog_functions, text_menu_functions_math, text_menu_functions_text, text_menu_functions_arrangement, text_menu_functions_conversion, text_none_variable, text_none_variable_instruction, text_ivprog_description, tooltip_visual, tooltip_textual, tooltip_upload, tooltip_download, tooltip_undo, tooltip_redo, tooltip_run, tooltip_evaluate, tooltip_help, tooltip_add_global, tooltip_minimize, tooltip_console, var_menu_select_var, var_menu_select_all, var_menu_select_function, expression_menu_select, math, text_t, inform_valid_name, inform_valid_content, inform_valid_expression, inform_valid_name_duplicated, inform_valid_global_duplicated, inform_valid_variable_duplicated, arrangement, conversion, $sin, $cos, $tan, $sqrt, $pow, $log, $abs, $negate, $invert, $max, $min, $substring, $length, $uppercase, $lowercase, $charAt, $numElements, $matrixLines, $matrixColumns, $isReal, $isInt, $isBool, $castReal, $castInt, $castBool, $castString, text_ivprog_version, default */
  1947. /***/ (function(module) {
  1948. module.exports = {"function":"funcao","btn_clear":"Limpar","btn_function":"Função","btn_arithmetic_plus":"Adição","btn_arithmetic_minus":"Subtração","btn_arithmetic_multiplication":"Multiplicação","btn_arithmetic_division":"Divisão","btn_arithmetic_module":"Módulo","btn_break":"Pare","btn_case":"Caso","start":"inicio","void":"vazio","integer":"inteiro","and":"E","or":"OU","not":"nao","real":"real","program":"programa","text":"cadeia","text_start":"texto","boolean":"logico","true":"verdadeiro","false":"falso","variable":"Variável","command":"Comando","new_parameter":"novo_parametro","new_variable":"nova_variavel","new_global":"nova_global","new_function":"nova_funcao","vector":"vetor","text_comment_start":"Comentário inicial da função...","text_comment_main":"Esta é a função principal...","text_read_var":"Leitura de dados","text_write_var":"Escrita de dados","text_command_read":"leia","text_command_write":"escreva","text_return":"retorne","text_btn_return":"Retorno","text_comment":"Comentário","join_or":"ou","matrix_string":"matriz de $0","vector_string":"vetor de $0","text_attribution":"Atribuição","text_if":"se","text_break":"pare","text_else":"senao","text_for":"para","text_code_while":"enquanto","text_code_do":"faca","text_command_do":"faça","text_code_switch":"escolha","text_code_case":"caso","text_logic_expression":"Expressão Lógica","text_arithmetic_expression":"Expressão Relacional","text_iftrue":"Se verdadeiro então","text_repeatNtimes":"Repita N vezes","text_receives":"recebe","text_whiletrue":"Enquanto verdadeiro","text_dowhiletrue":"Faça enquanto verdadeiro","text_switch":"Escolha","text_functioncall":"Chamada de função","text_value":"Valor","text_operator":"Operador","text_parentheses":"Parênteses","text_change":"Alterar","text_teacher_algorithm":"Algoritmo","text_teacher_algorithm_include":"Incluir o algoritmo abaixo no exercício","text_teacher_test_case":"Casos de teste","text_teacher_config":"Configurações","text_teacher_data_types":"Tipos de dados","text_teacher_commands":"Comandos","text_teacher_functions":"Funções","text_teacher_create_functions":"Criar novas funções","text_teacher_create_movement_functions":"Movimentar funções","text_teacher_test_case_input":"Entrada","text_teacher_test_case_output":"Saída","text_teacher_test_case_actions":"Ações","text_teacher_test_case_add":"Adicionar caso de teste","text_header_ivprog_functions":"Funções do iVProg","text_menu_functions_math":"Matemática","text_menu_functions_text":"Texto","text_menu_functions_arrangement":"Arranjo","text_menu_functions_conversion":"Conversão","text_none_variable":"Nenhuma variável declarada","text_none_variable_instruction":"Antes de utilizar uma variável, é necessário criá-la","text_ivprog_description":"Programação Visual interativa na Internet","tooltip_visual":"Programação visual","tooltip_textual":"Programação textual","tooltip_upload":"Upload de código fonte","tooltip_download":"Download do código fonte","tooltip_undo":"Desfazer","tooltip_redo":"Refazer","tooltip_run":"Executar o programa","tooltip_evaluate":"Avaliar o programa","tooltip_help":"Ajuda","tooltip_add_global":"Adicionar variável global","tooltip_minimize":"Ocultar os elementos da função","tooltip_console":"Abrir/fechar o terminal","var_menu_select_var":"Selecione uma variável","var_menu_select_all":"Selecione","var_menu_select_function":"Selecione uma função","expression_menu_select":"Construir uma expressão lógica","math":"Matematica","text_t":"Texto","inform_valid_name":"Informe um nome válido!","inform_valid_content":"Informe o conteúdo!","inform_valid_expression":"Construa uma expressão lógica!","inform_valid_name_duplicated":"Este nome já está em uso por outra função!","inform_valid_global_duplicated":"Já existe uma variável global com o nome informado.","inform_valid_variable_duplicated":"Já existe uma variável local com o nome informado.","arrangement":"Arranjo","conversion":"Conversao","$sin":"seno","$cos":"cosseno","$tan":"tangente","$sqrt":"raiz_quadrada","$pow":"potencia","$log":"logaritmo","$abs":"modulo","$negate":"trocar_sinal","$invert":"inverter_valor","$max":"maximo","$min":"minimo","$substring":"subcadeia","$length":"comprimento","$uppercase":"caixa_alta","$lowercase":"caixa_baixa","$charAt":"texto_na_posicao","$numElements":"total_de_elementos","$matrixLines":"total_de_linhas","$matrixColumns":"total_de_colunas","$isReal":"e_real","$isInt":"e_inteiro","$isBool":"e_logico","$castReal":"como_real","$castInt":"como_inteiro","$castBool":"como_logico","$castString":"como_cadeia","text_ivprog_version":"Versão"};
  1949. /***/ }),
  1950. /***/ "./js/Sortable.js":
  1951. /*!************************!*\
  1952. !*** ./js/Sortable.js ***!
  1953. \************************/
  1954. /*! no static exports found */
  1955. /***/ (function(module, exports, __webpack_require__) {
  1956. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  1957. /**!
  1958. * Sortable
  1959. * @author RubaXa <trash@rubaxa.org>
  1960. * @license MIT
  1961. */
  1962. (function sortableModule(factory) {
  1963. "use strict";
  1964. if (true) {
  1965. !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  1966. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  1967. (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
  1968. __WEBPACK_AMD_DEFINE_FACTORY__),
  1969. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  1970. } else {}
  1971. })(function sortableFactory() {
  1972. "use strict";
  1973. if (typeof window == "undefined" || !window.document) {
  1974. return function sortableError() {
  1975. throw new Error("Sortable.js requires a window with a document");
  1976. };
  1977. }
  1978. var dragEl,
  1979. parentEl,
  1980. ghostEl,
  1981. cloneEl,
  1982. rootEl,
  1983. nextEl,
  1984. lastDownEl,
  1985. scrollEl,
  1986. scrollParentEl,
  1987. scrollCustomFn,
  1988. lastEl,
  1989. lastCSS,
  1990. lastParentCSS,
  1991. oldIndex,
  1992. newIndex,
  1993. activeGroup,
  1994. putSortable,
  1995. autoScroll = {},
  1996. tapEvt,
  1997. touchEvt,
  1998. moved,
  1999. /** @const */
  2000. R_SPACE = /\s+/g,
  2001. R_FLOAT = /left|right|inline/,
  2002. expando = 'Sortable' + new Date().getTime(),
  2003. win = window,
  2004. document = win.document,
  2005. parseInt = win.parseInt,
  2006. $ = win.jQuery || win.Zepto,
  2007. Polymer = win.Polymer,
  2008. captureMode = false,
  2009. supportDraggable = !!('draggable' in document.createElement('div')),
  2010. supportCssPointerEvents = function (el) {
  2011. // false when IE11
  2012. if (!!navigator.userAgent.match(/Trident.*rv[ :]?11\./)) {
  2013. return false;
  2014. }
  2015. el = document.createElement('x');
  2016. el.style.cssText = 'pointer-events:auto';
  2017. return el.style.pointerEvents === 'auto';
  2018. }(),
  2019. _silent = false,
  2020. abs = Math.abs,
  2021. min = Math.min,
  2022. savedInputChecked = [],
  2023. touchDragOverListeners = [],
  2024. _autoScroll = _throttle(function (
  2025. /**Event*/
  2026. evt,
  2027. /**Object*/
  2028. options,
  2029. /**HTMLElement*/
  2030. rootEl) {
  2031. // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=505521
  2032. if (rootEl && options.scroll) {
  2033. var _this = rootEl[expando],
  2034. el,
  2035. rect,
  2036. sens = options.scrollSensitivity,
  2037. speed = options.scrollSpeed,
  2038. x = evt.clientX,
  2039. y = evt.clientY,
  2040. winWidth = window.innerWidth,
  2041. winHeight = window.innerHeight,
  2042. vx,
  2043. vy,
  2044. scrollOffsetX,
  2045. scrollOffsetY; // Delect scrollEl
  2046. if (scrollParentEl !== rootEl) {
  2047. scrollEl = options.scroll;
  2048. scrollParentEl = rootEl;
  2049. scrollCustomFn = options.scrollFn;
  2050. if (scrollEl === true) {
  2051. scrollEl = rootEl;
  2052. do {
  2053. if (scrollEl.offsetWidth < scrollEl.scrollWidth || scrollEl.offsetHeight < scrollEl.scrollHeight) {
  2054. break;
  2055. }
  2056. /* jshint boss:true */
  2057. } while (scrollEl = scrollEl.parentNode);
  2058. }
  2059. }
  2060. if (scrollEl) {
  2061. el = scrollEl;
  2062. rect = scrollEl.getBoundingClientRect();
  2063. vx = (abs(rect.right - x) <= sens) - (abs(rect.left - x) <= sens);
  2064. vy = (abs(rect.bottom - y) <= sens) - (abs(rect.top - y) <= sens);
  2065. }
  2066. if (!(vx || vy)) {
  2067. vx = (winWidth - x <= sens) - (x <= sens);
  2068. vy = (winHeight - y <= sens) - (y <= sens);
  2069. /* jshint expr:true */
  2070. (vx || vy) && (el = win);
  2071. }
  2072. if (autoScroll.vx !== vx || autoScroll.vy !== vy || autoScroll.el !== el) {
  2073. autoScroll.el = el;
  2074. autoScroll.vx = vx;
  2075. autoScroll.vy = vy;
  2076. clearInterval(autoScroll.pid);
  2077. if (el) {
  2078. autoScroll.pid = setInterval(function () {
  2079. scrollOffsetY = vy ? vy * speed : 0;
  2080. scrollOffsetX = vx ? vx * speed : 0;
  2081. if ('function' === typeof scrollCustomFn) {
  2082. return scrollCustomFn.call(_this, scrollOffsetX, scrollOffsetY, evt);
  2083. }
  2084. if (el === win) {
  2085. win.scrollTo(win.pageXOffset + scrollOffsetX, win.pageYOffset + scrollOffsetY);
  2086. } else {
  2087. el.scrollTop += scrollOffsetY;
  2088. el.scrollLeft += scrollOffsetX;
  2089. }
  2090. }, 24);
  2091. }
  2092. }
  2093. }
  2094. }, 30),
  2095. _prepareGroup = function _prepareGroup(options) {
  2096. function toFn(value, pull) {
  2097. if (value === void 0 || value === true) {
  2098. value = group.name;
  2099. }
  2100. if (typeof value === 'function') {
  2101. return value;
  2102. } else {
  2103. return function (to, from) {
  2104. var fromGroup = from.options.group.name;
  2105. return pull ? value : value && (value.join ? value.indexOf(fromGroup) > -1 : fromGroup == value);
  2106. };
  2107. }
  2108. }
  2109. var group = {};
  2110. var originalGroup = options.group;
  2111. if (!originalGroup || _typeof(originalGroup) != 'object') {
  2112. originalGroup = {
  2113. name: originalGroup
  2114. };
  2115. }
  2116. group.name = originalGroup.name;
  2117. group.checkPull = toFn(originalGroup.pull, true);
  2118. group.checkPut = toFn(originalGroup.put);
  2119. group.revertClone = originalGroup.revertClone;
  2120. options.group = group;
  2121. };
  2122. /**
  2123. * @class Sortable
  2124. * @param {HTMLElement} el
  2125. * @param {Object} [options]
  2126. */
  2127. function Sortable(el, options) {
  2128. if (!(el && el.nodeType && el.nodeType === 1)) {
  2129. throw 'Sortable: `el` must be HTMLElement, and not ' + {}.toString.call(el);
  2130. }
  2131. this.el = el; // root element
  2132. this.options = options = _extend({}, options); // Export instance
  2133. el[expando] = this; // Default options
  2134. var defaults = {
  2135. group: Math.random(),
  2136. sort: true,
  2137. disabled: false,
  2138. store: null,
  2139. handle: null,
  2140. scroll: true,
  2141. scrollSensitivity: 30,
  2142. scrollSpeed: 10,
  2143. draggable: /[uo]l/i.test(el.nodeName) ? 'li' : '>*',
  2144. ghostClass: 'sortable-ghost',
  2145. chosenClass: 'sortable-chosen',
  2146. dragClass: 'sortable-drag',
  2147. ignore: 'a, img',
  2148. filter: null,
  2149. preventOnFilter: true,
  2150. animation: 0,
  2151. setData: function setData(dataTransfer, dragEl) {
  2152. dataTransfer.setData('Text', dragEl.textContent);
  2153. },
  2154. dropBubble: false,
  2155. dragoverBubble: false,
  2156. dataIdAttr: 'data-id',
  2157. delay: 0,
  2158. forceFallback: false,
  2159. fallbackClass: 'sortable-fallback',
  2160. fallbackOnBody: false,
  2161. fallbackTolerance: 0,
  2162. fallbackOffset: {
  2163. x: 0,
  2164. y: 0
  2165. }
  2166. }; // Set default options
  2167. for (var name in defaults) {
  2168. !(name in options) && (options[name] = defaults[name]);
  2169. }
  2170. _prepareGroup(options); // Bind all private methods
  2171. for (var fn in this) {
  2172. if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {
  2173. this[fn] = this[fn].bind(this);
  2174. }
  2175. } // Setup drag mode
  2176. this.nativeDraggable = options.forceFallback ? false : supportDraggable; // Bind events
  2177. _on(el, 'mousedown', this._onTapStart);
  2178. _on(el, 'touchstart', this._onTapStart);
  2179. _on(el, 'pointerdown', this._onTapStart);
  2180. if (this.nativeDraggable) {
  2181. _on(el, 'dragover', this);
  2182. _on(el, 'dragenter', this);
  2183. }
  2184. touchDragOverListeners.push(this._onDragOver); // Restore sorting
  2185. options.store && this.sort(options.store.get(this));
  2186. }
  2187. Sortable.prototype =
  2188. /** @lends Sortable.prototype */
  2189. {
  2190. constructor: Sortable,
  2191. _onTapStart: function _onTapStart(
  2192. /** Event|TouchEvent */
  2193. evt) {
  2194. var _this = this,
  2195. el = this.el,
  2196. options = this.options,
  2197. preventOnFilter = options.preventOnFilter,
  2198. type = evt.type,
  2199. touch = evt.touches && evt.touches[0],
  2200. target = (touch || evt).target,
  2201. originalTarget = evt.target.shadowRoot && evt.path && evt.path[0] || target,
  2202. filter = options.filter,
  2203. startIndex;
  2204. _saveInputCheckedState(el); // Don't trigger start event when an element is been dragged, otherwise the evt.oldindex always wrong when set option.group.
  2205. if (dragEl) {
  2206. return;
  2207. }
  2208. if (/mousedown|pointerdown/.test(type) && evt.button !== 0 || options.disabled) {
  2209. return; // only left button or enabled
  2210. }
  2211. target = _closest(target, options.draggable, el);
  2212. if (!target) {
  2213. return;
  2214. }
  2215. if (lastDownEl === target) {
  2216. // Ignoring duplicate `down`
  2217. return;
  2218. } // Get the index of the dragged element within its parent
  2219. startIndex = _index(target, options.draggable); // Check filter
  2220. if (typeof filter === 'function') {
  2221. if (filter.call(this, evt, target, this)) {
  2222. _dispatchEvent(_this, originalTarget, 'filter', target, el, startIndex);
  2223. preventOnFilter && evt.preventDefault();
  2224. return; // cancel dnd
  2225. }
  2226. } else if (filter) {
  2227. filter = filter.split(',').some(function (criteria) {
  2228. criteria = _closest(originalTarget, criteria.trim(), el);
  2229. if (criteria) {
  2230. _dispatchEvent(_this, criteria, 'filter', target, el, startIndex);
  2231. return true;
  2232. }
  2233. });
  2234. if (filter) {
  2235. preventOnFilter && evt.preventDefault();
  2236. return; // cancel dnd
  2237. }
  2238. }
  2239. if (options.handle && !_closest(originalTarget, options.handle, el)) {
  2240. return;
  2241. } // Prepare `dragstart`
  2242. this._prepareDragStart(evt, touch, target, startIndex);
  2243. },
  2244. _prepareDragStart: function _prepareDragStart(
  2245. /** Event */
  2246. evt,
  2247. /** Touch */
  2248. touch,
  2249. /** HTMLElement */
  2250. target,
  2251. /** Number */
  2252. startIndex) {
  2253. var _this = this,
  2254. el = _this.el,
  2255. options = _this.options,
  2256. ownerDocument = el.ownerDocument,
  2257. dragStartFn;
  2258. if (target && !dragEl && target.parentNode === el) {
  2259. tapEvt = evt;
  2260. rootEl = el;
  2261. dragEl = target;
  2262. parentEl = dragEl.parentNode;
  2263. nextEl = dragEl.nextSibling;
  2264. lastDownEl = target;
  2265. activeGroup = options.group;
  2266. oldIndex = startIndex;
  2267. this._lastX = (touch || evt).clientX;
  2268. this._lastY = (touch || evt).clientY;
  2269. dragEl.style['will-change'] = 'transform';
  2270. dragStartFn = function dragStartFn() {
  2271. // Delayed drag has been triggered
  2272. // we can re-enable the events: touchmove/mousemove
  2273. _this._disableDelayedDrag(); // Make the element draggable
  2274. dragEl.draggable = _this.nativeDraggable; // Chosen item
  2275. _toggleClass(dragEl, options.chosenClass, true); // Bind the events: dragstart/dragend
  2276. _this._triggerDragStart(evt, touch); // Drag start event
  2277. _dispatchEvent(_this, rootEl, 'choose', dragEl, rootEl, oldIndex);
  2278. }; // Disable "draggable"
  2279. options.ignore.split(',').forEach(function (criteria) {
  2280. _find(dragEl, criteria.trim(), _disableDraggable);
  2281. });
  2282. _on(ownerDocument, 'mouseup', _this._onDrop);
  2283. _on(ownerDocument, 'touchend', _this._onDrop);
  2284. _on(ownerDocument, 'touchcancel', _this._onDrop);
  2285. _on(ownerDocument, 'pointercancel', _this._onDrop);
  2286. _on(ownerDocument, 'selectstart', _this);
  2287. if (options.delay) {
  2288. // If the user moves the pointer or let go the click or touch
  2289. // before the delay has been reached:
  2290. // disable the delayed drag
  2291. _on(ownerDocument, 'mouseup', _this._disableDelayedDrag);
  2292. _on(ownerDocument, 'touchend', _this._disableDelayedDrag);
  2293. _on(ownerDocument, 'touchcancel', _this._disableDelayedDrag);
  2294. _on(ownerDocument, 'mousemove', _this._disableDelayedDrag);
  2295. _on(ownerDocument, 'touchmove', _this._disableDelayedDrag);
  2296. _on(ownerDocument, 'pointermove', _this._disableDelayedDrag);
  2297. _this._dragStartTimer = setTimeout(dragStartFn, options.delay);
  2298. } else {
  2299. dragStartFn();
  2300. }
  2301. }
  2302. },
  2303. _disableDelayedDrag: function _disableDelayedDrag() {
  2304. var ownerDocument = this.el.ownerDocument;
  2305. clearTimeout(this._dragStartTimer);
  2306. _off(ownerDocument, 'mouseup', this._disableDelayedDrag);
  2307. _off(ownerDocument, 'touchend', this._disableDelayedDrag);
  2308. _off(ownerDocument, 'touchcancel', this._disableDelayedDrag);
  2309. _off(ownerDocument, 'mousemove', this._disableDelayedDrag);
  2310. _off(ownerDocument, 'touchmove', this._disableDelayedDrag);
  2311. _off(ownerDocument, 'pointermove', this._disableDelayedDrag);
  2312. },
  2313. _triggerDragStart: function _triggerDragStart(
  2314. /** Event */
  2315. evt,
  2316. /** Touch */
  2317. touch) {
  2318. touch = touch || (evt.pointerType == 'touch' ? evt : null);
  2319. if (touch) {
  2320. // Touch device support
  2321. tapEvt = {
  2322. target: dragEl,
  2323. clientX: touch.clientX,
  2324. clientY: touch.clientY
  2325. };
  2326. this._onDragStart(tapEvt, 'touch');
  2327. } else if (!this.nativeDraggable) {
  2328. this._onDragStart(tapEvt, true);
  2329. } else {
  2330. _on(dragEl, 'dragend', this);
  2331. _on(rootEl, 'dragstart', this._onDragStart);
  2332. }
  2333. try {
  2334. if (document.selection) {
  2335. // Timeout neccessary for IE9
  2336. setTimeout(function () {
  2337. document.selection.empty();
  2338. });
  2339. } else {
  2340. window.getSelection().removeAllRanges();
  2341. }
  2342. } catch (err) {}
  2343. },
  2344. _dragStarted: function _dragStarted() {
  2345. if (rootEl && dragEl) {
  2346. var options = this.options; // Apply effect
  2347. _toggleClass(dragEl, options.ghostClass, true);
  2348. _toggleClass(dragEl, options.dragClass, false);
  2349. Sortable.active = this; // Drag start event
  2350. _dispatchEvent(this, rootEl, 'start', dragEl, rootEl, oldIndex);
  2351. } else {
  2352. this._nulling();
  2353. }
  2354. },
  2355. _emulateDragOver: function _emulateDragOver() {
  2356. if (touchEvt) {
  2357. if (this._lastX === touchEvt.clientX && this._lastY === touchEvt.clientY) {
  2358. return;
  2359. }
  2360. this._lastX = touchEvt.clientX;
  2361. this._lastY = touchEvt.clientY;
  2362. if (!supportCssPointerEvents) {
  2363. _css(ghostEl, 'display', 'none');
  2364. }
  2365. var target = document.elementFromPoint(touchEvt.clientX, touchEvt.clientY),
  2366. parent = target,
  2367. i = touchDragOverListeners.length;
  2368. if (parent) {
  2369. do {
  2370. if (parent[expando]) {
  2371. while (i--) {
  2372. touchDragOverListeners[i]({
  2373. clientX: touchEvt.clientX,
  2374. clientY: touchEvt.clientY,
  2375. target: target,
  2376. rootEl: parent
  2377. });
  2378. }
  2379. break;
  2380. }
  2381. target = parent; // store last element
  2382. }
  2383. /* jshint boss:true */
  2384. while (parent = parent.parentNode);
  2385. }
  2386. if (!supportCssPointerEvents) {
  2387. _css(ghostEl, 'display', '');
  2388. }
  2389. }
  2390. },
  2391. _onTouchMove: function _onTouchMove(
  2392. /**TouchEvent*/
  2393. evt) {
  2394. if (tapEvt) {
  2395. var options = this.options,
  2396. fallbackTolerance = options.fallbackTolerance,
  2397. fallbackOffset = options.fallbackOffset,
  2398. touch = evt.touches ? evt.touches[0] : evt,
  2399. dx = touch.clientX - tapEvt.clientX + fallbackOffset.x,
  2400. dy = touch.clientY - tapEvt.clientY + fallbackOffset.y,
  2401. translate3d = evt.touches ? 'translate3d(' + dx + 'px,' + dy + 'px,0)' : 'translate(' + dx + 'px,' + dy + 'px)'; // only set the status to dragging, when we are actually dragging
  2402. if (!Sortable.active) {
  2403. if (fallbackTolerance && min(abs(touch.clientX - this._lastX), abs(touch.clientY - this._lastY)) < fallbackTolerance) {
  2404. return;
  2405. }
  2406. this._dragStarted();
  2407. } // as well as creating the ghost element on the document body
  2408. this._appendGhost();
  2409. moved = true;
  2410. touchEvt = touch;
  2411. _css(ghostEl, 'webkitTransform', translate3d);
  2412. _css(ghostEl, 'mozTransform', translate3d);
  2413. _css(ghostEl, 'msTransform', translate3d);
  2414. _css(ghostEl, 'transform', translate3d);
  2415. evt.preventDefault();
  2416. }
  2417. },
  2418. _appendGhost: function _appendGhost() {
  2419. if (!ghostEl) {
  2420. var rect = dragEl.getBoundingClientRect(),
  2421. css = _css(dragEl),
  2422. options = this.options,
  2423. ghostRect;
  2424. ghostEl = dragEl.cloneNode(true);
  2425. _toggleClass(ghostEl, options.ghostClass, false);
  2426. _toggleClass(ghostEl, options.fallbackClass, true);
  2427. _toggleClass(ghostEl, options.dragClass, true);
  2428. _css(ghostEl, 'top', rect.top - parseInt(css.marginTop, 10));
  2429. _css(ghostEl, 'left', rect.left - parseInt(css.marginLeft, 10));
  2430. _css(ghostEl, 'width', rect.width);
  2431. _css(ghostEl, 'height', rect.height);
  2432. _css(ghostEl, 'opacity', '0.8');
  2433. _css(ghostEl, 'position', 'fixed');
  2434. _css(ghostEl, 'zIndex', '100000');
  2435. _css(ghostEl, 'pointerEvents', 'none');
  2436. options.fallbackOnBody && document.body.appendChild(ghostEl) || rootEl.appendChild(ghostEl); // Fixing dimensions.
  2437. ghostRect = ghostEl.getBoundingClientRect();
  2438. _css(ghostEl, 'width', rect.width * 2 - ghostRect.width);
  2439. _css(ghostEl, 'height', rect.height * 2 - ghostRect.height);
  2440. }
  2441. },
  2442. _onDragStart: function _onDragStart(
  2443. /**Event*/
  2444. evt,
  2445. /**boolean*/
  2446. useFallback) {
  2447. var dataTransfer = evt.dataTransfer,
  2448. options = this.options;
  2449. this._offUpEvents();
  2450. if (activeGroup.checkPull(this, this, dragEl, evt)) {
  2451. cloneEl = _clone(dragEl);
  2452. cloneEl.draggable = false;
  2453. cloneEl.style['will-change'] = '';
  2454. _css(cloneEl, 'display', 'none');
  2455. _toggleClass(cloneEl, this.options.chosenClass, false);
  2456. rootEl.insertBefore(cloneEl, dragEl);
  2457. _dispatchEvent(this, rootEl, 'clone', dragEl);
  2458. }
  2459. _toggleClass(dragEl, options.dragClass, true);
  2460. if (useFallback) {
  2461. if (useFallback === 'touch') {
  2462. // Bind touch events
  2463. _on(document, 'touchmove', this._onTouchMove);
  2464. _on(document, 'touchend', this._onDrop);
  2465. _on(document, 'touchcancel', this._onDrop);
  2466. _on(document, 'pointermove', this._onTouchMove);
  2467. _on(document, 'pointerup', this._onDrop);
  2468. } else {
  2469. // Old brwoser
  2470. _on(document, 'mousemove', this._onTouchMove);
  2471. _on(document, 'mouseup', this._onDrop);
  2472. }
  2473. this._loopId = setInterval(this._emulateDragOver, 50);
  2474. } else {
  2475. if (dataTransfer) {
  2476. dataTransfer.effectAllowed = 'move';
  2477. options.setData && options.setData.call(this, dataTransfer, dragEl);
  2478. }
  2479. _on(document, 'drop', this);
  2480. setTimeout(this._dragStarted, 0);
  2481. }
  2482. },
  2483. _onDragOver: function _onDragOver(
  2484. /**Event*/
  2485. evt) {
  2486. var el = this.el,
  2487. target,
  2488. dragRect,
  2489. targetRect,
  2490. revert,
  2491. options = this.options,
  2492. group = options.group,
  2493. activeSortable = Sortable.active,
  2494. isOwner = activeGroup === group,
  2495. isMovingBetweenSortable = false,
  2496. canSort = options.sort;
  2497. if (evt.preventDefault !== void 0) {
  2498. evt.preventDefault();
  2499. !options.dragoverBubble && evt.stopPropagation();
  2500. }
  2501. if (dragEl.animated) {
  2502. return;
  2503. }
  2504. moved = true;
  2505. if (activeSortable && !options.disabled && (isOwner ? canSort || (revert = !rootEl.contains(dragEl)) // Reverting item into the original list
  2506. : putSortable === this || (activeSortable.lastPullMode = activeGroup.checkPull(this, activeSortable, dragEl, evt)) && group.checkPut(this, activeSortable, dragEl, evt)) && (evt.rootEl === void 0 || evt.rootEl === this.el) // touch fallback
  2507. ) {
  2508. // Smart auto-scrolling
  2509. _autoScroll(evt, options, this.el);
  2510. if (_silent) {
  2511. return;
  2512. }
  2513. target = _closest(evt.target, options.draggable, el);
  2514. dragRect = dragEl.getBoundingClientRect();
  2515. if (putSortable !== this) {
  2516. putSortable = this;
  2517. isMovingBetweenSortable = true;
  2518. }
  2519. if (revert) {
  2520. _cloneHide(activeSortable, true);
  2521. parentEl = rootEl; // actualization
  2522. if (cloneEl || nextEl) {
  2523. rootEl.insertBefore(dragEl, cloneEl || nextEl);
  2524. } else if (!canSort) {
  2525. rootEl.appendChild(dragEl);
  2526. }
  2527. return;
  2528. }
  2529. if (el.children.length === 0 || el.children[0] === ghostEl || el === evt.target && _ghostIsLast(el, evt)) {
  2530. //assign target only if condition is true
  2531. if (el.children.length !== 0 && el.children[0] !== ghostEl && el === evt.target) {
  2532. target = el.lastElementChild;
  2533. }
  2534. if (target) {
  2535. if (target.animated) {
  2536. return;
  2537. }
  2538. targetRect = target.getBoundingClientRect();
  2539. }
  2540. _cloneHide(activeSortable, isOwner);
  2541. if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt) !== false) {
  2542. if (!dragEl.contains(el)) {
  2543. el.appendChild(dragEl);
  2544. parentEl = el; // actualization
  2545. }
  2546. this._animate(dragRect, dragEl);
  2547. target && this._animate(targetRect, target);
  2548. }
  2549. } else if (target && !target.animated && target !== dragEl && target.parentNode[expando] !== void 0) {
  2550. if (lastEl !== target) {
  2551. lastEl = target;
  2552. lastCSS = _css(target);
  2553. lastParentCSS = _css(target.parentNode);
  2554. }
  2555. targetRect = target.getBoundingClientRect();
  2556. var width = targetRect.right - targetRect.left,
  2557. height = targetRect.bottom - targetRect.top,
  2558. floating = R_FLOAT.test(lastCSS.cssFloat + lastCSS.display) || lastParentCSS.display == 'flex' && lastParentCSS['flex-direction'].indexOf('row') === 0,
  2559. isWide = target.offsetWidth > dragEl.offsetWidth,
  2560. isLong = target.offsetHeight > dragEl.offsetHeight,
  2561. halfway = (floating ? (evt.clientX - targetRect.left) / width : (evt.clientY - targetRect.top) / height) > 0.5,
  2562. nextSibling = target.nextElementSibling,
  2563. after = false;
  2564. if (floating) {
  2565. var elTop = dragEl.offsetTop,
  2566. tgTop = target.offsetTop;
  2567. if (elTop === tgTop) {
  2568. after = target.previousElementSibling === dragEl && !isWide || halfway && isWide;
  2569. } else if (target.previousElementSibling === dragEl || dragEl.previousElementSibling === target) {
  2570. after = (evt.clientY - targetRect.top) / height > 0.5;
  2571. } else {
  2572. after = tgTop > elTop;
  2573. }
  2574. } else if (!isMovingBetweenSortable) {
  2575. after = nextSibling !== dragEl && !isLong || halfway && isLong;
  2576. }
  2577. var moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, after);
  2578. if (moveVector !== false) {
  2579. if (moveVector === 1 || moveVector === -1) {
  2580. after = moveVector === 1;
  2581. }
  2582. _silent = true;
  2583. setTimeout(_unsilent, 30);
  2584. _cloneHide(activeSortable, isOwner);
  2585. if (!dragEl.contains(el)) {
  2586. if (after && !nextSibling) {
  2587. el.appendChild(dragEl);
  2588. } else {
  2589. target.parentNode.insertBefore(dragEl, after ? nextSibling : target);
  2590. }
  2591. }
  2592. parentEl = dragEl.parentNode; // actualization
  2593. this._animate(dragRect, dragEl);
  2594. this._animate(targetRect, target);
  2595. }
  2596. }
  2597. }
  2598. },
  2599. _animate: function _animate(prevRect, target) {
  2600. var ms = this.options.animation;
  2601. if (ms) {
  2602. var currentRect = target.getBoundingClientRect();
  2603. if (prevRect.nodeType === 1) {
  2604. prevRect = prevRect.getBoundingClientRect();
  2605. }
  2606. _css(target, 'transition', 'none');
  2607. _css(target, 'transform', 'translate3d(' + (prevRect.left - currentRect.left) + 'px,' + (prevRect.top - currentRect.top) + 'px,0)');
  2608. target.offsetWidth; // repaint
  2609. _css(target, 'transition', 'all ' + ms + 'ms');
  2610. _css(target, 'transform', 'translate3d(0,0,0)');
  2611. clearTimeout(target.animated);
  2612. target.animated = setTimeout(function () {
  2613. _css(target, 'transition', '');
  2614. _css(target, 'transform', '');
  2615. target.animated = false;
  2616. }, ms);
  2617. }
  2618. },
  2619. _offUpEvents: function _offUpEvents() {
  2620. var ownerDocument = this.el.ownerDocument;
  2621. _off(document, 'touchmove', this._onTouchMove);
  2622. _off(document, 'pointermove', this._onTouchMove);
  2623. _off(ownerDocument, 'mouseup', this._onDrop);
  2624. _off(ownerDocument, 'touchend', this._onDrop);
  2625. _off(ownerDocument, 'pointerup', this._onDrop);
  2626. _off(ownerDocument, 'touchcancel', this._onDrop);
  2627. _off(ownerDocument, 'pointercancel', this._onDrop);
  2628. _off(ownerDocument, 'selectstart', this);
  2629. },
  2630. _onDrop: function _onDrop(
  2631. /**Event*/
  2632. evt) {
  2633. var el = this.el,
  2634. options = this.options;
  2635. clearInterval(this._loopId);
  2636. clearInterval(autoScroll.pid);
  2637. clearTimeout(this._dragStartTimer); // Unbind events
  2638. _off(document, 'mousemove', this._onTouchMove);
  2639. if (this.nativeDraggable) {
  2640. _off(document, 'drop', this);
  2641. _off(el, 'dragstart', this._onDragStart);
  2642. }
  2643. this._offUpEvents();
  2644. if (evt) {
  2645. if (moved) {
  2646. evt.preventDefault();
  2647. !options.dropBubble && evt.stopPropagation();
  2648. }
  2649. ghostEl && ghostEl.parentNode && ghostEl.parentNode.removeChild(ghostEl);
  2650. if (rootEl === parentEl || Sortable.active.lastPullMode !== 'clone') {
  2651. // Remove clone
  2652. cloneEl && cloneEl.parentNode && cloneEl.parentNode.removeChild(cloneEl);
  2653. }
  2654. if (dragEl) {
  2655. if (this.nativeDraggable) {
  2656. _off(dragEl, 'dragend', this);
  2657. }
  2658. _disableDraggable(dragEl);
  2659. dragEl.style['will-change'] = ''; // Remove class's
  2660. _toggleClass(dragEl, this.options.ghostClass, false);
  2661. _toggleClass(dragEl, this.options.chosenClass, false); // Drag stop event
  2662. _dispatchEvent(this, rootEl, 'unchoose', dragEl, rootEl, oldIndex);
  2663. if (rootEl !== parentEl) {
  2664. newIndex = _index(dragEl, options.draggable);
  2665. if (newIndex >= 0) {
  2666. // Add event
  2667. _dispatchEvent(null, parentEl, 'add', dragEl, rootEl, oldIndex, newIndex); // Remove event
  2668. _dispatchEvent(this, rootEl, 'remove', dragEl, rootEl, oldIndex, newIndex); // drag from one list and drop into another
  2669. _dispatchEvent(null, parentEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
  2670. _dispatchEvent(this, rootEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
  2671. }
  2672. } else {
  2673. if (dragEl.nextSibling !== nextEl) {
  2674. // Get the index of the dragged element within its parent
  2675. newIndex = _index(dragEl, options.draggable);
  2676. if (newIndex >= 0) {
  2677. // drag & drop within the same list
  2678. _dispatchEvent(this, rootEl, 'update', dragEl, rootEl, oldIndex, newIndex);
  2679. _dispatchEvent(this, rootEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
  2680. }
  2681. }
  2682. }
  2683. if (Sortable.active) {
  2684. /* jshint eqnull:true */
  2685. if (newIndex == null || newIndex === -1) {
  2686. newIndex = oldIndex;
  2687. }
  2688. _dispatchEvent(this, rootEl, 'end', dragEl, rootEl, oldIndex, newIndex); // Save sorting
  2689. this.save();
  2690. }
  2691. }
  2692. }
  2693. this._nulling();
  2694. },
  2695. _nulling: function _nulling() {
  2696. rootEl = dragEl = parentEl = ghostEl = nextEl = cloneEl = lastDownEl = scrollEl = scrollParentEl = tapEvt = touchEvt = moved = newIndex = lastEl = lastCSS = putSortable = activeGroup = Sortable.active = null;
  2697. savedInputChecked.forEach(function (el) {
  2698. el.checked = true;
  2699. });
  2700. savedInputChecked.length = 0;
  2701. },
  2702. handleEvent: function handleEvent(
  2703. /**Event*/
  2704. evt) {
  2705. switch (evt.type) {
  2706. case 'drop':
  2707. case 'dragend':
  2708. this._onDrop(evt);
  2709. break;
  2710. case 'dragover':
  2711. case 'dragenter':
  2712. if (dragEl) {
  2713. this._onDragOver(evt);
  2714. _globalDragOver(evt);
  2715. }
  2716. break;
  2717. case 'selectstart':
  2718. evt.preventDefault();
  2719. break;
  2720. }
  2721. },
  2722. /**
  2723. * Serializes the item into an array of string.
  2724. * @returns {String[]}
  2725. */
  2726. toArray: function toArray() {
  2727. var order = [],
  2728. el,
  2729. children = this.el.children,
  2730. i = 0,
  2731. n = children.length,
  2732. options = this.options;
  2733. for (; i < n; i++) {
  2734. el = children[i];
  2735. if (_closest(el, options.draggable, this.el)) {
  2736. order.push(el.getAttribute(options.dataIdAttr) || _generateId(el));
  2737. }
  2738. }
  2739. return order;
  2740. },
  2741. /**
  2742. * Sorts the elements according to the array.
  2743. * @param {String[]} order order of the items
  2744. */
  2745. sort: function sort(order) {
  2746. var items = {},
  2747. rootEl = this.el;
  2748. this.toArray().forEach(function (id, i) {
  2749. var el = rootEl.children[i];
  2750. if (_closest(el, this.options.draggable, rootEl)) {
  2751. items[id] = el;
  2752. }
  2753. }, this);
  2754. order.forEach(function (id) {
  2755. if (items[id]) {
  2756. rootEl.removeChild(items[id]);
  2757. rootEl.appendChild(items[id]);
  2758. }
  2759. });
  2760. },
  2761. /**
  2762. * Save the current sorting
  2763. */
  2764. save: function save() {
  2765. var store = this.options.store;
  2766. store && store.set(this);
  2767. },
  2768. /**
  2769. * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.
  2770. * @param {HTMLElement} el
  2771. * @param {String} [selector] default: `options.draggable`
  2772. * @returns {HTMLElement|null}
  2773. */
  2774. closest: function closest(el, selector) {
  2775. return _closest(el, selector || this.options.draggable, this.el);
  2776. },
  2777. /**
  2778. * Set/get option
  2779. * @param {string} name
  2780. * @param {*} [value]
  2781. * @returns {*}
  2782. */
  2783. option: function option(name, value) {
  2784. var options = this.options;
  2785. if (value === void 0) {
  2786. return options[name];
  2787. } else {
  2788. options[name] = value;
  2789. if (name === 'group') {
  2790. _prepareGroup(options);
  2791. }
  2792. }
  2793. },
  2794. /**
  2795. * Destroy
  2796. */
  2797. destroy: function destroy() {
  2798. var el = this.el;
  2799. el[expando] = null;
  2800. _off(el, 'mousedown', this._onTapStart);
  2801. _off(el, 'touchstart', this._onTapStart);
  2802. _off(el, 'pointerdown', this._onTapStart);
  2803. if (this.nativeDraggable) {
  2804. _off(el, 'dragover', this);
  2805. _off(el, 'dragenter', this);
  2806. } // Remove draggable attributes
  2807. Array.prototype.forEach.call(el.querySelectorAll('[draggable]'), function (el) {
  2808. el.removeAttribute('draggable');
  2809. });
  2810. touchDragOverListeners.splice(touchDragOverListeners.indexOf(this._onDragOver), 1);
  2811. this._onDrop();
  2812. this.el = el = null;
  2813. }
  2814. };
  2815. function _cloneHide(sortable, state) {
  2816. if (sortable.lastPullMode !== 'clone') {
  2817. state = true;
  2818. }
  2819. if (cloneEl && cloneEl.state !== state) {
  2820. _css(cloneEl, 'display', state ? 'none' : '');
  2821. if (!state) {
  2822. if (cloneEl.state) {
  2823. if (sortable.options.group.revertClone) {
  2824. rootEl.insertBefore(cloneEl, nextEl);
  2825. sortable._animate(dragEl, cloneEl);
  2826. } else {
  2827. rootEl.insertBefore(cloneEl, dragEl);
  2828. }
  2829. }
  2830. }
  2831. cloneEl.state = state;
  2832. }
  2833. }
  2834. function _closest(
  2835. /**HTMLElement*/
  2836. el,
  2837. /**String*/
  2838. selector,
  2839. /**HTMLElement*/
  2840. ctx) {
  2841. if (el) {
  2842. ctx = ctx || document;
  2843. do {
  2844. if (selector === '>*' && el.parentNode === ctx || _matches(el, selector)) {
  2845. return el;
  2846. }
  2847. /* jshint boss:true */
  2848. } while (el = _getParentOrHost(el));
  2849. }
  2850. return null;
  2851. }
  2852. function _getParentOrHost(el) {
  2853. var parent = el.host;
  2854. return parent && parent.nodeType ? parent : el.parentNode;
  2855. }
  2856. function _globalDragOver(
  2857. /**Event*/
  2858. evt) {
  2859. if (evt.dataTransfer) {
  2860. evt.dataTransfer.dropEffect = 'move';
  2861. }
  2862. evt.preventDefault();
  2863. }
  2864. function _on(el, event, fn) {
  2865. el.addEventListener(event, fn, captureMode);
  2866. }
  2867. function _off(el, event, fn) {
  2868. el.removeEventListener(event, fn, captureMode);
  2869. }
  2870. function _toggleClass(el, name, state) {
  2871. if (el) {
  2872. if (el.classList) {
  2873. el.classList[state ? 'add' : 'remove'](name);
  2874. } else {
  2875. var className = (' ' + el.className + ' ').replace(R_SPACE, ' ').replace(' ' + name + ' ', ' ');
  2876. el.className = (className + (state ? ' ' + name : '')).replace(R_SPACE, ' ');
  2877. }
  2878. }
  2879. }
  2880. function _css(el, prop, val) {
  2881. var style = el && el.style;
  2882. if (style) {
  2883. if (val === void 0) {
  2884. if (document.defaultView && document.defaultView.getComputedStyle) {
  2885. val = document.defaultView.getComputedStyle(el, '');
  2886. } else if (el.currentStyle) {
  2887. val = el.currentStyle;
  2888. }
  2889. return prop === void 0 ? val : val[prop];
  2890. } else {
  2891. if (!(prop in style)) {
  2892. prop = '-webkit-' + prop;
  2893. }
  2894. style[prop] = val + (typeof val === 'string' ? '' : 'px');
  2895. }
  2896. }
  2897. }
  2898. function _find(ctx, tagName, iterator) {
  2899. if (ctx) {
  2900. var list = ctx.getElementsByTagName(tagName),
  2901. i = 0,
  2902. n = list.length;
  2903. if (iterator) {
  2904. for (; i < n; i++) {
  2905. iterator(list[i], i);
  2906. }
  2907. }
  2908. return list;
  2909. }
  2910. return [];
  2911. }
  2912. function _dispatchEvent(sortable, rootEl, name, targetEl, fromEl, startIndex, newIndex) {
  2913. sortable = sortable || rootEl[expando];
  2914. var evt = document.createEvent('Event'),
  2915. options = sortable.options,
  2916. onName = 'on' + name.charAt(0).toUpperCase() + name.substr(1);
  2917. evt.initEvent(name, true, true);
  2918. evt.to = rootEl;
  2919. evt.from = fromEl || rootEl;
  2920. evt.item = targetEl || rootEl;
  2921. evt.clone = cloneEl;
  2922. evt.oldIndex = startIndex;
  2923. evt.newIndex = newIndex;
  2924. rootEl.dispatchEvent(evt);
  2925. if (options[onName]) {
  2926. options[onName].call(sortable, evt);
  2927. }
  2928. }
  2929. function _onMove(fromEl, toEl, dragEl, dragRect, targetEl, targetRect, originalEvt, willInsertAfter) {
  2930. var evt,
  2931. sortable = fromEl[expando],
  2932. onMoveFn = sortable.options.onMove,
  2933. retVal;
  2934. evt = document.createEvent('Event');
  2935. evt.initEvent('move', true, true);
  2936. evt.to = toEl;
  2937. evt.from = fromEl;
  2938. evt.dragged = dragEl;
  2939. evt.draggedRect = dragRect;
  2940. evt.related = targetEl || toEl;
  2941. evt.relatedRect = targetRect || toEl.getBoundingClientRect();
  2942. evt.willInsertAfter = willInsertAfter;
  2943. fromEl.dispatchEvent(evt);
  2944. if (onMoveFn) {
  2945. retVal = onMoveFn.call(sortable, evt, originalEvt);
  2946. }
  2947. return retVal;
  2948. }
  2949. function _disableDraggable(el) {
  2950. el.draggable = false;
  2951. }
  2952. function _unsilent() {
  2953. _silent = false;
  2954. }
  2955. /** @returns {HTMLElement|false} */
  2956. function _ghostIsLast(el, evt) {
  2957. var lastEl = el.lastElementChild,
  2958. rect = lastEl.getBoundingClientRect(); // 5 — min delta
  2959. // abs — нельзя добавлять, а то глюки при наведении сверху
  2960. return evt.clientY - (rect.top + rect.height) > 5 || evt.clientX - (rect.left + rect.width) > 5;
  2961. }
  2962. /**
  2963. * Generate id
  2964. * @param {HTMLElement} el
  2965. * @returns {String}
  2966. * @private
  2967. */
  2968. function _generateId(el) {
  2969. var str = el.tagName + el.className + el.src + el.href + el.textContent,
  2970. i = str.length,
  2971. sum = 0;
  2972. while (i--) {
  2973. sum += str.charCodeAt(i);
  2974. }
  2975. return sum.toString(36);
  2976. }
  2977. /**
  2978. * Returns the index of an element within its parent for a selected set of
  2979. * elements
  2980. * @param {HTMLElement} el
  2981. * @param {selector} selector
  2982. * @return {number}
  2983. */
  2984. function _index(el, selector) {
  2985. var index = 0;
  2986. if (!el || !el.parentNode) {
  2987. return -1;
  2988. }
  2989. while (el && (el = el.previousElementSibling)) {
  2990. if (el.nodeName.toUpperCase() !== 'TEMPLATE' && (selector === '>*' || _matches(el, selector))) {
  2991. index++;
  2992. }
  2993. }
  2994. return index;
  2995. }
  2996. function _matches(
  2997. /**HTMLElement*/
  2998. el,
  2999. /**String*/
  3000. selector) {
  3001. if (el) {
  3002. selector = selector.split('.');
  3003. var tag = selector.shift().toUpperCase(),
  3004. re = new RegExp('\\s(' + selector.join('|') + ')(?=\\s)', 'g');
  3005. return (tag === '' || el.nodeName.toUpperCase() == tag) && (!selector.length || ((' ' + el.className + ' ').match(re) || []).length == selector.length);
  3006. }
  3007. return false;
  3008. }
  3009. function _throttle(callback, ms) {
  3010. var args, _this;
  3011. return function () {
  3012. if (args === void 0) {
  3013. args = arguments;
  3014. _this = this;
  3015. setTimeout(function () {
  3016. if (args.length === 1) {
  3017. callback.call(_this, args[0]);
  3018. } else {
  3019. callback.apply(_this, args);
  3020. }
  3021. args = void 0;
  3022. }, ms);
  3023. }
  3024. };
  3025. }
  3026. function _extend(dst, src) {
  3027. if (dst && src) {
  3028. for (var key in src) {
  3029. if (src.hasOwnProperty(key)) {
  3030. dst[key] = src[key];
  3031. }
  3032. }
  3033. }
  3034. return dst;
  3035. }
  3036. function _clone(el) {
  3037. return $ ? $(el).clone(true)[0] : Polymer && Polymer.dom ? Polymer.dom(el).cloneNode(true) : el.cloneNode(true);
  3038. }
  3039. function _saveInputCheckedState(root) {
  3040. var inputs = root.getElementsByTagName('input');
  3041. var idx = inputs.length;
  3042. while (idx--) {
  3043. var el = inputs[idx];
  3044. el.checked && savedInputChecked.push(el);
  3045. }
  3046. } // Fixed #973:
  3047. _on(document, 'touchmove', function (evt) {
  3048. if (Sortable.active) {
  3049. evt.preventDefault();
  3050. }
  3051. });
  3052. try {
  3053. window.addEventListener('test', null, Object.defineProperty({}, 'passive', {
  3054. get: function get() {
  3055. captureMode = {
  3056. capture: false,
  3057. passive: false
  3058. };
  3059. }
  3060. }));
  3061. } catch (err) {} // Export utils
  3062. Sortable.utils = {
  3063. on: _on,
  3064. off: _off,
  3065. css: _css,
  3066. find: _find,
  3067. is: function is(el, selector) {
  3068. return !!_closest(el, selector, el);
  3069. },
  3070. extend: _extend,
  3071. throttle: _throttle,
  3072. closest: _closest,
  3073. toggleClass: _toggleClass,
  3074. clone: _clone,
  3075. index: _index
  3076. };
  3077. /**
  3078. * Create sortable instance
  3079. * @param {HTMLElement} el
  3080. * @param {Object} [options]
  3081. */
  3082. Sortable.create = function (el, options) {
  3083. return new Sortable(el, options);
  3084. }; // Export
  3085. Sortable.version = '1.6.1';
  3086. return Sortable;
  3087. });
  3088. /***/ }),
  3089. /***/ "./js/assessment/ivprogAssessment.js":
  3090. /*!*******************************************!*\
  3091. !*** ./js/assessment/ivprogAssessment.js ***!
  3092. \*******************************************/
  3093. /*! exports provided: IVProgAssessment */
  3094. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3095. "use strict";
  3096. __webpack_require__.r(__webpack_exports__);
  3097. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IVProgAssessment", function() { return IVProgAssessment; });
  3098. /* harmony import */ var _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  3099. /* harmony import */ var _processor_semantic_semanticAnalyser__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../processor/semantic/semanticAnalyser */ "./js/processor/semantic/semanticAnalyser.js");
  3100. /* harmony import */ var _processor_ivprogProcessor__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  3101. /* harmony import */ var _util_inputTest__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../util/inputTest */ "./js/util/inputTest.js");
  3102. /* harmony import */ var _util_outputTest__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./../util/outputTest */ "./js/util/outputTest.js");
  3103. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  3104. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  3105. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(decimal_js__WEBPACK_IMPORTED_MODULE_6__);
  3106. /* harmony import */ var _util_config__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../util/config */ "./js/util/config.js");
  3107. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3108. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  3109. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  3110. var LocalizedStrings = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_5__["getInstance"]();
  3111. var IVProgAssessment =
  3112. /*#__PURE__*/
  3113. function () {
  3114. function IVProgAssessment(textCode, testCases, domConsole) {
  3115. _classCallCheck(this, IVProgAssessment);
  3116. this.textCode = textCode;
  3117. this.testCases = testCases;
  3118. this.domConsole = domConsole;
  3119. }
  3120. _createClass(IVProgAssessment, [{
  3121. key: "runTest",
  3122. value: function runTest() {
  3123. var _this = this;
  3124. try {
  3125. // try and show error messages through domconsole
  3126. var parser = _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_0__["IVProgParser"].createParser(this.textCode);
  3127. var semantic = new _processor_semantic_semanticAnalyser__WEBPACK_IMPORTED_MODULE_1__["SemanticAnalyser"](parser.parseTree());
  3128. var validTree = semantic.analyseTree(); // loop test cases and show messages through domconsole
  3129. var partialTests = this.testCases.map(function (t, name) {
  3130. return _this.partialEvaluateTestCase(new _processor_ivprogProcessor__WEBPACK_IMPORTED_MODULE_2__["IVProgProcessor"](validTree), t.input, t.output, name);
  3131. });
  3132. var testResult = partialTests.reduce(function (acc, curr) {
  3133. return acc.then(curr);
  3134. }, Promise.resolve(0));
  3135. return testResult.then(function (total) {
  3136. return Promise.resolve(total / _this.testCases.length);
  3137. }).catch(function (err) {
  3138. _this.domConsole.err("Erro durante a execução do programa"); // try and show error messages through domconsole
  3139. _this.domConsole.err(err.message);
  3140. return Promise.resolve(0);
  3141. });
  3142. } catch (error) {
  3143. this.domConsole.err("Erro durante a execução do programa"); // try and show error messages through domconsole
  3144. this.domConsole.err(error.message);
  3145. return Promise.resolve(0);
  3146. }
  3147. }
  3148. }, {
  3149. key: "evaluateTestCase",
  3150. value: function evaluateTestCase(prog, inputList, outputList, name, accumulator) {
  3151. var outerThis = this;
  3152. var input = new _util_inputTest__WEBPACK_IMPORTED_MODULE_3__["InputTest"](inputList);
  3153. var output = new _util_outputTest__WEBPACK_IMPORTED_MODULE_4__["OutputTest"]();
  3154. prog.registerInput(input);
  3155. prog.registerOutput(output);
  3156. var startTime = Date.now();
  3157. return prog.interpretAST().then(function (_) {
  3158. var millis = Date.now() - startTime;
  3159. if (input.inputList.length !== input.index) {
  3160. outerThis.showErrorMessage('test_case_few_reads', name + 1);
  3161. outerThis.showMessage('test_case_duration', millis);
  3162. return Promise.resolve(accumulator + 1 * (input.index / inputList.length));
  3163. } else if (output.list.length < outputList.length) {
  3164. outerThis.showErrorMessage('test_case_failed', name + 1, inputList.join(','), outputList.join(','), output.list.join(','));
  3165. outerThis.showMessage('test_case_duration', millis);
  3166. return Promise.resolve(accumulator + 1 * (output.list.length / outputList.length));
  3167. } else if (output.list.length > outputList.length) {
  3168. outerThis.showErrorMessage('test_case_failed', name + 1, inputList.join(','), outputList.join(','), output.list.join(','));
  3169. outerThis.showMessage('test_case_duration', millis);
  3170. return Promise.resolve(accumulator + 1 * (outputList.length / output.list.length));
  3171. } else {
  3172. var isOk = outerThis.checkOutput(output.list, outputList);
  3173. if (!isOk) {
  3174. outerThis.showErrorMessage('test_case_failed', name + 1, inputList.join(','), outputList.join(','), output.list.join(','));
  3175. outerThis.showMessage('test_case_duration', millis);
  3176. return Promise.resolve(accumulator);
  3177. } else {
  3178. outerThis.showMessage('test_case_success', name + 1);
  3179. outerThis.showMessage('test_case_duration', millis);
  3180. return Promise.resolve(accumulator + 1);
  3181. }
  3182. }
  3183. }).catch(function (error) {
  3184. outerThis.showErrorMessage('test_case_failed_exception', name + 1, error.message);
  3185. return Promise.resolve(accumulator);
  3186. });
  3187. }
  3188. }, {
  3189. key: "partialEvaluateTestCase",
  3190. value: function partialEvaluateTestCase(prog, inputList, outputList, name) {
  3191. return this.evaluateTestCase.bind(this, prog, inputList, outputList, name);
  3192. }
  3193. }, {
  3194. key: "checkOutput",
  3195. value: function checkOutput(aList, bList) {
  3196. for (var i = 0; i < aList.length; i++) {
  3197. var outValue = aList[i];
  3198. var castNumberA = parseFloat(outValue);
  3199. if (!Number.isNaN(castNumberA)) {
  3200. var castNumberB = parseFloat(bList[i]);
  3201. if (Number.isNaN(castNumberB)) {
  3202. return false;
  3203. }
  3204. castNumberA = new decimal_js__WEBPACK_IMPORTED_MODULE_6__["Decimal"](castNumberA);
  3205. castNumberB = new decimal_js__WEBPACK_IMPORTED_MODULE_6__["Decimal"](castNumberB);
  3206. var decimalPlaces = Math.min(castNumberB.dp(), _util_config__WEBPACK_IMPORTED_MODULE_7__["Config"].decimalPlaces);
  3207. decimal_js__WEBPACK_IMPORTED_MODULE_6__["Decimal"].set({
  3208. rounding: decimal_js__WEBPACK_IMPORTED_MODULE_6__["Decimal"].ROUND_FLOOR
  3209. });
  3210. castNumberA = new decimal_js__WEBPACK_IMPORTED_MODULE_6__["Decimal"](castNumberA.toFixed(decimalPlaces));
  3211. castNumberB = new decimal_js__WEBPACK_IMPORTED_MODULE_6__["Decimal"](castNumberB.toFixed(decimalPlaces));
  3212. var aEqualsB = castNumberA.eq(castNumberB);
  3213. decimal_js__WEBPACK_IMPORTED_MODULE_6__["Decimal"].set({
  3214. rounding: decimal_js__WEBPACK_IMPORTED_MODULE_6__["Decimal"].ROUND_HALF_UP
  3215. });
  3216. if (!aEqualsB) {
  3217. return false;
  3218. }
  3219. } else if (outValue != bList[i]) {
  3220. return false;
  3221. }
  3222. }
  3223. return true;
  3224. }
  3225. }, {
  3226. key: "showErrorMessage",
  3227. value: function showErrorMessage(errorID) {
  3228. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  3229. args[_key - 1] = arguments[_key];
  3230. }
  3231. this.domConsole.err(LocalizedStrings.getError(errorID, args));
  3232. }
  3233. }, {
  3234. key: "showMessage",
  3235. value: function showMessage(msgID) {
  3236. for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
  3237. args[_key2 - 1] = arguments[_key2];
  3238. }
  3239. this.domConsole.info(LocalizedStrings.getMessage(msgID, args));
  3240. }
  3241. }]);
  3242. return IVProgAssessment;
  3243. }();
  3244. /***/ }),
  3245. /***/ "./js/ast/commands/arrayAssign.js":
  3246. /*!****************************************!*\
  3247. !*** ./js/ast/commands/arrayAssign.js ***!
  3248. \****************************************/
  3249. /*! exports provided: ArrayIndexAssign */
  3250. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3251. "use strict";
  3252. __webpack_require__.r(__webpack_exports__);
  3253. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ArrayIndexAssign", function() { return ArrayIndexAssign; });
  3254. /* harmony import */ var _assign__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./assign */ "./js/ast/commands/assign.js");
  3255. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  3256. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3257. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  3258. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  3259. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  3260. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  3261. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  3262. var ArrayIndexAssign =
  3263. /*#__PURE__*/
  3264. function (_Assign) {
  3265. _inherits(ArrayIndexAssign, _Assign);
  3266. function ArrayIndexAssign(id, lineExpression, columnExpression, expression) {
  3267. var _this;
  3268. _classCallCheck(this, ArrayIndexAssign);
  3269. _this = _possibleConstructorReturn(this, _getPrototypeOf(ArrayIndexAssign).call(this, id, expression));
  3270. _this.line = lineExpression;
  3271. _this.column = columnExpression;
  3272. return _this;
  3273. }
  3274. return ArrayIndexAssign;
  3275. }(_assign__WEBPACK_IMPORTED_MODULE_0__["Assign"]);
  3276. /***/ }),
  3277. /***/ "./js/ast/commands/arrayDeclaration.js":
  3278. /*!*********************************************!*\
  3279. !*** ./js/ast/commands/arrayDeclaration.js ***!
  3280. \*********************************************/
  3281. /*! exports provided: ArrayDeclaration */
  3282. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3283. "use strict";
  3284. __webpack_require__.r(__webpack_exports__);
  3285. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ArrayDeclaration", function() { return ArrayDeclaration; });
  3286. /* harmony import */ var _declaration__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./declaration */ "./js/ast/commands/declaration.js");
  3287. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  3288. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3289. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  3290. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  3291. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  3292. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  3293. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  3294. var ArrayDeclaration =
  3295. /*#__PURE__*/
  3296. function (_Declaration) {
  3297. _inherits(ArrayDeclaration, _Declaration);
  3298. function ArrayDeclaration(id, type, lines, columns, initial, isConst) {
  3299. var _this;
  3300. _classCallCheck(this, ArrayDeclaration);
  3301. _this = _possibleConstructorReturn(this, _getPrototypeOf(ArrayDeclaration).call(this, id, type, initial, isConst));
  3302. _this.lines = lines;
  3303. _this.columns = columns;
  3304. return _this;
  3305. }
  3306. return ArrayDeclaration;
  3307. }(_declaration__WEBPACK_IMPORTED_MODULE_0__["Declaration"]);
  3308. /***/ }),
  3309. /***/ "./js/ast/commands/assign.js":
  3310. /*!***********************************!*\
  3311. !*** ./js/ast/commands/assign.js ***!
  3312. \***********************************/
  3313. /*! exports provided: Assign */
  3314. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3315. "use strict";
  3316. __webpack_require__.r(__webpack_exports__);
  3317. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Assign", function() { return Assign; });
  3318. /* harmony import */ var _command__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3319. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  3320. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3321. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  3322. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  3323. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  3324. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  3325. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  3326. var Assign =
  3327. /*#__PURE__*/
  3328. function (_Command) {
  3329. _inherits(Assign, _Command);
  3330. function Assign(id, expression) {
  3331. var _this;
  3332. _classCallCheck(this, Assign);
  3333. _this = _possibleConstructorReturn(this, _getPrototypeOf(Assign).call(this));
  3334. _this.id = id;
  3335. _this.expression = expression;
  3336. return _this;
  3337. }
  3338. return Assign;
  3339. }(_command__WEBPACK_IMPORTED_MODULE_0__["Command"]);
  3340. /***/ }),
  3341. /***/ "./js/ast/commands/break.js":
  3342. /*!**********************************!*\
  3343. !*** ./js/ast/commands/break.js ***!
  3344. \**********************************/
  3345. /*! exports provided: Break */
  3346. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3347. "use strict";
  3348. __webpack_require__.r(__webpack_exports__);
  3349. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Break", function() { return Break; });
  3350. /* harmony import */ var _command__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3351. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  3352. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3353. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  3354. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  3355. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  3356. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  3357. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  3358. var Break =
  3359. /*#__PURE__*/
  3360. function (_Command) {
  3361. _inherits(Break, _Command);
  3362. function Break() {
  3363. _classCallCheck(this, Break);
  3364. return _possibleConstructorReturn(this, _getPrototypeOf(Break).call(this));
  3365. }
  3366. return Break;
  3367. }(_command__WEBPACK_IMPORTED_MODULE_0__["Command"]);
  3368. /***/ }),
  3369. /***/ "./js/ast/commands/case.js":
  3370. /*!*********************************!*\
  3371. !*** ./js/ast/commands/case.js ***!
  3372. \*********************************/
  3373. /*! exports provided: Case */
  3374. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3375. "use strict";
  3376. __webpack_require__.r(__webpack_exports__);
  3377. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Case", function() { return Case; });
  3378. /* harmony import */ var _command__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3379. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  3380. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3381. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  3382. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  3383. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  3384. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  3385. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  3386. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  3387. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  3388. var Case =
  3389. /*#__PURE__*/
  3390. function (_Command) {
  3391. _inherits(Case, _Command);
  3392. function Case(expression) {
  3393. var _this;
  3394. _classCallCheck(this, Case);
  3395. _this = _possibleConstructorReturn(this, _getPrototypeOf(Case).call(this));
  3396. _this.expression = expression;
  3397. _this.commands = [];
  3398. return _this;
  3399. }
  3400. _createClass(Case, [{
  3401. key: "setCommands",
  3402. value: function setCommands(commands) {
  3403. this.commands = commands;
  3404. }
  3405. }, {
  3406. key: "isDefault",
  3407. get: function get() {
  3408. return this.expression === null;
  3409. }
  3410. }]);
  3411. return Case;
  3412. }(_command__WEBPACK_IMPORTED_MODULE_0__["Command"]);
  3413. /***/ }),
  3414. /***/ "./js/ast/commands/command.js":
  3415. /*!************************************!*\
  3416. !*** ./js/ast/commands/command.js ***!
  3417. \************************************/
  3418. /*! exports provided: Command */
  3419. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3420. "use strict";
  3421. __webpack_require__.r(__webpack_exports__);
  3422. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Command", function() { return Command; });
  3423. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3424. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  3425. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  3426. var Command =
  3427. /*#__PURE__*/
  3428. function () {
  3429. function Command() {
  3430. _classCallCheck(this, Command);
  3431. this._sourceInfo = null;
  3432. }
  3433. _createClass(Command, [{
  3434. key: "sourceInfo",
  3435. set: function set(sourceInfo) {
  3436. this._sourceInfo = sourceInfo;
  3437. },
  3438. get: function get() {
  3439. return this._sourceInfo;
  3440. }
  3441. }]);
  3442. return Command;
  3443. }();
  3444. /***/ }),
  3445. /***/ "./js/ast/commands/commandBlock.js":
  3446. /*!*****************************************!*\
  3447. !*** ./js/ast/commands/commandBlock.js ***!
  3448. \*****************************************/
  3449. /*! exports provided: CommandBlock */
  3450. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3451. "use strict";
  3452. __webpack_require__.r(__webpack_exports__);
  3453. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CommandBlock", function() { return CommandBlock; });
  3454. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3455. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  3456. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  3457. var CommandBlock =
  3458. /*#__PURE__*/
  3459. function () {
  3460. function CommandBlock(variables, commands) {
  3461. _classCallCheck(this, CommandBlock);
  3462. this.variables = variables;
  3463. this.commands = commands;
  3464. this._sourceInfo = null;
  3465. }
  3466. _createClass(CommandBlock, [{
  3467. key: "sourceInfo",
  3468. set: function set(sourceInfo) {
  3469. this._sourceInfo = sourceInfo;
  3470. },
  3471. get: function get() {
  3472. return this._sourceInfo;
  3473. }
  3474. }]);
  3475. return CommandBlock;
  3476. }();
  3477. /***/ }),
  3478. /***/ "./js/ast/commands/declaration.js":
  3479. /*!****************************************!*\
  3480. !*** ./js/ast/commands/declaration.js ***!
  3481. \****************************************/
  3482. /*! exports provided: Declaration */
  3483. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3484. "use strict";
  3485. __webpack_require__.r(__webpack_exports__);
  3486. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Declaration", function() { return Declaration; });
  3487. /* harmony import */ var _command__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3488. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  3489. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3490. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  3491. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  3492. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  3493. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  3494. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  3495. var Declaration =
  3496. /*#__PURE__*/
  3497. function (_Command) {
  3498. _inherits(Declaration, _Command);
  3499. function Declaration(id, type, initial, isConst) {
  3500. var _this;
  3501. _classCallCheck(this, Declaration);
  3502. _this = _possibleConstructorReturn(this, _getPrototypeOf(Declaration).call(this));
  3503. _this.id = id;
  3504. _this.type = type;
  3505. _this.initial = initial;
  3506. _this.isConst = isConst;
  3507. return _this;
  3508. }
  3509. return Declaration;
  3510. }(_command__WEBPACK_IMPORTED_MODULE_0__["Command"]);
  3511. /***/ }),
  3512. /***/ "./js/ast/commands/doWhile.js":
  3513. /*!************************************!*\
  3514. !*** ./js/ast/commands/doWhile.js ***!
  3515. \************************************/
  3516. /*! exports provided: DoWhile */
  3517. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3518. "use strict";
  3519. __webpack_require__.r(__webpack_exports__);
  3520. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DoWhile", function() { return DoWhile; });
  3521. /* harmony import */ var _while__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./while */ "./js/ast/commands/while.js");
  3522. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  3523. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3524. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  3525. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  3526. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  3527. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  3528. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  3529. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  3530. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  3531. var DoWhile =
  3532. /*#__PURE__*/
  3533. function (_While) {
  3534. _inherits(DoWhile, _While);
  3535. function DoWhile(condition, commandBlock) {
  3536. _classCallCheck(this, DoWhile);
  3537. return _possibleConstructorReturn(this, _getPrototypeOf(DoWhile).call(this, condition, commandBlock));
  3538. }
  3539. _createClass(DoWhile, [{
  3540. key: "testFirst",
  3541. get: function get() {
  3542. return false;
  3543. }
  3544. }]);
  3545. return DoWhile;
  3546. }(_while__WEBPACK_IMPORTED_MODULE_0__["While"]);
  3547. /***/ }),
  3548. /***/ "./js/ast/commands/for.js":
  3549. /*!********************************!*\
  3550. !*** ./js/ast/commands/for.js ***!
  3551. \********************************/
  3552. /*! exports provided: For */
  3553. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3554. "use strict";
  3555. __webpack_require__.r(__webpack_exports__);
  3556. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "For", function() { return For; });
  3557. /* harmony import */ var _command__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3558. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  3559. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3560. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  3561. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  3562. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  3563. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  3564. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  3565. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  3566. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  3567. var For =
  3568. /*#__PURE__*/
  3569. function (_Command) {
  3570. _inherits(For, _Command);
  3571. function For(assignment, condition, increment, commandBlock) {
  3572. var _this;
  3573. _classCallCheck(this, For);
  3574. _this = _possibleConstructorReturn(this, _getPrototypeOf(For).call(this));
  3575. _this.assignment = assignment;
  3576. _this.condition = condition;
  3577. _this.increment = increment;
  3578. _this.commandBlock = commandBlock;
  3579. return _this;
  3580. }
  3581. _createClass(For, [{
  3582. key: "commands",
  3583. get: function get() {
  3584. return this.commandBlock.commands;
  3585. }
  3586. }]);
  3587. return For;
  3588. }(_command__WEBPACK_IMPORTED_MODULE_0__["Command"]);
  3589. /***/ }),
  3590. /***/ "./js/ast/commands/formalParameter.js":
  3591. /*!********************************************!*\
  3592. !*** ./js/ast/commands/formalParameter.js ***!
  3593. \********************************************/
  3594. /*! exports provided: FormalParameter */
  3595. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3596. "use strict";
  3597. __webpack_require__.r(__webpack_exports__);
  3598. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FormalParameter", function() { return FormalParameter; });
  3599. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3600. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  3601. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  3602. var FormalParameter =
  3603. /*#__PURE__*/
  3604. function () {
  3605. function FormalParameter(type, id) {
  3606. var byRef = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  3607. _classCallCheck(this, FormalParameter);
  3608. this.type = type;
  3609. this.id = id;
  3610. this.byRef = byRef;
  3611. this._sourceInfo = null;
  3612. }
  3613. _createClass(FormalParameter, [{
  3614. key: "sourceInfo",
  3615. set: function set(sourceInfo) {
  3616. this._sourceInfo = sourceInfo;
  3617. },
  3618. get: function get() {
  3619. return this._sourceInfo;
  3620. }
  3621. }]);
  3622. return FormalParameter;
  3623. }();
  3624. /***/ }),
  3625. /***/ "./js/ast/commands/function.js":
  3626. /*!*************************************!*\
  3627. !*** ./js/ast/commands/function.js ***!
  3628. \*************************************/
  3629. /*! exports provided: Function */
  3630. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3631. "use strict";
  3632. __webpack_require__.r(__webpack_exports__);
  3633. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Function", function() { return Function; });
  3634. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  3635. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3636. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  3637. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  3638. var Function =
  3639. /*#__PURE__*/
  3640. function () {
  3641. function Function(name, returnType, formalParameters, commandBlock) {
  3642. _classCallCheck(this, Function);
  3643. this.name = name;
  3644. this.returnType = returnType;
  3645. this.formalParameters = formalParameters;
  3646. this.commandBlock = commandBlock;
  3647. this._sourceInfo = null;
  3648. }
  3649. _createClass(Function, [{
  3650. key: "isMain",
  3651. get: function get() {
  3652. return this.name === null && this.returnType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].VOID);
  3653. }
  3654. }, {
  3655. key: "commands",
  3656. get: function get() {
  3657. return this.commandBlock.commands;
  3658. }
  3659. }, {
  3660. key: "variablesDeclarations",
  3661. get: function get() {
  3662. return this.commandBlock.variables;
  3663. }
  3664. }, {
  3665. key: "sourceInfo",
  3666. set: function set(sourceInfo) {
  3667. this._sourceInfo = sourceInfo;
  3668. },
  3669. get: function get() {
  3670. return this._sourceInfo;
  3671. }
  3672. }]);
  3673. return Function;
  3674. }();
  3675. /***/ }),
  3676. /***/ "./js/ast/commands/ifThenElse.js":
  3677. /*!***************************************!*\
  3678. !*** ./js/ast/commands/ifThenElse.js ***!
  3679. \***************************************/
  3680. /*! exports provided: IfThenElse */
  3681. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3682. "use strict";
  3683. __webpack_require__.r(__webpack_exports__);
  3684. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IfThenElse", function() { return IfThenElse; });
  3685. /* harmony import */ var _command__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3686. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  3687. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3688. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  3689. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  3690. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  3691. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  3692. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  3693. var IfThenElse =
  3694. /*#__PURE__*/
  3695. function (_Command) {
  3696. _inherits(IfThenElse, _Command);
  3697. function IfThenElse(condition, ifTrue, ifFalse) {
  3698. var _this;
  3699. _classCallCheck(this, IfThenElse);
  3700. _this = _possibleConstructorReturn(this, _getPrototypeOf(IfThenElse).call(this));
  3701. _this.condition = condition;
  3702. _this.ifTrue = ifTrue;
  3703. _this.ifFalse = ifFalse;
  3704. return _this;
  3705. }
  3706. return IfThenElse;
  3707. }(_command__WEBPACK_IMPORTED_MODULE_0__["Command"]);
  3708. /***/ }),
  3709. /***/ "./js/ast/commands/index.js":
  3710. /*!**********************************!*\
  3711. !*** ./js/ast/commands/index.js ***!
  3712. \**********************************/
  3713. /*! exports provided: Break, Return, Assign, ArrayIndexAssign, Declaration, ArrayDeclaration, While, For, Function, IfThenElse, CommandBlock, DoWhile, Switch, Case, SysCall, FormalParameter, FunctionCall */
  3714. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3715. "use strict";
  3716. __webpack_require__.r(__webpack_exports__);
  3717. /* harmony import */ var _break__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./break */ "./js/ast/commands/break.js");
  3718. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Break", function() { return _break__WEBPACK_IMPORTED_MODULE_0__["Break"]; });
  3719. /* harmony import */ var _return__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./return */ "./js/ast/commands/return.js");
  3720. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Return", function() { return _return__WEBPACK_IMPORTED_MODULE_1__["Return"]; });
  3721. /* harmony import */ var _assign__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./assign */ "./js/ast/commands/assign.js");
  3722. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Assign", function() { return _assign__WEBPACK_IMPORTED_MODULE_2__["Assign"]; });
  3723. /* harmony import */ var _arrayAssign__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./arrayAssign */ "./js/ast/commands/arrayAssign.js");
  3724. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ArrayIndexAssign", function() { return _arrayAssign__WEBPACK_IMPORTED_MODULE_3__["ArrayIndexAssign"]; });
  3725. /* harmony import */ var _declaration__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./declaration */ "./js/ast/commands/declaration.js");
  3726. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Declaration", function() { return _declaration__WEBPACK_IMPORTED_MODULE_4__["Declaration"]; });
  3727. /* harmony import */ var _arrayDeclaration__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./arrayDeclaration */ "./js/ast/commands/arrayDeclaration.js");
  3728. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ArrayDeclaration", function() { return _arrayDeclaration__WEBPACK_IMPORTED_MODULE_5__["ArrayDeclaration"]; });
  3729. /* harmony import */ var _while__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./while */ "./js/ast/commands/while.js");
  3730. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "While", function() { return _while__WEBPACK_IMPORTED_MODULE_6__["While"]; });
  3731. /* harmony import */ var _for__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./for */ "./js/ast/commands/for.js");
  3732. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "For", function() { return _for__WEBPACK_IMPORTED_MODULE_7__["For"]; });
  3733. /* harmony import */ var _function__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./function */ "./js/ast/commands/function.js");
  3734. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Function", function() { return _function__WEBPACK_IMPORTED_MODULE_8__["Function"]; });
  3735. /* harmony import */ var _ifThenElse__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./ifThenElse */ "./js/ast/commands/ifThenElse.js");
  3736. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "IfThenElse", function() { return _ifThenElse__WEBPACK_IMPORTED_MODULE_9__["IfThenElse"]; });
  3737. /* harmony import */ var _commandBlock__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./commandBlock */ "./js/ast/commands/commandBlock.js");
  3738. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "CommandBlock", function() { return _commandBlock__WEBPACK_IMPORTED_MODULE_10__["CommandBlock"]; });
  3739. /* harmony import */ var _doWhile__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./doWhile */ "./js/ast/commands/doWhile.js");
  3740. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DoWhile", function() { return _doWhile__WEBPACK_IMPORTED_MODULE_11__["DoWhile"]; });
  3741. /* harmony import */ var _switch__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./switch */ "./js/ast/commands/switch.js");
  3742. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Switch", function() { return _switch__WEBPACK_IMPORTED_MODULE_12__["Switch"]; });
  3743. /* harmony import */ var _case__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./case */ "./js/ast/commands/case.js");
  3744. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Case", function() { return _case__WEBPACK_IMPORTED_MODULE_13__["Case"]; });
  3745. /* harmony import */ var _sysCall__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./sysCall */ "./js/ast/commands/sysCall.js");
  3746. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SysCall", function() { return _sysCall__WEBPACK_IMPORTED_MODULE_14__["SysCall"]; });
  3747. /* harmony import */ var _formalParameter__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./formalParameter */ "./js/ast/commands/formalParameter.js");
  3748. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FormalParameter", function() { return _formalParameter__WEBPACK_IMPORTED_MODULE_15__["FormalParameter"]; });
  3749. /* harmony import */ var _expressions_functionCall__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./../expressions/functionCall */ "./js/ast/expressions/functionCall.js");
  3750. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FunctionCall", function() { return _expressions_functionCall__WEBPACK_IMPORTED_MODULE_16__["FunctionCall"]; });
  3751. //Proxy to expression since they do exatcly the same thing
  3752. /***/ }),
  3753. /***/ "./js/ast/commands/return.js":
  3754. /*!***********************************!*\
  3755. !*** ./js/ast/commands/return.js ***!
  3756. \***********************************/
  3757. /*! exports provided: Return */
  3758. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3759. "use strict";
  3760. __webpack_require__.r(__webpack_exports__);
  3761. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Return", function() { return Return; });
  3762. /* harmony import */ var _command__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3763. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  3764. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3765. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  3766. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  3767. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  3768. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  3769. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  3770. var Return =
  3771. /*#__PURE__*/
  3772. function (_Command) {
  3773. _inherits(Return, _Command);
  3774. function Return(expression) {
  3775. var _this;
  3776. _classCallCheck(this, Return);
  3777. _this = _possibleConstructorReturn(this, _getPrototypeOf(Return).call(this));
  3778. _this.expression = expression;
  3779. return _this;
  3780. }
  3781. return Return;
  3782. }(_command__WEBPACK_IMPORTED_MODULE_0__["Command"]);
  3783. /***/ }),
  3784. /***/ "./js/ast/commands/switch.js":
  3785. /*!***********************************!*\
  3786. !*** ./js/ast/commands/switch.js ***!
  3787. \***********************************/
  3788. /*! exports provided: Switch */
  3789. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3790. "use strict";
  3791. __webpack_require__.r(__webpack_exports__);
  3792. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Switch", function() { return Switch; });
  3793. /* harmony import */ var _command__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3794. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  3795. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3796. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  3797. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  3798. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  3799. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  3800. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  3801. var Switch =
  3802. /*#__PURE__*/
  3803. function (_Command) {
  3804. _inherits(Switch, _Command);
  3805. function Switch(expression, cases) {
  3806. var _this;
  3807. _classCallCheck(this, Switch);
  3808. _this = _possibleConstructorReturn(this, _getPrototypeOf(Switch).call(this));
  3809. _this.expression = expression;
  3810. _this.cases = cases;
  3811. return _this;
  3812. }
  3813. return Switch;
  3814. }(_command__WEBPACK_IMPORTED_MODULE_0__["Command"]);
  3815. /***/ }),
  3816. /***/ "./js/ast/commands/sysCall.js":
  3817. /*!************************************!*\
  3818. !*** ./js/ast/commands/sysCall.js ***!
  3819. \************************************/
  3820. /*! exports provided: SysCall */
  3821. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3822. "use strict";
  3823. __webpack_require__.r(__webpack_exports__);
  3824. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SysCall", function() { return SysCall; });
  3825. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3826. /**
  3827. * This class represents all the language defined functions.
  3828. * The language processor uses the id provided here to properly execute the desired function.
  3829. * The function is actually implemented inside the language processor.
  3830. * All the functions can be found at: js/processor/definedFunctions.js
  3831. */
  3832. var SysCall = function SysCall(langFunc) {
  3833. _classCallCheck(this, SysCall);
  3834. this.langFunc = langFunc;
  3835. };
  3836. /***/ }),
  3837. /***/ "./js/ast/commands/while.js":
  3838. /*!**********************************!*\
  3839. !*** ./js/ast/commands/while.js ***!
  3840. \**********************************/
  3841. /*! exports provided: While */
  3842. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3843. "use strict";
  3844. __webpack_require__.r(__webpack_exports__);
  3845. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "While", function() { return While; });
  3846. /* harmony import */ var _command__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3847. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  3848. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3849. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  3850. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  3851. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  3852. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  3853. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  3854. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  3855. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  3856. var While =
  3857. /*#__PURE__*/
  3858. function (_Command) {
  3859. _inherits(While, _Command);
  3860. function While(expression, commandBlock) {
  3861. var _this;
  3862. _classCallCheck(this, While);
  3863. _this = _possibleConstructorReturn(this, _getPrototypeOf(While).call(this));
  3864. _this.expression = expression;
  3865. _this.commandBlock = commandBlock;
  3866. return _this;
  3867. }
  3868. _createClass(While, [{
  3869. key: "commands",
  3870. get: function get() {
  3871. return this.commandBlock.commands;
  3872. }
  3873. }, {
  3874. key: "testFirst",
  3875. get: function get() {
  3876. return true;
  3877. }
  3878. }]);
  3879. return While;
  3880. }(_command__WEBPACK_IMPORTED_MODULE_0__["Command"]);
  3881. /***/ }),
  3882. /***/ "./js/ast/error/syntaxError.js":
  3883. /*!*************************************!*\
  3884. !*** ./js/ast/error/syntaxError.js ***!
  3885. \*************************************/
  3886. /*! exports provided: SyntaxError */
  3887. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3888. "use strict";
  3889. __webpack_require__.r(__webpack_exports__);
  3890. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SyntaxError", function() { return SyntaxError; });
  3891. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  3892. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3893. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  3894. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  3895. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  3896. function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
  3897. function isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
  3898. function _construct(Parent, args, Class) { if (isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
  3899. function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
  3900. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  3901. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  3902. var SyntaxError =
  3903. /*#__PURE__*/
  3904. function (_Error) {
  3905. _inherits(SyntaxError, _Error);
  3906. function SyntaxError() {
  3907. var _getPrototypeOf2;
  3908. var _this;
  3909. _classCallCheck(this, SyntaxError);
  3910. for (var _len = arguments.length, msg = new Array(_len), _key = 0; _key < _len; _key++) {
  3911. msg[_key] = arguments[_key];
  3912. }
  3913. _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(SyntaxError)).call.apply(_getPrototypeOf2, [this].concat(msg)));
  3914. if (Error.captureStackTrace) Error.captureStackTrace(_assertThisInitialized(_this), SyntaxError);
  3915. return _this;
  3916. }
  3917. return SyntaxError;
  3918. }(_wrapNativeSuper(Error));
  3919. /***/ }),
  3920. /***/ "./js/ast/error/syntaxErrorFactory.js":
  3921. /*!********************************************!*\
  3922. !*** ./js/ast/error/syntaxErrorFactory.js ***!
  3923. \********************************************/
  3924. /*! exports provided: SyntaxErrorFactory */
  3925. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3926. "use strict";
  3927. __webpack_require__.r(__webpack_exports__);
  3928. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SyntaxErrorFactory", function() { return SyntaxErrorFactory; });
  3929. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  3930. /* harmony import */ var _syntaxError__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./syntaxError */ "./js/ast/error/syntaxError.js");
  3931. var LocalizedStrings = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__["getInstance"]();
  3932. var SyntaxErrorFactory = Object.freeze({
  3933. extra_lines: function extra_lines() {
  3934. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError("extra_lines"));
  3935. },
  3936. token_missing_one: function token_missing_one(expected, token) {
  3937. var context = [expected, token.text, token.line, token.column];
  3938. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError("token_missing_one", context));
  3939. },
  3940. token_missing_list: function token_missing_list(expectedList, token) {
  3941. var line = expectedList.join(LocalizedStrings.getOR());
  3942. return SyntaxErrorFactory.token_missing_one(line, token);
  3943. },
  3944. id_missing: function id_missing(token) {
  3945. var context = [token.text, token.line, token.column];
  3946. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError("id_missing", context));
  3947. },
  3948. eos_missing: function eos_missing(token) {
  3949. var context = [token.line, token.column];
  3950. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError("eos_missing", context));
  3951. },
  3952. invalid_array_dimension: function invalid_array_dimension(typeName, token) {
  3953. var context = [token.line, token.column, typeName];
  3954. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError("invalid_array_dimension", context));
  3955. },
  3956. invalid_array_size: function invalid_array_size(token) {
  3957. var context = [token.line];
  3958. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError("invalid_array_size", context));
  3959. },
  3960. invalid_main_return: function invalid_main_return(name, typeName, token) {
  3961. var context = [name, typeName, token.line];
  3962. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError("invalid_main_return", context));
  3963. },
  3964. invalid_var_declaration: function invalid_var_declaration(token) {
  3965. var context = [token.line];
  3966. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError("invalid_var_declaration", context));
  3967. },
  3968. invalid_break_command: function invalid_break_command(cmdName, token) {
  3969. var context = [token.line, cmdName];
  3970. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError("invalid_break_command", context));
  3971. },
  3972. invalid_terminal: function invalid_terminal(token) {
  3973. var context = [token.text, token.line, token.column];
  3974. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError('invalid_terminal', context));
  3975. },
  3976. invalid_type: function invalid_type(list, token) {
  3977. var line = list.join(LocalizedStrings.getOR());
  3978. var context = [token.text, token.line, token.column, line];
  3979. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError("invalid_type", context));
  3980. },
  3981. const_not_init: function const_not_init(token) {
  3982. var context = [token.line, token.column];
  3983. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError("const_not_init", context));
  3984. },
  3985. invalid_id_format: function invalid_id_format(token) {
  3986. var context = [token.text, token.line, token.column];
  3987. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError("invalid_id_format", context));
  3988. },
  3989. duplicate_function: function duplicate_function(token) {
  3990. var context = [token.text, token.line, token.column];
  3991. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError("duplicate_function", context));
  3992. },
  3993. main_parameters: function main_parameters() {
  3994. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError("main_parameters"));
  3995. },
  3996. duplicate_variable: function duplicate_variable(token) {
  3997. var context = [token.text, token.line, token.column];
  3998. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError("duplicate_variable", context));
  3999. }
  4000. });
  4001. /***/ }),
  4002. /***/ "./js/ast/expressions/arrayAccess.js":
  4003. /*!*******************************************!*\
  4004. !*** ./js/ast/expressions/arrayAccess.js ***!
  4005. \*******************************************/
  4006. /*! exports provided: ArrayAccess */
  4007. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4008. "use strict";
  4009. __webpack_require__.r(__webpack_exports__);
  4010. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ArrayAccess", function() { return ArrayAccess; });
  4011. /* harmony import */ var _expression__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  4012. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  4013. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4014. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  4015. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  4016. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  4017. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  4018. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  4019. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  4020. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  4021. var ArrayAccess =
  4022. /*#__PURE__*/
  4023. function (_Expression) {
  4024. _inherits(ArrayAccess, _Expression);
  4025. function ArrayAccess(id, line, column) {
  4026. var _this;
  4027. _classCallCheck(this, ArrayAccess);
  4028. _this = _possibleConstructorReturn(this, _getPrototypeOf(ArrayAccess).call(this));
  4029. _this.id = id;
  4030. _this.line = line;
  4031. _this.column = column;
  4032. return _this;
  4033. }
  4034. _createClass(ArrayAccess, [{
  4035. key: "toString",
  4036. value: function toString() {
  4037. var strLine = this.line.toString();
  4038. var strColumn = null;
  4039. if (this.column) {
  4040. strColumn = this.column.toString();
  4041. }
  4042. if (strColumn) {
  4043. return "".concat(this.id, "[").concat(strLine, "][").concat(strColumn, "]");
  4044. } else {
  4045. return "".concat(this.id, "[").concat(strLine, "]");
  4046. }
  4047. }
  4048. }]);
  4049. return ArrayAccess;
  4050. }(_expression__WEBPACK_IMPORTED_MODULE_0__["Expression"]);
  4051. /***/ }),
  4052. /***/ "./js/ast/expressions/arrayLiteral.js":
  4053. /*!********************************************!*\
  4054. !*** ./js/ast/expressions/arrayLiteral.js ***!
  4055. \********************************************/
  4056. /*! exports provided: ArrayLiteral */
  4057. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4058. "use strict";
  4059. __webpack_require__.r(__webpack_exports__);
  4060. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ArrayLiteral", function() { return ArrayLiteral; });
  4061. /* harmony import */ var _literal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4062. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  4063. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4064. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  4065. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  4066. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  4067. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  4068. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  4069. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  4070. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  4071. var ArrayLiteral =
  4072. /*#__PURE__*/
  4073. function (_Literal) {
  4074. _inherits(ArrayLiteral, _Literal);
  4075. function ArrayLiteral(type, value) {
  4076. var _this;
  4077. _classCallCheck(this, ArrayLiteral);
  4078. _this = _possibleConstructorReturn(this, _getPrototypeOf(ArrayLiteral).call(this, type));
  4079. _this.value = value;
  4080. return _this;
  4081. }
  4082. _createClass(ArrayLiteral, [{
  4083. key: "validateType",
  4084. value: function validateType() {
  4085. // let valid = true;
  4086. // if(this.columns !== null) {
  4087. // const len = this.columns;
  4088. // const len2 = this.lines;
  4089. // for (let i = len - 1; i >= 0; i--) {
  4090. // for (let j = len2 - 1; j >= 0; j--) {
  4091. // if(this.value[i].value[j].type !== this.subtype) {
  4092. // valid = false;
  4093. // break;
  4094. // }
  4095. // }
  4096. // }
  4097. // } else {
  4098. // const len = this.lines;
  4099. // for (var i = len - 1; i >= 0; i--) {
  4100. // if(this.value[i].type !== this.subtype) {
  4101. // valid = false;
  4102. // break;
  4103. // }
  4104. // }
  4105. // }
  4106. return true; //valid;
  4107. }
  4108. }, {
  4109. key: "validateSize",
  4110. value: function validateSize() {
  4111. var valid = true;
  4112. if (this.columns !== null) {
  4113. var equalityTest = data.value.map(function (v) {
  4114. return v.length;
  4115. }).reduce(function (old, next) {
  4116. if (old === null) {
  4117. return next;
  4118. } else if (old === next) {
  4119. return old;
  4120. } else {
  4121. return -1;
  4122. }
  4123. }, null);
  4124. valid = equalityTest !== -1;
  4125. }
  4126. return valid;
  4127. }
  4128. }, {
  4129. key: "toString",
  4130. value: function toString() {
  4131. var strList = this.value.map(function (arrayLiteral) {
  4132. return arrayLiteral.toString();
  4133. });
  4134. return "{" + strList.join(',') + "}";
  4135. }
  4136. }, {
  4137. key: "subtype",
  4138. get: function get() {
  4139. var element = this.value[0];
  4140. if (element instanceof ArrayLiteral) {
  4141. return element.value[0].type;
  4142. } else {
  4143. return element.type;
  4144. }
  4145. }
  4146. }, {
  4147. key: "lines",
  4148. get: function get() {
  4149. return this.value.length;
  4150. }
  4151. }, {
  4152. key: "columns",
  4153. get: function get() {
  4154. var element = this.value[0];
  4155. if (!(element instanceof ArrayLiteral)) {
  4156. return null;
  4157. } else {
  4158. return element.value[0].length;
  4159. }
  4160. }
  4161. }, {
  4162. key: "isVector",
  4163. get: function get() {
  4164. return this.columns === null;
  4165. }
  4166. }, {
  4167. key: "isValid",
  4168. get: function get() {
  4169. return true; //this.validateType() && this.validateSize();
  4170. }
  4171. }]);
  4172. return ArrayLiteral;
  4173. }(_literal__WEBPACK_IMPORTED_MODULE_0__["Literal"]);
  4174. /***/ }),
  4175. /***/ "./js/ast/expressions/boolLiteral.js":
  4176. /*!*******************************************!*\
  4177. !*** ./js/ast/expressions/boolLiteral.js ***!
  4178. \*******************************************/
  4179. /*! exports provided: BoolLiteral */
  4180. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4181. "use strict";
  4182. __webpack_require__.r(__webpack_exports__);
  4183. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BoolLiteral", function() { return BoolLiteral; });
  4184. /* harmony import */ var _literal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4185. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  4186. /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  4187. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  4188. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4189. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  4190. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  4191. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  4192. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  4193. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  4194. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  4195. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  4196. var BoolLiteral =
  4197. /*#__PURE__*/
  4198. function (_Literal) {
  4199. _inherits(BoolLiteral, _Literal);
  4200. function BoolLiteral(value) {
  4201. var _this;
  4202. _classCallCheck(this, BoolLiteral);
  4203. _this = _possibleConstructorReturn(this, _getPrototypeOf(BoolLiteral).call(this, _typeSystem_types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN));
  4204. _this.value = value;
  4205. return _this;
  4206. }
  4207. _createClass(BoolLiteral, [{
  4208. key: "toString",
  4209. value: function toString() {
  4210. return Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_2__["convertBoolToString"])(this.value);
  4211. }
  4212. }]);
  4213. return BoolLiteral;
  4214. }(_literal__WEBPACK_IMPORTED_MODULE_0__["Literal"]);
  4215. /***/ }),
  4216. /***/ "./js/ast/expressions/expression.js":
  4217. /*!******************************************!*\
  4218. !*** ./js/ast/expressions/expression.js ***!
  4219. \******************************************/
  4220. /*! exports provided: Expression */
  4221. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4222. "use strict";
  4223. __webpack_require__.r(__webpack_exports__);
  4224. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Expression", function() { return Expression; });
  4225. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4226. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  4227. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  4228. var Expression =
  4229. /*#__PURE__*/
  4230. function () {
  4231. function Expression() {
  4232. _classCallCheck(this, Expression);
  4233. this._sourceInfo = null;
  4234. }
  4235. _createClass(Expression, [{
  4236. key: "sourceInfo",
  4237. set: function set(sourceInfo) {
  4238. this._sourceInfo = sourceInfo;
  4239. },
  4240. get: function get() {
  4241. return this._sourceInfo;
  4242. }
  4243. }]);
  4244. return Expression;
  4245. }();
  4246. /***/ }),
  4247. /***/ "./js/ast/expressions/functionCall.js":
  4248. /*!********************************************!*\
  4249. !*** ./js/ast/expressions/functionCall.js ***!
  4250. \********************************************/
  4251. /*! exports provided: FunctionCall */
  4252. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4253. "use strict";
  4254. __webpack_require__.r(__webpack_exports__);
  4255. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FunctionCall", function() { return FunctionCall; });
  4256. /* harmony import */ var _expression__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  4257. /* harmony import */ var _processor_definedFunctions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../processor/definedFunctions */ "./js/processor/definedFunctions.js");
  4258. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  4259. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4260. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  4261. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  4262. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  4263. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  4264. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  4265. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  4266. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  4267. var FunctionCall =
  4268. /*#__PURE__*/
  4269. function (_Expression) {
  4270. _inherits(FunctionCall, _Expression);
  4271. function FunctionCall(id, actualParameters) {
  4272. var _this;
  4273. _classCallCheck(this, FunctionCall);
  4274. _this = _possibleConstructorReturn(this, _getPrototypeOf(FunctionCall).call(this));
  4275. _this.id = id;
  4276. _this.actualParameters = actualParameters;
  4277. return _this;
  4278. }
  4279. _createClass(FunctionCall, [{
  4280. key: "toString",
  4281. value: function toString() {
  4282. var name = null;
  4283. if (this.isMainCall) {
  4284. name = _processor_definedFunctions__WEBPACK_IMPORTED_MODULE_1__["LanguageDefinedFunction"].getMainFunctionName();
  4285. } else {
  4286. name = _processor_definedFunctions__WEBPACK_IMPORTED_MODULE_1__["LanguageDefinedFunction"].getLocalName(this.id);
  4287. }
  4288. var params = null;
  4289. if (this.actualParameters.length == 0) {
  4290. params = "()";
  4291. } else {
  4292. var strParams = this.actualParameters.map(function (v) {
  4293. return v.toString();
  4294. });
  4295. params = "(" + strParams.join(",") + ")";
  4296. }
  4297. return name + params;
  4298. }
  4299. }, {
  4300. key: "isMainCall",
  4301. get: function get() {
  4302. return this.id === null;
  4303. }
  4304. }, {
  4305. key: "parametersSize",
  4306. get: function get() {
  4307. return this.actualParameters.length;
  4308. }
  4309. }]);
  4310. return FunctionCall;
  4311. }(_expression__WEBPACK_IMPORTED_MODULE_0__["Expression"]);
  4312. /***/ }),
  4313. /***/ "./js/ast/expressions/index.js":
  4314. /*!*************************************!*\
  4315. !*** ./js/ast/expressions/index.js ***!
  4316. \*************************************/
  4317. /*! exports provided: ArrayAccess, FunctionCall, IntLiteral, RealLiteral, BoolLiteral, StringLiteral, ArrayLiteral, VariableLiteral, InfixApp, UnaryApp */
  4318. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4319. "use strict";
  4320. __webpack_require__.r(__webpack_exports__);
  4321. /* harmony import */ var _arrayAccess__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./arrayAccess */ "./js/ast/expressions/arrayAccess.js");
  4322. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ArrayAccess", function() { return _arrayAccess__WEBPACK_IMPORTED_MODULE_0__["ArrayAccess"]; });
  4323. /* harmony import */ var _functionCall__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./functionCall */ "./js/ast/expressions/functionCall.js");
  4324. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FunctionCall", function() { return _functionCall__WEBPACK_IMPORTED_MODULE_1__["FunctionCall"]; });
  4325. /* harmony import */ var _intLiteral__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./intLiteral */ "./js/ast/expressions/intLiteral.js");
  4326. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "IntLiteral", function() { return _intLiteral__WEBPACK_IMPORTED_MODULE_2__["IntLiteral"]; });
  4327. /* harmony import */ var _realLiteral__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./realLiteral */ "./js/ast/expressions/realLiteral.js");
  4328. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "RealLiteral", function() { return _realLiteral__WEBPACK_IMPORTED_MODULE_3__["RealLiteral"]; });
  4329. /* harmony import */ var _boolLiteral__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./boolLiteral */ "./js/ast/expressions/boolLiteral.js");
  4330. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "BoolLiteral", function() { return _boolLiteral__WEBPACK_IMPORTED_MODULE_4__["BoolLiteral"]; });
  4331. /* harmony import */ var _stringLiteral__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./stringLiteral */ "./js/ast/expressions/stringLiteral.js");
  4332. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "StringLiteral", function() { return _stringLiteral__WEBPACK_IMPORTED_MODULE_5__["StringLiteral"]; });
  4333. /* harmony import */ var _arrayLiteral__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./arrayLiteral */ "./js/ast/expressions/arrayLiteral.js");
  4334. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ArrayLiteral", function() { return _arrayLiteral__WEBPACK_IMPORTED_MODULE_6__["ArrayLiteral"]; });
  4335. /* harmony import */ var _variableLiteral__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./variableLiteral */ "./js/ast/expressions/variableLiteral.js");
  4336. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "VariableLiteral", function() { return _variableLiteral__WEBPACK_IMPORTED_MODULE_7__["VariableLiteral"]; });
  4337. /* harmony import */ var _infixApp__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./infixApp */ "./js/ast/expressions/infixApp.js");
  4338. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "InfixApp", function() { return _infixApp__WEBPACK_IMPORTED_MODULE_8__["InfixApp"]; });
  4339. /* harmony import */ var _unaryApp__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./unaryApp */ "./js/ast/expressions/unaryApp.js");
  4340. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "UnaryApp", function() { return _unaryApp__WEBPACK_IMPORTED_MODULE_9__["UnaryApp"]; });
  4341. /***/ }),
  4342. /***/ "./js/ast/expressions/infixApp.js":
  4343. /*!****************************************!*\
  4344. !*** ./js/ast/expressions/infixApp.js ***!
  4345. \****************************************/
  4346. /*! exports provided: InfixApp */
  4347. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4348. "use strict";
  4349. __webpack_require__.r(__webpack_exports__);
  4350. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "InfixApp", function() { return InfixApp; });
  4351. /* harmony import */ var _expression__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  4352. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  4353. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4354. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  4355. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  4356. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  4357. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  4358. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  4359. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  4360. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  4361. var InfixApp =
  4362. /*#__PURE__*/
  4363. function (_Expression) {
  4364. _inherits(InfixApp, _Expression);
  4365. function InfixApp(op, left, right) {
  4366. var _this;
  4367. _classCallCheck(this, InfixApp);
  4368. _this = _possibleConstructorReturn(this, _getPrototypeOf(InfixApp).call(this));
  4369. _this.op = op;
  4370. _this.left = left;
  4371. _this.right = right;
  4372. return _this;
  4373. }
  4374. _createClass(InfixApp, [{
  4375. key: "toString",
  4376. value: function toString() {
  4377. var l = this.left.toString();
  4378. var op = this.op.value;
  4379. var r = this.right.toString();
  4380. return l + op + r;
  4381. }
  4382. }]);
  4383. return InfixApp;
  4384. }(_expression__WEBPACK_IMPORTED_MODULE_0__["Expression"]);
  4385. /***/ }),
  4386. /***/ "./js/ast/expressions/intLiteral.js":
  4387. /*!******************************************!*\
  4388. !*** ./js/ast/expressions/intLiteral.js ***!
  4389. \******************************************/
  4390. /*! exports provided: IntLiteral */
  4391. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4392. "use strict";
  4393. __webpack_require__.r(__webpack_exports__);
  4394. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IntLiteral", function() { return IntLiteral; });
  4395. /* harmony import */ var _literal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4396. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  4397. /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  4398. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  4399. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4400. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  4401. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  4402. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  4403. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  4404. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  4405. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  4406. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  4407. var IntLiteral =
  4408. /*#__PURE__*/
  4409. function (_Literal) {
  4410. _inherits(IntLiteral, _Literal);
  4411. function IntLiteral(value) {
  4412. var _this;
  4413. _classCallCheck(this, IntLiteral);
  4414. _this = _possibleConstructorReturn(this, _getPrototypeOf(IntLiteral).call(this, _typeSystem_types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER));
  4415. _this.value = value;
  4416. return _this;
  4417. }
  4418. _createClass(IntLiteral, [{
  4419. key: "toString",
  4420. value: function toString() {
  4421. return Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_2__["convertToString"])(this.value, this.type);
  4422. }
  4423. }]);
  4424. return IntLiteral;
  4425. }(_literal__WEBPACK_IMPORTED_MODULE_0__["Literal"]);
  4426. /***/ }),
  4427. /***/ "./js/ast/expressions/literal.js":
  4428. /*!***************************************!*\
  4429. !*** ./js/ast/expressions/literal.js ***!
  4430. \***************************************/
  4431. /*! exports provided: Literal */
  4432. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4433. "use strict";
  4434. __webpack_require__.r(__webpack_exports__);
  4435. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Literal", function() { return Literal; });
  4436. /* harmony import */ var _expression__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  4437. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  4438. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4439. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  4440. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  4441. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  4442. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  4443. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  4444. var Literal =
  4445. /*#__PURE__*/
  4446. function (_Expression) {
  4447. _inherits(Literal, _Expression);
  4448. function Literal(type) {
  4449. var _this;
  4450. _classCallCheck(this, Literal);
  4451. _this = _possibleConstructorReturn(this, _getPrototypeOf(Literal).call(this));
  4452. _this.type = type;
  4453. return _this;
  4454. }
  4455. return Literal;
  4456. }(_expression__WEBPACK_IMPORTED_MODULE_0__["Expression"]);
  4457. /***/ }),
  4458. /***/ "./js/ast/expressions/realLiteral.js":
  4459. /*!*******************************************!*\
  4460. !*** ./js/ast/expressions/realLiteral.js ***!
  4461. \*******************************************/
  4462. /*! exports provided: RealLiteral */
  4463. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4464. "use strict";
  4465. __webpack_require__.r(__webpack_exports__);
  4466. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RealLiteral", function() { return RealLiteral; });
  4467. /* harmony import */ var _literal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4468. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  4469. /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  4470. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  4471. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4472. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  4473. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  4474. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  4475. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  4476. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  4477. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  4478. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  4479. var RealLiteral =
  4480. /*#__PURE__*/
  4481. function (_Literal) {
  4482. _inherits(RealLiteral, _Literal);
  4483. function RealLiteral(value) {
  4484. var _this;
  4485. _classCallCheck(this, RealLiteral);
  4486. _this = _possibleConstructorReturn(this, _getPrototypeOf(RealLiteral).call(this, _typeSystem_types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL));
  4487. _this.value = value;
  4488. return _this;
  4489. }
  4490. _createClass(RealLiteral, [{
  4491. key: "toString",
  4492. value: function toString() {
  4493. return Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_2__["convertToString"])(this.value, this.type);
  4494. }
  4495. }]);
  4496. return RealLiteral;
  4497. }(_literal__WEBPACK_IMPORTED_MODULE_0__["Literal"]);
  4498. /***/ }),
  4499. /***/ "./js/ast/expressions/stringLiteral.js":
  4500. /*!*********************************************!*\
  4501. !*** ./js/ast/expressions/stringLiteral.js ***!
  4502. \*********************************************/
  4503. /*! exports provided: StringLiteral */
  4504. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4505. "use strict";
  4506. __webpack_require__.r(__webpack_exports__);
  4507. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StringLiteral", function() { return StringLiteral; });
  4508. /* harmony import */ var _literal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4509. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  4510. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  4511. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4512. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  4513. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  4514. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  4515. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  4516. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  4517. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  4518. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  4519. var StringLiteral =
  4520. /*#__PURE__*/
  4521. function (_Literal) {
  4522. _inherits(StringLiteral, _Literal);
  4523. function StringLiteral(value) {
  4524. var _this;
  4525. _classCallCheck(this, StringLiteral);
  4526. _this = _possibleConstructorReturn(this, _getPrototypeOf(StringLiteral).call(this, _typeSystem_types__WEBPACK_IMPORTED_MODULE_1__["Types"].STRING));
  4527. _this.value = value;
  4528. return _this;
  4529. }
  4530. _createClass(StringLiteral, [{
  4531. key: "toString",
  4532. value: function toString() {
  4533. return '"' + this.value + '"';
  4534. }
  4535. }]);
  4536. return StringLiteral;
  4537. }(_literal__WEBPACK_IMPORTED_MODULE_0__["Literal"]);
  4538. /***/ }),
  4539. /***/ "./js/ast/expressions/unaryApp.js":
  4540. /*!****************************************!*\
  4541. !*** ./js/ast/expressions/unaryApp.js ***!
  4542. \****************************************/
  4543. /*! exports provided: UnaryApp */
  4544. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4545. "use strict";
  4546. __webpack_require__.r(__webpack_exports__);
  4547. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UnaryApp", function() { return UnaryApp; });
  4548. /* harmony import */ var _infixApp__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./infixApp */ "./js/ast/expressions/infixApp.js");
  4549. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  4550. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4551. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  4552. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  4553. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  4554. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  4555. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  4556. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  4557. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  4558. var UnaryApp =
  4559. /*#__PURE__*/
  4560. function (_InfixApp) {
  4561. _inherits(UnaryApp, _InfixApp);
  4562. function UnaryApp(op, left) {
  4563. _classCallCheck(this, UnaryApp);
  4564. return _possibleConstructorReturn(this, _getPrototypeOf(UnaryApp).call(this, op, left, null));
  4565. }
  4566. _createClass(UnaryApp, [{
  4567. key: "toString",
  4568. value: function toString() {
  4569. var l = this.left.toString();
  4570. var op = this.op.value;
  4571. return op + l;
  4572. }
  4573. }]);
  4574. return UnaryApp;
  4575. }(_infixApp__WEBPACK_IMPORTED_MODULE_0__["InfixApp"]);
  4576. /***/ }),
  4577. /***/ "./js/ast/expressions/variableLiteral.js":
  4578. /*!***********************************************!*\
  4579. !*** ./js/ast/expressions/variableLiteral.js ***!
  4580. \***********************************************/
  4581. /*! exports provided: VariableLiteral */
  4582. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4583. "use strict";
  4584. __webpack_require__.r(__webpack_exports__);
  4585. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VariableLiteral", function() { return VariableLiteral; });
  4586. /* harmony import */ var _literal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4587. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  4588. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  4589. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4590. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  4591. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  4592. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  4593. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  4594. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  4595. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  4596. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  4597. var VariableLiteral =
  4598. /*#__PURE__*/
  4599. function (_Literal) {
  4600. _inherits(VariableLiteral, _Literal);
  4601. function VariableLiteral(id) {
  4602. var _this;
  4603. _classCallCheck(this, VariableLiteral);
  4604. _this = _possibleConstructorReturn(this, _getPrototypeOf(VariableLiteral).call(this, _typeSystem_types__WEBPACK_IMPORTED_MODULE_1__["Types"].UNDEFINED));
  4605. _this.id = id;
  4606. return _this;
  4607. }
  4608. _createClass(VariableLiteral, [{
  4609. key: "toString",
  4610. value: function toString() {
  4611. return this.id;
  4612. }
  4613. }]);
  4614. return VariableLiteral;
  4615. }(_literal__WEBPACK_IMPORTED_MODULE_0__["Literal"]);
  4616. /***/ }),
  4617. /***/ "./js/ast/ivprogParser.js":
  4618. /*!********************************!*\
  4619. !*** ./js/ast/ivprogParser.js ***!
  4620. \********************************/
  4621. /*! exports provided: IVProgParser */
  4622. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4623. "use strict";
  4624. __webpack_require__.r(__webpack_exports__);
  4625. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IVProgParser", function() { return IVProgParser; });
  4626. /* harmony import */ var antlr4_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js");
  4627. /* harmony import */ var antlr4_index__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(antlr4_index__WEBPACK_IMPORTED_MODULE_0__);
  4628. /* harmony import */ var _expressions___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./expressions/ */ "./js/ast/expressions/index.js");
  4629. /* harmony import */ var _commands___WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./commands/ */ "./js/ast/commands/index.js");
  4630. /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  4631. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./../typeSystem/types */ "./js/typeSystem/types.js");
  4632. /* harmony import */ var _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  4633. /* harmony import */ var _sourceInfo__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./sourceInfo */ "./js/ast/sourceInfo.js");
  4634. /* harmony import */ var _operators__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./operators */ "./js/ast/operators.js");
  4635. /* harmony import */ var _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./error/syntaxErrorFactory */ "./js/ast/error/syntaxErrorFactory.js");
  4636. /* harmony import */ var _processor_definedFunctions__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./../processor/definedFunctions */ "./js/processor/definedFunctions.js");
  4637. /* harmony import */ var _services_languageService__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js");
  4638. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4639. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  4640. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  4641. var IVProgParser =
  4642. /*#__PURE__*/
  4643. function () {
  4644. _createClass(IVProgParser, null, [{
  4645. key: "createParser",
  4646. value: function createParser(input) {
  4647. var lexerClass = _services_languageService__WEBPACK_IMPORTED_MODULE_10__["LanguageService"].getCurrentLexer();
  4648. return new IVProgParser(input, lexerClass);
  4649. } // <BEGIN scope consts>
  4650. }, {
  4651. key: "BASE",
  4652. get: function get() {
  4653. return 0;
  4654. }
  4655. }, {
  4656. key: "FUNCTION",
  4657. get: function get() {
  4658. return 1;
  4659. }
  4660. }, {
  4661. key: "COMMAND",
  4662. get: function get() {
  4663. return 2;
  4664. }
  4665. }, {
  4666. key: "BREAKABLE",
  4667. get: function get() {
  4668. return 4;
  4669. } // </ END scope consts>
  4670. }]);
  4671. function IVProgParser(input, lexerClass) {
  4672. _classCallCheck(this, IVProgParser);
  4673. this.lexerClass = lexerClass;
  4674. this.lexer = new lexerClass(new antlr4_index__WEBPACK_IMPORTED_MODULE_0__["InputStream"](input));
  4675. this.tokenStream = new antlr4_index__WEBPACK_IMPORTED_MODULE_0__["CommonTokenStream"](this.lexer);
  4676. this.tokenStream.fill();
  4677. this.pos = 1;
  4678. this.variableTypes = [this.lexerClass.RK_INTEGER, this.lexerClass.RK_REAL, this.lexerClass.RK_BOOLEAN, this.lexerClass.RK_STRING];
  4679. this.functionTypes = this.variableTypes.concat(this.lexerClass.RK_VOID);
  4680. this.parsingArrayDimension = 0;
  4681. this.scope = [];
  4682. this.langFuncs = _services_languageService__WEBPACK_IMPORTED_MODULE_10__["LanguageService"].getCurrentLangFuncs();
  4683. this.definedFuncsNameList = [];
  4684. this.definedVariablesStack = [];
  4685. }
  4686. _createClass(IVProgParser, [{
  4687. key: "parseTree",
  4688. value: function parseTree() {
  4689. return this.parseProgram();
  4690. }
  4691. }, {
  4692. key: "getToken",
  4693. value: function getToken() {
  4694. var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.pos;
  4695. // if(index === null)
  4696. // index = this.pos;
  4697. return this.tokenStream.LT(index);
  4698. }
  4699. }, {
  4700. key: "insideScope",
  4701. value: function insideScope(scope) {
  4702. if (this.scope.length <= 0) {
  4703. return IVProgParser.BASE === scope;
  4704. } else {
  4705. return this.scope[this.scope.length - 1] === scope;
  4706. }
  4707. }
  4708. }, {
  4709. key: "pushScope",
  4710. value: function pushScope(scope) {
  4711. this.scope.push(scope);
  4712. }
  4713. }, {
  4714. key: "pushVariableStack",
  4715. value: function pushVariableStack() {
  4716. this.definedVariablesStack.push([]);
  4717. }
  4718. }, {
  4719. key: "popScope",
  4720. value: function popScope() {
  4721. return this.scope.pop();
  4722. }
  4723. }, {
  4724. key: "popVariableStack",
  4725. value: function popVariableStack() {
  4726. return this.definedVariablesStack.pop();
  4727. }
  4728. }, {
  4729. key: "getCurrentVariableStack",
  4730. value: function getCurrentVariableStack() {
  4731. return this.definedVariablesStack[this.definedVariablesStack.length - 1];
  4732. }
  4733. }, {
  4734. key: "isEOF",
  4735. value: function isEOF() {
  4736. this.getToken(this.pos);
  4737. return this.tokenStream.fetchedEOF;
  4738. }
  4739. }, {
  4740. key: "parseProgram",
  4741. value: function parseProgram() {
  4742. var token = this.getToken();
  4743. var globalVars = [];
  4744. var functions = [];
  4745. if (this.lexerClass.RK_PROGRAM === token.type) {
  4746. this.pos++;
  4747. this.consumeNewLines();
  4748. this.checkOpenCurly();
  4749. this.pos++;
  4750. this.pushVariableStack();
  4751. while (true) {
  4752. this.consumeNewLines();
  4753. var _token = this.getToken();
  4754. if (_token.type === this.lexerClass.RK_CONST || this.isVariableType(_token)) {
  4755. globalVars = globalVars.concat(this.parseGlobalVariables());
  4756. } else if (_token.type === this.lexerClass.RK_FUNCTION) {
  4757. this.pushVariableStack();
  4758. functions = functions.concat(this.parseFunction());
  4759. this.popVariableStack();
  4760. } else {
  4761. break;
  4762. }
  4763. }
  4764. this.consumeNewLines();
  4765. this.checkCloseCurly();
  4766. this.pos++;
  4767. this.consumeNewLines();
  4768. if (!this.isEOF()) {
  4769. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].extra_lines();
  4770. }
  4771. this.popVariableStack();
  4772. return {
  4773. global: globalVars,
  4774. functions: functions
  4775. };
  4776. } else {
  4777. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_one(this.lexer.literalNames[this.lexerClass.RK_PROGRAM], token);
  4778. }
  4779. }
  4780. }, {
  4781. key: "checkOpenCurly",
  4782. value: function checkOpenCurly() {
  4783. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4784. var token = this.getToken();
  4785. if (this.lexerClass.OPEN_CURLY !== token.type) {
  4786. if (!attempt) throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_one('{', token);else return false;
  4787. }
  4788. return true;
  4789. }
  4790. }, {
  4791. key: "checkCloseCurly",
  4792. value: function checkCloseCurly() {
  4793. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4794. var token = this.getToken();
  4795. if (this.lexerClass.CLOSE_CURLY !== token.type) {
  4796. if (!attempt) throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_one('}', token);else return false;
  4797. }
  4798. return true;
  4799. }
  4800. /* It checks if the current token at position pos is a ']'.
  4801. * As a check function it doesn't increment pos.
  4802. *
  4803. * @params bool:attempt, indicates that the token is optional. Defaults: false
  4804. *
  4805. * @returns true if the attempt is true and current token is '[',
  4806. * false is attempt is true and current token is not '['
  4807. **/
  4808. }, {
  4809. key: "checkOpenBrace",
  4810. value: function checkOpenBrace() {
  4811. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4812. var token = this.getToken();
  4813. if (this.lexerClass.OPEN_BRACE !== token.type) {
  4814. if (!attempt) {
  4815. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_one('[', token);
  4816. } else {
  4817. return false;
  4818. }
  4819. }
  4820. return true;
  4821. }
  4822. }, {
  4823. key: "checkCloseBrace",
  4824. value: function checkCloseBrace() {
  4825. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4826. var token = this.getToken();
  4827. if (this.lexerClass.CLOSE_BRACE !== token.type) {
  4828. if (!attempt) {
  4829. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_one(']', token);
  4830. } else {
  4831. return false;
  4832. }
  4833. }
  4834. return true;
  4835. }
  4836. }, {
  4837. key: "checkOpenParenthesis",
  4838. value: function checkOpenParenthesis() {
  4839. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4840. var token = this.getToken();
  4841. if (this.lexerClass.OPEN_PARENTHESIS !== token.type) {
  4842. if (!attempt) {
  4843. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_one('(', token);
  4844. } else {
  4845. return false;
  4846. }
  4847. }
  4848. return true;
  4849. }
  4850. }, {
  4851. key: "checkCloseParenthesis",
  4852. value: function checkCloseParenthesis() {
  4853. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4854. var token = this.getToken();
  4855. if (this.lexerClass.CLOSE_PARENTHESIS !== token.type) {
  4856. if (!attempt) {
  4857. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_one(')', token);
  4858. } else {
  4859. return false;
  4860. }
  4861. }
  4862. return true;
  4863. }
  4864. }, {
  4865. key: "checkEOS",
  4866. value: function checkEOS() {
  4867. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4868. var eosToken = this.getToken();
  4869. if (eosToken.type !== this.lexerClass.EOS) {
  4870. if (!attempt) throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].eos_missing(eosToken);else return false;
  4871. }
  4872. return true;
  4873. }
  4874. }, {
  4875. key: "checkFunctionDuplicate",
  4876. value: function checkFunctionDuplicate(functionID, funcIDToken) {
  4877. var id = functionID === null ? "$main" : functionID;
  4878. var index = this.definedFuncsNameList.indexOf(id);
  4879. if (index !== -1) {
  4880. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].duplicate_function(funcIDToken);
  4881. }
  4882. this.definedFuncsNameList.push(id);
  4883. }
  4884. }, {
  4885. key: "checkVariableDuplicate",
  4886. value: function checkVariableDuplicate(variableID, variableIDToken) {
  4887. var index = this.getCurrentVariableStack().indexOf(variableID);
  4888. if (index !== -1) {
  4889. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].duplicate_variable(variableIDToken);
  4890. }
  4891. this.getCurrentVariableStack().push(variableID);
  4892. }
  4893. }, {
  4894. key: "consumeForSemiColon",
  4895. value: function consumeForSemiColon() {
  4896. var eosToken = this.getToken();
  4897. if (eosToken.type === this.lexerClass.EOS && eosToken.text.match(';')) {
  4898. this.pos++;
  4899. return;
  4900. }
  4901. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_one(';', eosToken);
  4902. }
  4903. }, {
  4904. key: "parseGlobalVariables",
  4905. value: function parseGlobalVariables() {
  4906. var decl = this.parseMaybeConst();
  4907. this.checkEOS();
  4908. this.pos++;
  4909. return decl;
  4910. }
  4911. /*
  4912. * Checks if the next token is PR_CONST. It's only available
  4913. * at global variables declaration level
  4914. * @returns Declararion(const, type, id, initVal?)
  4915. **/
  4916. }, {
  4917. key: "parseMaybeConst",
  4918. value: function parseMaybeConst() {
  4919. var constToken = this.getToken();
  4920. if (constToken.type === this.lexerClass.RK_CONST) {
  4921. this.pos++;
  4922. var typeString = this.parseType();
  4923. return this.parseDeclaration(typeString, true);
  4924. } else if (this.isVariableType(constToken)) {
  4925. var _typeString = this.parseType();
  4926. return this.parseDeclaration(_typeString);
  4927. } else {
  4928. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_list([this.lexer.literalNames[this.lexerClass.RK_CONST]].concat(this.getTypeArray()), constToken);
  4929. }
  4930. }
  4931. /*
  4932. * Parses a declarion of the form: type --- id --- (= --- EAnd)?
  4933. * @returns a list of Declararion(const, type, id, initVal?)
  4934. **/
  4935. }, {
  4936. key: "parseDeclaration",
  4937. value: function parseDeclaration(typeString) {
  4938. var isConst = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  4939. var initial = null;
  4940. var dim1 = null;
  4941. var dim2 = null;
  4942. var idToken = this.getToken();
  4943. var idString = this.parseID();
  4944. this.checkVariableDuplicate(idString, idToken); // Check for array or vector
  4945. // ID[int/IDi][int/IDj]
  4946. if (this.checkOpenBrace(true)) {
  4947. this.pos++;
  4948. this.consumeNewLines();
  4949. dim1 = this.parseArrayDimension();
  4950. this.consumeNewLines();
  4951. this.checkCloseBrace();
  4952. this.pos++;
  4953. if (this.checkOpenBrace(true)) {
  4954. this.pos++;
  4955. this.consumeNewLines();
  4956. dim2 = this.parseArrayDimension();
  4957. this.consumeNewLines();
  4958. this.checkCloseBrace();
  4959. this.pos++;
  4960. }
  4961. }
  4962. var equalsToken = this.getToken();
  4963. if (isConst && equalsToken.type !== this.lexerClass.EQUAL) {
  4964. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].const_not_init(idToken);
  4965. }
  4966. if (equalsToken.type === this.lexerClass.EQUAL) {
  4967. this.pos++;
  4968. initial = this.parseExpressionOR();
  4969. }
  4970. var declaration = null;
  4971. var dimensions = 0;
  4972. if (dim1 !== null) {
  4973. dimensions++;
  4974. if (dim2 !== null) {
  4975. dimensions++;
  4976. }
  4977. declaration = new _commands___WEBPACK_IMPORTED_MODULE_2__["ArrayDeclaration"](idString, new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_5__["CompoundType"](typeString, dimensions), dim1, dim2, initial, isConst);
  4978. } else {
  4979. declaration = new _commands___WEBPACK_IMPORTED_MODULE_2__["Declaration"](idString, typeString, initial, isConst);
  4980. }
  4981. declaration.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(idToken);
  4982. var commaToken = this.getToken();
  4983. if (commaToken.type === this.lexerClass.COMMA) {
  4984. this.pos++;
  4985. this.consumeNewLines();
  4986. return [declaration].concat(this.parseDeclaration(typeString, isConst));
  4987. } else {
  4988. return [declaration];
  4989. }
  4990. }
  4991. }, {
  4992. key: "consumeNewLines",
  4993. value: function consumeNewLines() {
  4994. var token = this.getToken();
  4995. while (token.type === this.lexerClass.EOS && token.text.match('[\r\n]+')) {
  4996. this.pos++;
  4997. token = this.getToken();
  4998. }
  4999. }
  5000. }, {
  5001. key: "isVariableType",
  5002. value: function isVariableType(token) {
  5003. return this.variableTypes.find(function (v) {
  5004. return v === token.type;
  5005. });
  5006. }
  5007. /*
  5008. * Reads the next token of the stream to check if it is a Integer or an ID.
  5009. * @returns Integer | ID
  5010. **/
  5011. }, {
  5012. key: "parseArrayDimension",
  5013. value: function parseArrayDimension() {
  5014. var dimToken = this.getToken();
  5015. if (dimToken.type === this.lexerClass.INTEGER) {
  5016. //parse as int literal
  5017. this.pos++;
  5018. return this.getIntLiteral(dimToken);
  5019. } else if (dimToken.type === this.lexerClass.ID) {
  5020. //parse as variable
  5021. this.pos++;
  5022. return this.parseVariable(dimToken);
  5023. } else {
  5024. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].invalid_array_dimension(this.lexer.literalNames[this.lexerClass.RK_INTEGER], dimToken);
  5025. }
  5026. }
  5027. /*
  5028. * Returns an object {type: 'int', value: value}.
  5029. * It checks for binary and hexadecimal integers.
  5030. * @returns object with fields type and value
  5031. **/
  5032. }, {
  5033. key: "getIntLiteral",
  5034. value: function getIntLiteral(token) {
  5035. var text = token.text;
  5036. var sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(token);
  5037. var exp = new _expressions___WEBPACK_IMPORTED_MODULE_1__["IntLiteral"](Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__["toInt"])(text));
  5038. exp.sourceInfo = sourceInfo;
  5039. return exp;
  5040. }
  5041. }, {
  5042. key: "getRealLiteral",
  5043. value: function getRealLiteral(token) {
  5044. var sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(token);
  5045. var exp = new _expressions___WEBPACK_IMPORTED_MODULE_1__["RealLiteral"](Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__["toReal"])(token.text));
  5046. exp.sourceInfo = sourceInfo;
  5047. return exp;
  5048. }
  5049. }, {
  5050. key: "getStringLiteral",
  5051. value: function getStringLiteral(token) {
  5052. var text = token.text;
  5053. var sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(token);
  5054. var exp = new _expressions___WEBPACK_IMPORTED_MODULE_1__["StringLiteral"](Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__["toString"])(text));
  5055. exp.sourceInfo = sourceInfo;
  5056. return exp;
  5057. }
  5058. }, {
  5059. key: "getBoolLiteral",
  5060. value: function getBoolLiteral(token) {
  5061. var val = Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__["toBool"])(token.text);
  5062. var exp = new _expressions___WEBPACK_IMPORTED_MODULE_1__["BoolLiteral"](val);
  5063. exp.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(token);
  5064. ;
  5065. return exp;
  5066. }
  5067. }, {
  5068. key: "parseArrayLiteral",
  5069. value: function parseArrayLiteral() {
  5070. this.checkOpenCurly();
  5071. var beginArray = this.getToken();
  5072. if (this.parsingArrayDimension >= 2) {
  5073. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_list("Array dimensions exceed maximum size of 2 at line ".concat(beginArray.line));
  5074. }
  5075. this.pos++;
  5076. this.parsingArrayDimension++;
  5077. this.consumeNewLines();
  5078. var data = this.parseExpressionList();
  5079. this.consumeNewLines();
  5080. this.checkCloseCurly();
  5081. var endArray = this.getToken();
  5082. this.pos++;
  5083. this.parsingArrayDimension--;
  5084. if (this.parsingArrayDimension === 0) {// if (!data.isValid) {
  5085. // // TODO: better error message
  5086. // console.log('invalid array');
  5087. // throw new Error(`Invalid array at line ${beginArray.line}`);
  5088. // }
  5089. }
  5090. var sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfoFromList(beginArray, endArray);
  5091. var dataDim = 1;
  5092. if (data[0] instanceof _expressions___WEBPACK_IMPORTED_MODULE_1__["ArrayLiteral"]) {
  5093. dataDim++;
  5094. }
  5095. var type = new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_5__["CompoundType"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_4__["Types"].UNDEFINED, dataDim);
  5096. var exp = new _expressions___WEBPACK_IMPORTED_MODULE_1__["ArrayLiteral"](type, data);
  5097. exp.sourceInfo = sourceInfo;
  5098. return exp;
  5099. }
  5100. /*
  5101. * Returns an object {type: 'variable', value: value}.
  5102. * @returns object with fields type and value
  5103. **/
  5104. }, {
  5105. key: "parseVariable",
  5106. value: function parseVariable(token) {
  5107. var sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(token);
  5108. var exp = new _expressions___WEBPACK_IMPORTED_MODULE_1__["VariableLiteral"](token.text);
  5109. exp.sourceInfo = sourceInfo;
  5110. return exp;
  5111. }
  5112. /*
  5113. * Returns an object representing a function. It has
  5114. * four attributes: returnType, id, formalParams and block.
  5115. * The block object has two attributes: declarations and commands
  5116. **/
  5117. }, {
  5118. key: "parseFunction",
  5119. value: function parseFunction() {
  5120. this.pushScope(IVProgParser.FUNCTION);
  5121. var formalParams = [];
  5122. var token = this.getToken();
  5123. if (token.type !== this.lexerClass.RK_FUNCTION) {
  5124. //throw SyntaxError.createError(this.lexer.literalNames[this.lexerClass.PR_FUNCAO], token);
  5125. return null;
  5126. }
  5127. this.pos++;
  5128. var funType = this.parseType();
  5129. var dimensions = 0;
  5130. if (this.checkOpenBrace(true)) {
  5131. this.pos++;
  5132. this.checkCloseBrace();
  5133. this.pos++;
  5134. dimensions++;
  5135. if (this.checkOpenBrace(true)) {
  5136. this.pos++;
  5137. this.checkCloseBrace();
  5138. this.pos++;
  5139. dimensions++;
  5140. }
  5141. }
  5142. var funcIDToken = this.getToken();
  5143. var functionID = this.parseID();
  5144. this.checkFunctionDuplicate(functionID, funcIDToken);
  5145. this.checkOpenParenthesis();
  5146. this.pos++;
  5147. this.consumeNewLines();
  5148. if (!this.checkCloseParenthesis(true)) {
  5149. formalParams = this.parseFormalParameters(); // formal parameters
  5150. this.consumeNewLines();
  5151. this.checkCloseParenthesis();
  5152. this.pos++;
  5153. } else {
  5154. this.pos++;
  5155. }
  5156. this.consumeNewLines();
  5157. var commandsBlock = this.parseCommandBlock();
  5158. var returnType = funType;
  5159. if (dimensions > 0) {
  5160. returnType = new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_5__["CompoundType"](funType, dimensions);
  5161. }
  5162. var func = new _commands___WEBPACK_IMPORTED_MODULE_2__["Function"](functionID, returnType, formalParams, commandsBlock);
  5163. if (functionID === null && !func.isMain) {
  5164. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].invalid_main_return(_processor_definedFunctions__WEBPACK_IMPORTED_MODULE_9__["LanguageDefinedFunction"].getMainFunctionName(), this.lexer.literalNames[this.lexerClass.RK_VOID], token.line);
  5165. } else if (func.isMain && formalParams.length !== 0) {
  5166. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].main_parameters();
  5167. }
  5168. this.popScope();
  5169. return func;
  5170. }
  5171. /*
  5172. * Parse the formal parameters of a function.
  5173. * @returns a list of objects with the following attributes: type, id and dimensions.
  5174. **/
  5175. }, {
  5176. key: "parseFormalParameters",
  5177. value: function parseFormalParameters() {
  5178. var list = [];
  5179. while (true) {
  5180. var dimensions = 0;
  5181. var typeString = this.parseType();
  5182. var idToken = this.getToken();
  5183. var idString = this.parseID();
  5184. this.checkVariableDuplicate(idString, idToken);
  5185. if (this.checkOpenBrace(true)) {
  5186. this.pos++;
  5187. dimensions++;
  5188. this.checkCloseBrace();
  5189. this.pos++;
  5190. if (this.checkOpenBrace(true)) {
  5191. this.pos++;
  5192. dimensions++;
  5193. this.checkCloseBrace();
  5194. this.pos++;
  5195. }
  5196. }
  5197. var type = null;
  5198. if (dimensions > 0) {
  5199. type = new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_5__["CompoundType"](typeString, dimensions);
  5200. } else {
  5201. type = typeString;
  5202. }
  5203. list.push(new _commands___WEBPACK_IMPORTED_MODULE_2__["FormalParameter"](type, idString));
  5204. var commaToken = this.getToken();
  5205. if (commaToken.type !== this.lexerClass.COMMA) break;
  5206. this.pos++;
  5207. this.consumeNewLines();
  5208. }
  5209. return list;
  5210. }
  5211. }, {
  5212. key: "parseID",
  5213. value: function parseID() {
  5214. var token = this.getToken();
  5215. if (token.type !== this.lexerClass.ID) {
  5216. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].id_missing(token);
  5217. }
  5218. this.pos++;
  5219. if (this.insideScope(IVProgParser.FUNCTION)) {
  5220. if (token.text === _processor_definedFunctions__WEBPACK_IMPORTED_MODULE_9__["LanguageDefinedFunction"].getMainFunctionName()) {
  5221. return null;
  5222. }
  5223. }
  5224. return token.text;
  5225. }
  5226. }, {
  5227. key: "parseMaybeLibID",
  5228. value: function parseMaybeLibID() {
  5229. var token = this.getToken();
  5230. if (token.type !== this.lexerClass.ID && token.type !== this.lexerClass.LIB_ID) {
  5231. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].id_missing(token);
  5232. }
  5233. this.pos++;
  5234. return token.text;
  5235. }
  5236. }, {
  5237. key: "parseType",
  5238. value: function parseType() {
  5239. var token = this.getToken();
  5240. if (token.type === this.lexerClass.ID && this.insideScope(IVProgParser.FUNCTION)) {
  5241. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_4__["Types"].VOID;
  5242. } else if (token.type === this.lexerClass.RK_VOID && this.insideScope(IVProgParser.FUNCTION)) {
  5243. this.pos++;
  5244. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_4__["Types"].VOID;
  5245. } else if (this.isVariableType(token)) {
  5246. this.pos++;
  5247. switch (token.type) {
  5248. case this.lexerClass.RK_INTEGER:
  5249. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_4__["Types"].INTEGER;
  5250. case this.lexerClass.RK_BOOLEAN:
  5251. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_4__["Types"].BOOLEAN;
  5252. case this.lexerClass.RK_REAL:
  5253. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_4__["Types"].REAL;
  5254. case this.lexerClass.RK_STRING:
  5255. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_4__["Types"].STRING;
  5256. default:
  5257. break;
  5258. }
  5259. }
  5260. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].invalid_type(this.getTypeArray(), token);
  5261. }
  5262. }, {
  5263. key: "parseCommandBlock",
  5264. value: function parseCommandBlock() {
  5265. var optionalCurly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  5266. var variablesDecl = [];
  5267. var commands = [];
  5268. var hasOpen = false;
  5269. if (this.checkOpenCurly(optionalCurly)) {
  5270. this.pos++;
  5271. hasOpen = true;
  5272. }
  5273. this.consumeNewLines();
  5274. while (true) {
  5275. var cmd = this.parseCommand();
  5276. if (cmd === null) break;
  5277. if (cmd !== -1) {
  5278. if (cmd instanceof Array) {
  5279. variablesDecl = variablesDecl.concat(cmd);
  5280. } else {
  5281. commands.push(cmd);
  5282. }
  5283. }
  5284. }
  5285. this.consumeNewLines();
  5286. if (hasOpen) {
  5287. this.checkCloseCurly();
  5288. this.pos++;
  5289. this.consumeNewLines();
  5290. }
  5291. return new _commands___WEBPACK_IMPORTED_MODULE_2__["CommandBlock"](variablesDecl, commands);
  5292. }
  5293. }, {
  5294. key: "parseCommand",
  5295. value: function parseCommand() {
  5296. var token = this.getToken();
  5297. if (this.isVariableType(token)) {
  5298. if (!this.insideScope(IVProgParser.FUNCTION)) {
  5299. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].invalid_var_declaration(token.line);
  5300. }
  5301. this.pushScope(IVProgParser.BASE);
  5302. var varType = this.parseType();
  5303. this.popScope();
  5304. var cmd = this.parseDeclaration(varType);
  5305. this.checkEOS();
  5306. this.pos++;
  5307. return cmd;
  5308. } else if (token.type === this.lexerClass.ID) {
  5309. return this.parseIDCommand();
  5310. } else if (token.type === this.lexerClass.LIB_ID) {
  5311. return this.parseIDCommand();
  5312. } else if (token.type === this.lexerClass.RK_RETURN) {
  5313. return this.parseReturn();
  5314. } else if (token.type === this.lexerClass.RK_WHILE) {
  5315. return this.parseWhile();
  5316. } else if (token.type === this.lexerClass.RK_FOR) {
  5317. return this.parseFor();
  5318. } else if (token.type === this.lexerClass.RK_BREAK) {
  5319. if (!this.insideScope(IVProgParser.BREAKABLE)) {
  5320. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].invalid_break_command(this.lexer.literalNames[this.lexerClass.RK_BREAK], token);
  5321. }
  5322. return this.parseBreak();
  5323. } else if (token.type === this.lexerClass.RK_SWITCH) {
  5324. return this.parseSwitchCase();
  5325. } else if (token.type === this.lexerClass.RK_DO) {
  5326. return this.parseDoWhile();
  5327. } else if (token.type === this.lexerClass.RK_IF) {
  5328. return this.parseIfThenElse();
  5329. } else if (this.checkEOS(true)) {
  5330. this.pos++;
  5331. return -1;
  5332. } else {
  5333. return null;
  5334. }
  5335. }
  5336. }, {
  5337. key: "parseSwitchCase",
  5338. value: function parseSwitchCase() {
  5339. this.pushScope(IVProgParser.BREAKABLE);
  5340. this.pos++;
  5341. this.checkOpenParenthesis();
  5342. this.pos++;
  5343. this.consumeNewLines();
  5344. var exp = this.parseExpressionOR();
  5345. this.consumeNewLines();
  5346. this.checkCloseParenthesis();
  5347. this.pos++;
  5348. this.consumeNewLines();
  5349. this.checkOpenCurly();
  5350. this.pos++;
  5351. this.consumeNewLines();
  5352. var casesList = this.parseCases();
  5353. this.consumeNewLines();
  5354. this.checkCloseCurly();
  5355. this.pos++;
  5356. this.consumeNewLines();
  5357. this.popScope();
  5358. return new _commands___WEBPACK_IMPORTED_MODULE_2__["Switch"](exp, casesList);
  5359. }
  5360. }, {
  5361. key: "parseDoWhile",
  5362. value: function parseDoWhile() {
  5363. this.pos++;
  5364. this.consumeNewLines();
  5365. this.pushScope(IVProgParser.BREAKABLE);
  5366. var commandsBlock = this.parseCommandBlock();
  5367. this.consumeNewLines(); //Maybe not...
  5368. var whileToken = this.getToken();
  5369. if (whileToken.type !== this.lexerClass.RK_WHILE) {
  5370. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_one(this.lexer.literalNames[this.lexerClass.RK_WHILE], whileToken);
  5371. }
  5372. this.pos++;
  5373. this.checkOpenParenthesis();
  5374. this.pos++;
  5375. this.consumeNewLines();
  5376. var condition = this.parseExpressionOR();
  5377. this.consumeNewLines();
  5378. this.checkCloseParenthesis();
  5379. this.pos++;
  5380. this.checkEOS();
  5381. this.popScope();
  5382. return new _commands___WEBPACK_IMPORTED_MODULE_2__["DoWhile"](condition, commandsBlock);
  5383. }
  5384. }, {
  5385. key: "parseIfThenElse",
  5386. value: function parseIfThenElse() {
  5387. if (this.insideScope(IVProgParser.BREAKABLE)) {
  5388. this.pushScope(IVProgParser.BREAKABLE);
  5389. } else {
  5390. this.pushScope(IVProgParser.COMMAND);
  5391. }
  5392. var token = this.getToken();
  5393. this.pos++;
  5394. this.checkOpenParenthesis();
  5395. this.pos++;
  5396. this.consumeNewLines();
  5397. var logicalExpression = this.parseExpressionOR();
  5398. this.consumeNewLines();
  5399. this.checkCloseParenthesis();
  5400. this.pos++;
  5401. this.consumeNewLines();
  5402. var cmdBlocks = this.parseCommandBlock();
  5403. var maybeElse = this.getToken();
  5404. if (maybeElse.type === this.lexerClass.RK_ELSE) {
  5405. this.pos++;
  5406. this.consumeNewLines();
  5407. var maybeIf = this.getToken();
  5408. var elseBlock = null;
  5409. if (this.checkOpenCurly(true)) {
  5410. elseBlock = this.parseCommandBlock();
  5411. } else if (maybeIf.type === this.lexerClass.RK_IF) {
  5412. elseBlock = this.parseIfThenElse();
  5413. } else {
  5414. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_list([this.lexer.literalNames[this.lexerClass.RK_IF], '{'], maybeIf);
  5415. }
  5416. this.popScope();
  5417. var _cmd = new _commands___WEBPACK_IMPORTED_MODULE_2__["IfThenElse"](logicalExpression, cmdBlocks, elseBlock);
  5418. _cmd.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(token);
  5419. return _cmd;
  5420. }
  5421. this.popScope();
  5422. var cmd = new _commands___WEBPACK_IMPORTED_MODULE_2__["IfThenElse"](logicalExpression, cmdBlocks, null);
  5423. cmd.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(token);
  5424. return cmd;
  5425. }
  5426. }, {
  5427. key: "parseFor",
  5428. value: function parseFor() {
  5429. this.pushScope(IVProgParser.BREAKABLE);
  5430. this.pos++;
  5431. this.checkOpenParenthesis();
  5432. this.pos++;
  5433. this.consumeNewLines();
  5434. var attribution = this.parseForAssign();
  5435. this.consumeNewLines();
  5436. var condition = this.parseExpressionOR();
  5437. this.consumeForSemiColon();
  5438. var increment = this.parseForAssign(true);
  5439. this.checkCloseParenthesis();
  5440. this.pos++;
  5441. this.consumeNewLines();
  5442. var commandsBlock = this.parseCommandBlock();
  5443. this.popScope();
  5444. return new _commands___WEBPACK_IMPORTED_MODULE_2__["For"](attribution, condition, increment, commandsBlock);
  5445. }
  5446. }, {
  5447. key: "parseWhile",
  5448. value: function parseWhile() {
  5449. this.pushScope(IVProgParser.BREAKABLE);
  5450. var token = this.getToken();
  5451. this.pos++;
  5452. this.checkOpenParenthesis();
  5453. this.pos++;
  5454. this.consumeNewLines();
  5455. var logicalExpression = this.parseExpressionOR();
  5456. this.consumeNewLines();
  5457. this.checkCloseParenthesis();
  5458. this.pos++;
  5459. this.consumeNewLines();
  5460. var cmdBlocks = this.parseCommandBlock();
  5461. this.popScope();
  5462. var cmd = new _commands___WEBPACK_IMPORTED_MODULE_2__["While"](logicalExpression, cmdBlocks);
  5463. cmd.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(token);
  5464. return cmd;
  5465. }
  5466. }, {
  5467. key: "parseBreak",
  5468. value: function parseBreak() {
  5469. this.pos++;
  5470. this.checkEOS();
  5471. this.pos++;
  5472. return new _commands___WEBPACK_IMPORTED_MODULE_2__["Break"]();
  5473. }
  5474. }, {
  5475. key: "parseReturn",
  5476. value: function parseReturn() {
  5477. this.pos++;
  5478. var exp = null;
  5479. if (!this.checkEOS(true)) {
  5480. exp = this.parseExpressionOR();
  5481. this.checkEOS();
  5482. }
  5483. this.pos++;
  5484. return new _commands___WEBPACK_IMPORTED_MODULE_2__["Return"](exp);
  5485. }
  5486. }, {
  5487. key: "parseIDCommand",
  5488. value: function parseIDCommand() {
  5489. var refToken = this.getToken();
  5490. var isID = refToken.type === this.lexerClass.ID;
  5491. var id = this.parseMaybeLibID();
  5492. if (this.checkOpenBrace(true)) {
  5493. this.pos++;
  5494. var lineExpression = null;
  5495. var columnExpression = null;
  5496. this.consumeNewLines();
  5497. lineExpression = this.parseExpression();
  5498. this.consumeNewLines();
  5499. this.checkCloseBrace();
  5500. this.pos++;
  5501. if (this.checkOpenBrace(true)) {
  5502. this.pos++;
  5503. this.consumeNewLines();
  5504. columnExpression = this.parseExpression();
  5505. this.consumeNewLines();
  5506. this.checkCloseBrace();
  5507. this.pos++;
  5508. }
  5509. var equalToken = this.getToken();
  5510. if (equalToken.type !== this.lexerClass.EQUAL) {
  5511. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_one('=', equalToken);
  5512. }
  5513. this.pos++;
  5514. var exp = this.parseExpressionOR();
  5515. this.checkEOS();
  5516. this.pos++;
  5517. var cmd = new _commands___WEBPACK_IMPORTED_MODULE_2__["ArrayIndexAssign"](id, lineExpression, columnExpression, exp);
  5518. cmd.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(equalToken);
  5519. return cmd;
  5520. }
  5521. var equalOrParenthesis = this.getToken();
  5522. if (isID && equalOrParenthesis.type === this.lexerClass.EQUAL) {
  5523. this.pos++;
  5524. var _exp = this.parseExpressionOR();
  5525. this.checkEOS();
  5526. this.pos++;
  5527. var _cmd2 = new _commands___WEBPACK_IMPORTED_MODULE_2__["Assign"](id, _exp);
  5528. _cmd2.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(equalOrParenthesis);
  5529. return _cmd2;
  5530. } else if (equalOrParenthesis.type === this.lexerClass.OPEN_PARENTHESIS) {
  5531. var funcCall = this.parseFunctionCallCommand(id);
  5532. this.checkEOS();
  5533. this.pos++;
  5534. return funcCall;
  5535. } else if (isID) {
  5536. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_list(['=', '('], equalOrParenthesis);
  5537. } else {
  5538. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].invalid_id_format(refToken);
  5539. }
  5540. }
  5541. }, {
  5542. key: "parseForAssign",
  5543. value: function parseForAssign() {
  5544. var isLast = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  5545. if (!isLast) this.consumeNewLines();
  5546. if (this.checkEOS(true)) {
  5547. return null;
  5548. }
  5549. var id = this.parseID();
  5550. var equal = this.getToken();
  5551. if (equal.type !== this.lexerClass.EQUAL) {
  5552. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_one('=', equal);
  5553. }
  5554. this.pos++;
  5555. var exp = this.parseExpressionOR();
  5556. if (!isLast) {
  5557. this.consumeForSemiColon();
  5558. }
  5559. var sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(equal);
  5560. var cmd = new _commands___WEBPACK_IMPORTED_MODULE_2__["Assign"](id, exp);
  5561. cmd.sourceInfo = sourceInfo;
  5562. return cmd;
  5563. }
  5564. }, {
  5565. key: "parseCases",
  5566. value: function parseCases() {
  5567. var token = this.getToken();
  5568. if (token.type !== this.lexerClass.RK_CASE) {
  5569. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_one(this.lexer.literalNames[this.lexerClass.RK_CASE], token);
  5570. }
  5571. this.pos++;
  5572. var nextToken = this.getToken();
  5573. if (nextToken.type === this.lexerClass.RK_DEFAULT) {
  5574. this.pos++;
  5575. var colonToken = this.getToken();
  5576. if (colonToken.type !== this.lexerClass.COLON) {
  5577. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_one(':', colonToken);
  5578. }
  5579. this.pos++;
  5580. this.consumeNewLines();
  5581. var block = this.parseCommandBlock(true);
  5582. var defaultCase = new _commands___WEBPACK_IMPORTED_MODULE_2__["Case"](null);
  5583. defaultCase.setCommands(block.commands);
  5584. return [defaultCase];
  5585. } else {
  5586. var exp = this.parseExpressionOR();
  5587. var _colonToken = this.getToken();
  5588. if (_colonToken.type !== this.lexerClass.COLON) {
  5589. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_one(':', _colonToken);
  5590. }
  5591. this.pos++;
  5592. this.consumeNewLines();
  5593. var _block = this.parseCommandBlock(true);
  5594. var aCase = new _commands___WEBPACK_IMPORTED_MODULE_2__["Case"](exp);
  5595. aCase.setCommands(_block.commands);
  5596. var caseToken = this.getToken();
  5597. if (caseToken.type === this.lexerClass.RK_CASE) {
  5598. return [aCase].concat(this.parseCases());
  5599. } else {
  5600. return [aCase];
  5601. }
  5602. }
  5603. }
  5604. /*
  5605. * Parses an Expression following the structure:
  5606. *
  5607. * EOR => EAnd ( 'or' EOR)? #expression and
  5608. *
  5609. * EOR => ENot ('and' EOR)? #expression or
  5610. *
  5611. * ENot => 'not'? ER #expression not
  5612. *
  5613. * ER => E ((>=, <=, ==, >, <) E)? #expression relational
  5614. *
  5615. * E => factor ((+, -) E)? #expression
  5616. *
  5617. * factor=> term ((*, /, %) factor)?
  5618. *
  5619. * term => literal || arrayAccess || FuncCall || ID || '('EAnd')'
  5620. **/
  5621. }, {
  5622. key: "parseExpressionOR",
  5623. value: function parseExpressionOR() {
  5624. var exp1 = this.parseExpressionAND();
  5625. while (this.getToken().type === this.lexerClass.OR_OPERATOR) {
  5626. var opToken = this.getToken();
  5627. this.pos++;
  5628. var or = Object(_operators__WEBPACK_IMPORTED_MODULE_7__["convertFromString"])('or');
  5629. this.consumeNewLines();
  5630. var exp2 = this.parseExpressionAND();
  5631. var _finalExp = new _expressions___WEBPACK_IMPORTED_MODULE_1__["InfixApp"](or, exp1, exp2);
  5632. _finalExp.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(opToken);
  5633. exp1 = _finalExp;
  5634. }
  5635. return exp1;
  5636. }
  5637. }, {
  5638. key: "parseExpressionAND",
  5639. value: function parseExpressionAND() {
  5640. var exp1 = this.parseExpressionNot();
  5641. while (this.getToken().type === this.lexerClass.AND_OPERATOR) {
  5642. var opToken = this.getToken();
  5643. this.pos++;
  5644. var and = Object(_operators__WEBPACK_IMPORTED_MODULE_7__["convertFromString"])('and');
  5645. this.consumeNewLines();
  5646. var exp2 = this.parseExpressionNot();
  5647. var _finalExp2 = new _expressions___WEBPACK_IMPORTED_MODULE_1__["InfixApp"](and, exp1, exp2);
  5648. _finalExp2.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(opToken);
  5649. exp1 = _finalExp2;
  5650. }
  5651. return exp1;
  5652. }
  5653. }, {
  5654. key: "parseExpressionNot",
  5655. value: function parseExpressionNot() {
  5656. var maybeNotToken = this.getToken();
  5657. if (maybeNotToken.type === this.lexerClass.NOT_OPERATOR) {
  5658. var opToken = this.getToken();
  5659. this.pos++;
  5660. var not = Object(_operators__WEBPACK_IMPORTED_MODULE_7__["convertFromString"])('not');
  5661. var exp1 = this.parseExpressionRel();
  5662. finalExp = new _expressions___WEBPACK_IMPORTED_MODULE_1__["UnaryApp"](not, exp1);
  5663. finalExp.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(opToken);
  5664. return finalExp;
  5665. } else {
  5666. return this.parseExpressionRel();
  5667. }
  5668. }
  5669. }, {
  5670. key: "parseExpressionRel",
  5671. value: function parseExpressionRel() {
  5672. var exp1 = this.parseExpression();
  5673. while (this.getToken().type === this.lexerClass.RELATIONAL_OPERATOR) {
  5674. var relToken = this.getToken();
  5675. this.pos++;
  5676. var rel = Object(_operators__WEBPACK_IMPORTED_MODULE_7__["convertFromString"])(relToken.text);
  5677. var exp2 = this.parseExpression();
  5678. var _finalExp3 = new _expressions___WEBPACK_IMPORTED_MODULE_1__["InfixApp"](rel, exp1, exp2);
  5679. _finalExp3.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(relToken);
  5680. exp1 = _finalExp3;
  5681. }
  5682. return exp1;
  5683. }
  5684. }, {
  5685. key: "parseExpression",
  5686. value: function parseExpression() {
  5687. var factor = this.parseFactor();
  5688. while (this.getToken().type === this.lexerClass.SUM_OP) {
  5689. var sumOpToken = this.getToken();
  5690. this.pos++;
  5691. var op = Object(_operators__WEBPACK_IMPORTED_MODULE_7__["convertFromString"])(sumOpToken.text);
  5692. var factor2 = this.parseFactor();
  5693. var _finalExp4 = new _expressions___WEBPACK_IMPORTED_MODULE_1__["InfixApp"](op, factor, factor2);
  5694. _finalExp4.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(sumOpToken);
  5695. factor = _finalExp4;
  5696. }
  5697. return factor;
  5698. }
  5699. }, {
  5700. key: "parseFactor",
  5701. value: function parseFactor() {
  5702. var term = this.parseTerm();
  5703. while (this.getToken().type === this.lexerClass.MULTI_OP) {
  5704. var multOpToken = this.getToken();
  5705. this.pos++;
  5706. var op = Object(_operators__WEBPACK_IMPORTED_MODULE_7__["convertFromString"])(multOpToken.text);
  5707. var term2 = this.parseTerm();
  5708. var _finalExp5 = new _expressions___WEBPACK_IMPORTED_MODULE_1__["InfixApp"](op, term, term2);
  5709. _finalExp5.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(multOpToken);
  5710. term = _finalExp5;
  5711. }
  5712. return term;
  5713. }
  5714. }, {
  5715. key: "parseTerm",
  5716. value: function parseTerm() {
  5717. var token = this.getToken();
  5718. var sourceInfo = null;
  5719. switch (token.type) {
  5720. case this.lexerClass.SUM_OP:
  5721. this.pos++;
  5722. sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(token);
  5723. var exp = new _expressions___WEBPACK_IMPORTED_MODULE_1__["UnaryApp"](Object(_operators__WEBPACK_IMPORTED_MODULE_7__["convertFromString"])(token.text), this.parseTerm());
  5724. exp.sourceInfo = sourceInfo;
  5725. return exp;
  5726. case this.lexerClass.INTEGER:
  5727. this.pos++;
  5728. return this.getIntLiteral(token);
  5729. case this.lexerClass.REAL:
  5730. this.pos++;
  5731. return this.getRealLiteral(token);
  5732. case this.lexerClass.STRING:
  5733. this.pos++;
  5734. return this.getStringLiteral(token);
  5735. case this.lexerClass.RK_TRUE:
  5736. case this.lexerClass.RK_FALSE:
  5737. this.pos++;
  5738. return this.getBoolLiteral(token);
  5739. case this.lexerClass.OPEN_CURLY:
  5740. return this.parseArrayLiteral();
  5741. case this.lexerClass.ID:
  5742. case this.lexerClass.LIB_ID:
  5743. return this.parseIDTerm();
  5744. case this.lexerClass.OPEN_PARENTHESIS:
  5745. return this.parseParenthesisExp();
  5746. default:
  5747. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].invalid_terminal(token);
  5748. }
  5749. }
  5750. }, {
  5751. key: "parseIDTerm",
  5752. value: function parseIDTerm() {
  5753. var tokenA = this.getToken();
  5754. var id = this.parseMaybeLibID();
  5755. var isID = tokenA.type === this.lexerClass.ID;
  5756. if (isID && this.checkOpenBrace(true)) {
  5757. var tokenB = null;
  5758. this.pos++;
  5759. var firstIndex = this.parseExpression();
  5760. var secondIndex = null;
  5761. this.consumeNewLines();
  5762. this.checkCloseBrace();
  5763. tokenB = this.getToken();
  5764. this.pos++;
  5765. if (this.checkOpenBrace(true)) {
  5766. this.pos++;
  5767. secondIndex = this.parseExpression();
  5768. this.consumeNewLines();
  5769. this.checkCloseBrace();
  5770. tokenB = this.getToken();
  5771. this.pos++;
  5772. }
  5773. var sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfoFromList(tokenA, tokenB);
  5774. var exp = new _expressions___WEBPACK_IMPORTED_MODULE_1__["ArrayAccess"](id, firstIndex, secondIndex);
  5775. exp.sourceInfo = sourceInfo;
  5776. return exp;
  5777. } else if (this.checkOpenParenthesis(true)) {
  5778. return this.parseFunctionCallExpression(id);
  5779. } else if (isID) {
  5780. var _sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(tokenA);
  5781. var _exp2 = new _expressions___WEBPACK_IMPORTED_MODULE_1__["VariableLiteral"](id);
  5782. _exp2.sourceInfo = _sourceInfo;
  5783. return _exp2;
  5784. } else {
  5785. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].invalid_id_format(tokenA);
  5786. }
  5787. }
  5788. }, {
  5789. key: "getFunctionName",
  5790. value: function getFunctionName(id) {
  5791. var name = _processor_definedFunctions__WEBPACK_IMPORTED_MODULE_9__["LanguageDefinedFunction"].getInternalName(id);
  5792. if (name === null) {
  5793. if (id === _processor_definedFunctions__WEBPACK_IMPORTED_MODULE_9__["LanguageDefinedFunction"].getMainFunctionName()) {
  5794. return null;
  5795. }
  5796. return id;
  5797. } else {
  5798. return name;
  5799. }
  5800. }
  5801. }, {
  5802. key: "parseFunctionCallExpression",
  5803. value: function parseFunctionCallExpression(id) {
  5804. var tokenA = this.getToken(this.pos - 1);
  5805. var actualParameters = this.parseActualParameters();
  5806. var tokenB = this.getToken(this.pos - 1);
  5807. var funcName = this.getFunctionName(id);
  5808. var sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfoFromList(tokenA, tokenB);
  5809. var cmd = new _expressions___WEBPACK_IMPORTED_MODULE_1__["FunctionCall"](funcName, actualParameters);
  5810. cmd.sourceInfo = sourceInfo;
  5811. return cmd;
  5812. }
  5813. }, {
  5814. key: "parseFunctionCallCommand",
  5815. value: function parseFunctionCallCommand(id) {
  5816. return this.parseFunctionCallExpression(id);
  5817. }
  5818. }, {
  5819. key: "parseParenthesisExp",
  5820. value: function parseParenthesisExp() {
  5821. this.checkOpenParenthesis();
  5822. var tokenA = this.getToken();
  5823. this.pos++;
  5824. this.consumeNewLines();
  5825. var exp = this.parseExpressionOR();
  5826. this.consumeNewLines();
  5827. this.checkCloseParenthesis();
  5828. var tokenB = this.getToken();
  5829. var sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfoFromList(tokenA, tokenB);
  5830. this.pos++;
  5831. exp.sourceInfo = sourceInfo;
  5832. return exp;
  5833. }
  5834. }, {
  5835. key: "parseActualParameters",
  5836. value: function parseActualParameters() {
  5837. this.checkOpenParenthesis();
  5838. this.pos++;
  5839. if (this.checkCloseParenthesis(true)) {
  5840. this.pos++;
  5841. return [];
  5842. }
  5843. this.consumeNewLines();
  5844. var list = this.parseExpressionList();
  5845. this.consumeNewLines();
  5846. this.checkCloseParenthesis();
  5847. this.pos++;
  5848. return list;
  5849. }
  5850. }, {
  5851. key: "parseExpressionList",
  5852. value: function parseExpressionList() {
  5853. var list = [];
  5854. while (true) {
  5855. var exp = this.parseExpressionOR();
  5856. list.push(exp);
  5857. var maybeToken = this.getToken();
  5858. if (maybeToken.type !== this.lexerClass.COMMA) {
  5859. break;
  5860. } else {
  5861. this.pos++;
  5862. this.consumeNewLines();
  5863. }
  5864. }
  5865. return list;
  5866. }
  5867. }, {
  5868. key: "getTypeArray",
  5869. value: function getTypeArray() {
  5870. var _this = this;
  5871. var types = this.insideScope(IVProgParser.FUNCTION) ? this.functionTypes : this.variableTypes;
  5872. return types.map(function (x) {
  5873. return _this.lexer.literalNames[x];
  5874. });
  5875. }
  5876. }]);
  5877. return IVProgParser;
  5878. }();
  5879. /***/ }),
  5880. /***/ "./js/ast/operators.js":
  5881. /*!*****************************!*\
  5882. !*** ./js/ast/operators.js ***!
  5883. \*****************************/
  5884. /*! exports provided: Operators, convertFromString */
  5885. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  5886. "use strict";
  5887. __webpack_require__.r(__webpack_exports__);
  5888. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Operators", function() { return Operators; });
  5889. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "convertFromString", function() { return convertFromString; });
  5890. var Operators = Object.freeze({
  5891. ADD: {
  5892. ord: 0,
  5893. value: "+"
  5894. },
  5895. SUB: {
  5896. ord: 1,
  5897. value: "-"
  5898. },
  5899. MULT: {
  5900. ord: 2,
  5901. value: '*'
  5902. },
  5903. DIV: {
  5904. ord: 3,
  5905. value: '/'
  5906. },
  5907. MOD: {
  5908. ord: 4,
  5909. value: '%'
  5910. },
  5911. GT: {
  5912. ord: 5,
  5913. value: '>'
  5914. },
  5915. GE: {
  5916. ord: 6,
  5917. value: '>='
  5918. },
  5919. LT: {
  5920. ord: 7,
  5921. value: '<'
  5922. },
  5923. LE: {
  5924. ord: 8,
  5925. value: '<='
  5926. },
  5927. EQ: {
  5928. ord: 9,
  5929. value: '=='
  5930. },
  5931. NEQ: {
  5932. ord: 10,
  5933. value: '!='
  5934. },
  5935. AND: {
  5936. ord: 11,
  5937. value: 'and'
  5938. },
  5939. OR: {
  5940. ord: 12,
  5941. value: 'or'
  5942. },
  5943. NOT: {
  5944. ord: 13,
  5945. value: 'not'
  5946. }
  5947. });
  5948. function convertFromString(op) {
  5949. switch (op) {
  5950. case '+':
  5951. return Operators.ADD;
  5952. case '-':
  5953. return Operators.SUB;
  5954. case '*':
  5955. return Operators.MULT;
  5956. case '/':
  5957. return Operators.DIV;
  5958. case '%':
  5959. return Operators.MOD;
  5960. case '>':
  5961. return Operators.GT;
  5962. case '>=':
  5963. return Operators.GE;
  5964. case '<':
  5965. return Operators.LT;
  5966. case '<=':
  5967. return Operators.LE;
  5968. case '==':
  5969. return Operators.EQ;
  5970. case '!=':
  5971. return Operators.NEQ;
  5972. case 'and':
  5973. return Operators.AND;
  5974. case 'or':
  5975. return Operators.OR;
  5976. case 'not':
  5977. return Operators.NOT;
  5978. }
  5979. }
  5980. /***/ }),
  5981. /***/ "./js/ast/sourceInfo.js":
  5982. /*!******************************!*\
  5983. !*** ./js/ast/sourceInfo.js ***!
  5984. \******************************/
  5985. /*! exports provided: SourceInfo */
  5986. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  5987. "use strict";
  5988. __webpack_require__.r(__webpack_exports__);
  5989. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SourceInfo", function() { return SourceInfo; });
  5990. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5991. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  5992. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  5993. var SourceInfo =
  5994. /*#__PURE__*/
  5995. function () {
  5996. _createClass(SourceInfo, null, [{
  5997. key: "createSourceInfo",
  5998. value: function createSourceInfo(token) {
  5999. return new SourceInfo(token.line, token.column, token.text.length);
  6000. }
  6001. }, {
  6002. key: "createSourceInfoFromList",
  6003. value: function createSourceInfoFromList(tokenA, tokenB) {
  6004. var line = tokenA.line;
  6005. var column = tokenA.column; // copied from https://github.com/UNIVALI-LITE/Portugol-Studio/blob/master/core/src/main/java/br/univali/portugol/nucleo/analise/sintatica/Portugol.g
  6006. // No idea why...
  6007. var size = tokenB.tokenIndex + 1 - tokenA.tokenIndex;
  6008. return new SourceInfo(line, column, size);
  6009. }
  6010. }]);
  6011. function SourceInfo(line, column, size) {
  6012. _classCallCheck(this, SourceInfo);
  6013. this.line = line;
  6014. this.column = column;
  6015. this.size = size;
  6016. }
  6017. return SourceInfo;
  6018. }();
  6019. /***/ }),
  6020. /***/ "./js/io/domConsole.js":
  6021. /*!*****************************!*\
  6022. !*** ./js/io/domConsole.js ***!
  6023. \*****************************/
  6024. /*! exports provided: DOMConsole */
  6025. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  6026. "use strict";
  6027. __webpack_require__.r(__webpack_exports__);
  6028. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DOMConsole", function() { return DOMConsole; });
  6029. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  6030. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  6031. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6032. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  6033. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  6034. var DOMConsole =
  6035. /*#__PURE__*/
  6036. function () {
  6037. _createClass(DOMConsole, null, [{
  6038. key: "USER",
  6039. get: function get() {
  6040. return 0;
  6041. }
  6042. }, {
  6043. key: "INFO",
  6044. get: function get() {
  6045. return 1;
  6046. }
  6047. }, {
  6048. key: "ERR",
  6049. get: function get() {
  6050. return 2;
  6051. }
  6052. }]);
  6053. function DOMConsole(elementID) {
  6054. _classCallCheck(this, DOMConsole);
  6055. this.input = null;
  6056. this.needInput = false;
  6057. this.termDiv = null;
  6058. this.anyKey = false;
  6059. this.parent = jquery__WEBPACK_IMPORTED_MODULE_0___default()(elementID);
  6060. this.setup();
  6061. this.inputListeners = [];
  6062. }
  6063. _createClass(DOMConsole, [{
  6064. key: "setup",
  6065. value: function setup() {
  6066. this._setupDom();
  6067. this._setupEvents();
  6068. }
  6069. }, {
  6070. key: "_setupEvents",
  6071. value: function _setupEvents() {
  6072. var _this = this;
  6073. this.input.on("keydown", function (event) {
  6074. if (!_this.needInput) {
  6075. event.preventDefault();
  6076. return;
  6077. }
  6078. var keyCode = event.which;
  6079. if (keyCode === 13 || _this.anyKey) {
  6080. var text = _this.input.val();
  6081. text = text.replace('[\n\r]+', '');
  6082. _this.notifyListeners(text);
  6083. _this.write(text);
  6084. _this.input.val("");
  6085. }
  6086. });
  6087. }
  6088. }, {
  6089. key: "_setupDom",
  6090. value: function _setupDom() {
  6091. this.termDiv = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<div></div>");
  6092. this.termDiv.addClass("ivprog-term-div");
  6093. this.input = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<input text="type">');
  6094. this.input.addClass("ivprog-term-input");
  6095. this.termDiv.append(this.input);
  6096. this.parent.append(this.termDiv);
  6097. }
  6098. }, {
  6099. key: "notifyListeners",
  6100. value: function notifyListeners(text) {
  6101. this.inputListeners.forEach(function (resolve) {
  6102. return resolve(text);
  6103. });
  6104. this.inputListeners.splice(0, this.inputListeners.length);
  6105. this.hideInput();
  6106. this.anyKey = false;
  6107. }
  6108. }, {
  6109. key: "write",
  6110. value: function write(text) {
  6111. this._appendText(text, DOMConsole.USER);
  6112. }
  6113. }, {
  6114. key: "info",
  6115. value: function info(text) {
  6116. this._appendText(text, DOMConsole.INFO);
  6117. }
  6118. }, {
  6119. key: "err",
  6120. value: function err(text) {
  6121. this._appendText(text, DOMConsole.ERR);
  6122. }
  6123. }, {
  6124. key: "_appendText",
  6125. value: function _appendText(text, type) {
  6126. var divClass = this.getClassForType(type);
  6127. var textDiv = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<div></div>");
  6128. textDiv.addClass(divClass);
  6129. textDiv.append(text);
  6130. textDiv.insertBefore(this.input);
  6131. this.scrollTerm();
  6132. }
  6133. }, {
  6134. key: "scrollTerm",
  6135. value: function scrollTerm() {
  6136. this.termDiv.animate({
  6137. scrollTop: this.termDiv.prop('scrollHeight')
  6138. }, 0);
  6139. }
  6140. }, {
  6141. key: "getClassForType",
  6142. value: function getClassForType(type) {
  6143. switch (type) {
  6144. case DOMConsole.USER:
  6145. return "ivprog-term-userText";
  6146. case DOMConsole.INFO:
  6147. return "ivprog-term-info";
  6148. case DOMConsole.ERR:
  6149. return "ivprog-term-error";
  6150. }
  6151. }
  6152. }, {
  6153. key: "dispose",
  6154. value: function dispose() {
  6155. this.parent.off();
  6156. this.input.off();
  6157. this.input = null;
  6158. this.parent.empty();
  6159. }
  6160. }, {
  6161. key: "showInput",
  6162. value: function showInput() {
  6163. this.needInput = true;
  6164. this.input.show();
  6165. this.input.focus();
  6166. }
  6167. }, {
  6168. key: "hideInput",
  6169. value: function hideInput() {
  6170. this.needInput = false;
  6171. this.input.hide();
  6172. }
  6173. }, {
  6174. key: "requestInput",
  6175. value: function requestInput(callback) {
  6176. var anyKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  6177. this.inputListeners.push(callback);
  6178. this.anyKey = anyKey;
  6179. this.showInput();
  6180. }
  6181. }, {
  6182. key: "sendOutput",
  6183. value: function sendOutput(text) {
  6184. var _this2 = this;
  6185. var output = "" + text;
  6186. output.split("\n").forEach(function (t) {
  6187. t = t.replace(/\t/g, '&#9;');
  6188. _this2.write(t);
  6189. });
  6190. }
  6191. }, {
  6192. key: "clear",
  6193. value: function clear() {
  6194. this.input.parent().children().not(this.input).remove();
  6195. this.input.val("");
  6196. }
  6197. }]);
  6198. return DOMConsole;
  6199. }();
  6200. /***/ }),
  6201. /***/ "./js/io/input.js":
  6202. /*!************************!*\
  6203. !*** ./js/io/input.js ***!
  6204. \************************/
  6205. /*! exports provided: Input */
  6206. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  6207. "use strict";
  6208. __webpack_require__.r(__webpack_exports__);
  6209. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Input", function() { return Input; });
  6210. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6211. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  6212. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  6213. var Input =
  6214. /*#__PURE__*/
  6215. function () {
  6216. function Input() {
  6217. _classCallCheck(this, Input);
  6218. }
  6219. _createClass(Input, [{
  6220. key: "requestInput",
  6221. value: function requestInput(callback) {
  6222. throw new Error("Must be implemented");
  6223. }
  6224. }]);
  6225. return Input;
  6226. }();
  6227. /***/ }),
  6228. /***/ "./js/io/output.js":
  6229. /*!*************************!*\
  6230. !*** ./js/io/output.js ***!
  6231. \*************************/
  6232. /*! exports provided: Output */
  6233. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  6234. "use strict";
  6235. __webpack_require__.r(__webpack_exports__);
  6236. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Output", function() { return Output; });
  6237. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6238. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  6239. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  6240. var Output =
  6241. /*#__PURE__*/
  6242. function () {
  6243. function Output() {
  6244. _classCallCheck(this, Output);
  6245. }
  6246. _createClass(Output, [{
  6247. key: "sendOutput",
  6248. value: function sendOutput(text) {
  6249. throw new Error("Must be implemented");
  6250. }
  6251. }]);
  6252. return Output;
  6253. }();
  6254. /***/ }),
  6255. /***/ "./js/main.js":
  6256. /*!********************!*\
  6257. !*** ./js/main.js ***!
  6258. \********************/
  6259. /*! exports provided: runner, initVisualUI, addFunctionChangeListener, addGlobalChangeListener, removeFunctionListener, removeGlobalListener, LocalizedStrings, i18n */
  6260. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  6261. "use strict";
  6262. __webpack_require__.r(__webpack_exports__);
  6263. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LocalizedStrings", function() { return LocalizedStrings; });
  6264. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i18n", function() { return i18n; });
  6265. /* harmony import */ var _runner__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./runner */ "./js/runner.js");
  6266. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "runner", function() { return _runner__WEBPACK_IMPORTED_MODULE_0__["runner"]; });
  6267. /* harmony import */ var _visualUI_functions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./visualUI/functions */ "./js/visualUI/functions.js");
  6268. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "initVisualUI", function() { return _visualUI_functions__WEBPACK_IMPORTED_MODULE_1__["initVisualUI"]; });
  6269. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "addFunctionChangeListener", function() { return _visualUI_functions__WEBPACK_IMPORTED_MODULE_1__["addFunctionChangeListener"]; });
  6270. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "addGlobalChangeListener", function() { return _visualUI_functions__WEBPACK_IMPORTED_MODULE_1__["addGlobalChangeListener"]; });
  6271. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "removeFunctionListener", function() { return _visualUI_functions__WEBPACK_IMPORTED_MODULE_1__["removeFunctionListener"]; });
  6272. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "removeGlobalListener", function() { return _visualUI_functions__WEBPACK_IMPORTED_MODULE_1__["removeGlobalListener"]; });
  6273. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./services/localizedStringsService */ "./js/services/localizedStringsService.js");
  6274. /* harmony import */ var _services_i18nHelper__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./services/i18nHelper */ "./js/services/i18nHelper.js");
  6275. var i18n = _services_i18nHelper__WEBPACK_IMPORTED_MODULE_3__["i18nHelper"].i18n;
  6276. var LocalizedStrings = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__["getInstance"]();
  6277. /***/ }),
  6278. /***/ "./js/processor/compatibilityTable.js":
  6279. /*!********************************************!*\
  6280. !*** ./js/processor/compatibilityTable.js ***!
  6281. \********************************************/
  6282. /*! exports provided: resultTypeAfterInfixOp, resultTypeAfterUnaryOp */
  6283. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  6284. "use strict";
  6285. __webpack_require__.r(__webpack_exports__);
  6286. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "resultTypeAfterInfixOp", function() { return resultTypeAfterInfixOp; });
  6287. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "resultTypeAfterUnaryOp", function() { return resultTypeAfterUnaryOp; });
  6288. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./../typeSystem/types */ "./js/typeSystem/types.js");
  6289. /* harmony import */ var _ast_operators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../ast/operators */ "./js/ast/operators.js");
  6290. /* harmony import */ var _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../typeSystem/multiType */ "./js/typeSystem/multiType.js");
  6291. /* harmony import */ var _util_config__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../util/config */ "./js/util/config.js");
  6292. function buildInfixAddTable() {
  6293. var table = [[], [], [], []];
  6294. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER;
  6295. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL;
  6296. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING;
  6297. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL;
  6298. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL;
  6299. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING;
  6300. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING;
  6301. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING;
  6302. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING;
  6303. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING;
  6304. return table;
  6305. }
  6306. function buildInfixMultiDivSubTable() {
  6307. var table = [[], [], [], []];
  6308. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER;
  6309. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL;
  6310. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL;
  6311. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL;
  6312. return table;
  6313. }
  6314. function buildInfixEqualityInequalityTable() {
  6315. var table = [[], [], [], []];
  6316. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN;
  6317. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN;
  6318. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN;
  6319. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN;
  6320. return table;
  6321. }
  6322. function buildInfixRelationalTable() {
  6323. var table = [[], [], [], []];
  6324. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN;
  6325. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN;
  6326. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN;
  6327. return table;
  6328. }
  6329. function buildInfixAndOrTable() {
  6330. var table = [[], [], [], []];
  6331. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN;
  6332. return table;
  6333. }
  6334. function buildInfixModTable() {
  6335. var table = [[], [], [], []];
  6336. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER;
  6337. return table;
  6338. }
  6339. function buildUnarySumSubList() {
  6340. var list = [];
  6341. list[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER;
  6342. list[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL;
  6343. return list;
  6344. }
  6345. function buildUnaryNegList() {
  6346. var list = [];
  6347. list[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN;
  6348. return list;
  6349. }
  6350. function buildInfixCompatibilityTable() {
  6351. var compatibilityMap = new WeakMap();
  6352. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].ADD, buildInfixAddTable());
  6353. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].SUB, buildInfixMultiDivSubTable());
  6354. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].MULT, buildInfixMultiDivSubTable());
  6355. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].DIV, buildInfixMultiDivSubTable());
  6356. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].EQ, buildInfixEqualityInequalityTable());
  6357. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].NEQ, buildInfixEqualityInequalityTable());
  6358. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].GE, buildInfixRelationalTable());
  6359. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].GT, buildInfixRelationalTable());
  6360. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].LE, buildInfixRelationalTable());
  6361. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].LT, buildInfixRelationalTable());
  6362. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].OR, buildInfixAndOrTable());
  6363. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].AND, buildInfixAndOrTable());
  6364. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].MOD, buildInfixModTable());
  6365. return compatibilityMap;
  6366. }
  6367. function buildUnaryCompatibilityTable() {
  6368. var compatibilityMap = new WeakMap();
  6369. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].ADD, buildUnarySumSubList());
  6370. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].SUB, buildUnarySumSubList());
  6371. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].NOT, buildUnaryNegList());
  6372. return compatibilityMap;
  6373. }
  6374. var infixMap = buildInfixCompatibilityTable();
  6375. var unaryMap = buildUnaryCompatibilityTable();
  6376. function resultTypeAfterInfixOp(operator, leftExpressionType, rightExpressionType) {
  6377. try {
  6378. if (leftExpressionType instanceof _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_2__["MultiType"] && rightExpressionType instanceof _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_2__["MultiType"]) {
  6379. var newMulti = [];
  6380. for (var i = 0; i < leftExpressionType.types.length; ++i) {
  6381. var typeA = leftExpressionType.types[i];
  6382. for (var j = 0; j < rightExpressionType.types.length; ++i) {
  6383. var typeB = rightExpressionType.types[j];
  6384. newMulti.push(resultTypeAfterInfixOp(operator, typeA, typeB));
  6385. }
  6386. }
  6387. newMulti = newMulti.filter(function (x) {
  6388. return !x.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].UNDEFINED);
  6389. });
  6390. if (newMulti.length <= 0) {
  6391. if (_util_config__WEBPACK_IMPORTED_MODULE_3__["Config"].enable_type_casting) {
  6392. if (leftExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER) || leftExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL)) {
  6393. if (rightExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER) || rightExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL)) {
  6394. return new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_2__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL]);
  6395. }
  6396. }
  6397. }
  6398. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].UNDEFINED;
  6399. } else {
  6400. return new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_2__["MultiType"](newMulti);
  6401. }
  6402. } else if (leftExpressionType instanceof _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_2__["MultiType"]) {
  6403. if (leftExpressionType.isCompatible(rightExpressionType)) {
  6404. return resultTypeAfterInfixOp(operator, rightExpressionType, rightExpressionType);
  6405. } else {
  6406. if (_util_config__WEBPACK_IMPORTED_MODULE_3__["Config"].enable_type_casting) {
  6407. if (leftExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER) || leftExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL)) {
  6408. if (rightExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER) || rightExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL)) {
  6409. return rightExpressionType;
  6410. }
  6411. }
  6412. }
  6413. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].UNDEFINED;
  6414. }
  6415. } else if (rightExpressionType instanceof _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_2__["MultiType"]) {
  6416. if (rightExpressionType.isCompatible(leftExpressionType)) {
  6417. return resultTypeAfterInfixOp(operator, leftExpressionType, leftExpressionType);
  6418. } else {
  6419. if (_util_config__WEBPACK_IMPORTED_MODULE_3__["Config"].enable_type_casting) {
  6420. if (leftExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER) || leftExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL)) {
  6421. if (rightExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER) || rightExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL)) {
  6422. return leftExpressionType;
  6423. }
  6424. }
  6425. }
  6426. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].UNDEFINED;
  6427. }
  6428. }
  6429. var resultType = infixMap.get(operator)[leftExpressionType.ord][rightExpressionType.ord];
  6430. if (resultType === null || resultType === undefined) {
  6431. if (_util_config__WEBPACK_IMPORTED_MODULE_3__["Config"].enable_type_casting) {
  6432. if (leftExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER) || leftExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL)) {
  6433. if (rightExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER) || rightExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL)) {
  6434. if (operator === _ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].MOD) {
  6435. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER;
  6436. } else if (operator.ord >= 5 && operator.ord <= 10) {
  6437. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN;
  6438. }
  6439. }
  6440. }
  6441. }
  6442. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].UNDEFINED;
  6443. }
  6444. return resultType;
  6445. } catch (e) {
  6446. if (e instanceof TypeError) {
  6447. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].UNDEFINED;
  6448. } else {
  6449. throw e;
  6450. }
  6451. }
  6452. }
  6453. function resultTypeAfterUnaryOp(operator, leftExpressionType) {
  6454. try {
  6455. if (leftExpressionType instanceof _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_2__["MultiType"]) {
  6456. return leftExpressionType;
  6457. }
  6458. return unaryMap.get(operator)[leftExpressionType.ord];
  6459. } catch (e) {
  6460. if (e instanceof TypeError) {
  6461. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].UNDEFINED;
  6462. } else {
  6463. throw e;
  6464. }
  6465. }
  6466. }
  6467. /***/ }),
  6468. /***/ "./js/processor/context.js":
  6469. /*!*********************************!*\
  6470. !*** ./js/processor/context.js ***!
  6471. \*********************************/
  6472. /*! exports provided: Context */
  6473. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  6474. "use strict";
  6475. __webpack_require__.r(__webpack_exports__);
  6476. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Context", function() { return Context; });
  6477. var Context = Object.freeze({
  6478. BASE: Symbol('context:base'),
  6479. BREAKABLE: Symbol('context:breakable'),
  6480. FUNCTION: Symbol('context:function')
  6481. });
  6482. /***/ }),
  6483. /***/ "./js/processor/definedFunctions.js":
  6484. /*!******************************************!*\
  6485. !*** ./js/processor/definedFunctions.js ***!
  6486. \******************************************/
  6487. /*! exports provided: LanguageDefinedFunction */
  6488. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  6489. "use strict";
  6490. __webpack_require__.r(__webpack_exports__);
  6491. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LanguageDefinedFunction", function() { return LanguageDefinedFunction; });
  6492. /* harmony import */ var _services_languageService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js");
  6493. /* harmony import */ var _lib_io__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./lib/io */ "./js/processor/lib/io.js");
  6494. /* harmony import */ var _lib_strings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./lib/strings */ "./js/processor/lib/strings.js");
  6495. /* harmony import */ var _lib_arrays__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./lib/arrays */ "./js/processor/lib/arrays.js");
  6496. /* harmony import */ var _lib_lang__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./lib/lang */ "./js/processor/lib/lang.js");
  6497. /* harmony import */ var _lib_math__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./lib/math */ "./js/processor/lib/math.js");
  6498. function valueToKey(value, object) {
  6499. for (var key in object) {
  6500. if (object.hasOwnProperty(key)) {
  6501. if (object[key] === value) {
  6502. return key;
  6503. }
  6504. }
  6505. }
  6506. return null;
  6507. }
  6508. function concatObjects() {
  6509. var result = {};
  6510. for (var i = 0; i < arguments.length; i++) {
  6511. var obj = i < 0 || arguments.length <= i ? undefined : arguments[i];
  6512. for (var key in obj) {
  6513. if (obj.hasOwnProperty(key)) {
  6514. result[key] = obj[key];
  6515. }
  6516. }
  6517. }
  6518. return result;
  6519. }
  6520. var libsObject = {
  6521. $mathLib: {
  6522. $sin: Object(_lib_math__WEBPACK_IMPORTED_MODULE_5__["createSinFun"])(),
  6523. $cos: Object(_lib_math__WEBPACK_IMPORTED_MODULE_5__["createCosFun"])(),
  6524. $tan: Object(_lib_math__WEBPACK_IMPORTED_MODULE_5__["createTanFun"])(),
  6525. $sqrt: Object(_lib_math__WEBPACK_IMPORTED_MODULE_5__["createSqrtFun"])(),
  6526. $pow: Object(_lib_math__WEBPACK_IMPORTED_MODULE_5__["createPowFun"])(),
  6527. $log: Object(_lib_math__WEBPACK_IMPORTED_MODULE_5__["createLogFun"])(),
  6528. $abs: Object(_lib_math__WEBPACK_IMPORTED_MODULE_5__["createAbsFun"])(),
  6529. $negate: Object(_lib_math__WEBPACK_IMPORTED_MODULE_5__["createNegateFun"])(),
  6530. $invert: Object(_lib_math__WEBPACK_IMPORTED_MODULE_5__["createInvertFun"])(),
  6531. $max: Object(_lib_math__WEBPACK_IMPORTED_MODULE_5__["createMaxFun"])(),
  6532. $min: Object(_lib_math__WEBPACK_IMPORTED_MODULE_5__["createMinFun"])()
  6533. },
  6534. $ioLib: {
  6535. $read: Object(_lib_io__WEBPACK_IMPORTED_MODULE_1__["createInputFun"])(),
  6536. $write: Object(_lib_io__WEBPACK_IMPORTED_MODULE_1__["createOutputFun"])()
  6537. },
  6538. $strLib: {
  6539. $substring: Object(_lib_strings__WEBPACK_IMPORTED_MODULE_2__["createSubstringFun"])(),
  6540. $length: Object(_lib_strings__WEBPACK_IMPORTED_MODULE_2__["createLengthFun"])(),
  6541. $uppercase: Object(_lib_strings__WEBPACK_IMPORTED_MODULE_2__["createUppercaseFun"])(),
  6542. $lowercase: Object(_lib_strings__WEBPACK_IMPORTED_MODULE_2__["createLowercaseFun"])(),
  6543. $charAt: Object(_lib_strings__WEBPACK_IMPORTED_MODULE_2__["createrCharAtFun"])()
  6544. },
  6545. $arrayLib: {
  6546. $numElements: Object(_lib_arrays__WEBPACK_IMPORTED_MODULE_3__["createNumElementsFun"])(),
  6547. $matrixLines: Object(_lib_arrays__WEBPACK_IMPORTED_MODULE_3__["createMatrixLinesFun"])(),
  6548. $matrixColumns: Object(_lib_arrays__WEBPACK_IMPORTED_MODULE_3__["createMatrixColumnsFun"])()
  6549. },
  6550. $langLib: {
  6551. $isReal: Object(_lib_lang__WEBPACK_IMPORTED_MODULE_4__["createIsRealFun"])(),
  6552. $isInt: Object(_lib_lang__WEBPACK_IMPORTED_MODULE_4__["createIsIntFun"])(),
  6553. $isBool: Object(_lib_lang__WEBPACK_IMPORTED_MODULE_4__["createIsBoolFun"])(),
  6554. $castReal: Object(_lib_lang__WEBPACK_IMPORTED_MODULE_4__["createCastRealFun"])(),
  6555. $castInt: Object(_lib_lang__WEBPACK_IMPORTED_MODULE_4__["createCastIntFun"])(),
  6556. $castBool: Object(_lib_lang__WEBPACK_IMPORTED_MODULE_4__["createCastBoolFun"])(),
  6557. $castString: Object(_lib_lang__WEBPACK_IMPORTED_MODULE_4__["createCastStringFun"])()
  6558. }
  6559. };
  6560. var funcsObject = concatObjects(libsObject.$ioLib, libsObject.$langLib, libsObject.$strLib, libsObject.$arrayLib);
  6561. var LanguageDefinedFunction = Object.freeze({
  6562. getMainFunctionName: function getMainFunctionName() {
  6563. return _services_languageService__WEBPACK_IMPORTED_MODULE_0__["LanguageService"].getCurrentLangFuncs().main_function;
  6564. },
  6565. getInternalName: function getInternalName(localName) {
  6566. if (localName.indexOf(".") !== -1) {
  6567. var names = localName.split(".");
  6568. var lib = valueToKey(names[0], _services_languageService__WEBPACK_IMPORTED_MODULE_0__["LanguageService"].getCurrentLangLibs());
  6569. var internalName = valueToKey(names[1], _services_languageService__WEBPACK_IMPORTED_MODULE_0__["LanguageService"].getCurrentLangFuncs());
  6570. if (lib === null || internalName === null) {
  6571. return null;
  6572. }
  6573. return lib + "." + internalName;
  6574. }
  6575. var funcName = valueToKey(localName, _services_languageService__WEBPACK_IMPORTED_MODULE_0__["LanguageService"].getCurrentLangFuncs());
  6576. if (funcName !== null) {
  6577. if (funcsObject[funcName]) {
  6578. return funcName;
  6579. }
  6580. }
  6581. return null;
  6582. },
  6583. getFunction: function getFunction(internalName) {
  6584. if (internalName.indexOf(".") !== -1) {
  6585. var names = internalName.split(".");
  6586. var libName = names[0];
  6587. var funName = names[1];
  6588. return libsObject[libName][funName];
  6589. }
  6590. return funcsObject[internalName];
  6591. },
  6592. getLocalName: function getLocalName(internalName) {
  6593. if (internalName.indexOf(".") !== -1) {
  6594. var names = internalName.split(".");
  6595. var libName = _services_languageService__WEBPACK_IMPORTED_MODULE_0__["LanguageService"].getCurrentLangLibs()[names[0]];
  6596. var funName = _services_languageService__WEBPACK_IMPORTED_MODULE_0__["LanguageService"].getCurrentLangFuncs()[names[1]];
  6597. return "".concat(libName, ".").concat(funName);
  6598. } else if (_services_languageService__WEBPACK_IMPORTED_MODULE_0__["LanguageService"].getCurrentLangFuncs()[internalName]) {
  6599. return _services_languageService__WEBPACK_IMPORTED_MODULE_0__["LanguageService"].getCurrentLangFuncs()[internalName];
  6600. } else {
  6601. return internalName;
  6602. }
  6603. }
  6604. });
  6605. /***/ }),
  6606. /***/ "./js/processor/error/processorErrorFactory.js":
  6607. /*!*****************************************************!*\
  6608. !*** ./js/processor/error/processorErrorFactory.js ***!
  6609. \*****************************************************/
  6610. /*! exports provided: ProcessorErrorFactory */
  6611. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  6612. "use strict";
  6613. __webpack_require__.r(__webpack_exports__);
  6614. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ProcessorErrorFactory", function() { return ProcessorErrorFactory; });
  6615. /* harmony import */ var _runtimeError__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./runtimeError */ "./js/processor/error/runtimeError.js");
  6616. /* harmony import */ var _semanticError__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./semanticError */ "./js/processor/error/semanticError.js");
  6617. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  6618. var LocalizedStrings = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__["getInstance"]();
  6619. var ProcessorErrorFactory = Object.freeze({
  6620. symbol_not_found_full: function symbol_not_found_full(id, sourceInfo) {
  6621. if (sourceInfo) {
  6622. var context = [id, sourceInfo.line, sourceInfo.column];
  6623. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("symbol_not_found_full", context));
  6624. } else {
  6625. return ProcessorErrorFactory.symbol_not_found(id);
  6626. }
  6627. },
  6628. symbol_not_found: function symbol_not_found(id) {
  6629. var context = [id];
  6630. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("symbol_not_found", context));
  6631. },
  6632. function_missing_full: function function_missing_full(id, sourceInfo) {
  6633. if (sourceInfo) {
  6634. var context = [id, sourceInfo.line, sourceInfo.column];
  6635. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("function_missing_full", context));
  6636. } else {
  6637. return ProcessorErrorFactory.function_missing(id);
  6638. }
  6639. },
  6640. function_missing: function function_missing(id) {
  6641. var context = [id];
  6642. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("function_missing", context));
  6643. },
  6644. main_missing: function main_missing() {
  6645. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("main_missing"));
  6646. },
  6647. // TODO: better urgent error message
  6648. array_dimension_not_int_full: function array_dimension_not_int_full(sourceInfo) {
  6649. if (sourceInfo) {
  6650. var context = [sourceInfo.line];
  6651. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("array_dimension_not_int_full", context));
  6652. } else {
  6653. return ProcessorErrorFactory.array_dimension_not_int();
  6654. }
  6655. },
  6656. array_dimension_not_int: function array_dimension_not_int() {
  6657. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("array_dimension_not_int"));
  6658. },
  6659. unknown_command_full: function unknown_command_full(sourceInfo) {
  6660. if (sourceInfo) {
  6661. var context = [sourceInfo.line];
  6662. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("unknown_command_full", context));
  6663. } else {
  6664. return ProcessorErrorFactory.unknown_command();
  6665. }
  6666. },
  6667. unknown_command: function unknown_command() {
  6668. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("unknown_command"));
  6669. },
  6670. incompatible_types_full: function incompatible_types_full(type, dim, sourceInfo) {
  6671. if (sourceInfo) {
  6672. var context = [LocalizedStrings.translateType(type, dim), sourceInfo.line, sourceInfo.column];
  6673. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("incompatible_types_full", context));
  6674. } else {
  6675. return ProcessorErrorFactory.incompatible_types(type, dim);
  6676. }
  6677. },
  6678. incompatible_types: function incompatible_types(type, dim) {
  6679. var context = [LocalizedStrings.translateType(type, dim)];
  6680. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("incompatible_types", context));
  6681. },
  6682. incompatible_types_array_full: function incompatible_types_array_full(exp, type, dim, sourceInfo) {
  6683. if (sourceInfo) {
  6684. var context = [exp, LocalizedStrings.translateType(type, dim), sourceInfo.line, sourceInfo.column];
  6685. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("incompatible_types_array_full", context));
  6686. } else {
  6687. return ProcessorErrorFactory.incompatible_types_array(exp, type, dim);
  6688. }
  6689. },
  6690. incompatible_types_array: function incompatible_types_array(exp, type, dim) {
  6691. var context = [exp, LocalizedStrings.translateType(type, dim)];
  6692. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("incompatible_types_array", context));
  6693. },
  6694. loop_condition_type_full: function loop_condition_type_full(exp, sourceInfo) {
  6695. if (sourceInfo) {
  6696. var context = [sourceInfo.line, sourceInfo.column, exp];
  6697. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("loop_condition_type_full", context));
  6698. } else {
  6699. return ProcessorErrorFactory.loop_condition_type(exp);
  6700. }
  6701. },
  6702. loop_condition_type: function loop_condition_type(exp) {
  6703. var context = [exp];
  6704. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("loop_condition_type", context));
  6705. },
  6706. endless_loop_full: function endless_loop_full(sourceInfo) {
  6707. if (sourceInfo) {
  6708. var context = [sourceInfo.line];
  6709. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("endless_loop_full", context));
  6710. } else {
  6711. return ProcessorErrorFactory.endless_loop();
  6712. }
  6713. },
  6714. endless_loop: function endless_loop() {
  6715. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("endless_loop"));
  6716. },
  6717. for_condition_type_full: function for_condition_type_full(exp, sourceInfo) {
  6718. if (sourceInfo) {
  6719. var context = [sourceInfo.line, sourceInfo.column, exp];
  6720. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("for_condition_type_full", context));
  6721. } else {
  6722. return ProcessorErrorFactory.for_condition_type(exp);
  6723. }
  6724. },
  6725. for_condition_type: function for_condition_type(exp) {
  6726. var context = [exp];
  6727. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("for_condition_type", context));
  6728. },
  6729. if_condition_type_full: function if_condition_type_full(exp, sourceInfo) {
  6730. if (sourceInfo) {
  6731. var context = [sourceInfo.line, sourceInfo.column, exp];
  6732. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("if_condition_type_full", context));
  6733. } else {
  6734. return ProcessorErrorFactory.if_condition_type(exp);
  6735. }
  6736. },
  6737. if_condition_type: function if_condition_type(exp) {
  6738. var context = [exp];
  6739. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("if_condition_type", context));
  6740. },
  6741. invalid_global_var: function invalid_global_var() {
  6742. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("invalid_global_var"));
  6743. },
  6744. not_implemented: function not_implemented(id) {
  6745. var context = [id];
  6746. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("not_implemented", context));
  6747. },
  6748. invalid_case_type_full: function invalid_case_type_full(exp, type, dim, sourceInfo) {
  6749. if (sourceInfo) {
  6750. var context = [exp, LocalizedStrings.translateType(type, dim), sourceInfo.line, sourceInfo.column];
  6751. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_case_type_full", context));
  6752. } else {
  6753. return ProcessorErrorFactory.invalid_case_type(exp, type, dim);
  6754. }
  6755. },
  6756. invalid_case_type: function invalid_case_type(exp, type, dim) {
  6757. var context = [exp, LocalizedStrings.translateType(type, dim)];
  6758. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_case_type", context));
  6759. },
  6760. void_in_expression_full: function void_in_expression_full(id, sourceInfo) {
  6761. if (sourceInfo) {
  6762. var context = [sourceInfo.line, sourceInfo.column, id];
  6763. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("void_in_expression_full", context));
  6764. } else {
  6765. return ProcessorErrorFactory.void_in_expression(id);
  6766. }
  6767. },
  6768. void_in_expression: function void_in_expression(id) {
  6769. var context = [id];
  6770. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("void_in_expression", context));
  6771. },
  6772. invalid_array_access_full: function invalid_array_access_full(id, sourceInfo) {
  6773. if (sourceInfo) {
  6774. var context = [id, sourceInfo.line, sourceInfo.column];
  6775. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_array_access_full", context));
  6776. } else {
  6777. return ProcessorErrorFactory.invalid_array_access(id);
  6778. }
  6779. },
  6780. invalid_array_access: function invalid_array_access(id) {
  6781. var context = [id];
  6782. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_array_access", context));
  6783. },
  6784. invalid_matrix_access_full: function invalid_matrix_access_full(id, sourceInfo) {
  6785. if (sourceInfo) {
  6786. var context = [id, sourceInfo.line, sourceInfo.column];
  6787. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_matrix_access_full", context));
  6788. } else {
  6789. return ProcessorErrorFactory.invalid_matrix_access(id);
  6790. }
  6791. },
  6792. invalid_matrix_access: function invalid_matrix_access(id) {
  6793. var context = [id];
  6794. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_matrix_access", context));
  6795. },
  6796. matrix_column_outbounds_full: function matrix_column_outbounds_full(id, value, columns, sourceInfo) {
  6797. if (sourceInfo) {
  6798. var context = [sourceInfo.line, value, id, columns];
  6799. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("matrix_column_outbounds_full", context));
  6800. } else {
  6801. return ProcessorErrorFactory.matrix_column_outbounds(id, value, columns);
  6802. }
  6803. },
  6804. matrix_column_outbounds: function matrix_column_outbounds(id, value, columns) {
  6805. var context = [value, id, columns];
  6806. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("matrix_column_outbounds", context));
  6807. },
  6808. matrix_line_outbounds_full: function matrix_line_outbounds_full(id, value, lines, sourceInfo) {
  6809. if (sourceInfo) {
  6810. var context = [sourceInfo.line, value, id, lines];
  6811. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("matrix_line_outbounds_full", context));
  6812. } else {
  6813. return ProcessorErrorFactory.matrix_line_outbounds(id, value, lines);
  6814. }
  6815. },
  6816. matrix_line_outbounds: function matrix_line_outbounds(id, value, lines) {
  6817. var context = [value, id, lines];
  6818. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("matrix_line_outbounds", context));
  6819. },
  6820. vector_line_outbounds_full: function vector_line_outbounds_full(id, value, lines, sourceInfo) {
  6821. if (sourceInfo) {
  6822. var context = [sourceInfo.line, value, id, lines];
  6823. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("vector_line_outbounds_full", context));
  6824. } else {
  6825. return ProcessorErrorFactory.vector_line_outbounds(id, value, lines);
  6826. }
  6827. },
  6828. vector_line_outbounds: function vector_line_outbounds(id, value, lines) {
  6829. var context = [value, id, lines];
  6830. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("vector_line_outbounds", context));
  6831. },
  6832. vector_not_matrix_full: function vector_not_matrix_full(id, sourceInfo) {
  6833. if (sourceInfo) {
  6834. var context = [sourceInfo.line, id];
  6835. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("vector_not_matrix_full", context));
  6836. } else {
  6837. return ProcessorErrorFactory.vector_not_matrix(id);
  6838. }
  6839. },
  6840. vector_not_matrix: function vector_not_matrix(id) {
  6841. var context = [id];
  6842. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("vector_not_matrix", context));
  6843. },
  6844. function_no_return: function function_no_return(id) {
  6845. var context = [id];
  6846. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("function_no_return", context));
  6847. },
  6848. invalid_void_return_full: function invalid_void_return_full(id, type, dim, sourceInfo) {
  6849. if (sourceInfo) {
  6850. var context = [sourceInfo.line, id, LocalizedStrings.translateType(type, dim)];
  6851. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_void_return_full", context));
  6852. } else {
  6853. return ProcessorErrorFactory.invalid_void_return(id, type, dim);
  6854. }
  6855. },
  6856. invalid_void_return: function invalid_void_return(id, type, dim) {
  6857. var context = [id, LocalizedStrings.translateType(type, dim)];
  6858. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_void_return_full", context));
  6859. },
  6860. invalid_return_type_full: function invalid_return_type_full(id, type, dim, sourceInfo) {
  6861. if (sourceInfo) {
  6862. var context = [sourceInfo.line, id, LocalizedStrings.translateType(type, dim)];
  6863. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_return_type_full", context));
  6864. } else {
  6865. return ProcessorErrorFactory.invalid_return_type(id, type, dim);
  6866. }
  6867. },
  6868. invalid_return_type: function invalid_return_type(id, type, dim) {
  6869. var context = [id, LocalizedStrings.translateType(type, dim)];
  6870. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_return_type", context));
  6871. },
  6872. invalid_parameters_size_full: function invalid_parameters_size_full(id, expected, actual, sourceInfo) {
  6873. if (sourceInfo) {
  6874. var context = [sourceInfo.line, id, expected, actual];
  6875. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_parameters_size_full", context));
  6876. } else {
  6877. return ProcessorErrorFactory.invalid_parameters_size(id, expected, actual);
  6878. }
  6879. },
  6880. invalid_parameters_size: function invalid_parameters_size(id, expected, actual) {
  6881. var context = [id, expected, actual];
  6882. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_parameters_size", context));
  6883. },
  6884. invalid_parameter_type_full: function invalid_parameter_type_full(id, exp, sourceInfo) {
  6885. if (sourceInfo) {
  6886. var context = [exp, id, sourceInfo.line];
  6887. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_parameter_type_full", context));
  6888. } else {
  6889. return ProcessorErrorFactory.invalid_parameter_type(id, exp);
  6890. }
  6891. },
  6892. invalid_parameter_type: function invalid_parameter_type(id, exp) {
  6893. var context = [exp, id];
  6894. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_parameter_type_full", context));
  6895. },
  6896. invalid_ref_full: function invalid_ref_full(id, exp, sourceInfo) {
  6897. if (sourceInfo) {
  6898. var context = [exp, id, sourceInfo.line];
  6899. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_ref_full", context));
  6900. } else {
  6901. return ProcessorErrorFactory.invalid_ref(id, exp);
  6902. }
  6903. },
  6904. invalid_ref: function invalid_ref(id, exp) {
  6905. var context = [exp, id];
  6906. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_ref", context));
  6907. },
  6908. unexpected_break_command_full: function unexpected_break_command_full(sourceInfo) {
  6909. if (sourceInfo) {
  6910. var context = [sourceInfo.line];
  6911. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("unexpected_break_command_full", context));
  6912. } else {
  6913. return ProcessorErrorFactory.unexpected_break_command();
  6914. }
  6915. },
  6916. unexpected_break_command: function unexpected_break_command() {
  6917. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("unexpected_break_command"));
  6918. },
  6919. invalid_array_literal_type_full: function invalid_array_literal_type_full(exp, sourceInfo) {
  6920. if (sourceInfo) {
  6921. var context = [sourceInfo.line, exp];
  6922. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("invalid_array_literal_type_full", context));
  6923. } else {
  6924. return ProcessorErrorFactory.invalid_array_literal_type(exp);
  6925. }
  6926. },
  6927. invalid_array_literal_type: function invalid_array_literal_type(exp) {
  6928. var context = [exp];
  6929. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("invalid_array_literal_type", context));
  6930. },
  6931. invalid_array_literal_line_full: function invalid_array_literal_line_full(expected, actual, sourceInfo) {
  6932. if (sourceInfo) {
  6933. var context = [sourceInfo.line, expected, actual];
  6934. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("invalid_array_literal_line_full", context));
  6935. } else {
  6936. return ProcessorErrorFactory.invalid_array_literal_type(expected, actual);
  6937. }
  6938. },
  6939. invalid_array_literal_line: function invalid_array_literal_line(expected, actual) {
  6940. var context = [expected, actual];
  6941. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("invalid_array_literal_line", context));
  6942. },
  6943. invalid_array_literal_column_full: function invalid_array_literal_column_full(expected, actual, sourceInfo) {
  6944. if (sourceInfo) {
  6945. var context = [sourceInfo.line, expected, actual];
  6946. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("invalid_array_literal_column_full", context));
  6947. } else {
  6948. return ProcessorErrorFactory.invalid_array_literal_column(expected, actual);
  6949. }
  6950. },
  6951. invalid_array_literal_column: function invalid_array_literal_column(expected, actual) {
  6952. var context = [expected, actual];
  6953. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("invalid_array_literal_column", context));
  6954. },
  6955. invalid_unary_op_full: function invalid_unary_op_full(opName, type, dim, sourceInfo) {
  6956. if (sourceInfo) {
  6957. var context = [sourceInfo.line, LocalizedStrings.translateOp(opName), LocalizedStrings.translateType(type, dim)];
  6958. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("invalid_unary_op_full", context));
  6959. } else {
  6960. return ProcessorErrorFactory.invalid_unary_op(opName, type, dim);
  6961. }
  6962. },
  6963. invalid_unary_op: function invalid_unary_op(opName, type, dim) {
  6964. var context = [LocalizedStrings.translateOp(opName), LocalizedStrings.translateType(type, dim)];
  6965. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("invalid_unary_op", context));
  6966. },
  6967. invalid_infix_op_full: function invalid_infix_op_full(opName, typeLeft, dimLeft, typeRight, dimRight, sourceInfo) {
  6968. if (sourceInfo) {
  6969. var context = [sourceInfo.line, LocalizedStrings.translateOp(opName), LocalizedStrings.translateType(typeLeft, dimLeft), LocalizedStrings.translateType(typeRight, dimRight)];
  6970. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("invalid_infix_op_full", context));
  6971. } else {
  6972. return ProcessorErrorFactory.invalid_infix_op(opName, typeLeft, dimLeft, typeRight, dimRight);
  6973. }
  6974. },
  6975. invalid_infix_op: function invalid_infix_op(opName, typeLeft, dimLeft, typeRight, dimRight) {
  6976. var context = [LocalizedStrings.translateOp(opName), LocalizedStrings.translateType(typeLeft, dimLeft), LocalizedStrings.translateType(typeRight, dimRight)];
  6977. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("invalid_infix_op", context));
  6978. },
  6979. array_dimension_not_positive_full: function array_dimension_not_positive_full(sourceInfo) {
  6980. if (sourceInfo) {
  6981. var context = [sourceInfo.line];
  6982. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("array_dimension_not_positive_full", context));
  6983. } else {
  6984. return ProcessorErrorFactory.array_dimension_not_positive();
  6985. }
  6986. },
  6987. array_dimension_not_positive: function array_dimension_not_positive() {
  6988. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("array_dimension_not_positive"));
  6989. },
  6990. invalid_type_conversion: function invalid_type_conversion(value, type, dim) {
  6991. var context = [value, LocalizedStrings.translateType(type, dim)];
  6992. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("invalid_type_conversion", context));
  6993. }
  6994. });
  6995. /***/ }),
  6996. /***/ "./js/processor/error/runtimeError.js":
  6997. /*!********************************************!*\
  6998. !*** ./js/processor/error/runtimeError.js ***!
  6999. \********************************************/
  7000. /*! exports provided: RuntimeError */
  7001. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  7002. "use strict";
  7003. __webpack_require__.r(__webpack_exports__);
  7004. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RuntimeError", function() { return RuntimeError; });
  7005. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  7006. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7007. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  7008. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  7009. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  7010. function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
  7011. function isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
  7012. function _construct(Parent, args, Class) { if (isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
  7013. function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
  7014. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  7015. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  7016. var RuntimeError =
  7017. /*#__PURE__*/
  7018. function (_Error) {
  7019. _inherits(RuntimeError, _Error);
  7020. function RuntimeError() {
  7021. var _getPrototypeOf2;
  7022. var _this;
  7023. _classCallCheck(this, RuntimeError);
  7024. for (var _len = arguments.length, msg = new Array(_len), _key = 0; _key < _len; _key++) {
  7025. msg[_key] = arguments[_key];
  7026. }
  7027. _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(RuntimeError)).call.apply(_getPrototypeOf2, [this].concat(msg)));
  7028. if (Error.captureStackTrace) Error.captureStackTrace(_assertThisInitialized(_this), RuntimeError);
  7029. return _this;
  7030. }
  7031. return RuntimeError;
  7032. }(_wrapNativeSuper(Error));
  7033. /***/ }),
  7034. /***/ "./js/processor/error/semanticError.js":
  7035. /*!*********************************************!*\
  7036. !*** ./js/processor/error/semanticError.js ***!
  7037. \*********************************************/
  7038. /*! exports provided: SemanticError */
  7039. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  7040. "use strict";
  7041. __webpack_require__.r(__webpack_exports__);
  7042. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SemanticError", function() { return SemanticError; });
  7043. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  7044. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7045. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  7046. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  7047. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  7048. function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
  7049. function isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
  7050. function _construct(Parent, args, Class) { if (isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
  7051. function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
  7052. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  7053. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  7054. var SemanticError =
  7055. /*#__PURE__*/
  7056. function (_Error) {
  7057. _inherits(SemanticError, _Error);
  7058. function SemanticError() {
  7059. var _getPrototypeOf2;
  7060. var _this;
  7061. _classCallCheck(this, SemanticError);
  7062. for (var _len = arguments.length, msg = new Array(_len), _key = 0; _key < _len; _key++) {
  7063. msg[_key] = arguments[_key];
  7064. }
  7065. _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(SemanticError)).call.apply(_getPrototypeOf2, [this].concat(msg)));
  7066. if (Error.captureStackTrace) Error.captureStackTrace(_assertThisInitialized(_this), SemanticError);
  7067. return _this;
  7068. }
  7069. return SemanticError;
  7070. }(_wrapNativeSuper(Error));
  7071. /***/ }),
  7072. /***/ "./js/processor/ivprogProcessor.js":
  7073. /*!*****************************************!*\
  7074. !*** ./js/processor/ivprogProcessor.js ***!
  7075. \*****************************************/
  7076. /*! exports provided: IVProgProcessor */
  7077. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  7078. "use strict";
  7079. __webpack_require__.r(__webpack_exports__);
  7080. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IVProgProcessor", function() { return IVProgProcessor; });
  7081. /* harmony import */ var _store_store__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./store/store */ "./js/processor/store/store.js");
  7082. /* harmony import */ var _store_storeObject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./store/storeObject */ "./js/processor/store/storeObject.js");
  7083. /* harmony import */ var _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./store/storeObjectArray */ "./js/processor/store/storeObjectArray.js");
  7084. /* harmony import */ var _store_storeObjectRef__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./store/storeObjectRef */ "./js/processor/store/storeObjectRef.js");
  7085. /* harmony import */ var _modes__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./modes */ "./js/processor/modes.js");
  7086. /* harmony import */ var _context__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./context */ "./js/processor/context.js");
  7087. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./../typeSystem/types */ "./js/typeSystem/types.js");
  7088. /* harmony import */ var _ast_operators__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./../ast/operators */ "./js/ast/operators.js");
  7089. /* harmony import */ var _definedFunctions__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./definedFunctions */ "./js/processor/definedFunctions.js");
  7090. /* harmony import */ var _compatibilityTable__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./compatibilityTable */ "./js/processor/compatibilityTable.js");
  7091. /* harmony import */ var _ast_commands___WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./../ast/commands/ */ "./js/ast/commands/index.js");
  7092. /* harmony import */ var _ast_expressions___WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./../ast/expressions/ */ "./js/ast/expressions/index.js");
  7093. /* harmony import */ var _store_storeObjectArrayAddress__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./store/storeObjectArrayAddress */ "./js/processor/store/storeObjectArrayAddress.js");
  7094. /* harmony import */ var _store_storeObjectArrayAddressRef__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./store/storeObjectArrayAddressRef */ "./js/processor/store/storeObjectArrayAddressRef.js");
  7095. /* harmony import */ var _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  7096. /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  7097. /* harmony import */ var _util_config__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../util/config */ "./js/util/config.js");
  7098. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  7099. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_17___default = /*#__PURE__*/__webpack_require__.n(decimal_js__WEBPACK_IMPORTED_MODULE_17__);
  7100. /* harmony import */ var _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./error/processorErrorFactory */ "./js/processor/error/processorErrorFactory.js");
  7101. /* harmony import */ var _error_runtimeError__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./error/runtimeError */ "./js/processor/error/runtimeError.js");
  7102. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7103. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  7104. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  7105. var IVProgProcessor =
  7106. /*#__PURE__*/
  7107. function () {
  7108. _createClass(IVProgProcessor, null, [{
  7109. key: "LOOP_TIMEOUT",
  7110. get: function get() {
  7111. return _util_config__WEBPACK_IMPORTED_MODULE_16__["Config"].loopTimeout;
  7112. },
  7113. set: function set(ms) {
  7114. _util_config__WEBPACK_IMPORTED_MODULE_16__["Config"].setConfig({
  7115. loopTimeout: ms
  7116. });
  7117. }
  7118. }, {
  7119. key: "MAIN_INTERNAL_ID",
  7120. get: function get() {
  7121. return "$main";
  7122. }
  7123. }]);
  7124. function IVProgProcessor(ast) {
  7125. _classCallCheck(this, IVProgProcessor);
  7126. this.ast = ast;
  7127. this.globalStore = new _store_store__WEBPACK_IMPORTED_MODULE_0__["Store"]("$global");
  7128. this.stores = [this.globalStore];
  7129. this.context = [_context__WEBPACK_IMPORTED_MODULE_5__["Context"].BASE];
  7130. this.input = null;
  7131. this.forceKill = false;
  7132. this.loopTimers = [];
  7133. this.output = null;
  7134. }
  7135. _createClass(IVProgProcessor, [{
  7136. key: "registerInput",
  7137. value: function registerInput(input) {
  7138. if (this.input !== null) this.input = null;
  7139. this.input = input;
  7140. }
  7141. }, {
  7142. key: "registerOutput",
  7143. value: function registerOutput(output) {
  7144. if (this.output !== null) this.output = null;
  7145. this.output = output;
  7146. }
  7147. }, {
  7148. key: "checkContext",
  7149. value: function checkContext(context) {
  7150. return this.context[this.context.length - 1] === context;
  7151. }
  7152. }, {
  7153. key: "ignoreSwitchCases",
  7154. value: function ignoreSwitchCases(store) {
  7155. if (store.mode === _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].RETURN) {
  7156. return true;
  7157. } else if (store.mode === _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].BREAK) {
  7158. return true;
  7159. } else {
  7160. return false;
  7161. }
  7162. }
  7163. }, {
  7164. key: "prepareState",
  7165. value: function prepareState() {
  7166. if (this.stores !== null) {
  7167. for (var i = 0; i < this.stores.length; i++) {
  7168. delete this.stores[i];
  7169. }
  7170. this.stores = null;
  7171. }
  7172. if (this.globalStore !== null) this.globalStore = null;
  7173. this.globalStore = new _store_store__WEBPACK_IMPORTED_MODULE_0__["Store"]("$global");
  7174. this.stores = [this.globalStore];
  7175. this.context = [_context__WEBPACK_IMPORTED_MODULE_5__["Context"].BASE];
  7176. }
  7177. }, {
  7178. key: "interpretAST",
  7179. value: function interpretAST() {
  7180. var _this = this;
  7181. this.prepareState();
  7182. return this.initGlobal().then(function (_) {
  7183. var mainFunc = _this.findMainFunction();
  7184. if (mainFunc === null) {
  7185. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].main_missing();
  7186. }
  7187. return _this.runFunction(mainFunc, [], _this.globalStore);
  7188. });
  7189. }
  7190. }, {
  7191. key: "initGlobal",
  7192. value: function initGlobal() {
  7193. if (!this.checkContext(_context__WEBPACK_IMPORTED_MODULE_5__["Context"].BASE)) {
  7194. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].invalid_global_var();
  7195. }
  7196. return this.executeCommands(this.globalStore, this.ast.global);
  7197. }
  7198. }, {
  7199. key: "findMainFunction",
  7200. value: function findMainFunction() {
  7201. return this.ast.functions.find(function (v) {
  7202. return v.isMain;
  7203. });
  7204. }
  7205. }, {
  7206. key: "findFunction",
  7207. value: function findFunction(name) {
  7208. if (name.match(/^\$.+$/)) {
  7209. var fun = _definedFunctions__WEBPACK_IMPORTED_MODULE_8__["LanguageDefinedFunction"].getFunction(name);
  7210. if (!!!fun) {
  7211. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].not_implemented(name);
  7212. }
  7213. return fun;
  7214. } else {
  7215. var val = this.ast.functions.find(function (v) {
  7216. return v.name === name;
  7217. });
  7218. if (!!!val) {
  7219. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].function_missing(name);
  7220. }
  7221. return val;
  7222. }
  7223. }
  7224. }, {
  7225. key: "runFunction",
  7226. value: function runFunction(func, actualParameters, store) {
  7227. var _this2 = this;
  7228. var funcName = func.isMain ? IVProgProcessor.MAIN_INTERNAL_ID : func.name;
  7229. var funcStore = new _store_store__WEBPACK_IMPORTED_MODULE_0__["Store"](funcName);
  7230. funcStore.extendStore(this.globalStore);
  7231. var returnStoreObject = null;
  7232. if (func.returnType instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_14__["CompoundType"]) {
  7233. if (func.returnType.dimensions > 1) {
  7234. returnStoreObject = new _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"](func.returnType, -1, -1, [[]]);
  7235. } else {
  7236. returnStoreObject = new _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"](func.returnType, -1, null, []);
  7237. }
  7238. } else {
  7239. returnStoreObject = new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](func.returnType, null);
  7240. }
  7241. funcStore.insertStore('$', returnStoreObject);
  7242. var newFuncStore$ = this.associateParameters(func.formalParameters, actualParameters, store, funcStore);
  7243. var outerRef = this;
  7244. return newFuncStore$.then(function (sto) {
  7245. _this2.context.push(_context__WEBPACK_IMPORTED_MODULE_5__["Context"].FUNCTION);
  7246. _this2.stores.push(sto);
  7247. return _this2.executeCommands(sto, func.variablesDeclarations).then(function (stoWithVars) {
  7248. return outerRef.executeCommands(stoWithVars, func.commands);
  7249. }).then(function (finalSto) {
  7250. outerRef.stores.pop();
  7251. outerRef.context.pop();
  7252. return finalSto;
  7253. });
  7254. });
  7255. }
  7256. }, {
  7257. key: "associateParameters",
  7258. value: function associateParameters(formalList, actualList, callerStore, calleeStore) {
  7259. var _this3 = this;
  7260. var funcName = calleeStore.name === IVProgProcessor.MAIN_INTERNAL_ID ? _definedFunctions__WEBPACK_IMPORTED_MODULE_8__["LanguageDefinedFunction"].getMainFunctionName() : calleeStore.name;
  7261. if (formalList.length != actualList.length) {
  7262. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].invalid_parameters_size(funcName, formalList.length, actualList.length);
  7263. }
  7264. var promises$ = actualList.map(function (actualParameter) {
  7265. return _this3.evaluateExpression(callerStore, actualParameter);
  7266. });
  7267. return Promise.all(promises$).then(function (values) {
  7268. for (var i = 0; i < values.length; i++) {
  7269. var stoObj = values[i];
  7270. var exp = actualList[i];
  7271. var shouldTypeCast = false;
  7272. var formalParameter = formalList[i];
  7273. if (!formalParameter.type.isCompatible(stoObj.type)) {
  7274. if (_util_config__WEBPACK_IMPORTED_MODULE_16__["Config"].enable_type_casting && !formalParameter.byRef && _store_store__WEBPACK_IMPORTED_MODULE_0__["Store"].canImplicitTypeCast(formalParameter.type, stoObj.type)) {
  7275. shouldTypeCast = true;
  7276. } else {
  7277. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].invalid_parameter_type(funcName, exp.toString());
  7278. }
  7279. }
  7280. if (formalParameter.byRef && !stoObj.inStore) {
  7281. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].invalid_ref(funcName, exp.toString());
  7282. }
  7283. if (formalParameter.byRef) {
  7284. var ref = null;
  7285. if (stoObj instanceof _store_storeObjectArrayAddress__WEBPACK_IMPORTED_MODULE_12__["StoreObjectArrayAddress"]) {
  7286. ref = new _store_storeObjectArrayAddressRef__WEBPACK_IMPORTED_MODULE_13__["StoreObjectArrayAddressRef"](stoObj);
  7287. } else {
  7288. ref = new _store_storeObjectRef__WEBPACK_IMPORTED_MODULE_3__["StoreObjectRef"](stoObj.id, callerStore);
  7289. }
  7290. calleeStore.insertStore(formalParameter.id, ref);
  7291. } else {
  7292. var realValue = _this3.parseStoreObjectValue(stoObj);
  7293. if (shouldTypeCast) {
  7294. realValue = _store_store__WEBPACK_IMPORTED_MODULE_0__["Store"].doImplicitCasting(formalParameter.type, realValue);
  7295. }
  7296. calleeStore.insertStore(formalParameter.id, realValue);
  7297. }
  7298. }
  7299. return calleeStore;
  7300. });
  7301. }
  7302. }, {
  7303. key: "executeCommands",
  7304. value: function executeCommands(store, cmds) {
  7305. // helper to partially apply a function, in this case executeCommand
  7306. var outerRef = this;
  7307. var partial = function partial(fun, cmd) {
  7308. return function (sto) {
  7309. return fun(sto, cmd);
  7310. };
  7311. };
  7312. return cmds.reduce(function (lastCommand, next) {
  7313. var nextCommand = partial(outerRef.executeCommand.bind(outerRef), next);
  7314. return lastCommand.then(nextCommand);
  7315. }, Promise.resolve(store));
  7316. }
  7317. }, {
  7318. key: "executeCommand",
  7319. value: function executeCommand(store, cmd) {
  7320. if (this.forceKill) {
  7321. return Promise.reject("FORCED_KILL!");
  7322. } else if (store.mode === _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].PAUSE) {
  7323. return Promise.resolve(this.executeCommand(store, cmd));
  7324. } else if (store.mode === _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].RETURN) {
  7325. return Promise.resolve(store);
  7326. } else if (this.checkContext(_context__WEBPACK_IMPORTED_MODULE_5__["Context"].BREAKABLE) && store.mode === _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].BREAK) {
  7327. return Promise.resolve(store);
  7328. }
  7329. if (cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_10__["Declaration"]) {
  7330. return this.executeDeclaration(store, cmd);
  7331. } else if (cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_10__["ArrayIndexAssign"]) {
  7332. return this.executeArrayIndexAssign(store, cmd);
  7333. } else if (cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_10__["Assign"]) {
  7334. return this.executeAssign(store, cmd);
  7335. } else if (cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_10__["Break"]) {
  7336. return this.executeBreak(store, cmd);
  7337. } else if (cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_10__["Return"]) {
  7338. return this.executeReturn(store, cmd);
  7339. } else if (cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_10__["IfThenElse"]) {
  7340. return this.executeIfThenElse(store, cmd);
  7341. } else if (cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_10__["DoWhile"]) {
  7342. return this.executeDoWhile(store, cmd);
  7343. } else if (cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_10__["While"]) {
  7344. return this.executeWhile(store, cmd);
  7345. } else if (cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_10__["For"]) {
  7346. return this.executeFor(store, cmd);
  7347. } else if (cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_10__["Switch"]) {
  7348. return this.executeSwitch(store, cmd);
  7349. } else if (cmd instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_11__["FunctionCall"]) {
  7350. return this.executeFunctionCall(store, cmd);
  7351. } else if (cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_10__["SysCall"]) {
  7352. return this.executeSysCall(store, cmd);
  7353. } else {
  7354. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].unknown_command(cmd.sourceInfo);
  7355. }
  7356. }
  7357. }, {
  7358. key: "executeSysCall",
  7359. value: function executeSysCall(store, cmd) {
  7360. var func = cmd.langFunc.bind(this);
  7361. return func(store, cmd);
  7362. }
  7363. }, {
  7364. key: "executeFunctionCall",
  7365. value: function executeFunctionCall(store, cmd) {
  7366. var func = null;
  7367. if (cmd.isMainCall) {
  7368. func = this.findMainFunction();
  7369. } else {
  7370. func = this.findFunction(cmd.id);
  7371. }
  7372. return this.runFunction(func, cmd.actualParameters, store).then(function (sto) {
  7373. if (!_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].VOID.isCompatible(func.returnType) && sto.mode !== _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].RETURN) {
  7374. var funcName = func.name === IVProgProcessor.MAIN_INTERNAL_ID ? _definedFunctions__WEBPACK_IMPORTED_MODULE_8__["LanguageDefinedFunction"].getMainFunctionName() : func.name;
  7375. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].function_no_return(funcName));
  7376. } else {
  7377. return store;
  7378. }
  7379. });
  7380. }
  7381. }, {
  7382. key: "executeSwitch",
  7383. value: function executeSwitch(store, cmd) {
  7384. var _this4 = this;
  7385. this.context.push(_context__WEBPACK_IMPORTED_MODULE_5__["Context"].BREAKABLE);
  7386. var auxCaseFun = function auxCaseFun(promise, switchExp, aCase) {
  7387. return promise.then(function (result) {
  7388. var sto = result.sto;
  7389. if (_this4.ignoreSwitchCases(sto)) {
  7390. return Promise.resolve(result);
  7391. } else if (result.wasTrue || aCase.isDefault) {
  7392. var $newSto = _this4.executeCommands(result.sto, aCase.commands);
  7393. return $newSto.then(function (nSto) {
  7394. return Promise.resolve({
  7395. wasTrue: true,
  7396. sto: nSto
  7397. });
  7398. });
  7399. } else {
  7400. var $value = _this4.evaluateExpression(sto, new _ast_expressions___WEBPACK_IMPORTED_MODULE_11__["InfixApp"](_ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].EQ, switchExp, aCase.expression));
  7401. return $value.then(function (vl) {
  7402. if (vl.value) {
  7403. var _$newSto = _this4.executeCommands(result.sto, aCase.commands);
  7404. return _$newSto.then(function (nSto) {
  7405. return Promise.resolve({
  7406. wasTrue: true,
  7407. sto: nSto
  7408. });
  7409. });
  7410. } else {
  7411. return Promise.resolve({
  7412. wasTrue: false,
  7413. sto: sto
  7414. });
  7415. }
  7416. });
  7417. }
  7418. });
  7419. };
  7420. try {
  7421. var breakLoop = false;
  7422. var $result = Promise.resolve({
  7423. wasTrue: false,
  7424. sto: store
  7425. });
  7426. for (var index = 0; index < cmd.cases.length && !breakLoop; index++) {
  7427. var aCase = cmd.cases[index];
  7428. $result = auxCaseFun($result, cmd.expression, aCase);
  7429. $result.then(function (r) {
  7430. return breakLoop = _this4.ignoreSwitchCases(r.sto);
  7431. });
  7432. }
  7433. return $result.then(function (r) {
  7434. _this4.context.pop();
  7435. if (r.sto.mode === _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].BREAK) {
  7436. r.sto.mode = _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].RUN;
  7437. }
  7438. return r.sto;
  7439. });
  7440. } catch (error) {
  7441. return Promise.reject(error);
  7442. }
  7443. }
  7444. }, {
  7445. key: "executeFor",
  7446. value: function executeFor(store, cmd) {
  7447. try {
  7448. //BEGIN for -> while rewrite
  7449. var initCmd = cmd.assignment;
  7450. var condition = cmd.condition;
  7451. var increment = cmd.increment;
  7452. var whileBlock = new _ast_commands___WEBPACK_IMPORTED_MODULE_10__["CommandBlock"]([], cmd.commands.concat(increment));
  7453. var forAsWhile = new _ast_commands___WEBPACK_IMPORTED_MODULE_10__["While"](condition, whileBlock);
  7454. forAsWhile.sourceInfo = cmd.sourceInfo; //END for -> while rewrite
  7455. var newCmdList = [initCmd, forAsWhile];
  7456. return this.executeCommands(store, newCmdList);
  7457. } catch (error) {
  7458. return Promise.reject(error);
  7459. }
  7460. }
  7461. }, {
  7462. key: "executeDoWhile",
  7463. value: function executeDoWhile(store, cmd) {
  7464. var outerRef = this;
  7465. try {
  7466. outerRef.loopTimers.push(Date.now());
  7467. outerRef.context.push(_context__WEBPACK_IMPORTED_MODULE_5__["Context"].BREAKABLE);
  7468. var $newStore = outerRef.executeCommands(store, cmd.commands);
  7469. return $newStore.then(function (sto) {
  7470. if (sto.mode === _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].BREAK) {
  7471. outerRef.context.pop();
  7472. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].RUN;
  7473. outerRef.loopTimers.pop();
  7474. return sto;
  7475. }
  7476. var $value = outerRef.evaluateExpression(sto, cmd.expression);
  7477. return $value.then(function (vl) {
  7478. if (!vl.type.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].BOOLEAN)) {
  7479. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].loop_condition_type_full(cmd.sourceInfo));
  7480. }
  7481. if (vl.value) {
  7482. outerRef.context.pop();
  7483. for (var i = 0; i < outerRef.loopTimers.length; i++) {
  7484. var time = outerRef.loopTimers[i];
  7485. if (Date.now() - time >= IVProgProcessor.LOOP_TIMEOUT) {
  7486. outerRef.forceKill = true;
  7487. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].endless_loop_full(cmd.sourceInfo));
  7488. }
  7489. }
  7490. return outerRef.executeCommand(sto, cmd);
  7491. } else {
  7492. outerRef.context.pop();
  7493. outerRef.loopTimers.pop();
  7494. return sto;
  7495. }
  7496. });
  7497. });
  7498. } catch (error) {
  7499. return Promise.reject(error);
  7500. }
  7501. }
  7502. }, {
  7503. key: "executeWhile",
  7504. value: function executeWhile(store, cmd) {
  7505. var outerRef = this;
  7506. try {
  7507. outerRef.loopTimers.push(Date.now());
  7508. outerRef.context.push(_context__WEBPACK_IMPORTED_MODULE_5__["Context"].BREAKABLE);
  7509. var $value = outerRef.evaluateExpression(store, cmd.expression);
  7510. return $value.then(function (vl) {
  7511. if (vl.type.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].BOOLEAN)) {
  7512. if (vl.value) {
  7513. var $newStore = outerRef.executeCommands(store, cmd.commands);
  7514. return $newStore.then(function (sto) {
  7515. outerRef.context.pop();
  7516. if (sto.mode === _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].BREAK) {
  7517. outerRef.loopTimers.pop();
  7518. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].RUN;
  7519. return sto;
  7520. }
  7521. for (var i = 0; i < outerRef.loopTimers.length; i++) {
  7522. var time = outerRef.loopTimers[i];
  7523. if (Date.now() - time >= IVProgProcessor.LOOP_TIMEOUT) {
  7524. outerRef.forceKill = true;
  7525. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].endless_loop_full(cmd.sourceInfo));
  7526. }
  7527. }
  7528. return outerRef.executeCommand(sto, cmd);
  7529. });
  7530. } else {
  7531. outerRef.context.pop();
  7532. outerRef.loopTimers.pop();
  7533. return store;
  7534. }
  7535. } else {
  7536. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].loop_condition_type_full(cmd.expression.toString(), cmd.sourceInfo));
  7537. }
  7538. });
  7539. } catch (error) {
  7540. return Promise.reject(error);
  7541. }
  7542. }
  7543. }, {
  7544. key: "executeIfThenElse",
  7545. value: function executeIfThenElse(store, cmd) {
  7546. var _this5 = this;
  7547. try {
  7548. var $value = this.evaluateExpression(store, cmd.condition);
  7549. return $value.then(function (vl) {
  7550. if (vl.type.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].BOOLEAN)) {
  7551. if (vl.value) {
  7552. return _this5.executeCommands(store, cmd.ifTrue.commands);
  7553. } else if (cmd.ifFalse !== null) {
  7554. if (cmd.ifFalse instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_10__["IfThenElse"]) {
  7555. return _this5.executeCommand(store, cmd.ifFalse);
  7556. } else {
  7557. return _this5.executeCommands(store, cmd.ifFalse.commands);
  7558. }
  7559. } else {
  7560. return Promise.resolve(store);
  7561. }
  7562. } else {
  7563. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].if_condition_type_full(cmd.condition.toString(), cmd.sourceInfo));
  7564. }
  7565. });
  7566. } catch (error) {
  7567. return Promise.reject(error);
  7568. }
  7569. }
  7570. }, {
  7571. key: "executeReturn",
  7572. value: function executeReturn(store, cmd) {
  7573. var _this6 = this;
  7574. try {
  7575. var funcType = store.applyStore('$').type;
  7576. var $value = this.evaluateExpression(store, cmd.expression);
  7577. var funcName = store.name === IVProgProcessor.MAIN_INTERNAL_ID ? _definedFunctions__WEBPACK_IMPORTED_MODULE_8__["LanguageDefinedFunction"].getMainFunctionName() : store.name;
  7578. return $value.then(function (vl) {
  7579. if (vl === null && funcType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].VOID)) {
  7580. store.mode = _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].RETURN;
  7581. return Promise.resolve(store);
  7582. }
  7583. if (vl === null || !funcType.isCompatible(vl.type)) {
  7584. var stringInfo = funcType.stringInfo();
  7585. var info = stringInfo[0];
  7586. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].invalid_return_type_full(funcName, info.type, info.dim, cmd.sourceInfo));
  7587. } else {
  7588. var realValue = _this6.parseStoreObjectValue(vl);
  7589. store.updateStore('$', realValue);
  7590. store.mode = _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].RETURN;
  7591. return Promise.resolve(store);
  7592. }
  7593. });
  7594. } catch (error) {
  7595. return Promise.reject(error);
  7596. }
  7597. }
  7598. }, {
  7599. key: "executeBreak",
  7600. value: function executeBreak(store, cmd) {
  7601. if (this.checkContext(_context__WEBPACK_IMPORTED_MODULE_5__["Context"].BREAKABLE)) {
  7602. store.mode = _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].BREAK;
  7603. return Promise.resolve(store);
  7604. } else {
  7605. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].unexpected_break_command_full(cmd.sourceInfo));
  7606. }
  7607. }
  7608. }, {
  7609. key: "executeAssign",
  7610. value: function executeAssign(store, cmd) {
  7611. var _this7 = this;
  7612. try {
  7613. var inStore = store.applyStore(cmd.id);
  7614. var $value = this.evaluateExpression(store, cmd.expression);
  7615. return $value.then(function (vl) {
  7616. var realValue = _this7.parseStoreObjectValue(vl);
  7617. if (!inStore.type.isCompatible(realValue.type)) {
  7618. if (_util_config__WEBPACK_IMPORTED_MODULE_16__["Config"].enable_type_casting && _store_store__WEBPACK_IMPORTED_MODULE_0__["Store"].canImplicitTypeCast(inStore.type, vl.type)) {
  7619. realValue = _store_store__WEBPACK_IMPORTED_MODULE_0__["Store"].doImplicitCasting(inStore.type, realValue);
  7620. } else {
  7621. var stringInfo = inStore.type.stringInfo();
  7622. var info = stringInfo[0];
  7623. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].incompatible_types_full(info.type, info.dim, cmd.sourceInfo));
  7624. }
  7625. }
  7626. store.updateStore(cmd.id, realValue);
  7627. return store;
  7628. });
  7629. } catch (error) {
  7630. return Promise.reject(error);
  7631. }
  7632. }
  7633. }, {
  7634. key: "executeArrayIndexAssign",
  7635. value: function executeArrayIndexAssign(store, cmd) {
  7636. var _this8 = this;
  7637. var mustBeArray = store.applyStore(cmd.id);
  7638. if (!(mustBeArray.type instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_14__["CompoundType"])) {
  7639. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].invalid_array_access_full(cmd.id, cmd.sourceInfo));
  7640. }
  7641. var line$ = this.evaluateExpression(store, cmd.line);
  7642. var column$ = this.evaluateExpression(store, cmd.column);
  7643. var value$ = this.evaluateExpression(store, cmd.expression);
  7644. return Promise.all([line$, column$, value$]).then(function (results) {
  7645. var lineSO = results[0];
  7646. if (!_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].INTEGER.isCompatible(lineSO.type)) {
  7647. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].array_dimension_not_int_full(cmd.sourceInfo));
  7648. }
  7649. var line = lineSO.number;
  7650. var columnSO = results[1];
  7651. var column = null;
  7652. if (columnSO !== null) {
  7653. if (!_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].INTEGER.isCompatible(columnSO.type)) {
  7654. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].array_dimension_not_int_full(cmd.sourceInfo));
  7655. }
  7656. column = columnSO.number;
  7657. }
  7658. var value = _this8.parseStoreObjectValue(results[2]);
  7659. if (line >= mustBeArray.lines) {
  7660. if (mustBeArray.isVector) {
  7661. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].vector_line_outbounds_full(cmd.id, line, mustBeArray.lines, cmd.sourceInfo));
  7662. } else {
  7663. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].matrix_line_outbounds_full(cmd.id, line, mustBeArray.lines, cmd.sourceInfo));
  7664. }
  7665. } else if (line < 0) {
  7666. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].array_dimension_not_positive_full(cmd.sourceInfo);
  7667. }
  7668. if (column !== null && mustBeArray.columns === null) {
  7669. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].vector_not_matrix_full(cmd.id, cmd.sourceInfo));
  7670. }
  7671. if (column !== null) {
  7672. if (column >= mustBeArray.columns) {
  7673. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].matrix_column_outbounds_full(cmd.id, column, mustBeArray.columns, cmd.sourceInfo));
  7674. } else if (column < 0) {
  7675. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].array_dimension_not_positive_full(cmd.sourceInfo);
  7676. }
  7677. }
  7678. var newArray = Object.assign(new _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"](null, null, null), mustBeArray);
  7679. if (column !== null) {
  7680. if (value.type instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_14__["CompoundType"] || !newArray.type.canAccept(value.type)) {
  7681. var type = mustBeArray.type.innerType;
  7682. var stringInfo = type.stringInfo();
  7683. var info = stringInfo[0];
  7684. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].incompatible_types_full(info.type, info.dim, cmd.sourceInfo));
  7685. }
  7686. newArray.value[line].value[column] = value;
  7687. store.updateStore(cmd.id, newArray);
  7688. } else {
  7689. if (mustBeArray.columns !== null && value.type instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_14__["CompoundType"] || !newArray.type.canAccept(value.type)) {
  7690. var _type = mustBeArray.type;
  7691. var _stringInfo = _type.stringInfo();
  7692. var _info = _stringInfo[0];
  7693. var exp = cmd.expression.toString();
  7694. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].incompatible_types_array_full(exp, _info.type, _info.dim - 1, cmd.sourceInfo));
  7695. }
  7696. newArray.value[line] = value;
  7697. store.updateStore(cmd.id, newArray);
  7698. }
  7699. return store;
  7700. });
  7701. }
  7702. }, {
  7703. key: "executeDeclaration",
  7704. value: function executeDeclaration(store, cmd) {
  7705. try {
  7706. var $value = this.evaluateExpression(store, cmd.initial);
  7707. if (cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_10__["ArrayDeclaration"]) {
  7708. var $lines = this.evaluateExpression(store, cmd.lines);
  7709. var $columns = cmd.columns === null ? null : this.evaluateExpression(store, cmd.columns);
  7710. return Promise.all([$lines, $columns, $value]).then(function (values) {
  7711. var lineSO = values[0];
  7712. if (!_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].INTEGER.isCompatible(lineSO.type)) {
  7713. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].array_dimension_not_int_full(cmd.sourceInfo));
  7714. }
  7715. var line = lineSO.number;
  7716. if (line < 0) {
  7717. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].array_dimension_not_positive_full(cmd.sourceInfo);
  7718. }
  7719. var columnSO = values[1];
  7720. var column = null;
  7721. if (columnSO !== null) {
  7722. if (!_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].INTEGER.isCompatible(columnSO.type)) {
  7723. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].array_dimension_not_int_full(cmd.sourceInfo));
  7724. }
  7725. column = columnSO.number;
  7726. if (column < 0) {
  7727. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].array_dimension_not_positive_full(cmd.sourceInfo);
  7728. }
  7729. }
  7730. var value = values[2];
  7731. var temp = new _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"](cmd.type, line, column, null);
  7732. store.insertStore(cmd.id, temp);
  7733. var realValue = value;
  7734. if (value !== null) {
  7735. if (value instanceof _store_storeObjectArrayAddress__WEBPACK_IMPORTED_MODULE_12__["StoreObjectArrayAddress"]) {
  7736. if (value.type instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_14__["CompoundType"]) {
  7737. realValue = Object.assign(new _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"](null, null, null), value.refValue);
  7738. } else {
  7739. realValue = Object.assign(new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](null, null), value.refValue);
  7740. }
  7741. }
  7742. } else {
  7743. realValue = new _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"](cmd.type, line, column, []);
  7744. if (column !== null) {
  7745. for (var i = 0; i < line; i++) {
  7746. realValue.value.push(new _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"](new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_14__["CompoundType"](cmd.type.innerType, 1), column, null, []));
  7747. }
  7748. }
  7749. }
  7750. realValue.readOnly = cmd.isConst;
  7751. store.updateStore(cmd.id, realValue);
  7752. return store;
  7753. });
  7754. } else {
  7755. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](cmd.type, null);
  7756. store.insertStore(cmd.id, temp);
  7757. return $value.then(function (vl) {
  7758. var realValue = vl;
  7759. if (vl !== null) {
  7760. if (!vl.type.isCompatible(cmd.type)) {
  7761. if (_util_config__WEBPACK_IMPORTED_MODULE_16__["Config"].enable_type_casting && _store_store__WEBPACK_IMPORTED_MODULE_0__["Store"].canImplicitTypeCast(cmd.type, vl.type)) {
  7762. realValue = _store_store__WEBPACK_IMPORTED_MODULE_0__["Store"].doImplicitCasting(cmd.type, realValue);
  7763. } else {
  7764. var stringInfo = typeInfo.type.stringInfo();
  7765. var info = stringInfo[0];
  7766. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].incompatible_types_full(info.type, info.dim, cmd.sourceInfo));
  7767. }
  7768. }
  7769. if (vl instanceof _store_storeObjectArrayAddress__WEBPACK_IMPORTED_MODULE_12__["StoreObjectArrayAddress"]) {
  7770. if (vl.type instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_14__["CompoundType"]) {
  7771. return Promise.reject(new Error("!!!Critical Error: Compatibility check failed, a Type accepts a CompoundType"));
  7772. } else {
  7773. realValue = Object.assign(new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](null, null), vl.refValue);
  7774. }
  7775. }
  7776. } else {
  7777. realValue = new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](cmd.type, 0);
  7778. }
  7779. realValue.readOnly = cmd.isConst;
  7780. store.updateStore(cmd.id, realValue);
  7781. return store;
  7782. });
  7783. }
  7784. } catch (e) {
  7785. return Promise.reject(e);
  7786. }
  7787. }
  7788. }, {
  7789. key: "evaluateExpression",
  7790. value: function evaluateExpression(store, exp) {
  7791. if (exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_11__["UnaryApp"]) {
  7792. return this.evaluateUnaryApp(store, exp);
  7793. } else if (exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_11__["InfixApp"]) {
  7794. return this.evaluateInfixApp(store, exp);
  7795. } else if (exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_11__["ArrayAccess"]) {
  7796. return this.evaluateArrayAccess(store, exp);
  7797. } else if (exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_11__["VariableLiteral"]) {
  7798. return this.evaluateVariableLiteral(store, exp);
  7799. } else if (exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_11__["IntLiteral"]) {
  7800. return this.evaluateLiteral(store, exp);
  7801. } else if (exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_11__["RealLiteral"]) {
  7802. return this.evaluateLiteral(store, exp);
  7803. } else if (exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_11__["BoolLiteral"]) {
  7804. return this.evaluateLiteral(store, exp);
  7805. } else if (exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_11__["StringLiteral"]) {
  7806. return this.evaluateLiteral(store, exp);
  7807. } else if (exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_11__["ArrayLiteral"]) {
  7808. return this.evaluateArrayLiteral(store, exp);
  7809. } else if (exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_11__["FunctionCall"]) {
  7810. return this.evaluateFunctionCall(store, exp);
  7811. }
  7812. return Promise.resolve(null);
  7813. }
  7814. }, {
  7815. key: "evaluateFunctionCall",
  7816. value: function evaluateFunctionCall(store, exp) {
  7817. if (exp.isMainCall) {
  7818. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].void_in_expression_full(_definedFunctions__WEBPACK_IMPORTED_MODULE_8__["LanguageDefinedFunction"].getMainFunctionName(), exp.sourceInfo));
  7819. }
  7820. var func = this.findFunction(exp.id);
  7821. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].VOID.isCompatible(func.returnType)) {
  7822. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].void_in_expression_full(exp.id, exp.sourceInfo));
  7823. }
  7824. var $newStore = this.runFunction(func, exp.actualParameters, store);
  7825. return $newStore.then(function (sto) {
  7826. if (sto.mode !== _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].RETURN) {
  7827. return Promise.reject(new Error("The function that was called did not had a return command: " + exp.id));
  7828. }
  7829. var val = sto.applyStore('$');
  7830. if (val instanceof _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"]) {
  7831. return Promise.resolve(Object.assign(new _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"](null, null, null, null, null), val));
  7832. } else {
  7833. return Promise.resolve(Object.assign(new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](null, null), val));
  7834. }
  7835. });
  7836. }
  7837. }, {
  7838. key: "evaluateArrayLiteral",
  7839. value: function evaluateArrayLiteral(store, exp) {
  7840. var errorHelperFunction = function errorHelperFunction(validationResult, exp) {
  7841. var errorCode = validationResult[0];
  7842. switch (errorCode) {
  7843. case _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"].WRONG_COLUMN_NUMBER:
  7844. {
  7845. var columnValue = validationResult[1];
  7846. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].invalid_array_literal_column_full(arr.columns, columnValue, exp.sourceInfo));
  7847. }
  7848. case _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"].WRONG_LINE_NUMBER:
  7849. {
  7850. var lineValue = validationResult[1];
  7851. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].invalid_array_literal_line_full(arr.lines, lineValue, exp.sourceInfo));
  7852. }
  7853. case _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"].WRONG_TYPE:
  7854. {
  7855. var line = null;
  7856. var strExp = null;
  7857. if (validationResult.length > 2) {
  7858. line = validationResult[1];
  7859. var column = validationResult[2];
  7860. strExp = exp.value[line].value[column].toString();
  7861. } else {
  7862. line = validationResult[1];
  7863. strExp = exp.value[line].toString();
  7864. }
  7865. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].invalid_array_literal_type_full(strExp, exp.sourceInfo));
  7866. }
  7867. }
  7868. };
  7869. if (!exp.isVector) {
  7870. var $matrix = this.evaluateMatrix(store, exp.value);
  7871. return $matrix.then(function (list) {
  7872. var type = new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_14__["CompoundType"](list[0].type.innerType, 2);
  7873. var arr = new _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"](type, list.length, list[0].lines, list);
  7874. var checkResult = arr.isValid;
  7875. if (checkResult.length == 0) return Promise.resolve(arr);else {
  7876. return errorHelperFunction(checkResult, exp);
  7877. }
  7878. });
  7879. } else {
  7880. return this.evaluateVector(store, exp.value).then(function (list) {
  7881. var type = new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_14__["CompoundType"](list[0].type, 1);
  7882. var stoArray = new _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"](type, list.length, null, list);
  7883. var checkResult = stoArray.isValid;
  7884. if (checkResult.length == 0) return Promise.resolve(stoArray);else {
  7885. return errorHelperFunction(checkResult, exp);
  7886. }
  7887. });
  7888. }
  7889. }
  7890. }, {
  7891. key: "evaluateVector",
  7892. value: function evaluateVector(store, exps) {
  7893. var _this9 = this;
  7894. return Promise.all(exps.map(function (exp) {
  7895. return _this9.evaluateExpression(store, exp);
  7896. }));
  7897. }
  7898. }, {
  7899. key: "evaluateMatrix",
  7900. value: function evaluateMatrix(store, exps) {
  7901. var _this10 = this;
  7902. return Promise.all(exps.map(function (vector) {
  7903. var $vector = _this10.evaluateVector(store, vector.value);
  7904. return $vector.then(function (list) {
  7905. var type = new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_14__["CompoundType"](list[0].type, 1);
  7906. return new _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"](type, list.length, null, list);
  7907. });
  7908. }));
  7909. }
  7910. }, {
  7911. key: "evaluateLiteral",
  7912. value: function evaluateLiteral(_, exp) {
  7913. return Promise.resolve(new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](exp.type, exp.value));
  7914. }
  7915. }, {
  7916. key: "evaluateVariableLiteral",
  7917. value: function evaluateVariableLiteral(store, exp) {
  7918. try {
  7919. var val = store.applyStore(exp.id);
  7920. if (val instanceof _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"]) {
  7921. return Promise.resolve(Object.assign(new _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"](null, null, null, null), val));
  7922. } else {
  7923. return Promise.resolve(Object.assign(new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](null, null), val));
  7924. }
  7925. } catch (error) {
  7926. return Promise.reject(error);
  7927. }
  7928. }
  7929. }, {
  7930. key: "evaluateArrayAccess",
  7931. value: function evaluateArrayAccess(store, exp) {
  7932. var mustBeArray = store.applyStore(exp.id);
  7933. if (!(mustBeArray.type instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_14__["CompoundType"])) {
  7934. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].invalid_array_access_full(exp.id, exp.sourceInfo));
  7935. }
  7936. var $line = this.evaluateExpression(store, exp.line);
  7937. var $column = this.evaluateExpression(store, exp.column);
  7938. return Promise.all([$line, $column]).then(function (values) {
  7939. var lineSO = values[0];
  7940. var columnSO = values[1];
  7941. if (!_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].INTEGER.isCompatible(lineSO.type)) {
  7942. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].array_dimension_not_int_full(exp.sourceInfo));
  7943. }
  7944. var line = lineSO.number;
  7945. var column = null;
  7946. if (columnSO !== null) {
  7947. if (!_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].INTEGER.isCompatible(columnSO.type)) {
  7948. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].array_dimension_not_int_full(exp.sourceInfo));
  7949. }
  7950. column = columnSO.number;
  7951. }
  7952. if (line >= mustBeArray.lines) {
  7953. if (mustBeArray.isVector) {
  7954. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].vector_line_outbounds_full(exp.id, line, mustBeArray.lines, exp.sourceInfo));
  7955. } else {
  7956. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].matrix_line_outbounds_full(exp.id, line, mustBeArray.lines, exp.sourceInfo));
  7957. }
  7958. } else if (line < 0) {
  7959. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].array_dimension_not_positive_full(exp.sourceInfo);
  7960. }
  7961. if (column !== null && mustBeArray.columns === null) {
  7962. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].vector_not_matrix_full(exp.id, exp.sourceInfo));
  7963. }
  7964. if (column !== null) {
  7965. if (column >= mustBeArray.columns) {
  7966. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].matrix_column_outbounds_full(exp.id, column, mustBeArray.columns, exp.sourceInfo));
  7967. } else if (column < 0) {
  7968. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].array_dimension_not_positive_full(exp.sourceInfo);
  7969. }
  7970. }
  7971. return Promise.resolve(new _store_storeObjectArrayAddress__WEBPACK_IMPORTED_MODULE_12__["StoreObjectArrayAddress"](mustBeArray.id, line, column, store));
  7972. });
  7973. }
  7974. }, {
  7975. key: "evaluateUnaryApp",
  7976. value: function evaluateUnaryApp(store, unaryApp) {
  7977. var $left = this.evaluateExpression(store, unaryApp.left);
  7978. return $left.then(function (left) {
  7979. var resultType = Object(_compatibilityTable__WEBPACK_IMPORTED_MODULE_9__["resultTypeAfterUnaryOp"])(unaryApp.op, left.type);
  7980. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].UNDEFINED.isCompatible(resultType)) {
  7981. var stringInfo = left.type.stringInfo();
  7982. var info = stringInfo[0];
  7983. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].invalid_unary_op_full(unaryApp.op, info.type, info.dim, unaryApp.sourceInfo));
  7984. }
  7985. switch (unaryApp.op.ord) {
  7986. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].ADD.ord:
  7987. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, left.value);
  7988. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].SUB.ord:
  7989. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, left.value.negated());
  7990. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].NOT.ord:
  7991. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, !left.value);
  7992. default:
  7993. return Promise.reject(new _error_runtimeError__WEBPACK_IMPORTED_MODULE_19__["RuntimeError"]('!!!Critical Invalid UnaryApp ' + unaryApp.op));
  7994. }
  7995. });
  7996. }
  7997. }, {
  7998. key: "evaluateInfixApp",
  7999. value: function evaluateInfixApp(store, infixApp) {
  8000. var $left = this.evaluateExpression(store, infixApp.left);
  8001. var $right = this.evaluateExpression(store, infixApp.right);
  8002. return Promise.all([$left, $right]).then(function (values) {
  8003. var shouldImplicitCast = false;
  8004. var left = values[0];
  8005. var right = values[1];
  8006. var resultType = Object(_compatibilityTable__WEBPACK_IMPORTED_MODULE_9__["resultTypeAfterInfixOp"])(infixApp.op, left.type, right.type);
  8007. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].UNDEFINED.isCompatible(resultType)) {
  8008. if (_util_config__WEBPACK_IMPORTED_MODULE_16__["Config"].enable_type_casting && _store_store__WEBPACK_IMPORTED_MODULE_0__["Store"].canImplicitTypeCast(left.type, right.type)) {
  8009. shouldImplicitCast = true;
  8010. } else {
  8011. var stringInfoLeft = left.type.stringInfo();
  8012. var infoLeft = stringInfoLeft[0];
  8013. var stringInfoRight = right.type.stringInfo();
  8014. var infoRight = stringInfoRight[0];
  8015. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].invalid_infix_op_full(infixApp.op, infoLeft.type, infoLeft.dim, infoRight.type, infoRight.dim, infixApp.sourceInfo));
  8016. }
  8017. }
  8018. var result = null;
  8019. switch (infixApp.op.ord) {
  8020. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].ADD.ord:
  8021. {
  8022. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].STRING.isCompatible(left.type)) {
  8023. var rightStr = Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_15__["convertToString"])(right.value, right.type);
  8024. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, left.value + rightStr);
  8025. } else if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].STRING.isCompatible(right.type)) {
  8026. var leftStr = Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_15__["convertToString"])(left.value, left.type);
  8027. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, leftStr + right.value);
  8028. } else {
  8029. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, left.value.plus(right.value));
  8030. }
  8031. }
  8032. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].SUB.ord:
  8033. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, left.value.minus(right.value));
  8034. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].MULT.ord:
  8035. {
  8036. result = left.value.times(right.value);
  8037. if (result.dp() > _util_config__WEBPACK_IMPORTED_MODULE_16__["Config"].decimalPlaces) {
  8038. result = new decimal_js__WEBPACK_IMPORTED_MODULE_17___default.a(result.toFixed(_util_config__WEBPACK_IMPORTED_MODULE_16__["Config"].decimalPlaces));
  8039. }
  8040. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, result);
  8041. }
  8042. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].DIV.ord:
  8043. {
  8044. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].INTEGER.isCompatible(resultType)) result = left.value.divToInt(right.value);else result = left.value.div(right.value);
  8045. if (result.dp() > _util_config__WEBPACK_IMPORTED_MODULE_16__["Config"].decimalPlaces) {
  8046. result = new decimal_js__WEBPACK_IMPORTED_MODULE_17___default.a(result.toFixed(_util_config__WEBPACK_IMPORTED_MODULE_16__["Config"].decimalPlaces));
  8047. }
  8048. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, result);
  8049. }
  8050. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].MOD.ord:
  8051. {
  8052. var leftValue = left.value;
  8053. var rightValue = right.value;
  8054. if (shouldImplicitCast) {
  8055. resultType = _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].INTEGER;
  8056. leftValue = leftValue.trunc();
  8057. rightValue = rightValue.trunc();
  8058. }
  8059. result = leftValue.modulo(rightValue);
  8060. if (result.dp() > _util_config__WEBPACK_IMPORTED_MODULE_16__["Config"].decimalPlaces) {
  8061. result = new decimal_js__WEBPACK_IMPORTED_MODULE_17___default.a(result.toFixed(_util_config__WEBPACK_IMPORTED_MODULE_16__["Config"].decimalPlaces));
  8062. }
  8063. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, result);
  8064. }
  8065. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].GT.ord:
  8066. {
  8067. var _leftValue = left.value;
  8068. var _rightValue = right.value;
  8069. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].STRING.isCompatible(left.type)) {
  8070. result = left.value.length > right.value.length;
  8071. } else {
  8072. if (shouldImplicitCast) {
  8073. resultType = _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].BOOLEAN;
  8074. _leftValue = _leftValue.trunc();
  8075. _rightValue = _rightValue.trunc();
  8076. }
  8077. result = _leftValue.gt(_rightValue);
  8078. }
  8079. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, result);
  8080. }
  8081. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].GE.ord:
  8082. {
  8083. var _leftValue2 = left.value;
  8084. var _rightValue2 = right.value;
  8085. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].STRING.isCompatible(left.type)) {
  8086. result = left.value.length >= right.value.length;
  8087. } else {
  8088. if (shouldImplicitCast) {
  8089. resultType = _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].BOOLEAN;
  8090. _leftValue2 = _leftValue2.trunc();
  8091. _rightValue2 = _rightValue2.trunc();
  8092. }
  8093. result = _leftValue2.gte(_rightValue2);
  8094. }
  8095. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, result);
  8096. }
  8097. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].LT.ord:
  8098. {
  8099. var _leftValue3 = left.value;
  8100. var _rightValue3 = right.value;
  8101. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].STRING.isCompatible(left.type)) {
  8102. result = left.value.length < right.value.length;
  8103. } else {
  8104. if (shouldImplicitCast) {
  8105. resultType = _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].BOOLEAN;
  8106. _leftValue3 = _leftValue3.trunc();
  8107. _rightValue3 = _rightValue3.trunc();
  8108. }
  8109. result = _leftValue3.lt(_rightValue3);
  8110. }
  8111. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, result);
  8112. }
  8113. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].LE.ord:
  8114. {
  8115. var _leftValue4 = left.value;
  8116. var _rightValue4 = right.value;
  8117. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].STRING.isCompatible(left.type)) {
  8118. result = left.value.length <= right.value.length;
  8119. } else {
  8120. if (shouldImplicitCast) {
  8121. resultType = _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].BOOLEAN;
  8122. _leftValue4 = _leftValue4.trunc();
  8123. _rightValue4 = _rightValue4.trunc();
  8124. }
  8125. result = _leftValue4.lte(_rightValue4);
  8126. }
  8127. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, result);
  8128. }
  8129. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].EQ.ord:
  8130. {
  8131. var _leftValue5 = left.value;
  8132. var _rightValue5 = right.value;
  8133. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].INTEGER.isCompatible(left.type) || _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].REAL.isCompatible(left.type)) {
  8134. if (shouldImplicitCast) {
  8135. resultType = _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].BOOLEAN;
  8136. _leftValue5 = _leftValue5.trunc();
  8137. _rightValue5 = _rightValue5.trunc();
  8138. }
  8139. result = _leftValue5.eq(_rightValue5);
  8140. } else {
  8141. result = left.value === right.value;
  8142. }
  8143. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, result);
  8144. }
  8145. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].NEQ.ord:
  8146. {
  8147. var _leftValue6 = left.value;
  8148. var _rightValue6 = right.value;
  8149. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].INTEGER.isCompatible(left.type) || _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].REAL.isCompatible(left.type)) {
  8150. if (shouldImplicitCast) {
  8151. resultType = _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].BOOLEAN;
  8152. _leftValue6 = _leftValue6.trunc();
  8153. _rightValue6 = _rightValue6.trunc();
  8154. }
  8155. result = !_leftValue6.eq(_rightValue6);
  8156. } else {
  8157. result = left.value !== right.value;
  8158. }
  8159. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, result);
  8160. }
  8161. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].AND.ord:
  8162. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, left.value && right.value);
  8163. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].OR.ord:
  8164. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, left.value || right.value);
  8165. default:
  8166. return Promise.reject(new _error_runtimeError__WEBPACK_IMPORTED_MODULE_19__["RuntimeError"]('!!!Critical Invalid InfixApp ' + infixApp.op));
  8167. }
  8168. });
  8169. }
  8170. }, {
  8171. key: "parseStoreObjectValue",
  8172. value: function parseStoreObjectValue(vl) {
  8173. var realValue = vl;
  8174. if (vl instanceof _store_storeObjectArrayAddress__WEBPACK_IMPORTED_MODULE_12__["StoreObjectArrayAddress"]) {
  8175. if (vl.type instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_14__["CompoundType"]) {
  8176. switch (vl.type.dimensions) {
  8177. case 1:
  8178. {
  8179. realValue = new _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"](vl.type, vl.value);
  8180. break;
  8181. }
  8182. default:
  8183. {
  8184. throw new _error_runtimeError__WEBPACK_IMPORTED_MODULE_19__["RuntimeError"]("Three dimensional array address...");
  8185. }
  8186. }
  8187. } else {
  8188. realValue = new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](vl.type, vl.value);
  8189. }
  8190. }
  8191. return realValue;
  8192. }
  8193. }]);
  8194. return IVProgProcessor;
  8195. }();
  8196. /***/ }),
  8197. /***/ "./js/processor/lib/arrays.js":
  8198. /*!************************************!*\
  8199. !*** ./js/processor/lib/arrays.js ***!
  8200. \************************************/
  8201. /*! exports provided: createNumElementsFun, createMatrixLinesFun, createMatrixColumnsFun */
  8202. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8203. "use strict";
  8204. __webpack_require__.r(__webpack_exports__);
  8205. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createNumElementsFun", function() { return createNumElementsFun; });
  8206. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createMatrixLinesFun", function() { return createMatrixLinesFun; });
  8207. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createMatrixColumnsFun", function() { return createMatrixColumnsFun; });
  8208. /* harmony import */ var _store_storeObject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js");
  8209. /* harmony import */ var _ast_commands__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  8210. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  8211. /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  8212. /* harmony import */ var _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  8213. /* harmony import */ var _modes__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../modes */ "./js/processor/modes.js");
  8214. /**
  8215. * num_elements
  8216. * matrix_lines
  8217. * matrix_columns
  8218. */
  8219. function createNumElementsFun() {
  8220. var numElementsFun = function numElementsFun(sto, _) {
  8221. var vector = sto.applyStore("vector");
  8222. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__["toInt"])(vector.lines));
  8223. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_5__["Modes"].RETURN;
  8224. return Promise.resolve(sto.updateStore("$", temp));
  8225. };
  8226. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](numElementsFun)]);
  8227. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$numElements', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_4__["CompoundType"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].ALL, 1), 'vector', false)], block);
  8228. return func;
  8229. }
  8230. function createMatrixLinesFun() {
  8231. var matrixLinesFun = function matrixLinesFun(sto, _) {
  8232. var matrix = sto.applyStore("matrix");
  8233. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__["toInt"])(matrix.lines));
  8234. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_5__["Modes"].RETURN;
  8235. return Promise.resolve(sto.updateStore("$", temp));
  8236. };
  8237. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](matrixLinesFun)]);
  8238. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$matrixLines', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_4__["CompoundType"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].ALL, 2), 'matrix', false)], block);
  8239. return func;
  8240. }
  8241. function createMatrixColumnsFun() {
  8242. var matrixColumnsFun = function matrixColumnsFun(sto, _) {
  8243. var matrix = sto.applyStore("matrix");
  8244. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__["toInt"])(matrix.columns));
  8245. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_5__["Modes"].RETURN;
  8246. return Promise.resolve(sto.updateStore("$", temp));
  8247. };
  8248. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](matrixColumnsFun)]);
  8249. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$matrixColumns', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_4__["CompoundType"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].ALL, 2), 'matrix', false)], block);
  8250. return func;
  8251. }
  8252. /***/ }),
  8253. /***/ "./js/processor/lib/io.js":
  8254. /*!********************************!*\
  8255. !*** ./js/processor/lib/io.js ***!
  8256. \********************************/
  8257. /*! exports provided: createOutputFun, createInputFun */
  8258. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8259. "use strict";
  8260. __webpack_require__.r(__webpack_exports__);
  8261. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createOutputFun", function() { return createOutputFun; });
  8262. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createInputFun", function() { return createInputFun; });
  8263. /* harmony import */ var _store_storeObject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./../store/storeObject */ "./js/processor/store/storeObject.js");
  8264. /* harmony import */ var _ast_commands__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  8265. /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  8266. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  8267. function createOutputFun() {
  8268. var writeFunction = function writeFunction(store, _) {
  8269. var val = store.applyStore('p1');
  8270. this.output.sendOutput(Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_2__["convertToString"])(val.value, val.type));
  8271. return Promise.resolve(store);
  8272. };
  8273. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](writeFunction)]);
  8274. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$write', _typeSystem_types__WEBPACK_IMPORTED_MODULE_3__["Types"].VOID, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__["Types"].ALL, 'p1', false)], block);
  8275. return func;
  8276. }
  8277. function createInputFun() {
  8278. var readFunction = function readFunction(store, _) {
  8279. var _this = this;
  8280. var request = new Promise(function (resolve, _) {
  8281. _this.input.requestInput(resolve);
  8282. });
  8283. return request.then(function (text) {
  8284. var typeToConvert = store.applyStore('p1').type;
  8285. var stoObj = null;
  8286. if (typeToConvert.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__["Types"].INTEGER)) {
  8287. var val = Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_2__["toInt"])(text);
  8288. stoObj = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__["Types"].INTEGER, val.trunc());
  8289. } else if (typeToConvert.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__["Types"].REAL)) {
  8290. stoObj = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__["Types"].REAL, Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_2__["toReal"])(text));
  8291. } else if (typeToConvert.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__["Types"].BOOLEAN)) {
  8292. stoObj = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__["Types"].BOOLEAN, Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_2__["toBool"])(text));
  8293. } else if (typeToConvert.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__["Types"].STRING)) {
  8294. stoObj = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__["Types"].STRING, Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_2__["toString"])(text));
  8295. }
  8296. _this.loopTimers.splice(0, _this.loopTimers.length);
  8297. store.updateStore('p1', stoObj);
  8298. return Promise.resolve(store);
  8299. });
  8300. };
  8301. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](readFunction)]);
  8302. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$read', _typeSystem_types__WEBPACK_IMPORTED_MODULE_3__["Types"].VOID, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__["Types"].ALL, 'p1', true)], block);
  8303. return func;
  8304. }
  8305. /***/ }),
  8306. /***/ "./js/processor/lib/lang.js":
  8307. /*!**********************************!*\
  8308. !*** ./js/processor/lib/lang.js ***!
  8309. \**********************************/
  8310. /*! exports provided: createIsRealFun, createIsIntFun, createIsBoolFun, createCastRealFun, createCastIntFun, createCastBoolFun, createCastStringFun */
  8311. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8312. "use strict";
  8313. __webpack_require__.r(__webpack_exports__);
  8314. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createIsRealFun", function() { return createIsRealFun; });
  8315. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createIsIntFun", function() { return createIsIntFun; });
  8316. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createIsBoolFun", function() { return createIsBoolFun; });
  8317. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createCastRealFun", function() { return createCastRealFun; });
  8318. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createCastIntFun", function() { return createCastIntFun; });
  8319. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createCastBoolFun", function() { return createCastBoolFun; });
  8320. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createCastStringFun", function() { return createCastStringFun; });
  8321. /* harmony import */ var _store_storeObject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js");
  8322. /* harmony import */ var _ast_commands__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  8323. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  8324. /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  8325. /* harmony import */ var _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  8326. /* harmony import */ var _ast_expressions__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../ast/expressions */ "./js/ast/expressions/index.js");
  8327. /* harmony import */ var _modes__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../modes */ "./js/processor/modes.js");
  8328. /* harmony import */ var _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../typeSystem/multiType */ "./js/typeSystem/multiType.js");
  8329. /* harmony import */ var _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../error/processorErrorFactory */ "./js/processor/error/processorErrorFactory.js");
  8330. /**
  8331. *
  8332. * is_real
  8333. * is_int
  8334. * is_bool
  8335. * cast_real
  8336. * cast_int
  8337. * cast_bool
  8338. * cast_string
  8339. */
  8340. function createIsRealFun() {
  8341. var isRealFun = function isRealFun(sto, _) {
  8342. var str = sto.applyStore("str");
  8343. var parser = _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_4__["IVProgParser"].createParser(str.value);
  8344. var result = false;
  8345. try {
  8346. var val = parser.parseTerm();
  8347. if (val instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_5__["RealLiteral"]) {
  8348. result = true;
  8349. }
  8350. } catch (error) {}
  8351. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].BOOLEAN, result);
  8352. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_6__["Modes"].RETURN;
  8353. return Promise.resolve(sto.updateStore("$", temp));
  8354. };
  8355. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](isRealFun)]);
  8356. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$isReal', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].BOOLEAN, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, 'str', false)], block);
  8357. return func;
  8358. }
  8359. function createIsIntFun() {
  8360. var isIntFun = function isIntFun(sto, _) {
  8361. var str = sto.applyStore("str");
  8362. var parser = _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_4__["IVProgParser"].createParser(str.value);
  8363. var result = false;
  8364. try {
  8365. var val = parser.parseTerm();
  8366. if (val instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_5__["IntLiteral"]) {
  8367. result = true;
  8368. }
  8369. } catch (error) {}
  8370. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].BOOLEAN, result);
  8371. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_6__["Modes"].RETURN;
  8372. return Promise.resolve(sto.updateStore("$", temp));
  8373. };
  8374. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](isIntFun)]);
  8375. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$isInt', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].BOOLEAN, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, 'str', false)], block);
  8376. return func;
  8377. }
  8378. function createIsBoolFun() {
  8379. var isBoolFun = function isBoolFun(sto, _) {
  8380. var str = sto.applyStore("str");
  8381. var parser = _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_4__["IVProgParser"].createParser(str.value);
  8382. var result = false;
  8383. try {
  8384. var val = parser.parseTerm();
  8385. if (val instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_5__["BoolLiteral"]) {
  8386. result = true;
  8387. }
  8388. } catch (error) {}
  8389. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].BOOLEAN, result);
  8390. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_6__["Modes"].RETURN;
  8391. return Promise.resolve(sto.updateStore("$", temp));
  8392. };
  8393. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](isBoolFun)]);
  8394. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$isBool', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].BOOLEAN, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, 'str', false)], block);
  8395. return func;
  8396. }
  8397. function createCastRealFun() {
  8398. var castRealFun = function castRealFun(sto, _) {
  8399. var val = sto.applyStore("val");
  8400. var value = val.value;
  8401. switch (val.type.ord) {
  8402. case _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER.ord:
  8403. {
  8404. value = value.toNumber();
  8405. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__["toReal"])(value));
  8406. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_6__["Modes"].RETURN;
  8407. return Promise.resolve(sto.updateStore("$", temp));
  8408. }
  8409. case _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING.ord:
  8410. {
  8411. var parser = _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_4__["IVProgParser"].createParser(value);
  8412. try {
  8413. var result = parser.parseTerm();
  8414. if (result instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_5__["RealLiteral"]) {
  8415. var _temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, result.value);
  8416. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_6__["Modes"].RETURN;
  8417. return Promise.resolve(sto.updateStore("$", _temp));
  8418. }
  8419. } catch (error) {}
  8420. }
  8421. }
  8422. var typeStringInfoArray = _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL.stringInfo();
  8423. var typeInfo = typeStringInfoArray[0];
  8424. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_8__["ProcessorErrorFactory"].invalid_type_conversion(value, typeInfo.type, typeInfo.dim));
  8425. };
  8426. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](castRealFun)]);
  8427. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$castReal', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_7__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING]), 'val', false)], block);
  8428. return func;
  8429. }
  8430. function createCastIntFun() {
  8431. var castIntFun = function castIntFun(sto, _) {
  8432. var val = sto.applyStore("val");
  8433. var value = val.value;
  8434. switch (val.type.ord) {
  8435. case _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL.ord:
  8436. {
  8437. value = value.toNumber();
  8438. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, Math.floor(value));
  8439. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_6__["Modes"].RETURN;
  8440. return Promise.resolve(sto.updateStore("$", temp));
  8441. }
  8442. case _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING.ord:
  8443. {
  8444. var parser = _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_4__["IVProgParser"].createParser(value);
  8445. try {
  8446. var result = parser.parseTerm();
  8447. if (result instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_5__["IntLiteral"]) {
  8448. var _temp2 = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, result.value);
  8449. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_6__["Modes"].RETURN;
  8450. return Promise.resolve(sto.updateStore("$", _temp2));
  8451. }
  8452. } catch (error) {}
  8453. }
  8454. }
  8455. var typeStringInfoArray = _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER.stringInfo();
  8456. var typeInfo = typeStringInfoArray[0];
  8457. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_8__["ProcessorErrorFactory"].invalid_type_conversion(value, typeInfo.type, typeInfo.dim));
  8458. };
  8459. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](castIntFun)]);
  8460. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$castInt', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_7__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING]), 'val', false)], block);
  8461. return func;
  8462. }
  8463. function createCastBoolFun() {
  8464. var castBoolFun = function castBoolFun(sto, _) {
  8465. var str = sto.applyStore("str");
  8466. var value = str.value;
  8467. var parser = _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_4__["IVProgParser"].createParser(value);
  8468. try {
  8469. var val = parser.parseTerm();
  8470. if (val instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_5__["BoolLiteral"]) {
  8471. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].BOOLEAN, val.value);
  8472. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_6__["Modes"].RETURN;
  8473. return Promise.resolve(sto.updateStore("$", temp));
  8474. }
  8475. } catch (error) {}
  8476. var typeStringInfoArray = _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].BOOLEAN.stringInfo();
  8477. var typeInfo = typeStringInfoArray[0];
  8478. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_8__["ProcessorErrorFactory"].invalid_type_conversion(value, typeInfo.type, typeInfo.dim));
  8479. };
  8480. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](castBoolFun)]);
  8481. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$castBool', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].BOOLEAN, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, 'str', false)], block);
  8482. return func;
  8483. }
  8484. function createCastStringFun() {
  8485. var castStringFun = function castStringFun(store, _) {
  8486. var val = store.applyStore('str');
  8487. var result = Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__["convertToString"])(val);
  8488. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, result);
  8489. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_6__["Modes"].RETURN;
  8490. return Promise.resolve(sto.updateStore("$", temp));
  8491. };
  8492. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](castStringFun)]);
  8493. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$castString', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].ALL, 'str', false)], block);
  8494. return func;
  8495. }
  8496. /***/ }),
  8497. /***/ "./js/processor/lib/math.js":
  8498. /*!**********************************!*\
  8499. !*** ./js/processor/lib/math.js ***!
  8500. \**********************************/
  8501. /*! exports provided: createSinFun, createCosFun, createTanFun, createSqrtFun, createPowFun, createLogFun, createAbsFun, createNegateFun, createInvertFun, createMaxFun, createMinFun */
  8502. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8503. "use strict";
  8504. __webpack_require__.r(__webpack_exports__);
  8505. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createSinFun", function() { return createSinFun; });
  8506. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createCosFun", function() { return createCosFun; });
  8507. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createTanFun", function() { return createTanFun; });
  8508. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createSqrtFun", function() { return createSqrtFun; });
  8509. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createPowFun", function() { return createPowFun; });
  8510. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createLogFun", function() { return createLogFun; });
  8511. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createAbsFun", function() { return createAbsFun; });
  8512. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createNegateFun", function() { return createNegateFun; });
  8513. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createInvertFun", function() { return createInvertFun; });
  8514. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createMaxFun", function() { return createMaxFun; });
  8515. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createMinFun", function() { return createMinFun; });
  8516. /* harmony import */ var _store_storeObject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js");
  8517. /* harmony import */ var _ast_commands__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  8518. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  8519. /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  8520. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  8521. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(decimal_js__WEBPACK_IMPORTED_MODULE_4__);
  8522. /* harmony import */ var _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../typeSystem/multiType */ "./js/typeSystem/multiType.js");
  8523. /* harmony import */ var _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  8524. /* harmony import */ var _modes__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../modes */ "./js/processor/modes.js");
  8525. /* harmony import */ var _util_config__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../util/config */ "./js/util/config.js");
  8526. function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
  8527. function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
  8528. function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
  8529. function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
  8530. /**
  8531. * sin
  8532. * cos
  8533. * tan
  8534. * sqrt
  8535. * pow
  8536. * log
  8537. * abs
  8538. * negate
  8539. * invert
  8540. * max
  8541. * min
  8542. */
  8543. function convertToRadians(degrees) {
  8544. return degrees.times(decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"].acos(-1)).div(180);
  8545. }
  8546. function createSinFun() {
  8547. var sinFun = function sinFun(sto, _) {
  8548. var x = sto.applyStore('x');
  8549. var angle = x.value.mod(360);
  8550. var result = null;
  8551. if (angle.eq(90)) {
  8552. result = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"](1);
  8553. } else if (angle.eq(180)) {
  8554. result = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"](0);
  8555. } else if (angle.eq(270)) {
  8556. result = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"](-1);
  8557. } else {
  8558. result = decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"].sin(convertToRadians(angle));
  8559. }
  8560. if (result.dp() > _util_config__WEBPACK_IMPORTED_MODULE_8__["Config"].decimalPlaces) {
  8561. result = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"](result.toFixed(_util_config__WEBPACK_IMPORTED_MODULE_8__["Config"].decimalPlaces));
  8562. }
  8563. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, result);
  8564. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__["Modes"].RETURN;
  8565. return Promise.resolve(sto.updateStore('$', temp));
  8566. };
  8567. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](sinFun)]);
  8568. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$sin', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), 'x', false)], block);
  8569. return func;
  8570. }
  8571. function createCosFun() {
  8572. var cosFun = function cosFun(sto, _) {
  8573. var x = sto.applyStore('x');
  8574. var angle = x.value.mod(360);
  8575. var result = null;
  8576. if (angle.eq(90)) {
  8577. result = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"](0);
  8578. } else if (angle.eq(180)) {
  8579. result = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"](-1);
  8580. } else if (angle.eq(270)) {
  8581. result = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"](0);
  8582. }
  8583. result = decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"].cos(convertToRadians(angle));
  8584. if (result.dp() > _util_config__WEBPACK_IMPORTED_MODULE_8__["Config"].decimalPlaces) {
  8585. result = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"](result.toFixed(_util_config__WEBPACK_IMPORTED_MODULE_8__["Config"].decimalPlaces));
  8586. }
  8587. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, result);
  8588. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__["Modes"].RETURN;
  8589. return Promise.resolve(sto.updateStore('$', temp));
  8590. };
  8591. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](cosFun)]);
  8592. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$cos', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), 'x', false)], block);
  8593. return func;
  8594. }
  8595. function createTanFun() {
  8596. var tanFun = function tanFun(sto, _) {
  8597. var x = sto.applyStore('x');
  8598. var angle = x.value.mod(360);
  8599. if (angle.eq(90) || angle.eq(270)) {
  8600. return Promise.reject("Tangent of " + x.value.toNumber() + "° is undefined.");
  8601. }
  8602. var result = decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"].tan(convertToRadians(angle));
  8603. if (result.dp() > _util_config__WEBPACK_IMPORTED_MODULE_8__["Config"].decimalPlaces) {
  8604. result = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"](result.toFixed(_util_config__WEBPACK_IMPORTED_MODULE_8__["Config"].decimalPlaces));
  8605. }
  8606. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, result);
  8607. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__["Modes"].RETURN;
  8608. return Promise.resolve(sto.updateStore('$', temp));
  8609. };
  8610. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](tanFun)]);
  8611. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$tan', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), 'x', false)], block);
  8612. return func;
  8613. }
  8614. function createSqrtFun() {
  8615. var sqrtFun = function sqrtFun(sto, _) {
  8616. var x = sto.applyStore('x');
  8617. var result = x.value.sqrt();
  8618. if (result.dp() > _util_config__WEBPACK_IMPORTED_MODULE_8__["Config"].decimalPlaces) {
  8619. result = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"](result.toFixed(_util_config__WEBPACK_IMPORTED_MODULE_8__["Config"].decimalPlaces));
  8620. }
  8621. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, result);
  8622. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__["Modes"].RETURN;
  8623. return Promise.resolve(sto.updateStore('$', temp));
  8624. };
  8625. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](sqrtFun)]);
  8626. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$sqrt', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), 'x', false)], block);
  8627. return func;
  8628. }
  8629. function createPowFun() {
  8630. var powFun = function powFun(sto, _) {
  8631. var x = sto.applyStore('x');
  8632. var y = sto.applyStore('y');
  8633. var result = x.value.pow(y.value);
  8634. if (result.dp() > _util_config__WEBPACK_IMPORTED_MODULE_8__["Config"].decimalPlaces) {
  8635. result = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"](result.toFixed(_util_config__WEBPACK_IMPORTED_MODULE_8__["Config"].decimalPlaces));
  8636. }
  8637. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, result);
  8638. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__["Modes"].RETURN;
  8639. return Promise.resolve(sto.updateStore('$', temp));
  8640. };
  8641. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](powFun)]);
  8642. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$pow', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), 'x', false), new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), 'y', false)], block);
  8643. return func;
  8644. }
  8645. function createLogFun() {
  8646. var logFun = function logFun(sto, _) {
  8647. var x = sto.applyStore('x');
  8648. if (x.value.isNegative()) {
  8649. return Promise.reject("the value passed to log function cannot be negative");
  8650. }
  8651. var result = decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"].log10(x.value);
  8652. if (result.dp() > _util_config__WEBPACK_IMPORTED_MODULE_8__["Config"].decimalPlaces) {
  8653. result = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"](result.toFixed(_util_config__WEBPACK_IMPORTED_MODULE_8__["Config"].decimalPlaces));
  8654. }
  8655. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, result);
  8656. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__["Modes"].RETURN;
  8657. return Promise.resolve(sto.updateStore('$', temp));
  8658. };
  8659. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](logFun)]);
  8660. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$log', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), 'x', false)], block);
  8661. return func;
  8662. }
  8663. function createAbsFun() {
  8664. var absFun = function absFun(sto, _) {
  8665. var x = sto.applyStore('x');
  8666. var result = x.value.abs();
  8667. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](x.type, result);
  8668. sto.updateStore('$', temp);
  8669. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__["Modes"].RETURN;
  8670. return Promise.resolve(sto);
  8671. };
  8672. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](absFun)]);
  8673. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$abs', new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), 'x', false)], block);
  8674. return func;
  8675. }
  8676. function createNegateFun() {
  8677. var negateFun = function negateFun(sto, _) {
  8678. var x = sto.applyStore('x');
  8679. var result = x.value.negated();
  8680. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](x.type, result);
  8681. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__["Modes"].RETURN;
  8682. return Promise.resolve(sto.updateStore('$', temp));
  8683. };
  8684. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](negateFun)]);
  8685. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$negate', new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), 'x', false)], block);
  8686. return func;
  8687. }
  8688. function createInvertFun() {
  8689. var invertFun = function invertFun(sto, _) {
  8690. var x = sto.applyStore('x');
  8691. var result = Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__["toReal"])(1).dividedBy(x.value);
  8692. if (result.dp() > _util_config__WEBPACK_IMPORTED_MODULE_8__["Config"].decimalPlaces) {
  8693. result = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"](result.toFixed(_util_config__WEBPACK_IMPORTED_MODULE_8__["Config"].decimalPlaces));
  8694. }
  8695. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, result);
  8696. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__["Modes"].RETURN;
  8697. return Promise.resolve(sto.updateStore('$', temp));
  8698. };
  8699. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](invertFun)]);
  8700. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$invert', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), 'x', false)], block);
  8701. return func;
  8702. }
  8703. function createMaxFun() {
  8704. var maxFun = function maxFun(sto, _) {
  8705. var x = sto.applyStore('x');
  8706. var numbers = x.value.map(function (stoObj) {
  8707. return stoObj.value;
  8708. });
  8709. var result = decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"].max.apply(decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"], _toConsumableArray(numbers));
  8710. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](x.type.innerType, result);
  8711. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__["Modes"].RETURN;
  8712. return Promise.resolve(sto.updateStore('$', temp));
  8713. };
  8714. var paramType = new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_6__["CompoundType"](new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), 1);
  8715. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](maxFun)]);
  8716. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$max', new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](paramType, 'x', false)], block);
  8717. return func;
  8718. }
  8719. function createMinFun() {
  8720. var minFun = function minFun(sto, _) {
  8721. var x = sto.applyStore('x');
  8722. var numbers = x.value.map(function (stoObj) {
  8723. return stoObj.value;
  8724. });
  8725. var result = decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"].min.apply(decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"], _toConsumableArray(numbers));
  8726. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](x.type.innerType, result);
  8727. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__["Modes"].RETURN;
  8728. return Promise.resolve(sto.updateStore('$', temp));
  8729. };
  8730. var paramType = new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_6__["CompoundType"](new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), 1);
  8731. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](minFun)]);
  8732. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$min', new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](paramType, 'x', false)], block);
  8733. return func;
  8734. }
  8735. /***/ }),
  8736. /***/ "./js/processor/lib/strings.js":
  8737. /*!*************************************!*\
  8738. !*** ./js/processor/lib/strings.js ***!
  8739. \*************************************/
  8740. /*! exports provided: createSubstringFun, createLengthFun, createUppercaseFun, createLowercaseFun, createrCharAtFun */
  8741. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8742. "use strict";
  8743. __webpack_require__.r(__webpack_exports__);
  8744. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createSubstringFun", function() { return createSubstringFun; });
  8745. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createLengthFun", function() { return createLengthFun; });
  8746. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createUppercaseFun", function() { return createUppercaseFun; });
  8747. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createLowercaseFun", function() { return createLowercaseFun; });
  8748. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createrCharAtFun", function() { return createrCharAtFun; });
  8749. /* harmony import */ var _store_storeObject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js");
  8750. /* harmony import */ var _ast_commands__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  8751. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  8752. /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  8753. /* harmony import */ var _modes__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../modes */ "./js/processor/modes.js");
  8754. /*
  8755. * substring
  8756. * length
  8757. * uppercase
  8758. * lowercase
  8759. * charAt
  8760. **/
  8761. function createSubstringFun() {
  8762. var substringFun = function substringFun(sto, _) {
  8763. var str = sto.applyStore("str");
  8764. var start = sto.applyStore("start");
  8765. var end = sto.applyStore("end");
  8766. var result = str.value.substring(start.value, end.value);
  8767. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, result);
  8768. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].RETURN;
  8769. return Promise.resolve(sto.updateStore("$", temp));
  8770. };
  8771. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](substringFun)]);
  8772. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$substring', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, 'str', false), new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, 'start', false), new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, 'end', false)], block);
  8773. return func;
  8774. }
  8775. function createLengthFun() {
  8776. var lengthFun = function lengthFun(sto, _) {
  8777. var str = sto.applyStore("str");
  8778. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__["toInt"])(str.value.length));
  8779. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].RETURN;
  8780. return Promise.resolve(sto.updateStore("$", temp));
  8781. };
  8782. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](lengthFun)]);
  8783. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$length', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, 'str', false)], block);
  8784. return func;
  8785. }
  8786. function createUppercaseFun() {
  8787. var uppercaseFun = function uppercaseFun(sto, _) {
  8788. var str = sto.applyStore("str");
  8789. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, str.value.toUpperCase());
  8790. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].RETURN;
  8791. return Promise.resolve(sto.updateStore("$", temp));
  8792. };
  8793. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](uppercaseFun)]);
  8794. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$uppercase', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, 'str', false)], block);
  8795. return func;
  8796. }
  8797. function createLowercaseFun() {
  8798. var lowercaseFun = function lowercaseFun(sto, _) {
  8799. var str = sto.applyStore("str");
  8800. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, str.value.toLowerCase());
  8801. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].RETURN;
  8802. return Promise.resolve(sto.updateStore("$", temp));
  8803. };
  8804. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](lowercaseFun)]);
  8805. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$lowercase', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, 'str', false)], block);
  8806. return func;
  8807. }
  8808. function createrCharAtFun() {
  8809. var charAtFun = function charAtFun(sto, _) {
  8810. var str = sto.applyStore("str");
  8811. var idx = sto.applyStore("index");
  8812. if (idx.value.toNumber() < 0 || idx.value.toNumber() >= str.value.length) {
  8813. return Promise.reject(new Error("invalid string position"));
  8814. }
  8815. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, str.value.charAt(idx.value.toNumber()));
  8816. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].RETURN;
  8817. return Promise.resolve(sto.updateStore("$", temp));
  8818. };
  8819. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](charAtFun)]);
  8820. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$charAt', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, 'str', false), new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, 'index', false)], block);
  8821. return func;
  8822. }
  8823. /***/ }),
  8824. /***/ "./js/processor/modes.js":
  8825. /*!*******************************!*\
  8826. !*** ./js/processor/modes.js ***!
  8827. \*******************************/
  8828. /*! exports provided: Modes */
  8829. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8830. "use strict";
  8831. __webpack_require__.r(__webpack_exports__);
  8832. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Modes", function() { return Modes; });
  8833. var Modes = Object.freeze({
  8834. RETURN: Symbol('mode:return'),
  8835. BREAK: Symbol('mode:break'),
  8836. PAUSE: Symbol('mode:pause'),
  8837. RUN: Symbol('mode:run')
  8838. });
  8839. /***/ }),
  8840. /***/ "./js/processor/semantic/semanticAnalyser.js":
  8841. /*!***************************************************!*\
  8842. !*** ./js/processor/semantic/semanticAnalyser.js ***!
  8843. \***************************************************/
  8844. /*! exports provided: SemanticAnalyser */
  8845. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8846. "use strict";
  8847. __webpack_require__.r(__webpack_exports__);
  8848. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SemanticAnalyser", function() { return SemanticAnalyser; });
  8849. /* harmony import */ var _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./../error/processorErrorFactory */ "./js/processor/error/processorErrorFactory.js");
  8850. /* harmony import */ var _definedFunctions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../definedFunctions */ "./js/processor/definedFunctions.js");
  8851. /* harmony import */ var _services_languageService__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../../services/languageService */ "./js/services/languageService.js");
  8852. /* harmony import */ var _ast_commands__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../ast/commands */ "./js/ast/commands/index.js");
  8853. /* harmony import */ var _ast_expressions__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../ast/expressions */ "./js/ast/expressions/index.js");
  8854. /* harmony import */ var _ast_expressions_literal__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../ast/expressions/literal */ "./js/ast/expressions/literal.js");
  8855. /* harmony import */ var _compatibilityTable__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../compatibilityTable */ "./js/processor/compatibilityTable.js");
  8856. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../typeSystem/types */ "./js/typeSystem/types.js");
  8857. /* harmony import */ var _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  8858. /* harmony import */ var _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../typeSystem/multiType */ "./js/typeSystem/multiType.js");
  8859. /* harmony import */ var _util_config__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../util/config */ "./js/util/config.js");
  8860. /* harmony import */ var _store_store__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../store/store */ "./js/processor/store/store.js");
  8861. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8862. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  8863. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  8864. var SemanticAnalyser =
  8865. /*#__PURE__*/
  8866. function () {
  8867. function SemanticAnalyser(ast) {
  8868. _classCallCheck(this, SemanticAnalyser);
  8869. this.ast = ast;
  8870. this.lexerClass = _services_languageService__WEBPACK_IMPORTED_MODULE_2__["LanguageService"].getCurrentLexer();
  8871. var lexer = new this.lexerClass(null);
  8872. this.literalNames = lexer.literalNames;
  8873. this.symbolMap = null;
  8874. this.currentFunction = null;
  8875. }
  8876. _createClass(SemanticAnalyser, [{
  8877. key: "pushMap",
  8878. value: function pushMap() {
  8879. if (this.symbolMap === null) {
  8880. this.symbolMap = {
  8881. map: {},
  8882. next: null
  8883. };
  8884. } else {
  8885. var n = {
  8886. map: {},
  8887. next: this.symbolMap
  8888. };
  8889. this.symbolMap = n;
  8890. }
  8891. }
  8892. }, {
  8893. key: "popMap",
  8894. value: function popMap() {
  8895. if (this.symbolMap !== null) {
  8896. this.symbolMap = this.symbolMap.next;
  8897. }
  8898. }
  8899. }, {
  8900. key: "insertSymbol",
  8901. value: function insertSymbol(id, typeInfo) {
  8902. this.symbolMap.map[id] = typeInfo;
  8903. }
  8904. }, {
  8905. key: "findSymbol",
  8906. value: function findSymbol(id, symMap) {
  8907. if (!symMap.map[id]) {
  8908. if (symMap.next) {
  8909. return this.findSymbol(id, symMap.next);
  8910. }
  8911. return null;
  8912. } else {
  8913. return symMap.map[id];
  8914. }
  8915. }
  8916. }, {
  8917. key: "getMainFunction",
  8918. value: function getMainFunction() {
  8919. return this.ast.functions.find(function (v) {
  8920. return v.isMain;
  8921. });
  8922. }
  8923. }, {
  8924. key: "findFunction",
  8925. value: function findFunction(name) {
  8926. if (name.match(/^\$.+$/)) {
  8927. var fun = _definedFunctions__WEBPACK_IMPORTED_MODULE_1__["LanguageDefinedFunction"].getFunction(name);
  8928. if (!!!fun) {
  8929. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].not_implemented(name);
  8930. }
  8931. return fun;
  8932. } else {
  8933. var val = this.ast.functions.find(function (v) {
  8934. return v.name === name;
  8935. });
  8936. if (!!!val) {
  8937. return null;
  8938. }
  8939. return val;
  8940. }
  8941. }
  8942. }, {
  8943. key: "analyseTree",
  8944. value: function analyseTree() {
  8945. var globalVars = this.ast.global;
  8946. this.pushMap();
  8947. this.assertDeclarations(globalVars);
  8948. var functions = this.ast.functions;
  8949. var mainFunc = functions.filter(function (f) {
  8950. return f.name === null;
  8951. });
  8952. if (mainFunc.length <= 0) {
  8953. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].main_missing();
  8954. }
  8955. for (var i = 0; i < functions.length; i++) {
  8956. var fun = functions[i];
  8957. this.assertFunction(fun);
  8958. }
  8959. return this.ast;
  8960. }
  8961. }, {
  8962. key: "assertDeclarations",
  8963. value: function assertDeclarations(list) {
  8964. for (var i = 0; i < list.length; i++) {
  8965. this.assertDeclaration(list[i]);
  8966. }
  8967. }
  8968. }, {
  8969. key: "assertDeclaration",
  8970. value: function assertDeclaration(declaration) {
  8971. if (declaration instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_3__["ArrayDeclaration"]) {
  8972. if (declaration.initial === null) {
  8973. var lineType = this.evaluateExpressionType(declaration.lines);
  8974. if (!lineType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].INTEGER)) {
  8975. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].array_dimension_not_int_full(declaration.sourceInfo);
  8976. }
  8977. if (declaration.columns !== null) {
  8978. var columnType = this.evaluateExpressionType(declaration.columns);
  8979. if (!columnType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].INTEGER)) {
  8980. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].array_dimension_not_int_full(declaration.sourceInfo);
  8981. }
  8982. }
  8983. this.insertSymbol(declaration.id, {
  8984. id: declaration.id,
  8985. lines: declaration.lines,
  8986. columns: declaration.columns,
  8987. type: declaration.type
  8988. });
  8989. return;
  8990. }
  8991. this.evaluateArrayLiteral(declaration.id, declaration.lines, declaration.columns, declaration.type, declaration.initial);
  8992. this.insertSymbol(declaration.id, {
  8993. id: declaration.id,
  8994. lines: declaration.lines,
  8995. columns: declaration.columns,
  8996. type: declaration.type
  8997. });
  8998. } else {
  8999. if (declaration.initial === null) {
  9000. this.insertSymbol(declaration.id, {
  9001. id: declaration.id,
  9002. type: declaration.type
  9003. });
  9004. return;
  9005. }
  9006. var resultType = this.evaluateExpressionType(declaration.initial);
  9007. if (resultType instanceof _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_9__["MultiType"]) {
  9008. if (!resultType.isCompatible(declaration.type)) {
  9009. var stringInfo = declaration.type.stringInfo();
  9010. var info = stringInfo[0];
  9011. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].incompatible_types_full(info.type, info.dim, declaration.sourceInfo);
  9012. }
  9013. this.insertSymbol(declaration.id, {
  9014. id: declaration.id,
  9015. type: declaration.type
  9016. });
  9017. } else if (!declaration.type.isCompatible(resultType) && !_util_config__WEBPACK_IMPORTED_MODULE_10__["Config"].enable_type_casting || !declaration.type.isCompatible(resultType) && _util_config__WEBPACK_IMPORTED_MODULE_10__["Config"].enable_type_casting && !_store_store__WEBPACK_IMPORTED_MODULE_11__["Store"].canImplicitTypeCast(declaration.type, resultType)) {
  9018. var _stringInfo = declaration.type.stringInfo();
  9019. var _info = _stringInfo[0];
  9020. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].incompatible_types_full(_info.type, _info.dim, declaration.sourceInfo);
  9021. } else {
  9022. this.insertSymbol(declaration.id, {
  9023. id: declaration.id,
  9024. type: declaration.type
  9025. });
  9026. }
  9027. }
  9028. }
  9029. }, {
  9030. key: "evaluateExpressionType",
  9031. value: function evaluateExpressionType(expression) {
  9032. if (expression instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_4__["UnaryApp"]) {
  9033. var op = expression.op;
  9034. var resultType = this.evaluateExpressionType(expression.left);
  9035. return Object(_compatibilityTable__WEBPACK_IMPORTED_MODULE_6__["resultTypeAfterUnaryOp"])(op, resultType);
  9036. } else if (expression instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_4__["InfixApp"]) {
  9037. var _op = expression.op;
  9038. var resultTypeLeft = this.evaluateExpressionType(expression.left);
  9039. var resultTypeRight = this.evaluateExpressionType(expression.right);
  9040. return Object(_compatibilityTable__WEBPACK_IMPORTED_MODULE_6__["resultTypeAfterInfixOp"])(_op, resultTypeLeft, resultTypeRight);
  9041. } else if (expression instanceof _ast_expressions_literal__WEBPACK_IMPORTED_MODULE_5__["Literal"]) {
  9042. return this.evaluateLiteralType(expression);
  9043. } else if (expression instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_4__["FunctionCall"]) {
  9044. if (expression.isMainCall) {
  9045. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].void_in_expression_full(_definedFunctions__WEBPACK_IMPORTED_MODULE_1__["LanguageDefinedFunction"].getMainFunctionName(), expression.sourceInfo);
  9046. }
  9047. var fun = this.findFunction(expression.id);
  9048. if (fun === null) {
  9049. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].function_missing_full(expression.id, expression.sourceInfo);
  9050. }
  9051. if (fun.returnType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].VOID)) {
  9052. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].void_in_expression_full(expression.id, expression.sourceInfo);
  9053. }
  9054. this.assertParameters(fun, expression.actualParameters);
  9055. return fun.returnType;
  9056. } else if (expression instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_4__["ArrayAccess"]) {
  9057. var arrayTypeInfo = this.findSymbol(expression.id, this.symbolMap);
  9058. if (arrayTypeInfo === null) {
  9059. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].symbol_not_found_full(expression.id, expression.sourceInfo);
  9060. }
  9061. if (!(arrayTypeInfo.type instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_8__["CompoundType"])) {
  9062. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].invalid_array_access_full(expression.id, expression.sourceInfo);
  9063. }
  9064. var lineType = this.evaluateExpressionType(expression.line);
  9065. if (!lineType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].INTEGER)) {
  9066. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].array_dimension_not_int_full(expression.sourceInfo);
  9067. }
  9068. if (expression.column !== null) {
  9069. if (arrayTypeInfo.columns === null) {
  9070. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].invalid_matrix_access_full(expression.id, expression.sourceInfo);
  9071. }
  9072. var columnType = this.evaluateExpressionType(expression.column);
  9073. if (!columnType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].INTEGER)) {
  9074. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].array_dimension_not_int_full(expression.sourceInfo);
  9075. }
  9076. }
  9077. var arrType = arrayTypeInfo.type;
  9078. if (expression.column !== null) {
  9079. // indexing matrix
  9080. return arrType.innerType;
  9081. } else {
  9082. if (arrayTypeInfo.columns === null) {
  9083. return arrType.innerType;
  9084. }
  9085. return new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_8__["CompoundType"](arrType.innerType, 1);
  9086. }
  9087. }
  9088. }
  9089. }, {
  9090. key: "evaluateLiteralType",
  9091. value: function evaluateLiteralType(literal) {
  9092. if (literal instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_4__["IntLiteral"]) {
  9093. return literal.type;
  9094. } else if (literal instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_4__["RealLiteral"]) {
  9095. return literal.type;
  9096. } else if (literal instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_4__["StringLiteral"]) {
  9097. return literal.type;
  9098. } else if (literal instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_4__["BoolLiteral"]) {
  9099. return literal.type;
  9100. } else if (literal instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_4__["VariableLiteral"]) {
  9101. var typeInfo = this.findSymbol(literal.id, this.symbolMap);
  9102. if (typeInfo === null) {
  9103. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].symbol_not_found_full(literal.id, literal.sourceInfo);
  9104. }
  9105. if (typeInfo.type instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_8__["CompoundType"]) {
  9106. return typeInfo.type;
  9107. }
  9108. return typeInfo.type;
  9109. } else {
  9110. console.warn("Evaluating type only for an array literal...");
  9111. var last = null;
  9112. if (literal.value.length === 1) {
  9113. last = this.evaluateExpressionType(literal.value[0]);
  9114. } else {
  9115. for (var i = 0; i < literal.value.length; i++) {
  9116. var e = this.evaluateExpressionType(literal.value[i]);
  9117. if (last === null) {
  9118. last = e;
  9119. } else if (!last.isCompatible(e)) {
  9120. var strInfo = last.stringInfo();
  9121. var info = strInfo[0];
  9122. var strExp = literal.toString();
  9123. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].incompatible_types_array_full(strExp, info.type, info.dim, literal.sourceInfo);
  9124. }
  9125. }
  9126. }
  9127. if (last instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_8__["CompoundType"]) {
  9128. return new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_8__["CompoundType"](last.innerType, last.dimensions + 1);
  9129. }
  9130. return new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_8__["CompoundType"](last, 1);
  9131. }
  9132. }
  9133. }, {
  9134. key: "evaluateArrayLiteral",
  9135. value: function evaluateArrayLiteral(id, lines, columns, type, literal) {
  9136. /* if (literal instanceof ArrayLiteral) {
  9137. const dimType = this.evaluateExpressionType(lines);
  9138. if (!dimType.isCompatible(Types.INTEGER)) {
  9139. throw ProcessorErrorFactory.array_dimension_not_int_full(literal.sourceInfo);
  9140. }
  9141. if ((lines instanceof IntLiteral)) {
  9142. if (!lines.value.eq(literal.value.length)) {
  9143. if(type.dimensions > 1) {
  9144. throw ProcessorErrorFactory.matrix_line_outbounds_full(id, literal.value.length, lines.value.toNumber(), literal.sourceInfo)
  9145. } else {
  9146. throw ProcessorErrorFactory.vector_line_outbounds_full(id, literal.value.length, lines.value.toNumber(), literal.sourceInfo)
  9147. }
  9148. } else if (lines.value.isNeg()) {
  9149. throw ProcessorErrorFactory.array_dimension_not_positive_full(literal.sourceInfo);
  9150. }
  9151. }
  9152. if (columns === null) {
  9153. // it's a vector...
  9154. literal.value.reduce((last, next) => {
  9155. const eType = this.evaluateExpressionType(next);
  9156. if (!last.canAccept(eType)) {
  9157. const strInfo = last.stringInfo();
  9158. const info = strInfo[0];
  9159. const strExp = literal.toString();
  9160. throw ProcessorErrorFactory.incompatible_types_array_full(strExp,info.type, info.dim, literal.sourceInfo);
  9161. }
  9162. return last;
  9163. }, type);
  9164. return true;
  9165. } else {
  9166. const dimType = this.evaluateExpressionType(columns);
  9167. if (!dimType.isCompatible(Types.INTEGER)) {
  9168. throw ProcessorErrorFactory.array_dimension_not_int_full(literal.sourceInfo);
  9169. }
  9170. if ((columns instanceof IntLiteral)) {
  9171. const columnValue = literal.value[0].value.length;
  9172. if (!columns.value.eq(columnValue)) {
  9173. if(type.dimensions > 1) {
  9174. throw ProcessorErrorFactory.matrix_column_outbounds_full(id, literal.value.length, columns.value.toNumber(), literal.sourceInfo)
  9175. } else {
  9176. throw ProcessorErrorFactory.invalid_matrix_access_full(id, literal.sourceInfo);
  9177. }
  9178. } else if (columns.value.isNeg()) {
  9179. throw ProcessorErrorFactory.array_dimension_not_positive_full(literal.sourceInfo);
  9180. }
  9181. for (let i = 0; i < columns; i++) {
  9182. const anotherArray = literal.value[i];
  9183. this.evaluateArrayLiteral(id, columns, null, type, anotherArray)
  9184. }
  9185. }
  9186. }
  9187. } else {
  9188. const resultType = this.evaluateExpressionType(literal);
  9189. if (!(resultType instanceof CompoundType)) {
  9190. const strInfo = type.stringInfo();
  9191. const info = strInfo[0];
  9192. const strExp = literal.toString();
  9193. throw ProcessorErrorFactory.incompatible_types_array_full(strExp,info.type, info.dim, literal.sourceInfo);
  9194. }
  9195. if (!type.isCompatible(resultType)) {
  9196. const strInfo = type.stringInfo();
  9197. const info = strInfo[0];
  9198. const strExp = literal.toString();
  9199. throw ProcessorErrorFactory.incompatible_types_array_full(strExp,info.type, info.dim, literal.sourceInfo);
  9200. }
  9201. return true;
  9202. } */
  9203. return true;
  9204. }
  9205. }, {
  9206. key: "assertFunction",
  9207. value: function assertFunction(fun) {
  9208. var _this = this;
  9209. this.pushMap();
  9210. this.currentFunction = fun;
  9211. fun.formalParameters.forEach(function (formalParam) {
  9212. if (formalParam.type instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_8__["CompoundType"]) {
  9213. if (formalParam.type.dimensions > 1) {
  9214. _this.insertSymbol(formalParam.id, {
  9215. id: formalParam.id,
  9216. lines: -1,
  9217. columns: -1,
  9218. type: formalParam.type
  9219. });
  9220. } else {
  9221. _this.insertSymbol(formalParam.id, {
  9222. id: formalParam.id,
  9223. lines: -1,
  9224. columns: null,
  9225. type: formalParam.type
  9226. });
  9227. }
  9228. } else {
  9229. _this.insertSymbol(formalParam.id, {
  9230. id: formalParam.id,
  9231. type: formalParam.type
  9232. });
  9233. }
  9234. });
  9235. this.assertDeclarations(fun.variablesDeclarations);
  9236. var optional = fun.returnType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].VOID);
  9237. var valid = this.assertReturn(fun, optional);
  9238. if (!valid) {
  9239. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].function_no_return(fun.name);
  9240. }
  9241. this.popMap();
  9242. }
  9243. }, {
  9244. key: "assertReturn",
  9245. value: function assertReturn(fun, optional) {
  9246. var _this2 = this;
  9247. return fun.commands.reduce(function (last, next) {
  9248. return _this2.checkCommand(fun.returnType, next, optional) || last;
  9249. }, optional);
  9250. }
  9251. }, {
  9252. key: "checkCommand",
  9253. value: function checkCommand(type, cmd, optional) {
  9254. if (cmd instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_3__["While"]) {
  9255. var resultType = this.evaluateExpressionType(cmd.expression);
  9256. if (!resultType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].BOOLEAN)) {
  9257. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].loop_condition_type_full(cmd.expression.toString(), cmd.sourceInfo);
  9258. }
  9259. this.checkCommands(type, cmd.commands, optional);
  9260. return false;
  9261. } else if (cmd instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_3__["For"]) {
  9262. this.checkCommand(type, cmd.assignment, optional);
  9263. var _resultType = this.evaluateExpressionType(cmd.condition);
  9264. if (!_resultType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].BOOLEAN)) {
  9265. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].for_condition_type_full(cmd.condition.toString(), cmd.sourceInfo);
  9266. }
  9267. this.checkCommand(type, cmd.increment, optional);
  9268. this.checkCommands(type, cmd.commands, optional);
  9269. return false;
  9270. } else if (cmd instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_3__["Switch"]) {
  9271. var sType = this.evaluateExpressionType(cmd.expression);
  9272. var result = optional;
  9273. var hasDefault = false;
  9274. for (var i = 0; i < cmd.cases.length; i++) {
  9275. var aCase = cmd.cases[i];
  9276. if (aCase.expression !== null) {
  9277. var caseType = this.evaluateExpressionType(aCase.expression);
  9278. if (!sType.isCompatible(caseType)) {
  9279. var strInfo = sType.stringInfo();
  9280. var info = strInfo[0];
  9281. var strExp = aCase.expression.toString();
  9282. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].invalid_case_type_full(strExp, info.type, info.dim, aCase.sourceInfo);
  9283. }
  9284. } else {
  9285. hasDefault = true;
  9286. }
  9287. result = result && this.checkCommands(type, aCase.commands, result);
  9288. }
  9289. return result && hasDefault;
  9290. } else if (cmd instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_3__["ArrayIndexAssign"]) {
  9291. var typeInfo = this.findSymbol(cmd.id, this.symbolMap);
  9292. if (typeInfo === null) {
  9293. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].symbol_not_found_full(cmd.id, cmd.sourceInfo);
  9294. }
  9295. if (!(typeInfo.type instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_8__["CompoundType"])) {
  9296. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].invalid_array_access_full(cmd.id, cmd.sourceInfo);
  9297. }
  9298. var exp = cmd.expression;
  9299. var lineExp = cmd.line;
  9300. var lineType = this.evaluateExpressionType(lineExp);
  9301. if (!lineType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].INTEGER)) {
  9302. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].array_dimension_not_int_full(cmd.sourceInfo);
  9303. }
  9304. var columnExp = cmd.column;
  9305. if (typeInfo.columns === null && columnExp !== null) {
  9306. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].invalid_matrix_access_full(cmd.id, cmd.sourceInfo);
  9307. } else if (columnExp !== null) {
  9308. var columnType = this.evaluateExpressionType(columnExp);
  9309. if (!columnType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].INTEGER)) {
  9310. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].array_dimension_not_int_full(cmd.sourceInfo);
  9311. }
  9312. } // exp can be a arrayLiteral, a single value exp or an array access
  9313. if (exp instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_4__["ArrayLiteral"]) {
  9314. this.evaluateArrayLiteral(cmd.id, typeInfo.lines, columnExp ? typeInfo.columns : null, typeInfo.type, exp);
  9315. } else {// cannot properly evaluate since type system is poorly constructed
  9316. }
  9317. return optional;
  9318. } else if (cmd instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_3__["Assign"]) {
  9319. var _typeInfo = this.findSymbol(cmd.id, this.symbolMap);
  9320. if (_typeInfo === null) {
  9321. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].symbol_not_found_full(cmd.id, cmd.sourceInfo);
  9322. }
  9323. var _exp = cmd.expression;
  9324. if (_exp instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_4__["ArrayLiteral"]) {
  9325. if (!(_typeInfo.type instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_8__["CompoundType"])) {
  9326. var stringInfo = _typeInfo.type.stringInfo();
  9327. var _info2 = stringInfo[0];
  9328. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].incompatible_types_full(_info2.type, _info2.dim, cmd.sourceInfo);
  9329. }
  9330. this.evaluateArrayLiteral(cmd.id, _typeInfo.lines, _typeInfo.columns, _typeInfo.type, _exp);
  9331. } else {
  9332. var _resultType2 = this.evaluateExpressionType(_exp);
  9333. if (!_resultType2.isCompatible(_typeInfo.type) && !_util_config__WEBPACK_IMPORTED_MODULE_10__["Config"].enable_type_casting || !_resultType2.isCompatible(_typeInfo.type) && _util_config__WEBPACK_IMPORTED_MODULE_10__["Config"].enable_type_casting && !_store_store__WEBPACK_IMPORTED_MODULE_11__["Store"].canImplicitTypeCast(_typeInfo.type, _resultType2)) {
  9334. var _stringInfo2 = _typeInfo.type.stringInfo();
  9335. var _info3 = _stringInfo2[0];
  9336. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].incompatible_types_full(_info3.type, _info3.dim, cmd.sourceInfo);
  9337. }
  9338. }
  9339. return optional;
  9340. } else if (cmd instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_3__["Break"]) {
  9341. return optional;
  9342. } else if (cmd instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_3__["IfThenElse"]) {
  9343. var _resultType3 = this.evaluateExpressionType(cmd.condition);
  9344. if (!_resultType3.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].BOOLEAN)) {
  9345. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].if_condition_type_full(cmd.condition.toString(), cmd.sourceInfo);
  9346. }
  9347. if (cmd.ifFalse instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_3__["IfThenElse"]) {
  9348. return this.checkCommands(type, cmd.ifTrue.commands, optional) && this.checkCommand(type, cmd.ifFalse, optional);
  9349. } else {
  9350. return this.checkCommands(type, cmd.ifTrue.commands, optional) && this.checkCommands(type, cmd.ifFalse.commands, optional);
  9351. }
  9352. } else if (cmd instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_4__["FunctionCall"]) {
  9353. var fun = null;
  9354. if (cmd.isMainCall) {
  9355. fun = this.getMainFunction();
  9356. } else {
  9357. fun = this.findFunction(cmd.id);
  9358. }
  9359. if (fun === null) {
  9360. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].function_missing_full(cmd.id, cmd.sourceInfo);
  9361. }
  9362. this.assertParameters(fun, cmd.actualParameters);
  9363. return optional;
  9364. } else if (cmd instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_3__["Return"]) {
  9365. var funcName = this.currentFunction.isMain ? _definedFunctions__WEBPACK_IMPORTED_MODULE_1__["LanguageDefinedFunction"].getMainFunctionName() : this.currentFunction.name;
  9366. if (cmd.expression === null && !type.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].VOID)) {
  9367. var _stringInfo3 = type.stringInfo();
  9368. var _info4 = _stringInfo3[0];
  9369. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].invalid_void_return_full(funcName, _info4.type, _info4.dim, cmd.sourceInfo);
  9370. } else if (cmd.expression !== null) {
  9371. var _resultType4 = this.evaluateExpressionType(cmd.expression);
  9372. if (!type.isCompatible(_resultType4)) {
  9373. var _stringInfo4 = type.stringInfo();
  9374. var _info5 = _stringInfo4[0];
  9375. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].invalid_return_type_full(funcName, _info5.type, _info5.dim, cmd.sourceInfo);
  9376. } else {
  9377. return true;
  9378. }
  9379. } else {
  9380. return true;
  9381. }
  9382. }
  9383. }
  9384. }, {
  9385. key: "checkCommands",
  9386. value: function checkCommands(type, cmds, optional) {
  9387. var _this3 = this;
  9388. return cmds.reduce(function (last, next) {
  9389. return _this3.checkCommand(type, next, optional) || last;
  9390. }, optional);
  9391. }
  9392. }, {
  9393. key: "assertParameters",
  9394. value: function assertParameters(fun, actualParametersList) {
  9395. if (fun.formalParameters.length !== actualParametersList.length) {
  9396. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].invalid_parameters_size_full(fun.name, actualParametersList.length, fun.formalParameters.length, null);
  9397. }
  9398. for (var i = 0; i < actualParametersList.length; i++) {
  9399. var param = actualParametersList[i];
  9400. var formalParam = fun.formalParameters[i];
  9401. var id = formalParam.id;
  9402. if (formalParam.byRef) {
  9403. if (!(param instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_4__["VariableLiteral"] || param instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_4__["ArrayAccess"])) {
  9404. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].invalid_parameter_type_full(id, param.toString(), param.sourceInfo);
  9405. }
  9406. }
  9407. var resultType = this.evaluateExpressionType(param);
  9408. if (resultType instanceof _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_9__["MultiType"] && formalParam.type instanceof _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_9__["MultiType"]) {
  9409. var shared = 0;
  9410. for (var j = 0; j < resultType.types.length; j++) {
  9411. var element = resultType.types[j];
  9412. if (formalParam.type.types.indexOf(element) !== -1) {
  9413. shared++;
  9414. }
  9415. }
  9416. if (shared <= 0) {
  9417. if (_util_config__WEBPACK_IMPORTED_MODULE_10__["Config"].enable_type_casting && !formalParam.byRef) {
  9418. if (resultType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].INTEGER) || resultType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].REAL)) {
  9419. if (formalParam.type.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].INTEGER) || formalParam.type.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].REAL)) {
  9420. continue;
  9421. }
  9422. }
  9423. }
  9424. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].invalid_parameter_type_full(id, param.toString(), param.sourceInfo);
  9425. }
  9426. } else if (resultType instanceof _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_9__["MultiType"]) {
  9427. if (!resultType.isCompatible(formalParam.type)) {
  9428. if (_util_config__WEBPACK_IMPORTED_MODULE_10__["Config"].enable_type_casting && !formalParam.byRef) {
  9429. if (resultType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].INTEGER) || resultType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].REAL)) {
  9430. if (formalParam.type.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].INTEGER) || formalParam.type.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].REAL)) {
  9431. continue;
  9432. }
  9433. }
  9434. }
  9435. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].invalid_parameter_type_full(id, param.toString(), param.sourceInfo);
  9436. }
  9437. } else if (!formalParam.type.isCompatible(resultType)) {
  9438. if (_util_config__WEBPACK_IMPORTED_MODULE_10__["Config"].enable_type_casting && !formalParam.byRef) {
  9439. if (_store_store__WEBPACK_IMPORTED_MODULE_11__["Store"].canImplicitTypeCast(formalParam.type, resultType)) {
  9440. continue;
  9441. }
  9442. }
  9443. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].invalid_parameter_type_full(id, param.toString(), param.sourceInfo);
  9444. }
  9445. }
  9446. }
  9447. }]);
  9448. return SemanticAnalyser;
  9449. }();
  9450. /***/ }),
  9451. /***/ "./js/processor/store/store.js":
  9452. /*!*************************************!*\
  9453. !*** ./js/processor/store/store.js ***!
  9454. \*************************************/
  9455. /*! exports provided: Store */
  9456. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  9457. "use strict";
  9458. __webpack_require__.r(__webpack_exports__);
  9459. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Store", function() { return Store; });
  9460. /* harmony import */ var _modes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./../modes */ "./js/processor/modes.js");
  9461. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  9462. /* harmony import */ var _storeObject__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  9463. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9464. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  9465. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  9466. var Store =
  9467. /*#__PURE__*/
  9468. function () {
  9469. _createClass(Store, null, [{
  9470. key: "canImplicitTypeCast",
  9471. value: function canImplicitTypeCast(castType, sourceType) {
  9472. if (castType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) || castType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL)) {
  9473. if (sourceType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) || sourceType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL)) {
  9474. return true;
  9475. }
  9476. }
  9477. return false;
  9478. }
  9479. }, {
  9480. key: "doImplicitCasting",
  9481. value: function doImplicitCasting(castType, stoObj) {
  9482. if (!Store.canImplicitTypeCast(castType, stoObj.type)) {
  9483. throw new Error("!!!Critical error: attempted to type cast invalid types");
  9484. }
  9485. if (castType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER)) {
  9486. return new _storeObject__WEBPACK_IMPORTED_MODULE_2__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER, stoObj.value.trunc());
  9487. } else {
  9488. return new _storeObject__WEBPACK_IMPORTED_MODULE_2__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL, stoObj.value);
  9489. }
  9490. }
  9491. }]);
  9492. function Store(name) {
  9493. _classCallCheck(this, Store);
  9494. this.name = name;
  9495. this.store = {};
  9496. this.nextStore = null;
  9497. this.mode = _modes__WEBPACK_IMPORTED_MODULE_0__["Modes"].RUN;
  9498. }
  9499. _createClass(Store, [{
  9500. key: "extendStore",
  9501. value: function extendStore(nextStore) {
  9502. this.nextStore = nextStore;
  9503. }
  9504. }, {
  9505. key: "applyStore",
  9506. value: function applyStore(id) {
  9507. if (!this.store[id]) {
  9508. if (this.nextStore !== null) {
  9509. return this.nextStore.applyStore(id);
  9510. } else {
  9511. throw new Error("Variable ".concat(id, " not found."));
  9512. }
  9513. }
  9514. var val = this.store[id];
  9515. if (val.isRef) {
  9516. return val.getRefObj();
  9517. }
  9518. return this.store[id];
  9519. }
  9520. }, {
  9521. key: "updateStore",
  9522. value: function updateStore(id, stoObj) {
  9523. if (!this.store[id]) {
  9524. if (this.nextStore !== null) {
  9525. this.nextStore.updateStore(id, stoObj);
  9526. return this;
  9527. } else {
  9528. // TODO: better error message
  9529. throw new Error("Variable ".concat(id, " not found."));
  9530. }
  9531. } else {
  9532. var oldObj = this.store[id];
  9533. if (oldObj.readOnly) {
  9534. // TODO: better error message
  9535. throw new Error("Cannot change value of a read only variable: " + id);
  9536. }
  9537. if (oldObj.isRef) {
  9538. oldObj.updateRef(stoObj);
  9539. return this;
  9540. } else if (oldObj.isCompatible(stoObj)) {
  9541. stoObj.setID(id);
  9542. this.store[id] = Object.freeze(stoObj);
  9543. return this;
  9544. } else {
  9545. var oldType = oldObj.type;
  9546. var stoType = stoObj.type; // TODO: better error message
  9547. throw new Error("".concat(oldType, " is not compatible with type ").concat(stoType, " given"));
  9548. }
  9549. }
  9550. } //In case of future use of ref, it needs to have a special function to update the storeRefObject
  9551. // and no the StoreObject refferenced by it
  9552. // updateStoreRef(id, stoObjAddress) {...}
  9553. }, {
  9554. key: "insertStore",
  9555. value: function insertStore(id, stoObj) {
  9556. if (this.store[id]) {
  9557. // TODO: better error message
  9558. throw new Error("".concat(id, " is already defined"));
  9559. }
  9560. stoObj.setID(id);
  9561. this.store[id] = Object.freeze(stoObj);
  9562. return this;
  9563. }
  9564. }]);
  9565. return Store;
  9566. }();
  9567. /***/ }),
  9568. /***/ "./js/processor/store/storeObject.js":
  9569. /*!*******************************************!*\
  9570. !*** ./js/processor/store/storeObject.js ***!
  9571. \*******************************************/
  9572. /*! exports provided: StoreObject */
  9573. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  9574. "use strict";
  9575. __webpack_require__.r(__webpack_exports__);
  9576. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StoreObject", function() { return StoreObject; });
  9577. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  9578. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(decimal_js__WEBPACK_IMPORTED_MODULE_0__);
  9579. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9580. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  9581. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  9582. var StoreObject =
  9583. /*#__PURE__*/
  9584. function () {
  9585. function StoreObject(type, value) {
  9586. var readOnly = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  9587. _classCallCheck(this, StoreObject);
  9588. this._type = type;
  9589. this._value = value;
  9590. this._readOnly = readOnly;
  9591. this._id = null;
  9592. }
  9593. _createClass(StoreObject, [{
  9594. key: "setID",
  9595. value: function setID(id) {
  9596. this._id = id;
  9597. }
  9598. }, {
  9599. key: "isCompatible",
  9600. value: function isCompatible(another) {
  9601. if (another instanceof StoreObject) {
  9602. return this.type.isCompatible(another.type);
  9603. }
  9604. return false;
  9605. }
  9606. }, {
  9607. key: "id",
  9608. get: function get() {
  9609. return this._id;
  9610. }
  9611. }, {
  9612. key: "inStore",
  9613. get: function get() {
  9614. return this.id !== null;
  9615. }
  9616. }, {
  9617. key: "type",
  9618. get: function get() {
  9619. return this._type;
  9620. }
  9621. }, {
  9622. key: "value",
  9623. get: function get() {
  9624. return this._value;
  9625. }
  9626. }, {
  9627. key: "number",
  9628. get: function get() {
  9629. if (this._value instanceof decimal_js__WEBPACK_IMPORTED_MODULE_0___default.a) {
  9630. return this._value.toNumber();
  9631. } else {
  9632. return null;
  9633. }
  9634. }
  9635. }, {
  9636. key: "readOnly",
  9637. get: function get() {
  9638. return this._readOnly;
  9639. },
  9640. set: function set(value) {
  9641. this._readOnly = value;
  9642. }
  9643. }]);
  9644. return StoreObject;
  9645. }();
  9646. /***/ }),
  9647. /***/ "./js/processor/store/storeObjectArray.js":
  9648. /*!************************************************!*\
  9649. !*** ./js/processor/store/storeObjectArray.js ***!
  9650. \************************************************/
  9651. /*! exports provided: StoreObjectArray */
  9652. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  9653. "use strict";
  9654. __webpack_require__.r(__webpack_exports__);
  9655. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StoreObjectArray", function() { return StoreObjectArray; });
  9656. /* harmony import */ var _storeObject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  9657. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  9658. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9659. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  9660. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  9661. function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); }
  9662. function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
  9663. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  9664. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  9665. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  9666. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  9667. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  9668. var StoreObjectArray =
  9669. /*#__PURE__*/
  9670. function (_StoreObject) {
  9671. _inherits(StoreObjectArray, _StoreObject);
  9672. _createClass(StoreObjectArray, null, [{
  9673. key: "WRONG_LINE_NUMBER",
  9674. get: function get() {
  9675. return 1;
  9676. }
  9677. }, {
  9678. key: "WRONG_TYPE",
  9679. get: function get() {
  9680. return 2;
  9681. }
  9682. }, {
  9683. key: "WRONG_COLUMN_NUMBER",
  9684. get: function get() {
  9685. return 3;
  9686. }
  9687. }]);
  9688. function StoreObjectArray(type, lines, columns) {
  9689. var _this;
  9690. var value = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  9691. var readOnly = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  9692. _classCallCheck(this, StoreObjectArray);
  9693. _this = _possibleConstructorReturn(this, _getPrototypeOf(StoreObjectArray).call(this, type, value, readOnly));
  9694. _this._lines = lines;
  9695. _this._columns = columns;
  9696. return _this;
  9697. }
  9698. _createClass(StoreObjectArray, [{
  9699. key: "isCompatible",
  9700. value: function isCompatible(another) {
  9701. if (another instanceof _storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"]) {
  9702. if (this.lines === -1 && another.lines > 0 || this.lines === another.lines) {
  9703. if (this.columns === -1 && another.columns > 0 || this.columns === another.columns) {
  9704. return _get(_getPrototypeOf(StoreObjectArray.prototype), "isCompatible", this).call(this, another);
  9705. }
  9706. }
  9707. }
  9708. return false;
  9709. }
  9710. }, {
  9711. key: "lines",
  9712. get: function get() {
  9713. return this._lines;
  9714. }
  9715. }, {
  9716. key: "columns",
  9717. get: function get() {
  9718. return this._columns;
  9719. }
  9720. }, {
  9721. key: "isVector",
  9722. get: function get() {
  9723. return this.type.dimensions === 1;
  9724. }
  9725. }, {
  9726. key: "isValid",
  9727. get: function get() {
  9728. var _this2 = this;
  9729. if (this.value !== null) {
  9730. if (this.isVector) {
  9731. if (this.value.length !== this.lines) {
  9732. return [StoreObjectArray.WRONG_LINE_NUMBER, this.value.length];
  9733. ;
  9734. }
  9735. var mustBeNull = this.value.find(function (v) {
  9736. return !_this2.type.canAccept(v.type);
  9737. });
  9738. if (!!mustBeNull) {
  9739. return [StoreObjectArray.WRONG_TYPE, this.value.indexOf(mustBeNull)];
  9740. ;
  9741. }
  9742. }
  9743. return [];
  9744. } else {
  9745. if (this.lines !== this.value.length) {
  9746. return [StoreObjectArray.WRONG_LINE_NUMBER, this.value.length];
  9747. }
  9748. for (var i = 0; i < this.lines; i++) {
  9749. for (var j = 0; j < this.columns; j++) {
  9750. var arr = this.value[i];
  9751. if (arr.length !== this.columns) {
  9752. return [StoreObjectArray.WRONG_COLUMN_NUMBER, arr.length];
  9753. }
  9754. var _mustBeNull = arr.find(function (v) {
  9755. return !_this2.type.canAccept(v.type);
  9756. });
  9757. if (!!_mustBeNull) {
  9758. return [StoreObjectArray.WRONG_TYPE, i, arr.indexOf(_mustBeNull)];
  9759. }
  9760. }
  9761. }
  9762. return [];
  9763. }
  9764. }
  9765. }]);
  9766. return StoreObjectArray;
  9767. }(_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"]);
  9768. /***/ }),
  9769. /***/ "./js/processor/store/storeObjectArrayAddress.js":
  9770. /*!*******************************************************!*\
  9771. !*** ./js/processor/store/storeObjectArrayAddress.js ***!
  9772. \*******************************************************/
  9773. /*! exports provided: StoreObjectArrayAddress */
  9774. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  9775. "use strict";
  9776. __webpack_require__.r(__webpack_exports__);
  9777. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StoreObjectArrayAddress", function() { return StoreObjectArrayAddress; });
  9778. /* harmony import */ var _storeObject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  9779. /* harmony import */ var _storeObjectArray__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./storeObjectArray */ "./js/processor/store/storeObjectArray.js");
  9780. /* harmony import */ var _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  9781. /* harmony import */ var _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../error/processorErrorFactory */ "./js/processor/error/processorErrorFactory.js");
  9782. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  9783. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9784. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  9785. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  9786. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  9787. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  9788. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  9789. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  9790. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  9791. var StoreObjectArrayAddress =
  9792. /*#__PURE__*/
  9793. function (_StoreObject) {
  9794. _inherits(StoreObjectArrayAddress, _StoreObject);
  9795. function StoreObjectArrayAddress(refID, line, column, store) {
  9796. var _this;
  9797. _classCallCheck(this, StoreObjectArrayAddress);
  9798. _this = _possibleConstructorReturn(this, _getPrototypeOf(StoreObjectArrayAddress).call(this, null, null, false));
  9799. _this.refID = refID;
  9800. _this.store = store;
  9801. _this.line = line;
  9802. _this.column = column;
  9803. return _this;
  9804. }
  9805. _createClass(StoreObjectArrayAddress, [{
  9806. key: "getArrayObject",
  9807. value: function getArrayObject() {
  9808. return this.store.applyStore(this.refID);
  9809. }
  9810. }, {
  9811. key: "updateArrayObject",
  9812. value: function updateArrayObject(stoObj) {
  9813. var anArray = this.getArrayObject();
  9814. var newArray = Object.assign(new _storeObjectArray__WEBPACK_IMPORTED_MODULE_1__["StoreObjectArray"](null, null, null), anArray);
  9815. if (!stoObj.type.isCompatible(this.type)) {
  9816. throw new Error("Invalid operation: cannot assign the value given to ".concat(this.refID));
  9817. } else if (this.type instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_2__["CompoundType"] && this.type.canAccept(stoObj.type)) {
  9818. throw new Error("Invalid operation: cannot assign the value given to ".concat(this.refID));
  9819. }
  9820. if (this.column !== null) {
  9821. newArray.value[this.line].value[this.column] = stoObj;
  9822. return newArray;
  9823. } else {
  9824. newArray.value[this.line] = stoObj;
  9825. return newArray;
  9826. }
  9827. }
  9828. }, {
  9829. key: "isCompatible",
  9830. value: function isCompatible(another) {
  9831. if (this.type.isCompatible(another.type)) {
  9832. if (another.type instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_2__["CompoundType"]) {
  9833. return this.lines === another.lines && this.columns === another.columns;
  9834. } else {
  9835. this.refValue.isCompatible(another);
  9836. }
  9837. }
  9838. }
  9839. }, {
  9840. key: "isRef",
  9841. get: function get() {
  9842. return false;
  9843. }
  9844. }, {
  9845. key: "inStore",
  9846. get: function get() {
  9847. return true;
  9848. }
  9849. }, {
  9850. key: "refValue",
  9851. get: function get() {
  9852. var refLine = this.store.applyStore(this.refID).value[this.line];
  9853. if (!refLine) {
  9854. if (this.getArrayObject().isVector) {
  9855. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_3__["ProcessorErrorFactory"].vector_line_outbounds(this.refID, this.line, this.getArrayObject().lines);
  9856. } else {
  9857. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_3__["ProcessorErrorFactory"].matrix_line_outbounds(this.refID, this.line, this.getArrayObject().lines);
  9858. }
  9859. }
  9860. if (this.column !== null) {
  9861. var refColumn = refLine.value[this.column];
  9862. if (!refColumn) {
  9863. if (this.getArrayObject().isVector) {
  9864. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_3__["ProcessorErrorFactory"].vector_not_matrix(this.refID);
  9865. } else {
  9866. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_3__["ProcessorErrorFactory"].matrix_column_outbounds(this.refID, this.column, this.getArrayObject().columns);
  9867. }
  9868. }
  9869. return refColumn;
  9870. }
  9871. return refLine;
  9872. }
  9873. }, {
  9874. key: "value",
  9875. get: function get() {
  9876. return this.refValue.value;
  9877. }
  9878. }, {
  9879. key: "type",
  9880. get: function get() {
  9881. return this.refValue.type;
  9882. }
  9883. }, {
  9884. key: "lines",
  9885. get: function get() {
  9886. if (!(this.type instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_2__["CompoundType"])) {
  9887. return null;
  9888. }
  9889. return this.refValue.value.length;
  9890. }
  9891. }, {
  9892. key: "columns",
  9893. get: function get() {
  9894. switch (this.type.dimensions) {
  9895. case 2:
  9896. return this.refValue.value[0].value.length;
  9897. default:
  9898. return null;
  9899. }
  9900. }
  9901. }]);
  9902. return StoreObjectArrayAddress;
  9903. }(_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"]);
  9904. /***/ }),
  9905. /***/ "./js/processor/store/storeObjectArrayAddressRef.js":
  9906. /*!**********************************************************!*\
  9907. !*** ./js/processor/store/storeObjectArrayAddressRef.js ***!
  9908. \**********************************************************/
  9909. /*! exports provided: StoreObjectArrayAddressRef */
  9910. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  9911. "use strict";
  9912. __webpack_require__.r(__webpack_exports__);
  9913. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StoreObjectArrayAddressRef", function() { return StoreObjectArrayAddressRef; });
  9914. /* harmony import */ var _storeObject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  9915. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  9916. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(decimal_js__WEBPACK_IMPORTED_MODULE_1__);
  9917. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  9918. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9919. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  9920. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  9921. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  9922. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  9923. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  9924. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  9925. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  9926. var StoreObjectArrayAddressRef =
  9927. /*#__PURE__*/
  9928. function (_StoreObject) {
  9929. _inherits(StoreObjectArrayAddressRef, _StoreObject);
  9930. function StoreObjectArrayAddressRef(address) {
  9931. var _this;
  9932. _classCallCheck(this, StoreObjectArrayAddressRef);
  9933. _this = _possibleConstructorReturn(this, _getPrototypeOf(StoreObjectArrayAddressRef).call(this, null, null, false));
  9934. _this.address = address;
  9935. return _this;
  9936. }
  9937. _createClass(StoreObjectArrayAddressRef, [{
  9938. key: "getRefObj",
  9939. value: function getRefObj() {
  9940. return this.address.refValue;
  9941. }
  9942. }, {
  9943. key: "updateRef",
  9944. value: function updateRef(stoObj) {
  9945. var newArray = this.address.updateArrayObject(stoObj);
  9946. this.address.store.updateStore(this.address.refID, newArray);
  9947. }
  9948. }, {
  9949. key: "isCompatible",
  9950. value: function isCompatible(another) {
  9951. return this.address.isCompatible(another);
  9952. }
  9953. }, {
  9954. key: "isRef",
  9955. get: function get() {
  9956. return true;
  9957. }
  9958. }, {
  9959. key: "type",
  9960. get: function get() {
  9961. return this.address.type;
  9962. }
  9963. }, {
  9964. key: "value",
  9965. get: function get() {
  9966. return this.address.value;
  9967. }
  9968. }, {
  9969. key: "number",
  9970. get: function get() {
  9971. if (this.value instanceof decimal_js__WEBPACK_IMPORTED_MODULE_1___default.a) {
  9972. return this.value.toNumber();
  9973. } else {
  9974. return null;
  9975. }
  9976. }
  9977. }]);
  9978. return StoreObjectArrayAddressRef;
  9979. }(_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"]);
  9980. /***/ }),
  9981. /***/ "./js/processor/store/storeObjectRef.js":
  9982. /*!**********************************************!*\
  9983. !*** ./js/processor/store/storeObjectRef.js ***!
  9984. \**********************************************/
  9985. /*! exports provided: StoreObjectRef */
  9986. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  9987. "use strict";
  9988. __webpack_require__.r(__webpack_exports__);
  9989. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StoreObjectRef", function() { return StoreObjectRef; });
  9990. /* harmony import */ var _storeObject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  9991. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  9992. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(decimal_js__WEBPACK_IMPORTED_MODULE_1__);
  9993. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  9994. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9995. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  9996. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  9997. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  9998. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  9999. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  10000. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  10001. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  10002. var StoreObjectRef =
  10003. /*#__PURE__*/
  10004. function (_StoreObject) {
  10005. _inherits(StoreObjectRef, _StoreObject);
  10006. function StoreObjectRef(refID, store) {
  10007. var _this;
  10008. _classCallCheck(this, StoreObjectRef);
  10009. _this = _possibleConstructorReturn(this, _getPrototypeOf(StoreObjectRef).call(this, null, null, false));
  10010. _this.refID = refID;
  10011. _this.store = store;
  10012. return _this;
  10013. }
  10014. _createClass(StoreObjectRef, [{
  10015. key: "getRefObj",
  10016. value: function getRefObj() {
  10017. return this.store.applyStore(this.refID);
  10018. }
  10019. }, {
  10020. key: "updateRef",
  10021. value: function updateRef(stoObj) {
  10022. this.store.updateStore(this.refID, stoObj);
  10023. }
  10024. }, {
  10025. key: "isCompatible",
  10026. value: function isCompatible(another) {
  10027. return this.store.applyStore(this.refID).isCompatible(another);
  10028. }
  10029. }, {
  10030. key: "isRef",
  10031. get: function get() {
  10032. return true;
  10033. }
  10034. }, {
  10035. key: "type",
  10036. get: function get() {
  10037. return this.store.applyStore(this.refID).type;
  10038. }
  10039. }, {
  10040. key: "value",
  10041. get: function get() {
  10042. return this.store.applyStore(this.refID).value;
  10043. }
  10044. }, {
  10045. key: "number",
  10046. get: function get() {
  10047. if (this.value instanceof decimal_js__WEBPACK_IMPORTED_MODULE_1___default.a) {
  10048. return this.value.toNumber();
  10049. } else {
  10050. return null;
  10051. }
  10052. }
  10053. }]);
  10054. return StoreObjectRef;
  10055. }(_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"]);
  10056. /***/ }),
  10057. /***/ "./js/runner.js":
  10058. /*!**********************!*\
  10059. !*** ./js/runner.js ***!
  10060. \**********************/
  10061. /*! exports provided: runner */
  10062. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  10063. "use strict";
  10064. __webpack_require__.r(__webpack_exports__);
  10065. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "runner", function() { return runner; });
  10066. /* harmony import */ var _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ast/ivprogParser */ "./js/ast/ivprogParser.js");
  10067. /* harmony import */ var _processor_ivprogProcessor__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  10068. /* harmony import */ var _io_domConsole__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./io/domConsole */ "./js/io/domConsole.js");
  10069. /* harmony import */ var _services_languageService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./services/languageService */ "./js/services/languageService.js");
  10070. /* harmony import */ var _processor_semantic_semanticAnalyser__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./processor/semantic/semanticAnalyser */ "./js/processor/semantic/semanticAnalyser.js");
  10071. function runner() {
  10072. var ivprogLexer = _services_languageService__WEBPACK_IMPORTED_MODULE_3__["LanguageService"].getCurrentLexer(); // const lexer = new ivprogLexer(new InputStream(input));
  10073. // const stream = new CommonTokenStream(lexer);
  10074. // stream.fill();
  10075. // let i = 1;
  10076. // let token = null;
  10077. // while ((token = stream.LT(i)).type !== ivprogLexer.EOF && token.type !== ivprogLexer.WHITESPACE) {
  10078. // console.log(`${token.type}-${token.text}`);
  10079. // console.log('\n')
  10080. // i++;
  10081. // }
  10082. // const anaSin = new IVProgParser(input, ivprogLexer);
  10083. var editor = new JsonEditor('#json-renderer', {});
  10084. var domConsole = new _io_domConsole__WEBPACK_IMPORTED_MODULE_2__["DOMConsole"]("#console"); // proc.interpretAST().then( sto => {
  10085. // console.log(sto.applyStore('a'));
  10086. // }).catch(e => console.log(e));
  10087. try {
  10088. $('#btn').click(function () {
  10089. var input = $('#input').val();
  10090. var analiser = new _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_0__["IVProgParser"](input, ivprogLexer);
  10091. try {
  10092. var data = analiser.parseTree();
  10093. var semAna = new _processor_semantic_semanticAnalyser__WEBPACK_IMPORTED_MODULE_4__["SemanticAnalyser"](data);
  10094. var proc = new _processor_ivprogProcessor__WEBPACK_IMPORTED_MODULE_1__["IVProgProcessor"](semAna.analyseTree());
  10095. proc.registerInput(domConsole);
  10096. domConsole.clear();
  10097. proc.registerOutput(domConsole);
  10098. proc.interpretAST().then(function (sto) {
  10099. return editor.load(sto.store);
  10100. }).catch(function (e) {
  10101. alert(e);
  10102. console.log(e);
  10103. });
  10104. } catch (error) {
  10105. alert(error);
  10106. console.log(error);
  10107. }
  10108. });
  10109. } catch (a) {
  10110. console.log(a);
  10111. }
  10112. }
  10113. /***/ }),
  10114. /***/ "./js/semantic/semantic.min.js":
  10115. /*!*************************************!*\
  10116. !*** ./js/semantic/semantic.min.js ***!
  10117. \*************************************/
  10118. /*! no static exports found */
  10119. /***/ (function(module, exports) {
  10120. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  10121. /*
  10122. * # Semantic UI - 2.3.3
  10123. * https://github.com/Semantic-Org/Semantic-UI
  10124. * http://www.semantic-ui.com/
  10125. *
  10126. * Copyright 2014 Contributors
  10127. * Released under the MIT license
  10128. * http://opensource.org/licenses/MIT
  10129. *
  10130. */
  10131. !function (e, t, n, i) {
  10132. e.site = e.fn.site = function (o) {
  10133. var a,
  10134. r,
  10135. s = new Date().getTime(),
  10136. l = [],
  10137. c = arguments[0],
  10138. u = "string" == typeof c,
  10139. d = [].slice.call(arguments, 1),
  10140. f = e.isPlainObject(o) ? e.extend(!0, {}, e.site.settings, o) : e.extend({}, e.site.settings),
  10141. m = f.namespace,
  10142. g = f.error,
  10143. p = "module-" + m,
  10144. h = e(n),
  10145. v = this,
  10146. b = h.data(p);
  10147. return a = {
  10148. initialize: function initialize() {
  10149. a.instantiate();
  10150. },
  10151. instantiate: function instantiate() {
  10152. a.verbose("Storing instance of site", a), b = a, h.data(p, a);
  10153. },
  10154. normalize: function normalize() {
  10155. a.fix.console(), a.fix.requestAnimationFrame();
  10156. },
  10157. fix: {
  10158. console: function (_console) {
  10159. function console() {
  10160. return _console.apply(this, arguments);
  10161. }
  10162. console.toString = function () {
  10163. return _console.toString();
  10164. };
  10165. return console;
  10166. }(function () {
  10167. a.debug("Normalizing window.console"), console !== i && console.log !== i || (a.verbose("Console not available, normalizing events"), a.disable.console()), void 0 !== console.group && void 0 !== console.groupEnd && void 0 !== console.groupCollapsed || (a.verbose("Console group not available, normalizing events"), t.console.group = function () {}, t.console.groupEnd = function () {}, t.console.groupCollapsed = function () {}), void 0 === console.markTimeline && (a.verbose("Mark timeline not available, normalizing events"), t.console.markTimeline = function () {});
  10168. }),
  10169. consoleClear: function consoleClear() {
  10170. a.debug("Disabling programmatic console clearing"), t.console.clear = function () {};
  10171. },
  10172. requestAnimationFrame: function requestAnimationFrame() {
  10173. a.debug("Normalizing requestAnimationFrame"), t.requestAnimationFrame === i && (a.debug("RequestAnimationFrame not available, normalizing event"), t.requestAnimationFrame = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  10174. setTimeout(e, 0);
  10175. });
  10176. }
  10177. },
  10178. moduleExists: function moduleExists(t) {
  10179. return e.fn[t] !== i && e.fn[t].settings !== i;
  10180. },
  10181. enabled: {
  10182. modules: function modules(t) {
  10183. var n = [];
  10184. return t = t || f.modules, e.each(t, function (e, t) {
  10185. a.moduleExists(t) && n.push(t);
  10186. }), n;
  10187. }
  10188. },
  10189. disabled: {
  10190. modules: function modules(t) {
  10191. var n = [];
  10192. return t = t || f.modules, e.each(t, function (e, t) {
  10193. a.moduleExists(t) || n.push(t);
  10194. }), n;
  10195. }
  10196. },
  10197. change: {
  10198. setting: function setting(t, n, o, r) {
  10199. o = "string" == typeof o ? "all" === o ? f.modules : [o] : o || f.modules, r = r === i || r, e.each(o, function (i, o) {
  10200. var s,
  10201. l = !a.moduleExists(o) || e.fn[o].settings.namespace || !1;
  10202. a.moduleExists(o) && (a.verbose("Changing default setting", t, n, o), e.fn[o].settings[t] = n, r && l && (s = e(":data(module-" + l + ")")).length > 0 && (a.verbose("Modifying existing settings", s), s[o]("setting", t, n)));
  10203. });
  10204. },
  10205. settings: function settings(t, n, o) {
  10206. n = "string" == typeof n ? [n] : n || f.modules, o = o === i || o, e.each(n, function (n, i) {
  10207. var r;
  10208. a.moduleExists(i) && (a.verbose("Changing default setting", t, i), e.extend(!0, e.fn[i].settings, t), o && m && (r = e(":data(module-" + m + ")")).length > 0 && (a.verbose("Modifying existing settings", r), r[i]("setting", t)));
  10209. });
  10210. }
  10211. },
  10212. enable: {
  10213. console: function console() {
  10214. a.console(!0);
  10215. },
  10216. debug: function debug(e, t) {
  10217. e = e || f.modules, a.debug("Enabling debug for modules", e), a.change.setting("debug", !0, e, t);
  10218. },
  10219. verbose: function verbose(e, t) {
  10220. e = e || f.modules, a.debug("Enabling verbose debug for modules", e), a.change.setting("verbose", !0, e, t);
  10221. }
  10222. },
  10223. disable: {
  10224. console: function console() {
  10225. a.console(!1);
  10226. },
  10227. debug: function debug(e, t) {
  10228. e = e || f.modules, a.debug("Disabling debug for modules", e), a.change.setting("debug", !1, e, t);
  10229. },
  10230. verbose: function verbose(e, t) {
  10231. e = e || f.modules, a.debug("Disabling verbose debug for modules", e), a.change.setting("verbose", !1, e, t);
  10232. }
  10233. },
  10234. console: function console(e) {
  10235. if (e) {
  10236. if (b.cache.console === i) return void a.error(g.console);
  10237. a.debug("Restoring console function"), t.console = b.cache.console;
  10238. } else a.debug("Disabling console function"), b.cache.console = t.console, t.console = {
  10239. clear: function clear() {},
  10240. error: function error() {},
  10241. group: function group() {},
  10242. groupCollapsed: function groupCollapsed() {},
  10243. groupEnd: function groupEnd() {},
  10244. info: function info() {},
  10245. log: function log() {},
  10246. markTimeline: function markTimeline() {},
  10247. warn: function warn() {}
  10248. };
  10249. },
  10250. destroy: function destroy() {
  10251. a.verbose("Destroying previous site for", h), h.removeData(p);
  10252. },
  10253. cache: {},
  10254. setting: function setting(t, n) {
  10255. if (e.isPlainObject(t)) e.extend(!0, f, t);else {
  10256. if (n === i) return f[t];
  10257. f[t] = n;
  10258. }
  10259. },
  10260. internal: function internal(t, n) {
  10261. if (e.isPlainObject(t)) e.extend(!0, a, t);else {
  10262. if (n === i) return a[t];
  10263. a[t] = n;
  10264. }
  10265. },
  10266. debug: function debug() {
  10267. f.debug && (f.performance ? a.performance.log(arguments) : (a.debug = Function.prototype.bind.call(console.info, console, f.name + ":"), a.debug.apply(console, arguments)));
  10268. },
  10269. verbose: function verbose() {
  10270. f.verbose && f.debug && (f.performance ? a.performance.log(arguments) : (a.verbose = Function.prototype.bind.call(console.info, console, f.name + ":"), a.verbose.apply(console, arguments)));
  10271. },
  10272. error: function error() {
  10273. a.error = Function.prototype.bind.call(console.error, console, f.name + ":"), a.error.apply(console, arguments);
  10274. },
  10275. performance: {
  10276. log: function log(e) {
  10277. var t, n;
  10278. f.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({
  10279. Element: v,
  10280. Name: e[0],
  10281. Arguments: [].slice.call(e, 1) || "",
  10282. "Execution Time": n
  10283. })), clearTimeout(a.performance.timer), a.performance.timer = setTimeout(a.performance.display, 500);
  10284. },
  10285. display: function display() {
  10286. var t = f.name + ":",
  10287. n = 0;
  10288. s = !1, clearTimeout(a.performance.timer), e.each(l, function (e, t) {
  10289. n += t["Execution Time"];
  10290. }), t += " " + n + "ms", (console.group !== i || console.table !== i) && l.length > 0 && (console.groupCollapsed(t), console.table ? console.table(l) : e.each(l, function (e, t) {
  10291. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  10292. }), console.groupEnd()), l = [];
  10293. }
  10294. },
  10295. invoke: function invoke(t, n, o) {
  10296. var s,
  10297. l,
  10298. c,
  10299. u = b;
  10300. return n = n || d, o = v || o, "string" == typeof t && u !== i && (t = t.split(/[\. ]/), s = t.length - 1, e.each(t, function (n, o) {
  10301. var r = n != s ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  10302. if (e.isPlainObject(u[r]) && n != s) u = u[r];else {
  10303. if (u[r] !== i) return l = u[r], !1;
  10304. if (!e.isPlainObject(u[o]) || n == s) return u[o] !== i ? (l = u[o], !1) : (a.error(g.method, t), !1);
  10305. u = u[o];
  10306. }
  10307. })), e.isFunction(l) ? c = l.apply(o, n) : l !== i && (c = l), e.isArray(r) ? r.push(c) : r !== i ? r = [r, c] : c !== i && (r = c), l;
  10308. }
  10309. }, u ? (b === i && a.initialize(), a.invoke(c)) : (b !== i && a.destroy(), a.initialize()), r !== i ? r : this;
  10310. }, e.site.settings = {
  10311. name: "Site",
  10312. namespace: "site",
  10313. error: {
  10314. console: "Console cannot be restored, most likely it was overwritten outside of module",
  10315. method: "The method you called is not defined."
  10316. },
  10317. debug: !1,
  10318. verbose: !1,
  10319. performance: !0,
  10320. modules: ["accordion", "api", "checkbox", "dimmer", "dropdown", "embed", "form", "modal", "nag", "popup", "rating", "shape", "sidebar", "state", "sticky", "tab", "transition", "visit", "visibility"],
  10321. siteNamespace: "site",
  10322. namespaceStub: {
  10323. cache: {},
  10324. config: {},
  10325. sections: {},
  10326. section: {},
  10327. utilities: {}
  10328. }
  10329. }, e.extend(e.expr[":"], {
  10330. data: e.expr.createPseudo ? e.expr.createPseudo(function (t) {
  10331. return function (n) {
  10332. return !!e.data(n, t);
  10333. };
  10334. }) : function (t, n, i) {
  10335. return !!e.data(t, i[3]);
  10336. }
  10337. });
  10338. }(jQuery, window, document), function (e, t, n, i) {
  10339. "use strict";
  10340. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.form = function (t) {
  10341. var o,
  10342. a = e(this),
  10343. r = a.selector || "",
  10344. s = new Date().getTime(),
  10345. l = [],
  10346. c = arguments[0],
  10347. u = arguments[1],
  10348. d = "string" == typeof c,
  10349. f = [].slice.call(arguments, 1);
  10350. return a.each(function () {
  10351. var m,
  10352. g,
  10353. p,
  10354. h,
  10355. v,
  10356. b,
  10357. y,
  10358. x,
  10359. C,
  10360. w,
  10361. S,
  10362. k,
  10363. T,
  10364. A,
  10365. R,
  10366. P,
  10367. E = e(this),
  10368. F = this,
  10369. O = [],
  10370. D = !1;
  10371. (P = {
  10372. initialize: function initialize() {
  10373. P.get.settings(), d ? (R === i && P.instantiate(), P.invoke(c)) : (R !== i && R.invoke("destroy"), P.verbose("Initializing form validation", E, v), P.bindEvents(), P.set.defaults(), P.instantiate());
  10374. },
  10375. instantiate: function instantiate() {
  10376. P.verbose("Storing instance of module", P), R = P, E.data(T, P);
  10377. },
  10378. destroy: function destroy() {
  10379. P.verbose("Destroying previous module", R), P.removeEvents(), E.removeData(T);
  10380. },
  10381. refresh: function refresh() {
  10382. P.verbose("Refreshing selector cache"), m = E.find(x.field), g = E.find(x.group), p = E.find(x.message), E.find(x.prompt), h = E.find(x.submit), E.find(x.clear), E.find(x.reset);
  10383. },
  10384. submit: function submit() {
  10385. P.verbose("Submitting form", E), E.submit();
  10386. },
  10387. attachEvents: function attachEvents(t, n) {
  10388. n = n || "submit", e(t).on("click" + A, function (e) {
  10389. P[n](), e.preventDefault();
  10390. });
  10391. },
  10392. bindEvents: function bindEvents() {
  10393. P.verbose("Attaching form events"), E.on("submit" + A, P.validate.form).on("blur" + A, x.field, P.event.field.blur).on("click" + A, x.submit, P.submit).on("click" + A, x.reset, P.reset).on("click" + A, x.clear, P.clear), v.keyboardShortcuts && E.on("keydown" + A, x.field, P.event.field.keydown), m.each(function () {
  10394. var t = e(this),
  10395. n = t.prop("type"),
  10396. i = P.get.changeEvent(n, t);
  10397. e(this).on(i + A, P.event.field.change);
  10398. });
  10399. },
  10400. clear: function clear() {
  10401. m.each(function () {
  10402. var t = e(this),
  10403. n = t.parent(),
  10404. i = t.closest(g),
  10405. o = i.find(x.prompt),
  10406. a = t.data(y.defaultValue) || "",
  10407. r = n.is(x.uiCheckbox),
  10408. s = n.is(x.uiDropdown);
  10409. i.hasClass(C.error) && (P.verbose("Resetting error on field", i), i.removeClass(C.error), o.remove()), s ? (P.verbose("Resetting dropdown value", n, a), n.dropdown("clear")) : r ? t.prop("checked", !1) : (P.verbose("Resetting field value", t, a), t.val(""));
  10410. });
  10411. },
  10412. reset: function reset() {
  10413. m.each(function () {
  10414. var t = e(this),
  10415. n = t.parent(),
  10416. o = t.closest(g),
  10417. a = o.find(x.prompt),
  10418. r = t.data(y.defaultValue),
  10419. s = n.is(x.uiCheckbox),
  10420. l = n.is(x.uiDropdown),
  10421. c = o.hasClass(C.error);
  10422. r !== i && (c && (P.verbose("Resetting error on field", o), o.removeClass(C.error), a.remove()), l ? (P.verbose("Resetting dropdown value", n, r), n.dropdown("restore defaults")) : s ? (P.verbose("Resetting checkbox value", n, r), t.prop("checked", r)) : (P.verbose("Resetting field value", t, r), t.val(r)));
  10423. });
  10424. },
  10425. determine: {
  10426. isValid: function isValid() {
  10427. var t = !0;
  10428. return e.each(b, function (e, n) {
  10429. P.validate.field(n, e, !0) || (t = !1);
  10430. }), t;
  10431. }
  10432. },
  10433. is: {
  10434. bracketedRule: function bracketedRule(e) {
  10435. return e.type && e.type.match(v.regExp.bracket);
  10436. },
  10437. shorthandFields: function shorthandFields(e) {
  10438. var t = e[Object.keys(e)[0]];
  10439. return P.is.shorthandRules(t);
  10440. },
  10441. shorthandRules: function shorthandRules(t) {
  10442. return "string" == typeof t || e.isArray(t);
  10443. },
  10444. empty: function empty(e) {
  10445. return !e || 0 === e.length || (e.is('input[type="checkbox"]') ? !e.is(":checked") : P.is.blank(e));
  10446. },
  10447. blank: function blank(t) {
  10448. return "" === e.trim(t.val());
  10449. },
  10450. valid: function valid(t) {
  10451. var n = !0;
  10452. return t ? (P.verbose("Checking if field is valid", t), P.validate.field(b[t], t, !1)) : (P.verbose("Checking if form is valid"), e.each(b, function (e, t) {
  10453. P.is.valid(e) || (n = !1);
  10454. }), n);
  10455. }
  10456. },
  10457. removeEvents: function removeEvents() {
  10458. E.off(A), m.off(A), h.off(A), m.off(A);
  10459. },
  10460. event: {
  10461. field: {
  10462. keydown: function keydown(t) {
  10463. var n = e(this),
  10464. i = t.which,
  10465. o = n.is(x.input),
  10466. a = n.is(x.checkbox),
  10467. r = n.closest(x.uiDropdown).length > 0,
  10468. s = 13;
  10469. i == 27 && (P.verbose("Escape key pressed blurring field"), n.blur()), t.ctrlKey || i != s || !o || r || a || (D || (n.one("keyup" + A, P.event.field.keyup), P.submit(), P.debug("Enter pressed on input submitting form")), D = !0);
  10470. },
  10471. keyup: function keyup() {
  10472. D = !1;
  10473. },
  10474. blur: function blur(t) {
  10475. var n = e(this),
  10476. i = n.closest(g),
  10477. o = P.get.validation(n);
  10478. i.hasClass(C.error) ? (P.debug("Revalidating field", n, o), o && P.validate.field(o)) : "blur" == v.on && o && P.validate.field(o);
  10479. },
  10480. change: function change(t) {
  10481. var n = e(this),
  10482. i = n.closest(g),
  10483. o = P.get.validation(n);
  10484. o && ("change" == v.on || i.hasClass(C.error) && v.revalidate) && (clearTimeout(P.timer), P.timer = setTimeout(function () {
  10485. P.debug("Revalidating field", n, P.get.validation(n)), P.validate.field(o);
  10486. }, v.delay));
  10487. }
  10488. }
  10489. },
  10490. get: {
  10491. ancillaryValue: function ancillaryValue(e) {
  10492. return !(!e.type || !e.value && !P.is.bracketedRule(e)) && (e.value !== i ? e.value : e.type.match(v.regExp.bracket)[1] + "");
  10493. },
  10494. ruleName: function ruleName(e) {
  10495. return P.is.bracketedRule(e) ? e.type.replace(e.type.match(v.regExp.bracket)[0], "") : e.type;
  10496. },
  10497. changeEvent: function changeEvent(e, t) {
  10498. return "checkbox" == e || "radio" == e || "hidden" == e || t.is("select") ? "change" : P.get.inputEvent();
  10499. },
  10500. inputEvent: function inputEvent() {
  10501. return n.createElement("input").oninput !== i ? "input" : n.createElement("input").onpropertychange !== i ? "propertychange" : "keyup";
  10502. },
  10503. fieldsFromShorthand: function fieldsFromShorthand(t) {
  10504. var n = {};
  10505. return e.each(t, function (t, i) {
  10506. "string" == typeof i && (i = [i]), n[t] = {
  10507. rules: []
  10508. }, e.each(i, function (e, i) {
  10509. n[t].rules.push({
  10510. type: i
  10511. });
  10512. });
  10513. }), n;
  10514. },
  10515. prompt: function prompt(t, n) {
  10516. var i,
  10517. o,
  10518. a = P.get.ruleName(t),
  10519. r = P.get.ancillaryValue(t),
  10520. s = P.get.field(n.identifier),
  10521. l = s.val(),
  10522. c = e.isFunction(t.prompt) ? t.prompt(l) : t.prompt || v.prompt[a] || v.text.unspecifiedRule,
  10523. u = -1 !== c.search("{value}"),
  10524. d = -1 !== c.search("{name}");
  10525. return u && (c = c.replace("{value}", s.val())), d && (o = 1 == (i = s.closest(x.group).find("label").eq(0)).length ? i.text() : s.prop("placeholder") || v.text.unspecifiedField, c = c.replace("{name}", o)), c = (c = c.replace("{identifier}", n.identifier)).replace("{ruleValue}", r), t.prompt || P.verbose("Using default validation prompt for type", c, a), c;
  10526. },
  10527. settings: function settings() {
  10528. if (e.isPlainObject(t)) {
  10529. var n = Object.keys(t);
  10530. n.length > 0 && t[n[0]].identifier !== i && t[n[0]].rules !== i ? (v = e.extend(!0, {}, e.fn.form.settings, u), b = e.extend({}, e.fn.form.settings.defaults, t), P.error(v.error.oldSyntax, F), P.verbose("Extending settings from legacy parameters", b, v)) : (t.fields && P.is.shorthandFields(t.fields) && (t.fields = P.get.fieldsFromShorthand(t.fields)), v = e.extend(!0, {}, e.fn.form.settings, t), b = e.extend({}, e.fn.form.settings.defaults, v.fields), P.verbose("Extending settings", b, v));
  10531. } else v = e.fn.form.settings, b = e.fn.form.settings.defaults, P.verbose("Using default form validation", b, v);
  10532. k = v.namespace, y = v.metadata, x = v.selector, C = v.className, w = v.regExp, S = v.error, T = "module-" + k, A = "." + k, R = E.data(T), P.refresh();
  10533. },
  10534. field: function field(t) {
  10535. return P.verbose("Finding field with identifier", t), t = P.escape.string(t), m.filter("#" + t).length > 0 ? m.filter("#" + t) : m.filter('[name="' + t + '"]').length > 0 ? m.filter('[name="' + t + '"]') : m.filter('[name="' + t + '[]"]').length > 0 ? m.filter('[name="' + t + '[]"]') : m.filter("[data-" + y.validate + '="' + t + '"]').length > 0 ? m.filter("[data-" + y.validate + '="' + t + '"]') : e("<input/>");
  10536. },
  10537. fields: function fields(t) {
  10538. var n = e();
  10539. return e.each(t, function (e, t) {
  10540. n = n.add(P.get.field(t));
  10541. }), n;
  10542. },
  10543. validation: function validation(t) {
  10544. var n, i;
  10545. return !!b && (e.each(b, function (e, o) {
  10546. i = o.identifier || e, P.get.field(i)[0] == t[0] && (o.identifier = i, n = o);
  10547. }), n || !1);
  10548. },
  10549. value: function value(e) {
  10550. var t = [];
  10551. return t.push(e), P.get.values.call(F, t)[e];
  10552. },
  10553. values: function values(t) {
  10554. var n = {};
  10555. return (e.isArray(t) ? P.get.fields(t) : m).each(function (t, o) {
  10556. var a = e(o),
  10557. r = (a.prop("type"), a.prop("name")),
  10558. s = a.val(),
  10559. l = a.is(x.checkbox),
  10560. c = a.is(x.radio),
  10561. u = -1 !== r.indexOf("[]"),
  10562. d = !!l && a.is(":checked");
  10563. r && (u ? (r = r.replace("[]", ""), n[r] || (n[r] = []), l ? d ? n[r].push(s || !0) : n[r].push(!1) : n[r].push(s)) : c ? n[r] !== i && 0 != n[r] || (n[r] = !!d && (s || !0)) : n[r] = l ? !!d && (s || !0) : s);
  10564. }), n;
  10565. }
  10566. },
  10567. has: {
  10568. field: function field(e) {
  10569. return P.verbose("Checking for existence of a field with identifier", e), "string" != typeof (e = P.escape.string(e)) && P.error(S.identifier, e), m.filter("#" + e).length > 0 || m.filter('[name="' + e + '"]').length > 0 || m.filter("[data-" + y.validate + '="' + e + '"]').length > 0;
  10570. }
  10571. },
  10572. escape: {
  10573. string: function string(e) {
  10574. return (e = String(e)).replace(w.escape, "\\$&");
  10575. }
  10576. },
  10577. add: {
  10578. rule: function rule(e, t) {
  10579. P.add.field(e, t);
  10580. },
  10581. field: function field(t, n) {
  10582. var i = {};
  10583. P.is.shorthandRules(n) ? (n = e.isArray(n) ? n : [n], i[t] = {
  10584. rules: []
  10585. }, e.each(n, function (e, n) {
  10586. i[t].rules.push({
  10587. type: n
  10588. });
  10589. })) : i[t] = n, b = e.extend({}, b, i), P.debug("Adding rules", i, b);
  10590. },
  10591. fields: function fields(t) {
  10592. var n;
  10593. n = t && P.is.shorthandFields(t) ? P.get.fieldsFromShorthand(t) : t, b = e.extend({}, b, n);
  10594. },
  10595. prompt: function prompt(t, n) {
  10596. var o = P.get.field(t).closest(g),
  10597. a = o.children(x.prompt),
  10598. r = 0 !== a.length;
  10599. n = "string" == typeof n ? [n] : n, P.verbose("Adding field error state", t), o.addClass(C.error), v.inline && (r || (a = v.templates.prompt(n)).appendTo(o), a.html(n[0]), r ? P.verbose("Inline errors are disabled, no inline error added", t) : v.transition && e.fn.transition !== i && E.transition("is supported") ? (P.verbose("Displaying error with css transition", v.transition), a.transition(v.transition + " in", v.duration)) : (P.verbose("Displaying error with fallback javascript animation"), a.fadeIn(v.duration)));
  10600. },
  10601. errors: function errors(e) {
  10602. P.debug("Adding form error messages", e), P.set.error(), p.html(v.templates.error(e));
  10603. }
  10604. },
  10605. remove: {
  10606. rule: function rule(t, n) {
  10607. var o = e.isArray(n) ? n : [n];
  10608. if (n == i) return P.debug("Removed all rules"), void (b[t].rules = []);
  10609. b[t] != i && e.isArray(b[t].rules) && e.each(b[t].rules, function (e, n) {
  10610. -1 !== o.indexOf(n.type) && (P.debug("Removed rule", n.type), b[t].rules.splice(e, 1));
  10611. });
  10612. },
  10613. field: function field(t) {
  10614. var n = e.isArray(t) ? t : [t];
  10615. e.each(n, function (e, t) {
  10616. P.remove.rule(t);
  10617. });
  10618. },
  10619. rules: function rules(t, n) {
  10620. e.isArray(t) ? e.each(fields, function (e, t) {
  10621. P.remove.rule(t, n);
  10622. }) : P.remove.rule(t, n);
  10623. },
  10624. fields: function fields(e) {
  10625. P.remove.field(e);
  10626. },
  10627. prompt: function prompt(t) {
  10628. var n = P.get.field(t).closest(g),
  10629. o = n.children(x.prompt);
  10630. n.removeClass(C.error), v.inline && o.is(":visible") && (P.verbose("Removing prompt for field", t), v.transition && e.fn.transition !== i && E.transition("is supported") ? o.transition(v.transition + " out", v.duration, function () {
  10631. o.remove();
  10632. }) : o.fadeOut(v.duration, function () {
  10633. o.remove();
  10634. }));
  10635. }
  10636. },
  10637. set: {
  10638. success: function success() {
  10639. E.removeClass(C.error).addClass(C.success);
  10640. },
  10641. defaults: function defaults() {
  10642. m.each(function () {
  10643. var t = e(this),
  10644. n = t.filter(x.checkbox).length > 0 ? t.is(":checked") : t.val();
  10645. t.data(y.defaultValue, n);
  10646. });
  10647. },
  10648. error: function error() {
  10649. E.removeClass(C.success).addClass(C.error);
  10650. },
  10651. value: function value(e, t) {
  10652. var n = {};
  10653. return n[e] = t, P.set.values.call(F, n);
  10654. },
  10655. values: function values(t) {
  10656. e.isEmptyObject(t) || e.each(t, function (t, n) {
  10657. var i,
  10658. o = P.get.field(t),
  10659. a = o.parent(),
  10660. r = e.isArray(n),
  10661. s = a.is(x.uiCheckbox),
  10662. l = a.is(x.uiDropdown),
  10663. c = o.is(x.radio) && s;
  10664. o.length > 0 && (r && s ? (P.verbose("Selecting multiple", n, o), a.checkbox("uncheck"), e.each(n, function (e, t) {
  10665. i = o.filter('[value="' + t + '"]'), a = i.parent(), i.length > 0 && a.checkbox("check");
  10666. })) : c ? (P.verbose("Selecting radio value", n, o), o.filter('[value="' + n + '"]').parent(x.uiCheckbox).checkbox("check")) : s ? (P.verbose("Setting checkbox value", n, a), !0 === n ? a.checkbox("check") : a.checkbox("uncheck")) : l ? (P.verbose("Setting dropdown value", n, a), a.dropdown("set selected", n)) : (P.verbose("Setting field value", n, o), o.val(n)));
  10667. });
  10668. }
  10669. },
  10670. validate: {
  10671. form: function form(e, t) {
  10672. var n = P.get.values();
  10673. if (D) return !1;
  10674. if (O = [], P.determine.isValid()) {
  10675. if (P.debug("Form has no validation errors, submitting"), P.set.success(), !0 !== t) return v.onSuccess.call(F, e, n);
  10676. } else if (P.debug("Form has errors"), P.set.error(), v.inline || P.add.errors(O), E.data("moduleApi") !== i && e.stopImmediatePropagation(), !0 !== t) return v.onFailure.call(F, O, n);
  10677. },
  10678. field: function field(t, n, o) {
  10679. o = o === i || o, "string" == typeof t && (P.verbose("Validating field", t), n = t, t = b[t]);
  10680. var a = t.identifier || n,
  10681. r = P.get.field(a),
  10682. s = !!t.depends && P.get.field(t.depends),
  10683. l = !0,
  10684. c = [];
  10685. return t.identifier || (P.debug("Using field name as identifier", a), t.identifier = a), r.prop("disabled") ? (P.debug("Field is disabled. Skipping", a), l = !0) : t.optional && P.is.blank(r) ? (P.debug("Field is optional and blank. Skipping", a), l = !0) : t.depends && P.is.empty(s) ? (P.debug("Field depends on another value that is not present or empty. Skipping", s), l = !0) : t.rules !== i && e.each(t.rules, function (e, n) {
  10686. P.has.field(a) && !P.validate.rule(t, n) && (P.debug("Field is invalid", a, n.type), c.push(P.get.prompt(n, t)), l = !1);
  10687. }), l ? (o && (P.remove.prompt(a, c), v.onValid.call(r)), !0) : (o && (O = O.concat(c), P.add.prompt(a, c), v.onInvalid.call(r, c)), !1);
  10688. },
  10689. rule: function rule(t, n) {
  10690. var o = P.get.field(t.identifier),
  10691. a = (n.type, o.val()),
  10692. r = P.get.ancillaryValue(n),
  10693. s = P.get.ruleName(n),
  10694. l = v.rules[s];
  10695. if (e.isFunction(l)) return a = a === i || "" === a || null === a ? "" : e.trim(a + ""), l.call(o, a, r);
  10696. P.error(S.noRule, s);
  10697. }
  10698. },
  10699. setting: function setting(t, n) {
  10700. if (e.isPlainObject(t)) e.extend(!0, v, t);else {
  10701. if (n === i) return v[t];
  10702. v[t] = n;
  10703. }
  10704. },
  10705. internal: function internal(t, n) {
  10706. if (e.isPlainObject(t)) e.extend(!0, P, t);else {
  10707. if (n === i) return P[t];
  10708. P[t] = n;
  10709. }
  10710. },
  10711. debug: function debug() {
  10712. !v.silent && v.debug && (v.performance ? P.performance.log(arguments) : (P.debug = Function.prototype.bind.call(console.info, console, v.name + ":"), P.debug.apply(console, arguments)));
  10713. },
  10714. verbose: function verbose() {
  10715. !v.silent && v.verbose && v.debug && (v.performance ? P.performance.log(arguments) : (P.verbose = Function.prototype.bind.call(console.info, console, v.name + ":"), P.verbose.apply(console, arguments)));
  10716. },
  10717. error: function error() {
  10718. v.silent || (P.error = Function.prototype.bind.call(console.error, console, v.name + ":"), P.error.apply(console, arguments));
  10719. },
  10720. performance: {
  10721. log: function log(e) {
  10722. var t, n;
  10723. v.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({
  10724. Name: e[0],
  10725. Arguments: [].slice.call(e, 1) || "",
  10726. Element: F,
  10727. "Execution Time": n
  10728. })), clearTimeout(P.performance.timer), P.performance.timer = setTimeout(P.performance.display, 500);
  10729. },
  10730. display: function display() {
  10731. var t = v.name + ":",
  10732. n = 0;
  10733. s = !1, clearTimeout(P.performance.timer), e.each(l, function (e, t) {
  10734. n += t["Execution Time"];
  10735. }), t += " " + n + "ms", r && (t += " '" + r + "'"), a.length > 1 && (t += " (" + a.length + ")"), (console.group !== i || console.table !== i) && l.length > 0 && (console.groupCollapsed(t), console.table ? console.table(l) : e.each(l, function (e, t) {
  10736. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  10737. }), console.groupEnd()), l = [];
  10738. }
  10739. },
  10740. invoke: function invoke(t, n, a) {
  10741. var r,
  10742. s,
  10743. l,
  10744. c = R;
  10745. return n = n || f, a = F || a, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  10746. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  10747. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  10748. if (c[a] !== i) return s = c[a], !1;
  10749. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);
  10750. c = c[o];
  10751. }
  10752. })), e.isFunction(s) ? l = s.apply(a, n) : s !== i && (l = s), e.isArray(o) ? o.push(l) : o !== i ? o = [o, l] : l !== i && (o = l), s;
  10753. }
  10754. }).initialize();
  10755. }), o !== i ? o : this;
  10756. }, e.fn.form.settings = {
  10757. name: "Form",
  10758. namespace: "form",
  10759. debug: !1,
  10760. verbose: !1,
  10761. performance: !0,
  10762. fields: !1,
  10763. keyboardShortcuts: !0,
  10764. on: "submit",
  10765. inline: !1,
  10766. delay: 200,
  10767. revalidate: !0,
  10768. transition: "scale",
  10769. duration: 200,
  10770. onValid: function onValid() {},
  10771. onInvalid: function onInvalid() {},
  10772. onSuccess: function onSuccess() {
  10773. return !0;
  10774. },
  10775. onFailure: function onFailure() {
  10776. return !1;
  10777. },
  10778. metadata: {
  10779. defaultValue: "default",
  10780. validate: "validate"
  10781. },
  10782. regExp: {
  10783. htmlID: /^[a-zA-Z][\w:.-]*$/g,
  10784. bracket: /\[(.*)\]/i,
  10785. decimal: /^\d+\.?\d*$/,
  10786. email: /^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i,
  10787. escape: /[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,
  10788. flags: /^\/(.*)\/(.*)?/,
  10789. integer: /^\-?\d+$/,
  10790. number: /^\-?\d*(\.\d+)?$/,
  10791. url: /(https?:\/\/(?:www\.|(?!www))[^\s\.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})/i
  10792. },
  10793. text: {
  10794. unspecifiedRule: "Please enter a valid value",
  10795. unspecifiedField: "This field"
  10796. },
  10797. prompt: {
  10798. empty: "{name} must have a value",
  10799. checked: "{name} must be checked",
  10800. email: "{name} must be a valid e-mail",
  10801. url: "{name} must be a valid url",
  10802. regExp: "{name} is not formatted correctly",
  10803. integer: "{name} must be an integer",
  10804. decimal: "{name} must be a decimal number",
  10805. number: "{name} must be set to a number",
  10806. is: '{name} must be "{ruleValue}"',
  10807. isExactly: '{name} must be exactly "{ruleValue}"',
  10808. not: '{name} cannot be set to "{ruleValue}"',
  10809. notExactly: '{name} cannot be set to exactly "{ruleValue}"',
  10810. contain: '{name} must contain "{ruleValue}"',
  10811. containExactly: '{name} must contain exactly "{ruleValue}"',
  10812. doesntContain: '{name} cannot contain "{ruleValue}"',
  10813. doesntContainExactly: '{name} cannot contain exactly "{ruleValue}"',
  10814. minLength: "{name} must be at least {ruleValue} characters",
  10815. length: "{name} must be at least {ruleValue} characters",
  10816. exactLength: "{name} must be exactly {ruleValue} characters",
  10817. maxLength: "{name} cannot be longer than {ruleValue} characters",
  10818. match: "{name} must match {ruleValue} field",
  10819. different: "{name} must have a different value than {ruleValue} field",
  10820. creditCard: "{name} must be a valid credit card number",
  10821. minCount: "{name} must have at least {ruleValue} choices",
  10822. exactCount: "{name} must have exactly {ruleValue} choices",
  10823. maxCount: "{name} must have {ruleValue} or less choices"
  10824. },
  10825. selector: {
  10826. checkbox: 'input[type="checkbox"], input[type="radio"]',
  10827. clear: ".clear",
  10828. field: "input, textarea, select",
  10829. group: ".field",
  10830. input: "input",
  10831. message: ".error.message",
  10832. prompt: ".prompt.label",
  10833. radio: 'input[type="radio"]',
  10834. reset: '.reset:not([type="reset"])',
  10835. submit: '.submit:not([type="submit"])',
  10836. uiCheckbox: ".ui.checkbox",
  10837. uiDropdown: ".ui.dropdown"
  10838. },
  10839. className: {
  10840. error: "error",
  10841. label: "ui prompt label",
  10842. pressed: "down",
  10843. success: "success"
  10844. },
  10845. error: {
  10846. identifier: "You must specify a string identifier for each field",
  10847. method: "The method you called is not defined.",
  10848. noRule: "There is no rule matching the one you specified",
  10849. oldSyntax: "Starting in 2.0 forms now only take a single settings object. Validation settings converted to new syntax automatically."
  10850. },
  10851. templates: {
  10852. error: function error(t) {
  10853. var n = '<ul class="list">';
  10854. return e.each(t, function (e, t) {
  10855. n += "<li>" + t + "</li>";
  10856. }), e(n += "</ul>");
  10857. },
  10858. prompt: function prompt(t) {
  10859. return e("<div/>").addClass("ui basic red pointing prompt label").html(t[0]);
  10860. }
  10861. },
  10862. rules: {
  10863. empty: function empty(t) {
  10864. return !(t === i || "" === t || e.isArray(t) && 0 === t.length);
  10865. },
  10866. checked: function checked() {
  10867. return e(this).filter(":checked").length > 0;
  10868. },
  10869. email: function email(t) {
  10870. return e.fn.form.settings.regExp.email.test(t);
  10871. },
  10872. url: function url(t) {
  10873. return e.fn.form.settings.regExp.url.test(t);
  10874. },
  10875. regExp: function regExp(t, n) {
  10876. if (n instanceof RegExp) return t.match(n);
  10877. var i,
  10878. o = n.match(e.fn.form.settings.regExp.flags);
  10879. return o && (n = o.length >= 2 ? o[1] : n, i = o.length >= 3 ? o[2] : ""), t.match(new RegExp(n, i));
  10880. },
  10881. integer: function integer(t, n) {
  10882. var o,
  10883. a,
  10884. r,
  10885. s = e.fn.form.settings.regExp.integer;
  10886. return n && -1 === ["", ".."].indexOf(n) && (-1 == n.indexOf("..") ? s.test(n) && (o = a = n - 0) : (r = n.split("..", 2), s.test(r[0]) && (o = r[0] - 0), s.test(r[1]) && (a = r[1] - 0))), s.test(t) && (o === i || t >= o) && (a === i || t <= a);
  10887. },
  10888. decimal: function decimal(t) {
  10889. return e.fn.form.settings.regExp.decimal.test(t);
  10890. },
  10891. number: function number(t) {
  10892. return e.fn.form.settings.regExp.number.test(t);
  10893. },
  10894. is: function is(e, t) {
  10895. return t = "string" == typeof t ? t.toLowerCase() : t, (e = "string" == typeof e ? e.toLowerCase() : e) == t;
  10896. },
  10897. isExactly: function isExactly(e, t) {
  10898. return e == t;
  10899. },
  10900. not: function not(e, t) {
  10901. return (e = "string" == typeof e ? e.toLowerCase() : e) != (t = "string" == typeof t ? t.toLowerCase() : t);
  10902. },
  10903. notExactly: function notExactly(e, t) {
  10904. return e != t;
  10905. },
  10906. contains: function contains(t, n) {
  10907. return n = n.replace(e.fn.form.settings.regExp.escape, "\\$&"), -1 !== t.search(new RegExp(n, "i"));
  10908. },
  10909. containsExactly: function containsExactly(t, n) {
  10910. return n = n.replace(e.fn.form.settings.regExp.escape, "\\$&"), -1 !== t.search(new RegExp(n));
  10911. },
  10912. doesntContain: function doesntContain(t, n) {
  10913. return n = n.replace(e.fn.form.settings.regExp.escape, "\\$&"), -1 === t.search(new RegExp(n, "i"));
  10914. },
  10915. doesntContainExactly: function doesntContainExactly(t, n) {
  10916. return n = n.replace(e.fn.form.settings.regExp.escape, "\\$&"), -1 === t.search(new RegExp(n));
  10917. },
  10918. minLength: function minLength(e, t) {
  10919. return e !== i && e.length >= t;
  10920. },
  10921. length: function length(e, t) {
  10922. return e !== i && e.length >= t;
  10923. },
  10924. exactLength: function exactLength(e, t) {
  10925. return e !== i && e.length == t;
  10926. },
  10927. maxLength: function maxLength(e, t) {
  10928. return e !== i && e.length <= t;
  10929. },
  10930. match: function match(t, n) {
  10931. var o;
  10932. e(this);
  10933. return e('[data-validate="' + n + '"]').length > 0 ? o = e('[data-validate="' + n + '"]').val() : e("#" + n).length > 0 ? o = e("#" + n).val() : e('[name="' + n + '"]').length > 0 ? o = e('[name="' + n + '"]').val() : e('[name="' + n + '[]"]').length > 0 && (o = e('[name="' + n + '[]"]')), o !== i && t.toString() == o.toString();
  10934. },
  10935. different: function different(t, n) {
  10936. var o;
  10937. e(this);
  10938. return e('[data-validate="' + n + '"]').length > 0 ? o = e('[data-validate="' + n + '"]').val() : e("#" + n).length > 0 ? o = e("#" + n).val() : e('[name="' + n + '"]').length > 0 ? o = e('[name="' + n + '"]').val() : e('[name="' + n + '[]"]').length > 0 && (o = e('[name="' + n + '[]"]')), o !== i && t.toString() !== o.toString();
  10939. },
  10940. creditCard: function creditCard(t, n) {
  10941. var i,
  10942. o,
  10943. a = {
  10944. visa: {
  10945. pattern: /^4/,
  10946. length: [16]
  10947. },
  10948. amex: {
  10949. pattern: /^3[47]/,
  10950. length: [15]
  10951. },
  10952. mastercard: {
  10953. pattern: /^5[1-5]/,
  10954. length: [16]
  10955. },
  10956. discover: {
  10957. pattern: /^(6011|622(12[6-9]|1[3-9][0-9]|[2-8][0-9]{2}|9[0-1][0-9]|92[0-5]|64[4-9])|65)/,
  10958. length: [16]
  10959. },
  10960. unionPay: {
  10961. pattern: /^(62|88)/,
  10962. length: [16, 17, 18, 19]
  10963. },
  10964. jcb: {
  10965. pattern: /^35(2[89]|[3-8][0-9])/,
  10966. length: [16]
  10967. },
  10968. maestro: {
  10969. pattern: /^(5018|5020|5038|6304|6759|676[1-3])/,
  10970. length: [12, 13, 14, 15, 16, 17, 18, 19]
  10971. },
  10972. dinersClub: {
  10973. pattern: /^(30[0-5]|^36)/,
  10974. length: [14]
  10975. },
  10976. laser: {
  10977. pattern: /^(6304|670[69]|6771)/,
  10978. length: [16, 17, 18, 19]
  10979. },
  10980. visaElectron: {
  10981. pattern: /^(4026|417500|4508|4844|491(3|7))/,
  10982. length: [16]
  10983. }
  10984. },
  10985. r = {},
  10986. s = !1,
  10987. l = "string" == typeof n && n.split(",");
  10988. if ("string" == typeof t && 0 !== t.length) {
  10989. if (t = t.replace(/[\-]/g, ""), l && (e.each(l, function (n, i) {
  10990. (o = a[i]) && (r = {
  10991. length: -1 !== e.inArray(t.length, o.length),
  10992. pattern: -1 !== t.search(o.pattern)
  10993. }).length && r.pattern && (s = !0);
  10994. }), !s)) return !1;
  10995. if ((i = {
  10996. number: -1 !== e.inArray(t.length, a.unionPay.length),
  10997. pattern: -1 !== t.search(a.unionPay.pattern)
  10998. }).number && i.pattern) return !0;
  10999. for (var c = t.length, u = 0, d = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 2, 4, 6, 8, 1, 3, 5, 7, 9]], f = 0; c--;) {
  11000. f += d[u][parseInt(t.charAt(c), 10)], u ^= 1;
  11001. }
  11002. return f % 10 == 0 && f > 0;
  11003. }
  11004. },
  11005. minCount: function minCount(e, t) {
  11006. return 0 == t || (1 == t ? "" !== e : e.split(",").length >= t);
  11007. },
  11008. exactCount: function exactCount(e, t) {
  11009. return 0 == t ? "" === e : 1 == t ? "" !== e && -1 === e.search(",") : e.split(",").length == t;
  11010. },
  11011. maxCount: function maxCount(e, t) {
  11012. return 0 != t && (1 == t ? -1 === e.search(",") : e.split(",").length <= t);
  11013. }
  11014. }
  11015. };
  11016. }(jQuery, window, document), function (e, t, n, i) {
  11017. "use strict";
  11018. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.accordion = function (n) {
  11019. var o,
  11020. a = e(this),
  11021. r = new Date().getTime(),
  11022. s = [],
  11023. l = arguments[0],
  11024. c = "string" == typeof l,
  11025. u = [].slice.call(arguments, 1);
  11026. t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame;
  11027. return a.each(function () {
  11028. var d,
  11029. f,
  11030. m = e.isPlainObject(n) ? e.extend(!0, {}, e.fn.accordion.settings, n) : e.extend({}, e.fn.accordion.settings),
  11031. g = m.className,
  11032. p = m.namespace,
  11033. h = m.selector,
  11034. v = m.error,
  11035. b = "." + p,
  11036. y = "module-" + p,
  11037. x = a.selector || "",
  11038. C = e(this),
  11039. w = C.find(h.title),
  11040. S = C.find(h.content),
  11041. k = this,
  11042. T = C.data(y);
  11043. f = {
  11044. initialize: function initialize() {
  11045. f.debug("Initializing", C), f.bind.events(), m.observeChanges && f.observeChanges(), f.instantiate();
  11046. },
  11047. instantiate: function instantiate() {
  11048. T = f, C.data(y, f);
  11049. },
  11050. destroy: function destroy() {
  11051. f.debug("Destroying previous instance", C), C.off(b).removeData(y);
  11052. },
  11053. refresh: function refresh() {
  11054. w = C.find(h.title), S = C.find(h.content);
  11055. },
  11056. observeChanges: function observeChanges() {
  11057. "MutationObserver" in t && ((d = new MutationObserver(function (e) {
  11058. f.debug("DOM tree modified, updating selector cache"), f.refresh();
  11059. })).observe(k, {
  11060. childList: !0,
  11061. subtree: !0
  11062. }), f.debug("Setting up mutation observer", d));
  11063. },
  11064. bind: {
  11065. events: function events() {
  11066. f.debug("Binding delegated events"), C.on(m.on + b, h.trigger, f.event.click);
  11067. }
  11068. },
  11069. event: {
  11070. click: function click() {
  11071. f.toggle.call(this);
  11072. }
  11073. },
  11074. toggle: function toggle(t) {
  11075. var n = t !== i ? "number" == typeof t ? w.eq(t) : e(t).closest(h.title) : e(this).closest(h.title),
  11076. o = n.next(S),
  11077. a = o.hasClass(g.animating),
  11078. r = o.hasClass(g.active),
  11079. s = r && !a,
  11080. l = !r && a;
  11081. f.debug("Toggling visibility of content", n), s || l ? m.collapsible ? f.close.call(n) : f.debug("Cannot close accordion content collapsing is disabled") : f.open.call(n);
  11082. },
  11083. open: function open(t) {
  11084. var n = t !== i ? "number" == typeof t ? w.eq(t) : e(t).closest(h.title) : e(this).closest(h.title),
  11085. o = n.next(S),
  11086. a = o.hasClass(g.animating);
  11087. o.hasClass(g.active) || a ? f.debug("Accordion already open, skipping", o) : (f.debug("Opening accordion content", n), m.onOpening.call(o), m.onChanging.call(o), m.exclusive && f.closeOthers.call(n), n.addClass(g.active), o.stop(!0, !0).addClass(g.animating), m.animateChildren && (e.fn.transition !== i && C.transition("is supported") ? o.children().transition({
  11088. animation: "fade in",
  11089. queue: !1,
  11090. useFailSafe: !0,
  11091. debug: m.debug,
  11092. verbose: m.verbose,
  11093. duration: m.duration
  11094. }) : o.children().stop(!0, !0).animate({
  11095. opacity: 1
  11096. }, m.duration, f.resetOpacity)), o.slideDown(m.duration, m.easing, function () {
  11097. o.removeClass(g.animating).addClass(g.active), f.reset.display.call(this), m.onOpen.call(this), m.onChange.call(this);
  11098. }));
  11099. },
  11100. close: function close(t) {
  11101. var n = t !== i ? "number" == typeof t ? w.eq(t) : e(t).closest(h.title) : e(this).closest(h.title),
  11102. o = n.next(S),
  11103. a = o.hasClass(g.animating),
  11104. r = o.hasClass(g.active);
  11105. !r && !(!r && a) || r && a || (f.debug("Closing accordion content", o), m.onClosing.call(o), m.onChanging.call(o), n.removeClass(g.active), o.stop(!0, !0).addClass(g.animating), m.animateChildren && (e.fn.transition !== i && C.transition("is supported") ? o.children().transition({
  11106. animation: "fade out",
  11107. queue: !1,
  11108. useFailSafe: !0,
  11109. debug: m.debug,
  11110. verbose: m.verbose,
  11111. duration: m.duration
  11112. }) : o.children().stop(!0, !0).animate({
  11113. opacity: 0
  11114. }, m.duration, f.resetOpacity)), o.slideUp(m.duration, m.easing, function () {
  11115. o.removeClass(g.animating).removeClass(g.active), f.reset.display.call(this), m.onClose.call(this), m.onChange.call(this);
  11116. }));
  11117. },
  11118. closeOthers: function closeOthers(t) {
  11119. var n,
  11120. o,
  11121. a,
  11122. r = t !== i ? w.eq(t) : e(this).closest(h.title),
  11123. s = r.parents(h.content).prev(h.title),
  11124. l = r.closest(h.accordion),
  11125. c = h.title + "." + g.active + ":visible",
  11126. u = h.content + "." + g.active + ":visible";
  11127. m.closeNested ? a = (n = l.find(c).not(s)).next(S) : (n = l.find(c).not(s), o = l.find(u).find(c).not(s), a = (n = n.not(o)).next(S)), n.length > 0 && (f.debug("Exclusive enabled, closing other content", n), n.removeClass(g.active), a.removeClass(g.animating).stop(!0, !0), m.animateChildren && (e.fn.transition !== i && C.transition("is supported") ? a.children().transition({
  11128. animation: "fade out",
  11129. useFailSafe: !0,
  11130. debug: m.debug,
  11131. verbose: m.verbose,
  11132. duration: m.duration
  11133. }) : a.children().stop(!0, !0).animate({
  11134. opacity: 0
  11135. }, m.duration, f.resetOpacity)), a.slideUp(m.duration, m.easing, function () {
  11136. e(this).removeClass(g.active), f.reset.display.call(this);
  11137. }));
  11138. },
  11139. reset: {
  11140. display: function display() {
  11141. f.verbose("Removing inline display from element", this), e(this).css("display", ""), "" === e(this).attr("style") && e(this).attr("style", "").removeAttr("style");
  11142. },
  11143. opacity: function opacity() {
  11144. f.verbose("Removing inline opacity from element", this), e(this).css("opacity", ""), "" === e(this).attr("style") && e(this).attr("style", "").removeAttr("style");
  11145. }
  11146. },
  11147. setting: function setting(t, n) {
  11148. if (f.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, m, t);else {
  11149. if (n === i) return m[t];
  11150. e.isPlainObject(m[t]) ? e.extend(!0, m[t], n) : m[t] = n;
  11151. }
  11152. },
  11153. internal: function internal(t, n) {
  11154. if (f.debug("Changing internal", t, n), n === i) return f[t];
  11155. e.isPlainObject(t) ? e.extend(!0, f, t) : f[t] = n;
  11156. },
  11157. debug: function debug() {
  11158. !m.silent && m.debug && (m.performance ? f.performance.log(arguments) : (f.debug = Function.prototype.bind.call(console.info, console, m.name + ":"), f.debug.apply(console, arguments)));
  11159. },
  11160. verbose: function verbose() {
  11161. !m.silent && m.verbose && m.debug && (m.performance ? f.performance.log(arguments) : (f.verbose = Function.prototype.bind.call(console.info, console, m.name + ":"), f.verbose.apply(console, arguments)));
  11162. },
  11163. error: function error() {
  11164. m.silent || (f.error = Function.prototype.bind.call(console.error, console, m.name + ":"), f.error.apply(console, arguments));
  11165. },
  11166. performance: {
  11167. log: function log(e) {
  11168. var t, n;
  11169. m.performance && (n = (t = new Date().getTime()) - (r || t), r = t, s.push({
  11170. Name: e[0],
  11171. Arguments: [].slice.call(e, 1) || "",
  11172. Element: k,
  11173. "Execution Time": n
  11174. })), clearTimeout(f.performance.timer), f.performance.timer = setTimeout(f.performance.display, 500);
  11175. },
  11176. display: function display() {
  11177. var t = m.name + ":",
  11178. n = 0;
  11179. r = !1, clearTimeout(f.performance.timer), e.each(s, function (e, t) {
  11180. n += t["Execution Time"];
  11181. }), t += " " + n + "ms", x && (t += " '" + x + "'"), (console.group !== i || console.table !== i) && s.length > 0 && (console.groupCollapsed(t), console.table ? console.table(s) : e.each(s, function (e, t) {
  11182. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  11183. }), console.groupEnd()), s = [];
  11184. }
  11185. },
  11186. invoke: function invoke(t, n, a) {
  11187. var r,
  11188. s,
  11189. l,
  11190. c = T;
  11191. return n = n || u, a = k || a, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  11192. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  11193. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  11194. if (c[a] !== i) return s = c[a], !1;
  11195. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (f.error(v.method, t), !1);
  11196. c = c[o];
  11197. }
  11198. })), e.isFunction(s) ? l = s.apply(a, n) : s !== i && (l = s), e.isArray(o) ? o.push(l) : o !== i ? o = [o, l] : l !== i && (o = l), s;
  11199. }
  11200. }, c ? (T === i && f.initialize(), f.invoke(l)) : (T !== i && T.invoke("destroy"), f.initialize());
  11201. }), o !== i ? o : this;
  11202. }, e.fn.accordion.settings = {
  11203. name: "Accordion",
  11204. namespace: "accordion",
  11205. silent: !1,
  11206. debug: !1,
  11207. verbose: !1,
  11208. performance: !0,
  11209. on: "click",
  11210. observeChanges: !0,
  11211. exclusive: !0,
  11212. collapsible: !0,
  11213. closeNested: !1,
  11214. animateChildren: !0,
  11215. duration: 350,
  11216. easing: "easeOutQuad",
  11217. onOpening: function onOpening() {},
  11218. onClosing: function onClosing() {},
  11219. onChanging: function onChanging() {},
  11220. onOpen: function onOpen() {},
  11221. onClose: function onClose() {},
  11222. onChange: function onChange() {},
  11223. error: {
  11224. method: "The method you called is not defined"
  11225. },
  11226. className: {
  11227. active: "active",
  11228. animating: "animating"
  11229. },
  11230. selector: {
  11231. accordion: ".accordion",
  11232. title: ".title",
  11233. trigger: ".title",
  11234. content: ".content"
  11235. }
  11236. }, e.extend(e.easing, {
  11237. easeOutQuad: function easeOutQuad(e, t, n, i, o) {
  11238. return -i * (t /= o) * (t - 2) + n;
  11239. }
  11240. });
  11241. }(jQuery, window, document), function (e, t, n, i) {
  11242. "use strict";
  11243. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.checkbox = function (o) {
  11244. var a,
  11245. r = e(this),
  11246. s = r.selector || "",
  11247. l = new Date().getTime(),
  11248. c = [],
  11249. u = arguments[0],
  11250. d = "string" == typeof u,
  11251. f = [].slice.call(arguments, 1);
  11252. return r.each(function () {
  11253. var r,
  11254. m,
  11255. g = e.extend(!0, {}, e.fn.checkbox.settings, o),
  11256. p = g.className,
  11257. h = g.namespace,
  11258. v = g.selector,
  11259. b = g.error,
  11260. y = "." + h,
  11261. x = "module-" + h,
  11262. C = e(this),
  11263. w = e(this).children(v.label),
  11264. S = e(this).children(v.input),
  11265. k = S[0],
  11266. T = !1,
  11267. A = !1,
  11268. R = C.data(x),
  11269. P = this;
  11270. m = {
  11271. initialize: function initialize() {
  11272. m.verbose("Initializing checkbox", g), m.create.label(), m.bind.events(), m.set.tabbable(), m.hide.input(), m.observeChanges(), m.instantiate(), m.setup();
  11273. },
  11274. instantiate: function instantiate() {
  11275. m.verbose("Storing instance of module", m), R = m, C.data(x, m);
  11276. },
  11277. destroy: function destroy() {
  11278. m.verbose("Destroying module"), m.unbind.events(), m.show.input(), C.removeData(x);
  11279. },
  11280. fix: {
  11281. reference: function reference() {
  11282. C.is(v.input) && (m.debug("Behavior called on <input> adjusting invoked element"), C = C.closest(v.checkbox), m.refresh());
  11283. }
  11284. },
  11285. setup: function setup() {
  11286. m.set.initialLoad(), m.is.indeterminate() ? (m.debug("Initial value is indeterminate"), m.indeterminate()) : m.is.checked() ? (m.debug("Initial value is checked"), m.check()) : (m.debug("Initial value is unchecked"), m.uncheck()), m.remove.initialLoad();
  11287. },
  11288. refresh: function refresh() {
  11289. w = C.children(v.label), S = C.children(v.input), k = S[0];
  11290. },
  11291. hide: {
  11292. input: function input() {
  11293. m.verbose("Modifying <input> z-index to be unselectable"), S.addClass(p.hidden);
  11294. }
  11295. },
  11296. show: {
  11297. input: function input() {
  11298. m.verbose("Modifying <input> z-index to be selectable"), S.removeClass(p.hidden);
  11299. }
  11300. },
  11301. observeChanges: function observeChanges() {
  11302. "MutationObserver" in t && ((r = new MutationObserver(function (e) {
  11303. m.debug("DOM tree modified, updating selector cache"), m.refresh();
  11304. })).observe(P, {
  11305. childList: !0,
  11306. subtree: !0
  11307. }), m.debug("Setting up mutation observer", r));
  11308. },
  11309. attachEvents: function attachEvents(t, n) {
  11310. var i = e(t);
  11311. n = e.isFunction(m[n]) ? m[n] : m.toggle, i.length > 0 ? (m.debug("Attaching checkbox events to element", t, n), i.on("click" + y, n)) : m.error(b.notFound);
  11312. },
  11313. event: {
  11314. click: function click(t) {
  11315. var n = e(t.target);
  11316. n.is(v.input) ? m.verbose("Using default check action on initialized checkbox") : n.is(v.link) ? m.debug("Clicking link inside checkbox, skipping toggle") : (m.toggle(), S.focus(), t.preventDefault());
  11317. },
  11318. keydown: function keydown(e) {
  11319. var t = e.which,
  11320. n = 13,
  11321. i = 32;
  11322. t == 27 ? (m.verbose("Escape key pressed blurring field"), S.blur(), A = !0) : e.ctrlKey || t != i && t != n ? A = !1 : (m.verbose("Enter/space key pressed, toggling checkbox"), m.toggle(), A = !0);
  11323. },
  11324. keyup: function keyup(e) {
  11325. A && e.preventDefault();
  11326. }
  11327. },
  11328. check: function check() {
  11329. m.should.allowCheck() && (m.debug("Checking checkbox", S), m.set.checked(), m.should.ignoreCallbacks() || (g.onChecked.call(k), g.onChange.call(k)));
  11330. },
  11331. uncheck: function uncheck() {
  11332. m.should.allowUncheck() && (m.debug("Unchecking checkbox"), m.set.unchecked(), m.should.ignoreCallbacks() || (g.onUnchecked.call(k), g.onChange.call(k)));
  11333. },
  11334. indeterminate: function indeterminate() {
  11335. m.should.allowIndeterminate() ? m.debug("Checkbox is already indeterminate") : (m.debug("Making checkbox indeterminate"), m.set.indeterminate(), m.should.ignoreCallbacks() || (g.onIndeterminate.call(k), g.onChange.call(k)));
  11336. },
  11337. determinate: function determinate() {
  11338. m.should.allowDeterminate() ? m.debug("Checkbox is already determinate") : (m.debug("Making checkbox determinate"), m.set.determinate(), m.should.ignoreCallbacks() || (g.onDeterminate.call(k), g.onChange.call(k)));
  11339. },
  11340. enable: function enable() {
  11341. m.is.enabled() ? m.debug("Checkbox is already enabled") : (m.debug("Enabling checkbox"), m.set.enabled(), g.onEnable.call(k), g.onEnabled.call(k));
  11342. },
  11343. disable: function disable() {
  11344. m.is.disabled() ? m.debug("Checkbox is already disabled") : (m.debug("Disabling checkbox"), m.set.disabled(), g.onDisable.call(k), g.onDisabled.call(k));
  11345. },
  11346. get: {
  11347. radios: function radios() {
  11348. var t = m.get.name();
  11349. return e('input[name="' + t + '"]').closest(v.checkbox);
  11350. },
  11351. otherRadios: function otherRadios() {
  11352. return m.get.radios().not(C);
  11353. },
  11354. name: function name() {
  11355. return S.attr("name");
  11356. }
  11357. },
  11358. is: {
  11359. initialLoad: function initialLoad() {
  11360. return T;
  11361. },
  11362. radio: function radio() {
  11363. return S.hasClass(p.radio) || "radio" == S.attr("type");
  11364. },
  11365. indeterminate: function indeterminate() {
  11366. return S.prop("indeterminate") !== i && S.prop("indeterminate");
  11367. },
  11368. checked: function checked() {
  11369. return S.prop("checked") !== i && S.prop("checked");
  11370. },
  11371. disabled: function disabled() {
  11372. return S.prop("disabled") !== i && S.prop("disabled");
  11373. },
  11374. enabled: function enabled() {
  11375. return !m.is.disabled();
  11376. },
  11377. determinate: function determinate() {
  11378. return !m.is.indeterminate();
  11379. },
  11380. unchecked: function unchecked() {
  11381. return !m.is.checked();
  11382. }
  11383. },
  11384. should: {
  11385. allowCheck: function allowCheck() {
  11386. return m.is.determinate() && m.is.checked() && !m.should.forceCallbacks() ? (m.debug("Should not allow check, checkbox is already checked"), !1) : !1 !== g.beforeChecked.apply(k) || (m.debug("Should not allow check, beforeChecked cancelled"), !1);
  11387. },
  11388. allowUncheck: function allowUncheck() {
  11389. return m.is.determinate() && m.is.unchecked() && !m.should.forceCallbacks() ? (m.debug("Should not allow uncheck, checkbox is already unchecked"), !1) : !1 !== g.beforeUnchecked.apply(k) || (m.debug("Should not allow uncheck, beforeUnchecked cancelled"), !1);
  11390. },
  11391. allowIndeterminate: function allowIndeterminate() {
  11392. return m.is.indeterminate() && !m.should.forceCallbacks() ? (m.debug("Should not allow indeterminate, checkbox is already indeterminate"), !1) : !1 !== g.beforeIndeterminate.apply(k) || (m.debug("Should not allow indeterminate, beforeIndeterminate cancelled"), !1);
  11393. },
  11394. allowDeterminate: function allowDeterminate() {
  11395. return m.is.determinate() && !m.should.forceCallbacks() ? (m.debug("Should not allow determinate, checkbox is already determinate"), !1) : !1 !== g.beforeDeterminate.apply(k) || (m.debug("Should not allow determinate, beforeDeterminate cancelled"), !1);
  11396. },
  11397. forceCallbacks: function forceCallbacks() {
  11398. return m.is.initialLoad() && g.fireOnInit;
  11399. },
  11400. ignoreCallbacks: function ignoreCallbacks() {
  11401. return T && !g.fireOnInit;
  11402. }
  11403. },
  11404. can: {
  11405. change: function change() {
  11406. return !(C.hasClass(p.disabled) || C.hasClass(p.readOnly) || S.prop("disabled") || S.prop("readonly"));
  11407. },
  11408. uncheck: function uncheck() {
  11409. return "boolean" == typeof g.uncheckable ? g.uncheckable : !m.is.radio();
  11410. }
  11411. },
  11412. set: {
  11413. initialLoad: function initialLoad() {
  11414. T = !0;
  11415. },
  11416. checked: function checked() {
  11417. m.verbose("Setting class to checked"), C.removeClass(p.indeterminate).addClass(p.checked), m.is.radio() && m.uncheckOthers(), m.is.indeterminate() || !m.is.checked() ? (m.verbose("Setting state to checked", k), S.prop("indeterminate", !1).prop("checked", !0), m.trigger.change()) : m.debug("Input is already checked, skipping input property change");
  11418. },
  11419. unchecked: function unchecked() {
  11420. m.verbose("Removing checked class"), C.removeClass(p.indeterminate).removeClass(p.checked), m.is.indeterminate() || !m.is.unchecked() ? (m.debug("Setting state to unchecked"), S.prop("indeterminate", !1).prop("checked", !1), m.trigger.change()) : m.debug("Input is already unchecked");
  11421. },
  11422. indeterminate: function indeterminate() {
  11423. m.verbose("Setting class to indeterminate"), C.addClass(p.indeterminate), m.is.indeterminate() ? m.debug("Input is already indeterminate, skipping input property change") : (m.debug("Setting state to indeterminate"), S.prop("indeterminate", !0), m.trigger.change());
  11424. },
  11425. determinate: function determinate() {
  11426. m.verbose("Removing indeterminate class"), C.removeClass(p.indeterminate), m.is.determinate() ? m.debug("Input is already determinate, skipping input property change") : (m.debug("Setting state to determinate"), S.prop("indeterminate", !1));
  11427. },
  11428. disabled: function disabled() {
  11429. m.verbose("Setting class to disabled"), C.addClass(p.disabled), m.is.disabled() ? m.debug("Input is already disabled, skipping input property change") : (m.debug("Setting state to disabled"), S.prop("disabled", "disabled"), m.trigger.change());
  11430. },
  11431. enabled: function enabled() {
  11432. m.verbose("Removing disabled class"), C.removeClass(p.disabled), m.is.enabled() ? m.debug("Input is already enabled, skipping input property change") : (m.debug("Setting state to enabled"), S.prop("disabled", !1), m.trigger.change());
  11433. },
  11434. tabbable: function tabbable() {
  11435. m.verbose("Adding tabindex to checkbox"), S.attr("tabindex") === i && S.attr("tabindex", 0);
  11436. }
  11437. },
  11438. remove: {
  11439. initialLoad: function initialLoad() {
  11440. T = !1;
  11441. }
  11442. },
  11443. trigger: {
  11444. change: function change() {
  11445. var e = n.createEvent("HTMLEvents"),
  11446. t = S[0];
  11447. t && (m.verbose("Triggering native change event"), e.initEvent("change", !0, !1), t.dispatchEvent(e));
  11448. }
  11449. },
  11450. create: {
  11451. label: function label() {
  11452. S.prevAll(v.label).length > 0 ? (S.prev(v.label).detach().insertAfter(S), m.debug("Moving existing label", w)) : m.has.label() || (w = e("<label>").insertAfter(S), m.debug("Creating label", w));
  11453. }
  11454. },
  11455. has: {
  11456. label: function label() {
  11457. return w.length > 0;
  11458. }
  11459. },
  11460. bind: {
  11461. events: function events() {
  11462. m.verbose("Attaching checkbox events"), C.on("click" + y, m.event.click).on("keydown" + y, v.input, m.event.keydown).on("keyup" + y, v.input, m.event.keyup);
  11463. }
  11464. },
  11465. unbind: {
  11466. events: function events() {
  11467. m.debug("Removing events"), C.off(y);
  11468. }
  11469. },
  11470. uncheckOthers: function uncheckOthers() {
  11471. var e = m.get.otherRadios();
  11472. m.debug("Unchecking other radios", e), e.removeClass(p.checked);
  11473. },
  11474. toggle: function toggle() {
  11475. m.can.change() ? m.is.indeterminate() || m.is.unchecked() ? (m.debug("Currently unchecked"), m.check()) : m.is.checked() && m.can.uncheck() && (m.debug("Currently checked"), m.uncheck()) : m.is.radio() || m.debug("Checkbox is read-only or disabled, ignoring toggle");
  11476. },
  11477. setting: function setting(t, n) {
  11478. if (m.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, g, t);else {
  11479. if (n === i) return g[t];
  11480. e.isPlainObject(g[t]) ? e.extend(!0, g[t], n) : g[t] = n;
  11481. }
  11482. },
  11483. internal: function internal(t, n) {
  11484. if (e.isPlainObject(t)) e.extend(!0, m, t);else {
  11485. if (n === i) return m[t];
  11486. m[t] = n;
  11487. }
  11488. },
  11489. debug: function debug() {
  11490. !g.silent && g.debug && (g.performance ? m.performance.log(arguments) : (m.debug = Function.prototype.bind.call(console.info, console, g.name + ":"), m.debug.apply(console, arguments)));
  11491. },
  11492. verbose: function verbose() {
  11493. !g.silent && g.verbose && g.debug && (g.performance ? m.performance.log(arguments) : (m.verbose = Function.prototype.bind.call(console.info, console, g.name + ":"), m.verbose.apply(console, arguments)));
  11494. },
  11495. error: function error() {
  11496. g.silent || (m.error = Function.prototype.bind.call(console.error, console, g.name + ":"), m.error.apply(console, arguments));
  11497. },
  11498. performance: {
  11499. log: function log(e) {
  11500. var t, n;
  11501. g.performance && (n = (t = new Date().getTime()) - (l || t), l = t, c.push({
  11502. Name: e[0],
  11503. Arguments: [].slice.call(e, 1) || "",
  11504. Element: P,
  11505. "Execution Time": n
  11506. })), clearTimeout(m.performance.timer), m.performance.timer = setTimeout(m.performance.display, 500);
  11507. },
  11508. display: function display() {
  11509. var t = g.name + ":",
  11510. n = 0;
  11511. l = !1, clearTimeout(m.performance.timer), e.each(c, function (e, t) {
  11512. n += t["Execution Time"];
  11513. }), t += " " + n + "ms", s && (t += " '" + s + "'"), (console.group !== i || console.table !== i) && c.length > 0 && (console.groupCollapsed(t), console.table ? console.table(c) : e.each(c, function (e, t) {
  11514. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  11515. }), console.groupEnd()), c = [];
  11516. }
  11517. },
  11518. invoke: function invoke(t, n, o) {
  11519. var r,
  11520. s,
  11521. l,
  11522. c = R;
  11523. return n = n || f, o = P || o, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  11524. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  11525. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  11526. if (c[a] !== i) return s = c[a], !1;
  11527. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (m.error(b.method, t), !1);
  11528. c = c[o];
  11529. }
  11530. })), e.isFunction(s) ? l = s.apply(o, n) : s !== i && (l = s), e.isArray(a) ? a.push(l) : a !== i ? a = [a, l] : l !== i && (a = l), s;
  11531. }
  11532. }, d ? (R === i && m.initialize(), m.invoke(u)) : (R !== i && R.invoke("destroy"), m.initialize());
  11533. }), a !== i ? a : this;
  11534. }, e.fn.checkbox.settings = {
  11535. name: "Checkbox",
  11536. namespace: "checkbox",
  11537. silent: !1,
  11538. debug: !1,
  11539. verbose: !0,
  11540. performance: !0,
  11541. uncheckable: "auto",
  11542. fireOnInit: !1,
  11543. onChange: function onChange() {},
  11544. beforeChecked: function beforeChecked() {},
  11545. beforeUnchecked: function beforeUnchecked() {},
  11546. beforeDeterminate: function beforeDeterminate() {},
  11547. beforeIndeterminate: function beforeIndeterminate() {},
  11548. onChecked: function onChecked() {},
  11549. onUnchecked: function onUnchecked() {},
  11550. onDeterminate: function onDeterminate() {},
  11551. onIndeterminate: function onIndeterminate() {},
  11552. onEnable: function onEnable() {},
  11553. onDisable: function onDisable() {},
  11554. onEnabled: function onEnabled() {},
  11555. onDisabled: function onDisabled() {},
  11556. className: {
  11557. checked: "checked",
  11558. indeterminate: "indeterminate",
  11559. disabled: "disabled",
  11560. hidden: "hidden",
  11561. radio: "radio",
  11562. readOnly: "read-only"
  11563. },
  11564. error: {
  11565. method: "The method you called is not defined"
  11566. },
  11567. selector: {
  11568. checkbox: ".ui.checkbox",
  11569. label: "label, .box",
  11570. input: 'input[type="checkbox"], input[type="radio"]',
  11571. link: "a[href]"
  11572. }
  11573. };
  11574. }(jQuery, window, document), function (e, t, n, i) {
  11575. "use strict";
  11576. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.dimmer = function (t) {
  11577. var o,
  11578. a = e(this),
  11579. r = new Date().getTime(),
  11580. s = [],
  11581. l = arguments[0],
  11582. c = "string" == typeof l,
  11583. u = [].slice.call(arguments, 1);
  11584. return a.each(function () {
  11585. var d,
  11586. f,
  11587. m,
  11588. g = e.isPlainObject(t) ? e.extend(!0, {}, e.fn.dimmer.settings, t) : e.extend({}, e.fn.dimmer.settings),
  11589. p = g.selector,
  11590. h = g.namespace,
  11591. v = g.className,
  11592. b = g.error,
  11593. y = "." + h,
  11594. x = "module-" + h,
  11595. C = a.selector || "",
  11596. w = "ontouchstart" in n.documentElement ? "touchstart" : "click",
  11597. S = e(this),
  11598. k = this,
  11599. T = S.data(x);
  11600. (m = {
  11601. preinitialize: function preinitialize() {
  11602. m.is.dimmer() ? (f = S.parent(), d = S) : (f = S, d = m.has.dimmer() ? g.dimmerName ? f.find(p.dimmer).filter("." + g.dimmerName) : f.find(p.dimmer) : m.create(), m.set.variation());
  11603. },
  11604. initialize: function initialize() {
  11605. m.debug("Initializing dimmer", g), m.bind.events(), m.set.dimmable(), m.instantiate();
  11606. },
  11607. instantiate: function instantiate() {
  11608. m.verbose("Storing instance of module", m), T = m, S.data(x, T);
  11609. },
  11610. destroy: function destroy() {
  11611. m.verbose("Destroying previous module", d), m.unbind.events(), m.remove.variation(), f.off(y);
  11612. },
  11613. bind: {
  11614. events: function events() {
  11615. m.is.page() && f.get(0).addEventListener("touchmove", m.event.preventScroll, {
  11616. passive: !1
  11617. }), "hover" == g.on ? f.on("mouseenter" + y, m.show).on("mouseleave" + y, m.hide) : "click" == g.on && f.on(w + y, m.toggle), m.is.page() && (m.debug("Setting as a page dimmer", f), m.set.pageDimmer()), m.is.closable() && (m.verbose("Adding dimmer close event", d), f.on(w + y, p.dimmer, m.event.click));
  11618. }
  11619. },
  11620. unbind: {
  11621. events: function events() {
  11622. m.is.page() && f.get(0).removeEventListener("touchmove", m.event.preventScroll, {
  11623. passive: !1
  11624. }), S.removeData(x), f.off(y);
  11625. }
  11626. },
  11627. event: {
  11628. click: function click(t) {
  11629. m.verbose("Determining if event occured on dimmer", t), (0 === d.find(t.target).length || e(t.target).is(p.content)) && (m.hide(), t.stopImmediatePropagation());
  11630. },
  11631. preventScroll: function preventScroll(e) {
  11632. e.preventDefault();
  11633. }
  11634. },
  11635. addContent: function addContent(t) {
  11636. var n = e(t);
  11637. m.debug("Add content to dimmer", n), n.parent()[0] !== d[0] && n.detach().appendTo(d);
  11638. },
  11639. create: function create() {
  11640. var t = e(g.template.dimmer());
  11641. return g.dimmerName && (m.debug("Creating named dimmer", g.dimmerName), t.addClass(g.dimmerName)), t.appendTo(f), t;
  11642. },
  11643. show: function show(t) {
  11644. t = e.isFunction(t) ? t : function () {}, m.debug("Showing dimmer", d, g), m.is.dimmed() && !m.is.animating() || !m.is.enabled() ? m.debug("Dimmer is already shown or disabled") : (m.animate.show(t), g.onShow.call(k), g.onChange.call(k));
  11645. },
  11646. hide: function hide(t) {
  11647. t = e.isFunction(t) ? t : function () {}, m.is.dimmed() || m.is.animating() ? (m.debug("Hiding dimmer", d), m.animate.hide(t), g.onHide.call(k), g.onChange.call(k)) : m.debug("Dimmer is not visible");
  11648. },
  11649. toggle: function toggle() {
  11650. m.verbose("Toggling dimmer visibility", d), m.is.dimmed() ? m.hide() : m.show();
  11651. },
  11652. animate: {
  11653. show: function show(t) {
  11654. t = e.isFunction(t) ? t : function () {}, g.useCSS && e.fn.transition !== i && d.transition("is supported") ? ("auto" !== g.opacity && m.set.opacity(), d.transition({
  11655. displayType: "flex",
  11656. animation: g.transition + " in",
  11657. queue: !1,
  11658. duration: m.get.duration(),
  11659. useFailSafe: !0,
  11660. onStart: function onStart() {
  11661. m.set.dimmed();
  11662. },
  11663. onComplete: function onComplete() {
  11664. m.set.active(), t();
  11665. }
  11666. })) : (m.verbose("Showing dimmer animation with javascript"), m.set.dimmed(), "auto" == g.opacity && (g.opacity = .8), d.stop().css({
  11667. opacity: 0,
  11668. width: "100%",
  11669. height: "100%"
  11670. }).fadeTo(m.get.duration(), g.opacity, function () {
  11671. d.removeAttr("style"), m.set.active(), t();
  11672. }));
  11673. },
  11674. hide: function hide(t) {
  11675. t = e.isFunction(t) ? t : function () {}, g.useCSS && e.fn.transition !== i && d.transition("is supported") ? (m.verbose("Hiding dimmer with css"), d.transition({
  11676. displayType: "flex",
  11677. animation: g.transition + " out",
  11678. queue: !1,
  11679. duration: m.get.duration(),
  11680. useFailSafe: !0,
  11681. onStart: function onStart() {
  11682. m.remove.dimmed();
  11683. },
  11684. onComplete: function onComplete() {
  11685. m.remove.active(), t();
  11686. }
  11687. })) : (m.verbose("Hiding dimmer with javascript"), m.remove.dimmed(), d.stop().fadeOut(m.get.duration(), function () {
  11688. m.remove.active(), d.removeAttr("style"), t();
  11689. }));
  11690. }
  11691. },
  11692. get: {
  11693. dimmer: function dimmer() {
  11694. return d;
  11695. },
  11696. duration: function duration() {
  11697. return "object" == _typeof(g.duration) ? m.is.active() ? g.duration.hide : g.duration.show : g.duration;
  11698. }
  11699. },
  11700. has: {
  11701. dimmer: function dimmer() {
  11702. return g.dimmerName ? S.find(p.dimmer).filter("." + g.dimmerName).length > 0 : S.find(p.dimmer).length > 0;
  11703. }
  11704. },
  11705. is: {
  11706. active: function active() {
  11707. return d.hasClass(v.active);
  11708. },
  11709. animating: function animating() {
  11710. return d.is(":animated") || d.hasClass(v.animating);
  11711. },
  11712. closable: function closable() {
  11713. return "auto" == g.closable ? "hover" != g.on : g.closable;
  11714. },
  11715. dimmer: function dimmer() {
  11716. return S.hasClass(v.dimmer);
  11717. },
  11718. dimmable: function dimmable() {
  11719. return S.hasClass(v.dimmable);
  11720. },
  11721. dimmed: function dimmed() {
  11722. return f.hasClass(v.dimmed);
  11723. },
  11724. disabled: function disabled() {
  11725. return f.hasClass(v.disabled);
  11726. },
  11727. enabled: function enabled() {
  11728. return !m.is.disabled();
  11729. },
  11730. page: function page() {
  11731. return f.is("body");
  11732. },
  11733. pageDimmer: function pageDimmer() {
  11734. return d.hasClass(v.pageDimmer);
  11735. }
  11736. },
  11737. can: {
  11738. show: function show() {
  11739. return !d.hasClass(v.disabled);
  11740. }
  11741. },
  11742. set: {
  11743. opacity: function opacity(e) {
  11744. var t = d.css("background-color"),
  11745. n = t.split(","),
  11746. i = n && 3 == n.length,
  11747. o = n && 4 == n.length;
  11748. e = 0 === g.opacity ? 0 : g.opacity || e, i || o ? (n[3] = e + ")", t = n.join(",")) : t = "rgba(0, 0, 0, " + e + ")", m.debug("Setting opacity to", e), d.css("background-color", t);
  11749. },
  11750. active: function active() {
  11751. d.addClass(v.active);
  11752. },
  11753. dimmable: function dimmable() {
  11754. f.addClass(v.dimmable);
  11755. },
  11756. dimmed: function dimmed() {
  11757. f.addClass(v.dimmed);
  11758. },
  11759. pageDimmer: function pageDimmer() {
  11760. d.addClass(v.pageDimmer);
  11761. },
  11762. disabled: function disabled() {
  11763. d.addClass(v.disabled);
  11764. },
  11765. variation: function variation(e) {
  11766. (e = e || g.variation) && d.addClass(e);
  11767. }
  11768. },
  11769. remove: {
  11770. active: function active() {
  11771. d.removeClass(v.active);
  11772. },
  11773. dimmed: function dimmed() {
  11774. f.removeClass(v.dimmed);
  11775. },
  11776. disabled: function disabled() {
  11777. d.removeClass(v.disabled);
  11778. },
  11779. variation: function variation(e) {
  11780. (e = e || g.variation) && d.removeClass(e);
  11781. }
  11782. },
  11783. setting: function setting(t, n) {
  11784. if (m.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, g, t);else {
  11785. if (n === i) return g[t];
  11786. e.isPlainObject(g[t]) ? e.extend(!0, g[t], n) : g[t] = n;
  11787. }
  11788. },
  11789. internal: function internal(t, n) {
  11790. if (e.isPlainObject(t)) e.extend(!0, m, t);else {
  11791. if (n === i) return m[t];
  11792. m[t] = n;
  11793. }
  11794. },
  11795. debug: function debug() {
  11796. !g.silent && g.debug && (g.performance ? m.performance.log(arguments) : (m.debug = Function.prototype.bind.call(console.info, console, g.name + ":"), m.debug.apply(console, arguments)));
  11797. },
  11798. verbose: function verbose() {
  11799. !g.silent && g.verbose && g.debug && (g.performance ? m.performance.log(arguments) : (m.verbose = Function.prototype.bind.call(console.info, console, g.name + ":"), m.verbose.apply(console, arguments)));
  11800. },
  11801. error: function error() {
  11802. g.silent || (m.error = Function.prototype.bind.call(console.error, console, g.name + ":"), m.error.apply(console, arguments));
  11803. },
  11804. performance: {
  11805. log: function log(e) {
  11806. var t, n;
  11807. g.performance && (n = (t = new Date().getTime()) - (r || t), r = t, s.push({
  11808. Name: e[0],
  11809. Arguments: [].slice.call(e, 1) || "",
  11810. Element: k,
  11811. "Execution Time": n
  11812. })), clearTimeout(m.performance.timer), m.performance.timer = setTimeout(m.performance.display, 500);
  11813. },
  11814. display: function display() {
  11815. var t = g.name + ":",
  11816. n = 0;
  11817. r = !1, clearTimeout(m.performance.timer), e.each(s, function (e, t) {
  11818. n += t["Execution Time"];
  11819. }), t += " " + n + "ms", C && (t += " '" + C + "'"), a.length > 1 && (t += " (" + a.length + ")"), (console.group !== i || console.table !== i) && s.length > 0 && (console.groupCollapsed(t), console.table ? console.table(s) : e.each(s, function (e, t) {
  11820. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  11821. }), console.groupEnd()), s = [];
  11822. }
  11823. },
  11824. invoke: function invoke(t, n, a) {
  11825. var r,
  11826. s,
  11827. l,
  11828. c = T;
  11829. return n = n || u, a = k || a, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  11830. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  11831. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  11832. if (c[a] !== i) return s = c[a], !1;
  11833. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (m.error(b.method, t), !1);
  11834. c = c[o];
  11835. }
  11836. })), e.isFunction(s) ? l = s.apply(a, n) : s !== i && (l = s), e.isArray(o) ? o.push(l) : o !== i ? o = [o, l] : l !== i && (o = l), s;
  11837. }
  11838. }).preinitialize(), c ? (T === i && m.initialize(), m.invoke(l)) : (T !== i && T.invoke("destroy"), m.initialize());
  11839. }), o !== i ? o : this;
  11840. }, e.fn.dimmer.settings = {
  11841. name: "Dimmer",
  11842. namespace: "dimmer",
  11843. silent: !1,
  11844. debug: !1,
  11845. verbose: !1,
  11846. performance: !0,
  11847. dimmerName: !1,
  11848. variation: !1,
  11849. closable: "auto",
  11850. useCSS: !0,
  11851. transition: "fade",
  11852. on: !1,
  11853. opacity: "auto",
  11854. duration: {
  11855. show: 500,
  11856. hide: 500
  11857. },
  11858. onChange: function onChange() {},
  11859. onShow: function onShow() {},
  11860. onHide: function onHide() {},
  11861. error: {
  11862. method: "The method you called is not defined."
  11863. },
  11864. className: {
  11865. active: "active",
  11866. animating: "animating",
  11867. dimmable: "dimmable",
  11868. dimmed: "dimmed",
  11869. dimmer: "dimmer",
  11870. disabled: "disabled",
  11871. hide: "hide",
  11872. pageDimmer: "page",
  11873. show: "show"
  11874. },
  11875. selector: {
  11876. dimmer: "> .ui.dimmer",
  11877. content: ".ui.dimmer > .content, .ui.dimmer > .content > .center"
  11878. },
  11879. template: {
  11880. dimmer: function dimmer() {
  11881. return e("<div />").attr("class", "ui dimmer");
  11882. }
  11883. }
  11884. };
  11885. }(jQuery, window, document), function (e, t, n, i) {
  11886. "use strict";
  11887. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.dropdown = function (o) {
  11888. var a,
  11889. r = e(this),
  11890. s = e(n),
  11891. l = r.selector || "",
  11892. c = "ontouchstart" in n.documentElement,
  11893. u = new Date().getTime(),
  11894. d = [],
  11895. f = arguments[0],
  11896. m = "string" == typeof f,
  11897. g = [].slice.call(arguments, 1);
  11898. return r.each(function (p) {
  11899. var h,
  11900. v,
  11901. b,
  11902. y,
  11903. x,
  11904. C,
  11905. w,
  11906. S,
  11907. k = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.dropdown.settings, o) : e.extend({}, e.fn.dropdown.settings),
  11908. T = k.className,
  11909. A = k.message,
  11910. R = k.fields,
  11911. P = k.keys,
  11912. E = k.metadata,
  11913. F = k.namespace,
  11914. O = k.regExp,
  11915. D = k.selector,
  11916. q = k.error,
  11917. j = k.templates,
  11918. z = "." + F,
  11919. I = "module-" + F,
  11920. M = e(this),
  11921. L = e(k.context),
  11922. V = M.find(D.text),
  11923. N = M.find(D.search),
  11924. H = M.find(D.sizer),
  11925. U = M.find(D.input),
  11926. W = M.find(D.icon),
  11927. B = M.prev().find(D.text).length > 0 ? M.prev().find(D.text) : M.prev(),
  11928. Q = M.children(D.menu),
  11929. X = Q.find(D.item),
  11930. $ = !1,
  11931. Y = !1,
  11932. Z = !1,
  11933. K = this,
  11934. J = M.data(I);
  11935. S = {
  11936. initialize: function initialize() {
  11937. S.debug("Initializing dropdown", k), S.is.alreadySetup() ? S.setup.reference() : (S.setup.layout(), k.values && S.change.values(k.values), S.refreshData(), S.save.defaults(), S.restore.selected(), S.create.id(), S.bind.events(), S.observeChanges(), S.instantiate());
  11938. },
  11939. instantiate: function instantiate() {
  11940. S.verbose("Storing instance of dropdown", S), J = S, M.data(I, S);
  11941. },
  11942. destroy: function destroy() {
  11943. S.verbose("Destroying previous dropdown", M), S.remove.tabbable(), M.off(z).removeData(I), Q.off(z), s.off(y), S.disconnect.menuObserver(), S.disconnect.selectObserver();
  11944. },
  11945. observeChanges: function observeChanges() {
  11946. "MutationObserver" in t && (C = new MutationObserver(S.event.select.mutation), w = new MutationObserver(S.event.menu.mutation), S.debug("Setting up mutation observer", C, w), S.observe.select(), S.observe.menu());
  11947. },
  11948. disconnect: {
  11949. menuObserver: function menuObserver() {
  11950. w && w.disconnect();
  11951. },
  11952. selectObserver: function selectObserver() {
  11953. C && C.disconnect();
  11954. }
  11955. },
  11956. observe: {
  11957. select: function select() {
  11958. S.has.input() && C.observe(M[0], {
  11959. childList: !0,
  11960. subtree: !0
  11961. });
  11962. },
  11963. menu: function menu() {
  11964. S.has.menu() && w.observe(Q[0], {
  11965. childList: !0,
  11966. subtree: !0
  11967. });
  11968. }
  11969. },
  11970. create: {
  11971. id: function id() {
  11972. x = (Math.random().toString(16) + "000000000").substr(2, 8), y = "." + x, S.verbose("Creating unique id for element", x);
  11973. },
  11974. userChoice: function userChoice(t) {
  11975. var n, o, a;
  11976. return !!(t = t || S.get.userValues()) && (t = e.isArray(t) ? t : [t], e.each(t, function (t, r) {
  11977. !1 === S.get.item(r) && (a = k.templates.addition(S.add.variables(A.addResult, r)), o = e("<div />").html(a).attr("data-" + E.value, r).attr("data-" + E.text, r).addClass(T.addition).addClass(T.item), k.hideAdditions && o.addClass(T.hidden), n = n === i ? o : n.add(o), S.verbose("Creating user choices for value", r, o));
  11978. }), n);
  11979. },
  11980. userLabels: function userLabels(t) {
  11981. var n = S.get.userValues();
  11982. n && (S.debug("Adding user labels", n), e.each(n, function (e, t) {
  11983. S.verbose("Adding custom user value"), S.add.label(t, t);
  11984. }));
  11985. },
  11986. menu: function menu() {
  11987. Q = e("<div />").addClass(T.menu).appendTo(M);
  11988. },
  11989. sizer: function sizer() {
  11990. H = e("<span />").addClass(T.sizer).insertAfter(N);
  11991. }
  11992. },
  11993. search: function search(e) {
  11994. e = e !== i ? e : S.get.query(), S.verbose("Searching for query", e), S.has.minCharacters(e) ? S.filter(e) : S.hide();
  11995. },
  11996. select: {
  11997. firstUnfiltered: function firstUnfiltered() {
  11998. S.verbose("Selecting first non-filtered element"), S.remove.selectedItem(), X.not(D.unselectable).not(D.addition + D.hidden).eq(0).addClass(T.selected);
  11999. },
  12000. nextAvailable: function nextAvailable(e) {
  12001. var t = (e = e.eq(0)).nextAll(D.item).not(D.unselectable).eq(0),
  12002. n = e.prevAll(D.item).not(D.unselectable).eq(0);
  12003. t.length > 0 ? (S.verbose("Moving selection to", t), t.addClass(T.selected)) : (S.verbose("Moving selection to", n), n.addClass(T.selected));
  12004. }
  12005. },
  12006. setup: {
  12007. api: function api() {
  12008. var e = {
  12009. debug: k.debug,
  12010. urlData: {
  12011. value: S.get.value(),
  12012. query: S.get.query()
  12013. },
  12014. on: !1
  12015. };
  12016. S.verbose("First request, initializing API"), M.api(e);
  12017. },
  12018. layout: function layout() {
  12019. M.is("select") && (S.setup.select(), S.setup.returnedObject()), S.has.menu() || S.create.menu(), S.is.search() && !S.has.search() && (S.verbose("Adding search input"), N = e("<input />").addClass(T.search).prop("autocomplete", "off").insertBefore(V)), S.is.multiple() && S.is.searchSelection() && !S.has.sizer() && S.create.sizer(), k.allowTab && S.set.tabbable();
  12020. },
  12021. select: function select() {
  12022. var t = S.get.selectValues();
  12023. S.debug("Dropdown initialized on a select", t), M.is("select") && (U = M), U.parent(D.dropdown).length > 0 ? (S.debug("UI dropdown already exists. Creating dropdown menu only"), M = U.closest(D.dropdown), S.has.menu() || S.create.menu(), Q = M.children(D.menu), S.setup.menu(t)) : (S.debug("Creating entire dropdown from select"), M = e("<div />").attr("class", U.attr("class")).addClass(T.selection).addClass(T.dropdown).html(j.dropdown(t)).insertBefore(U), U.hasClass(T.multiple) && !1 === U.prop("multiple") && (S.error(q.missingMultiple), U.prop("multiple", !0)), U.is("[multiple]") && S.set.multiple(), U.prop("disabled") && (S.debug("Disabling dropdown"), M.addClass(T.disabled)), U.removeAttr("class").detach().prependTo(M)), S.refresh();
  12024. },
  12025. menu: function menu(e) {
  12026. Q.html(j.menu(e, R)), X = Q.find(D.item);
  12027. },
  12028. reference: function reference() {
  12029. S.debug("Dropdown behavior was called on select, replacing with closest dropdown"), M = M.parent(D.dropdown), J = M.data(I), K = M.get(0), S.refresh(), S.setup.returnedObject();
  12030. },
  12031. returnedObject: function returnedObject() {
  12032. var e = r.slice(0, p),
  12033. t = r.slice(p + 1);
  12034. r = e.add(M).add(t);
  12035. }
  12036. },
  12037. refresh: function refresh() {
  12038. S.refreshSelectors(), S.refreshData();
  12039. },
  12040. refreshItems: function refreshItems() {
  12041. X = Q.find(D.item);
  12042. },
  12043. refreshSelectors: function refreshSelectors() {
  12044. S.verbose("Refreshing selector cache"), V = M.find(D.text), N = M.find(D.search), U = M.find(D.input), W = M.find(D.icon), B = M.prev().find(D.text).length > 0 ? M.prev().find(D.text) : M.prev(), Q = M.children(D.menu), X = Q.find(D.item);
  12045. },
  12046. refreshData: function refreshData() {
  12047. S.verbose("Refreshing cached metadata"), X.removeData(E.text).removeData(E.value);
  12048. },
  12049. clearData: function clearData() {
  12050. S.verbose("Clearing metadata"), X.removeData(E.text).removeData(E.value), M.removeData(E.defaultText).removeData(E.defaultValue).removeData(E.placeholderText);
  12051. },
  12052. toggle: function toggle() {
  12053. S.verbose("Toggling menu visibility"), S.is.active() ? S.hide() : S.show();
  12054. },
  12055. show: function show(t) {
  12056. if (t = e.isFunction(t) ? t : function () {}, !S.can.show() && S.is.remote() && (S.debug("No API results retrieved, searching before show"), S.queryRemote(S.get.query(), S.show)), S.can.show() && !S.is.active()) {
  12057. if (S.debug("Showing dropdown"), !S.has.message() || S.has.maxSelections() || S.has.allResultsFiltered() || S.remove.message(), S.is.allFiltered()) return !0;
  12058. !1 !== k.onShow.call(K) && S.animate.show(function () {
  12059. S.can.click() && S.bind.intent(), S.has.menuSearch() && S.focusSearch(), S.set.visible(), t.call(K);
  12060. });
  12061. }
  12062. },
  12063. hide: function hide(t) {
  12064. t = e.isFunction(t) ? t : function () {}, S.is.active() && !S.is.animatingOutward() && (S.debug("Hiding dropdown"), !1 !== k.onHide.call(K) && S.animate.hide(function () {
  12065. S.remove.visible(), t.call(K);
  12066. }));
  12067. },
  12068. hideOthers: function hideOthers() {
  12069. S.verbose("Finding other dropdowns to hide"), r.not(M).has(D.menu + "." + T.visible).dropdown("hide");
  12070. },
  12071. hideMenu: function hideMenu() {
  12072. S.verbose("Hiding menu instantaneously"), S.remove.active(), S.remove.visible(), Q.transition("hide");
  12073. },
  12074. hideSubMenus: function hideSubMenus() {
  12075. var e = Q.children(D.item).find(D.menu);
  12076. S.verbose("Hiding sub menus", e), e.transition("hide");
  12077. },
  12078. bind: {
  12079. events: function events() {
  12080. c && S.bind.touchEvents(), S.bind.keyboardEvents(), S.bind.inputEvents(), S.bind.mouseEvents();
  12081. },
  12082. touchEvents: function touchEvents() {
  12083. S.debug("Touch device detected binding additional touch events"), S.is.searchSelection() || S.is.single() && M.on("touchstart" + z, S.event.test.toggle), Q.on("touchstart" + z, D.item, S.event.item.mouseenter);
  12084. },
  12085. keyboardEvents: function keyboardEvents() {
  12086. S.verbose("Binding keyboard events"), M.on("keydown" + z, S.event.keydown), S.has.search() && M.on(S.get.inputEvent() + z, D.search, S.event.input), S.is.multiple() && s.on("keydown" + y, S.event.document.keydown);
  12087. },
  12088. inputEvents: function inputEvents() {
  12089. S.verbose("Binding input change events"), M.on("change" + z, D.input, S.event.change);
  12090. },
  12091. mouseEvents: function mouseEvents() {
  12092. S.verbose("Binding mouse events"), S.is.multiple() && M.on("click" + z, D.label, S.event.label.click).on("click" + z, D.remove, S.event.remove.click), S.is.searchSelection() ? (M.on("mousedown" + z, S.event.mousedown).on("mouseup" + z, S.event.mouseup).on("mousedown" + z, D.menu, S.event.menu.mousedown).on("mouseup" + z, D.menu, S.event.menu.mouseup).on("click" + z, D.icon, S.event.icon.click).on("focus" + z, D.search, S.event.search.focus).on("click" + z, D.search, S.event.search.focus).on("blur" + z, D.search, S.event.search.blur).on("click" + z, D.text, S.event.text.focus), S.is.multiple() && M.on("click" + z, S.event.click)) : ("click" == k.on ? M.on("click" + z, D.icon, S.event.icon.click).on("click" + z, S.event.test.toggle) : "hover" == k.on ? M.on("mouseenter" + z, S.delay.show).on("mouseleave" + z, S.delay.hide) : M.on(k.on + z, S.toggle), M.on("mousedown" + z, S.event.mousedown).on("mouseup" + z, S.event.mouseup).on("focus" + z, S.event.focus), S.has.menuSearch() ? M.on("blur" + z, D.search, S.event.search.blur) : M.on("blur" + z, S.event.blur)), Q.on("mouseenter" + z, D.item, S.event.item.mouseenter).on("mouseleave" + z, D.item, S.event.item.mouseleave).on("click" + z, D.item, S.event.item.click);
  12093. },
  12094. intent: function intent() {
  12095. S.verbose("Binding hide intent event to document"), c && s.on("touchstart" + y, S.event.test.touch).on("touchmove" + y, S.event.test.touch), s.on("click" + y, S.event.test.hide);
  12096. }
  12097. },
  12098. unbind: {
  12099. intent: function intent() {
  12100. S.verbose("Removing hide intent event from document"), c && s.off("touchstart" + y).off("touchmove" + y), s.off("click" + y);
  12101. }
  12102. },
  12103. filter: function filter(e) {
  12104. var t = e !== i ? e : S.get.query(),
  12105. n = function n() {
  12106. S.is.multiple() && S.filterActive(), (e || !e && 0 == S.get.activeItem().length) && S.select.firstUnfiltered(), S.has.allResultsFiltered() ? k.onNoResults.call(K, t) ? k.allowAdditions ? k.hideAdditions && (S.verbose("User addition with no menu, setting empty style"), S.set.empty(), S.hideMenu()) : (S.verbose("All items filtered, showing message", t), S.add.message(A.noResults)) : (S.verbose("All items filtered, hiding dropdown", t), S.hideMenu()) : (S.remove.empty(), S.remove.message()), k.allowAdditions && S.add.userSuggestion(e), S.is.searchSelection() && S.can.show() && S.is.focusedOnSearch() && S.show();
  12107. };
  12108. k.useLabels && S.has.maxSelections() || (k.apiSettings ? S.can.useAPI() ? S.queryRemote(t, function () {
  12109. k.filterRemoteData && S.filterItems(t), n();
  12110. }) : S.error(q.noAPI) : (S.filterItems(t), n()));
  12111. },
  12112. queryRemote: function queryRemote(t, n) {
  12113. var i = {
  12114. errorDuration: !1,
  12115. cache: "local",
  12116. throttle: k.throttle,
  12117. urlData: {
  12118. query: t
  12119. },
  12120. onError: function onError() {
  12121. S.add.message(A.serverError), n();
  12122. },
  12123. onFailure: function onFailure() {
  12124. S.add.message(A.serverError), n();
  12125. },
  12126. onSuccess: function onSuccess(t) {
  12127. var i = t[R.remoteValues];
  12128. e.isArray(i) && i.length > 0 ? (S.remove.message(), S.setup.menu({
  12129. values: t[R.remoteValues]
  12130. })) : S.add.message(A.noResults), n();
  12131. }
  12132. };
  12133. M.api("get request") || S.setup.api(), i = e.extend(!0, {}, i, k.apiSettings), M.api("setting", i).api("query");
  12134. },
  12135. filterItems: function filterItems(t) {
  12136. var n = t !== i ? t : S.get.query(),
  12137. o = null,
  12138. a = S.escape.string(n),
  12139. r = new RegExp("^" + a, "igm");
  12140. S.has.query() && (o = [], S.verbose("Searching for matching values", n), X.each(function () {
  12141. var t,
  12142. i,
  12143. a = e(this);
  12144. if ("both" == k.match || "text" == k.match) {
  12145. if (-1 !== (t = String(S.get.choiceText(a, !1))).search(r)) return o.push(this), !0;
  12146. if ("exact" === k.fullTextSearch && S.exactSearch(n, t)) return o.push(this), !0;
  12147. if (!0 === k.fullTextSearch && S.fuzzySearch(n, t)) return o.push(this), !0;
  12148. }
  12149. if ("both" == k.match || "value" == k.match) {
  12150. if (-1 !== (i = String(S.get.choiceValue(a, t))).search(r)) return o.push(this), !0;
  12151. if ("exact" === k.fullTextSearch && S.exactSearch(n, i)) return o.push(this), !0;
  12152. if (!0 === k.fullTextSearch && S.fuzzySearch(n, i)) return o.push(this), !0;
  12153. }
  12154. })), S.debug("Showing only matched items", n), S.remove.filteredItem(), o && X.not(o).addClass(T.filtered);
  12155. },
  12156. fuzzySearch: function fuzzySearch(e, t) {
  12157. var n = t.length,
  12158. i = e.length;
  12159. if (e = e.toLowerCase(), t = t.toLowerCase(), i > n) return !1;
  12160. if (i === n) return e === t;
  12161. e: for (var o = 0, a = 0; o < i; o++) {
  12162. for (var r = e.charCodeAt(o); a < n;) {
  12163. if (t.charCodeAt(a++) === r) continue e;
  12164. }
  12165. return !1;
  12166. }
  12167. return !0;
  12168. },
  12169. exactSearch: function exactSearch(e, t) {
  12170. return e = e.toLowerCase(), (t = t.toLowerCase()).indexOf(e) > -1;
  12171. },
  12172. filterActive: function filterActive() {
  12173. k.useLabels && X.filter("." + T.active).addClass(T.filtered);
  12174. },
  12175. focusSearch: function focusSearch(e) {
  12176. S.has.search() && !S.is.focusedOnSearch() && (e ? (M.off("focus" + z, D.search), N.focus(), M.on("focus" + z, D.search, S.event.search.focus)) : N.focus());
  12177. },
  12178. forceSelection: function forceSelection() {
  12179. var e = X.not(T.filtered).filter("." + T.selected).eq(0),
  12180. t = X.not(T.filtered).filter("." + T.active).eq(0),
  12181. n = e.length > 0 ? e : t;
  12182. if (n.length > 0 && !S.is.multiple()) return S.debug("Forcing partial selection to selected item", n), void S.event.item.click.call(n, {}, !0);
  12183. k.allowAdditions ? (S.set.selected(S.get.query()), S.remove.searchTerm()) : S.remove.searchTerm();
  12184. },
  12185. change: {
  12186. values: function values(t) {
  12187. k.allowAdditions || S.clear(), S.debug("Creating dropdown with specified values", t), S.setup.menu({
  12188. values: t
  12189. }), e.each(t, function (e, t) {
  12190. if (1 == t.selected) return S.debug("Setting initial selection to", t.value), S.set.selected(t.value), !0;
  12191. });
  12192. }
  12193. },
  12194. event: {
  12195. change: function change() {
  12196. Z || (S.debug("Input changed, updating selection"), S.set.selected());
  12197. },
  12198. focus: function focus() {
  12199. k.showOnFocus && !$ && S.is.hidden() && !v && S.show();
  12200. },
  12201. blur: function blur(e) {
  12202. v = n.activeElement === this, $ || v || (S.remove.activeLabel(), S.hide());
  12203. },
  12204. mousedown: function mousedown() {
  12205. S.is.searchSelection() ? b = !0 : $ = !0;
  12206. },
  12207. mouseup: function mouseup() {
  12208. S.is.searchSelection() ? b = !1 : $ = !1;
  12209. },
  12210. click: function click(t) {
  12211. e(t.target).is(M) && (S.is.focusedOnSearch() ? S.show() : S.focusSearch());
  12212. },
  12213. search: {
  12214. focus: function focus() {
  12215. $ = !0, S.is.multiple() && S.remove.activeLabel(), k.showOnFocus && S.search();
  12216. },
  12217. blur: function blur(e) {
  12218. v = n.activeElement === this, S.is.searchSelection() && !b && (Y || v || (k.forceSelection && S.forceSelection(), S.hide())), b = !1;
  12219. }
  12220. },
  12221. icon: {
  12222. click: function click(e) {
  12223. S.toggle();
  12224. }
  12225. },
  12226. text: {
  12227. focus: function focus(e) {
  12228. $ = !0, S.focusSearch();
  12229. }
  12230. },
  12231. input: function input(e) {
  12232. (S.is.multiple() || S.is.searchSelection()) && S.set.filtered(), clearTimeout(S.timer), S.timer = setTimeout(S.search, k.delay.search);
  12233. },
  12234. label: {
  12235. click: function click(t) {
  12236. var n = e(this),
  12237. i = M.find(D.label),
  12238. o = i.filter("." + T.active),
  12239. a = n.nextAll("." + T.active),
  12240. r = n.prevAll("." + T.active),
  12241. s = a.length > 0 ? n.nextUntil(a).add(o).add(n) : n.prevUntil(r).add(o).add(n);
  12242. t.shiftKey ? (o.removeClass(T.active), s.addClass(T.active)) : t.ctrlKey ? n.toggleClass(T.active) : (o.removeClass(T.active), n.addClass(T.active)), k.onLabelSelect.apply(this, i.filter("." + T.active));
  12243. }
  12244. },
  12245. remove: {
  12246. click: function click() {
  12247. var t = e(this).parent();
  12248. t.hasClass(T.active) ? S.remove.activeLabels() : S.remove.activeLabels(t);
  12249. }
  12250. },
  12251. test: {
  12252. toggle: function toggle(e) {
  12253. var t = S.is.multiple() ? S.show : S.toggle;
  12254. S.is.bubbledLabelClick(e) || S.is.bubbledIconClick(e) || S.determine.eventOnElement(e, t) && e.preventDefault();
  12255. },
  12256. touch: function touch(e) {
  12257. S.determine.eventOnElement(e, function () {
  12258. "touchstart" == e.type ? S.timer = setTimeout(function () {
  12259. S.hide();
  12260. }, k.delay.touch) : "touchmove" == e.type && clearTimeout(S.timer);
  12261. }), e.stopPropagation();
  12262. },
  12263. hide: function hide(e) {
  12264. S.determine.eventInModule(e, S.hide);
  12265. }
  12266. },
  12267. select: {
  12268. mutation: function mutation(t) {
  12269. S.debug("<select> modified, recreating menu");
  12270. var n = !1;
  12271. e.each(t, function (t, i) {
  12272. if (e(i.target).is("select") || e(i.addedNodes).is("select")) return n = !0, !0;
  12273. }), n && (S.disconnect.selectObserver(), S.refresh(), S.setup.select(), S.set.selected(), S.observe.select());
  12274. }
  12275. },
  12276. menu: {
  12277. mutation: function mutation(t) {
  12278. var n = t[0],
  12279. i = n.addedNodes ? e(n.addedNodes[0]) : e(!1),
  12280. o = n.removedNodes ? e(n.removedNodes[0]) : e(!1),
  12281. a = i.add(o),
  12282. r = a.is(D.addition) || a.closest(D.addition).length > 0,
  12283. s = a.is(D.message) || a.closest(D.message).length > 0;
  12284. r || s ? (S.debug("Updating item selector cache"), S.refreshItems()) : (S.debug("Menu modified, updating selector cache"), S.refresh());
  12285. },
  12286. mousedown: function mousedown() {
  12287. Y = !0;
  12288. },
  12289. mouseup: function mouseup() {
  12290. Y = !1;
  12291. }
  12292. },
  12293. item: {
  12294. mouseenter: function mouseenter(t) {
  12295. var n = e(t.target),
  12296. i = e(this),
  12297. o = i.children(D.menu),
  12298. a = i.siblings(D.item).children(D.menu),
  12299. r = o.length > 0;
  12300. !(o.find(n).length > 0) && r && (clearTimeout(S.itemTimer), S.itemTimer = setTimeout(function () {
  12301. S.verbose("Showing sub-menu", o), e.each(a, function () {
  12302. S.animate.hide(!1, e(this));
  12303. }), S.animate.show(!1, o);
  12304. }, k.delay.show), t.preventDefault());
  12305. },
  12306. mouseleave: function mouseleave(t) {
  12307. var n = e(this).children(D.menu);
  12308. n.length > 0 && (clearTimeout(S.itemTimer), S.itemTimer = setTimeout(function () {
  12309. S.verbose("Hiding sub-menu", n), S.animate.hide(!1, n);
  12310. }, k.delay.hide));
  12311. },
  12312. click: function click(t, i) {
  12313. var o = e(this),
  12314. a = e(t ? t.target : ""),
  12315. r = o.find(D.menu),
  12316. s = S.get.choiceText(o),
  12317. l = S.get.choiceValue(o, s),
  12318. c = r.length > 0,
  12319. u = r.find(a).length > 0;
  12320. S.has.menuSearch() && e(n.activeElement).blur(), u || c && !k.allowCategorySelection || (S.is.searchSelection() && (k.allowAdditions && S.remove.userAddition(), S.remove.searchTerm(), S.is.focusedOnSearch() || 1 == i || S.focusSearch(!0)), k.useLabels || (S.remove.filteredItem(), S.set.scrollPosition(o)), S.determine.selectAction.call(this, s, l));
  12321. }
  12322. },
  12323. document: {
  12324. keydown: function keydown(e) {
  12325. var t = e.which;
  12326. if (S.is.inObject(t, P)) {
  12327. var n = M.find(D.label),
  12328. i = n.filter("." + T.active),
  12329. o = (i.data(E.value), n.index(i)),
  12330. a = n.length,
  12331. r = i.length > 0,
  12332. s = i.length > 1,
  12333. l = 0 === o,
  12334. c = o + 1 == a,
  12335. u = S.is.searchSelection(),
  12336. d = S.is.focusedOnSearch(),
  12337. f = S.is.focused(),
  12338. m = d && 0 === S.get.caretPosition();
  12339. if (u && !r && !d) return;
  12340. t == P.leftArrow ? !f && !m || r ? r && (e.shiftKey ? S.verbose("Adding previous label to selection") : (S.verbose("Selecting previous label"), n.removeClass(T.active)), l && !s ? i.addClass(T.active) : i.prev(D.siblingLabel).addClass(T.active).end(), e.preventDefault()) : (S.verbose("Selecting previous label"), n.last().addClass(T.active)) : t == P.rightArrow ? (f && !r && n.first().addClass(T.active), r && (e.shiftKey ? S.verbose("Adding next label to selection") : (S.verbose("Selecting next label"), n.removeClass(T.active)), c ? u ? d ? n.removeClass(T.active) : S.focusSearch() : s ? i.next(D.siblingLabel).addClass(T.active) : i.addClass(T.active) : i.next(D.siblingLabel).addClass(T.active), e.preventDefault())) : t == P.deleteKey || t == P.backspace ? r ? (S.verbose("Removing active labels"), c && u && !d && S.focusSearch(), i.last().next(D.siblingLabel).addClass(T.active), S.remove.activeLabels(i), e.preventDefault()) : m && !r && t == P.backspace && (S.verbose("Removing last label on input backspace"), i = n.last().addClass(T.active), S.remove.activeLabels(i)) : i.removeClass(T.active);
  12341. }
  12342. }
  12343. },
  12344. keydown: function keydown(e) {
  12345. var t = e.which;
  12346. if (S.is.inObject(t, P)) {
  12347. var n,
  12348. i = X.not(D.unselectable).filter("." + T.selected).eq(0),
  12349. o = Q.children("." + T.active).eq(0),
  12350. a = i.length > 0 ? i : o,
  12351. r = a.length > 0 ? a.siblings(":not(." + T.filtered + ")").addBack() : Q.children(":not(." + T.filtered + ")"),
  12352. s = a.children(D.menu),
  12353. l = a.closest(D.menu),
  12354. c = l.hasClass(T.visible) || l.hasClass(T.animating) || l.parent(D.menu).length > 0,
  12355. u = s.length > 0,
  12356. d = a.length > 0,
  12357. f = a.not(D.unselectable).length > 0,
  12358. m = t == P.delimiter && k.allowAdditions && S.is.multiple();
  12359. if (k.allowAdditions && k.hideAdditions && (t == P.enter || m) && f && (S.verbose("Selecting item from keyboard shortcut", a), S.event.item.click.call(a, e), S.is.searchSelection() && S.remove.searchTerm()), S.is.visible()) {
  12360. if ((t == P.enter || m) && (t == P.enter && d && u && !k.allowCategorySelection ? (S.verbose("Pressed enter on unselectable category, opening sub menu"), t = P.rightArrow) : f && (S.verbose("Selecting item from keyboard shortcut", a), S.event.item.click.call(a, e), S.is.searchSelection() && S.remove.searchTerm()), e.preventDefault()), d && (t == P.leftArrow && l[0] !== Q[0] && (S.verbose("Left key pressed, closing sub-menu"), S.animate.hide(!1, l), a.removeClass(T.selected), l.closest(D.item).addClass(T.selected), e.preventDefault()), t == P.rightArrow && u && (S.verbose("Right key pressed, opening sub-menu"), S.animate.show(!1, s), a.removeClass(T.selected), s.find(D.item).eq(0).addClass(T.selected), e.preventDefault())), t == P.upArrow) {
  12361. if (n = d && c ? a.prevAll(D.item + ":not(" + D.unselectable + ")").eq(0) : X.eq(0), r.index(n) < 0) return S.verbose("Up key pressed but reached top of current menu"), void e.preventDefault();
  12362. S.verbose("Up key pressed, changing active item"), a.removeClass(T.selected), n.addClass(T.selected), S.set.scrollPosition(n), k.selectOnKeydown && S.is.single() && S.set.selectedItem(n), e.preventDefault();
  12363. }
  12364. if (t == P.downArrow) {
  12365. if (0 === (n = d && c ? n = a.nextAll(D.item + ":not(" + D.unselectable + ")").eq(0) : X.eq(0)).length) return S.verbose("Down key pressed but reached bottom of current menu"), void e.preventDefault();
  12366. S.verbose("Down key pressed, changing active item"), X.removeClass(T.selected), n.addClass(T.selected), S.set.scrollPosition(n), k.selectOnKeydown && S.is.single() && S.set.selectedItem(n), e.preventDefault();
  12367. }
  12368. t == P.pageUp && (S.scrollPage("up"), e.preventDefault()), t == P.pageDown && (S.scrollPage("down"), e.preventDefault()), t == P.escape && (S.verbose("Escape key pressed, closing dropdown"), S.hide());
  12369. } else m && e.preventDefault(), t != P.downArrow || S.is.visible() || (S.verbose("Down key pressed, showing dropdown"), S.show(), e.preventDefault());
  12370. } else S.has.search() || S.set.selectedLetter(String.fromCharCode(t));
  12371. }
  12372. },
  12373. trigger: {
  12374. change: function change() {
  12375. var e = n.createEvent("HTMLEvents"),
  12376. t = U[0];
  12377. t && (S.verbose("Triggering native change event"), e.initEvent("change", !0, !1), t.dispatchEvent(e));
  12378. }
  12379. },
  12380. determine: {
  12381. selectAction: function selectAction(t, n) {
  12382. S.verbose("Determining action", k.action), e.isFunction(S.action[k.action]) ? (S.verbose("Triggering preset action", k.action, t, n), S.action[k.action].call(K, t, n, this)) : e.isFunction(k.action) ? (S.verbose("Triggering user action", k.action, t, n), k.action.call(K, t, n, this)) : S.error(q.action, k.action);
  12383. },
  12384. eventInModule: function eventInModule(t, i) {
  12385. var o = e(t.target),
  12386. a = o.closest(n.documentElement).length > 0,
  12387. r = o.closest(M).length > 0;
  12388. return i = e.isFunction(i) ? i : function () {}, a && !r ? (S.verbose("Triggering event", i), i(), !0) : (S.verbose("Event occurred in dropdown, canceling callback"), !1);
  12389. },
  12390. eventOnElement: function eventOnElement(t, i) {
  12391. var o = e(t.target),
  12392. a = o.closest(D.siblingLabel),
  12393. r = n.body.contains(t.target),
  12394. s = 0 === M.find(a).length,
  12395. l = 0 === o.closest(Q).length;
  12396. return i = e.isFunction(i) ? i : function () {}, r && s && l ? (S.verbose("Triggering event", i), i(), !0) : (S.verbose("Event occurred in dropdown menu, canceling callback"), !1);
  12397. }
  12398. },
  12399. action: {
  12400. nothing: function nothing() {},
  12401. activate: function activate(t, n, o) {
  12402. if (n = n !== i ? n : t, S.can.activate(e(o))) {
  12403. if (S.set.selected(n, e(o)), S.is.multiple() && !S.is.allFiltered()) return;
  12404. S.hideAndClear();
  12405. }
  12406. },
  12407. select: function select(t, n, o) {
  12408. if (n = n !== i ? n : t, S.can.activate(e(o))) {
  12409. if (S.set.value(n, t, e(o)), S.is.multiple() && !S.is.allFiltered()) return;
  12410. S.hideAndClear();
  12411. }
  12412. },
  12413. combo: function combo(t, n, o) {
  12414. n = n !== i ? n : t, S.set.selected(n, e(o)), S.hideAndClear();
  12415. },
  12416. hide: function hide(e, t, n) {
  12417. S.set.value(t, e), S.hideAndClear();
  12418. }
  12419. },
  12420. get: {
  12421. id: function id() {
  12422. return x;
  12423. },
  12424. defaultText: function defaultText() {
  12425. return M.data(E.defaultText);
  12426. },
  12427. defaultValue: function defaultValue() {
  12428. return M.data(E.defaultValue);
  12429. },
  12430. placeholderText: function placeholderText() {
  12431. return "auto" != k.placeholder && "string" == typeof k.placeholder ? k.placeholder : M.data(E.placeholderText) || "";
  12432. },
  12433. text: function text() {
  12434. return V.text();
  12435. },
  12436. query: function query() {
  12437. return e.trim(N.val());
  12438. },
  12439. searchWidth: function searchWidth(e) {
  12440. return e = e !== i ? e : N.val(), H.text(e), Math.ceil(H.width() + 1);
  12441. },
  12442. selectionCount: function selectionCount() {
  12443. var t = S.get.values();
  12444. return S.is.multiple() ? e.isArray(t) ? t.length : 0 : "" !== S.get.value() ? 1 : 0;
  12445. },
  12446. transition: function transition(e) {
  12447. return "auto" == k.transition ? S.is.upward(e) ? "slide up" : "slide down" : k.transition;
  12448. },
  12449. userValues: function userValues() {
  12450. var t = S.get.values();
  12451. return !!t && (t = e.isArray(t) ? t : [t], e.grep(t, function (e) {
  12452. return !1 === S.get.item(e);
  12453. }));
  12454. },
  12455. uniqueArray: function uniqueArray(t) {
  12456. return e.grep(t, function (n, i) {
  12457. return e.inArray(n, t) === i;
  12458. });
  12459. },
  12460. caretPosition: function caretPosition() {
  12461. var e,
  12462. t,
  12463. i = N.get(0);
  12464. return "selectionStart" in i ? i.selectionStart : n.selection ? (i.focus(), t = (e = n.selection.createRange()).text.length, e.moveStart("character", -i.value.length), e.text.length - t) : void 0;
  12465. },
  12466. value: function value() {
  12467. var t = U.length > 0 ? U.val() : M.data(E.value),
  12468. n = e.isArray(t) && 1 === t.length && "" === t[0];
  12469. return t === i || n ? "" : t;
  12470. },
  12471. values: function values() {
  12472. var e = S.get.value();
  12473. return "" === e ? "" : !S.has.selectInput() && S.is.multiple() ? "string" == typeof e ? e.split(k.delimiter) : "" : e;
  12474. },
  12475. remoteValues: function remoteValues() {
  12476. var t = S.get.values(),
  12477. n = !1;
  12478. return t && ("string" == typeof t && (t = [t]), e.each(t, function (e, t) {
  12479. var i = S.read.remoteData(t);
  12480. S.verbose("Restoring value from session data", i, t), i && (n || (n = {}), n[t] = i);
  12481. })), n;
  12482. },
  12483. choiceText: function choiceText(t, n) {
  12484. if (n = n !== i ? n : k.preserveHTML, t) return t.find(D.menu).length > 0 && (S.verbose("Retrieving text of element with sub-menu"), (t = t.clone()).find(D.menu).remove(), t.find(D.menuIcon).remove()), t.data(E.text) !== i ? t.data(E.text) : n ? e.trim(t.html()) : e.trim(t.text());
  12485. },
  12486. choiceValue: function choiceValue(t, n) {
  12487. return n = n || S.get.choiceText(t), !!t && (t.data(E.value) !== i ? String(t.data(E.value)) : "string" == typeof n ? e.trim(n.toLowerCase()) : String(n));
  12488. },
  12489. inputEvent: function inputEvent() {
  12490. var e = N[0];
  12491. return !!e && (e.oninput !== i ? "input" : e.onpropertychange !== i ? "propertychange" : "keyup");
  12492. },
  12493. selectValues: function selectValues() {
  12494. var t = {
  12495. values: []
  12496. };
  12497. return M.find("option").each(function () {
  12498. var n = e(this),
  12499. o = n.html(),
  12500. a = n.attr("disabled"),
  12501. r = n.attr("value") !== i ? n.attr("value") : o;
  12502. "auto" === k.placeholder && "" === r ? t.placeholder = o : t.values.push({
  12503. name: o,
  12504. value: r,
  12505. disabled: a
  12506. });
  12507. }), k.placeholder && "auto" !== k.placeholder && (S.debug("Setting placeholder value to", k.placeholder), t.placeholder = k.placeholder), k.sortSelect ? (t.values.sort(function (e, t) {
  12508. return e.name > t.name ? 1 : -1;
  12509. }), S.debug("Retrieved and sorted values from select", t)) : S.debug("Retrieved values from select", t), t;
  12510. },
  12511. activeItem: function activeItem() {
  12512. return X.filter("." + T.active);
  12513. },
  12514. selectedItem: function selectedItem() {
  12515. var e = X.not(D.unselectable).filter("." + T.selected);
  12516. return e.length > 0 ? e : X.eq(0);
  12517. },
  12518. itemWithAdditions: function itemWithAdditions(e) {
  12519. var t = S.get.item(e),
  12520. n = S.create.userChoice(e);
  12521. return n && n.length > 0 && (t = t.length > 0 ? t.add(n) : n), t;
  12522. },
  12523. item: function item(t, n) {
  12524. var o,
  12525. a,
  12526. r = !1;
  12527. return t = t !== i ? t : S.get.values() !== i ? S.get.values() : S.get.text(), o = a ? t.length > 0 : t !== i && null !== t, a = S.is.multiple() && e.isArray(t), n = "" === t || 0 === t || n || !1, o && X.each(function () {
  12528. var o = e(this),
  12529. s = S.get.choiceText(o),
  12530. l = S.get.choiceValue(o, s);
  12531. if (null !== l && l !== i) if (a) -1 === e.inArray(String(l), t) && -1 === e.inArray(s, t) || (r = r ? r.add(o) : o);else if (n) {
  12532. if (S.verbose("Ambiguous dropdown value using strict type check", o, t), l === t || s === t) return r = o, !0;
  12533. } else if (String(l) == String(t) || s == t) return S.verbose("Found select item by value", l, t), r = o, !0;
  12534. }), r;
  12535. }
  12536. },
  12537. check: {
  12538. maxSelections: function maxSelections(e) {
  12539. return !k.maxSelections || ((e = e !== i ? e : S.get.selectionCount()) >= k.maxSelections ? (S.debug("Maximum selection count reached"), k.useLabels && (X.addClass(T.filtered), S.add.message(A.maxSelections)), !0) : (S.verbose("No longer at maximum selection count"), S.remove.message(), S.remove.filteredItem(), S.is.searchSelection() && S.filterItems(), !1));
  12540. }
  12541. },
  12542. restore: {
  12543. defaults: function defaults() {
  12544. S.clear(), S.restore.defaultText(), S.restore.defaultValue();
  12545. },
  12546. defaultText: function defaultText() {
  12547. var e = S.get.defaultText();
  12548. e === S.get.placeholderText ? (S.debug("Restoring default placeholder text", e), S.set.placeholderText(e)) : (S.debug("Restoring default text", e), S.set.text(e));
  12549. },
  12550. placeholderText: function placeholderText() {
  12551. S.set.placeholderText();
  12552. },
  12553. defaultValue: function defaultValue() {
  12554. var e = S.get.defaultValue();
  12555. e !== i && (S.debug("Restoring default value", e), "" !== e ? (S.set.value(e), S.set.selected()) : (S.remove.activeItem(), S.remove.selectedItem()));
  12556. },
  12557. labels: function labels() {
  12558. k.allowAdditions && (k.useLabels || (S.error(q.labels), k.useLabels = !0), S.debug("Restoring selected values"), S.create.userLabels()), S.check.maxSelections();
  12559. },
  12560. selected: function selected() {
  12561. S.restore.values(), S.is.multiple() ? (S.debug("Restoring previously selected values and labels"), S.restore.labels()) : S.debug("Restoring previously selected values");
  12562. },
  12563. values: function values() {
  12564. S.set.initialLoad(), k.apiSettings && k.saveRemoteData && S.get.remoteValues() ? S.restore.remoteValues() : S.set.selected(), S.remove.initialLoad();
  12565. },
  12566. remoteValues: function remoteValues() {
  12567. var t = S.get.remoteValues();
  12568. S.debug("Recreating selected from session data", t), t && (S.is.single() ? e.each(t, function (e, t) {
  12569. S.set.text(t);
  12570. }) : e.each(t, function (e, t) {
  12571. S.add.label(e, t);
  12572. }));
  12573. }
  12574. },
  12575. read: {
  12576. remoteData: function remoteData(e) {
  12577. var n;
  12578. if (t.Storage !== i) return (n = sessionStorage.getItem(e)) !== i && n;
  12579. S.error(q.noStorage);
  12580. }
  12581. },
  12582. save: {
  12583. defaults: function defaults() {
  12584. S.save.defaultText(), S.save.placeholderText(), S.save.defaultValue();
  12585. },
  12586. defaultValue: function defaultValue() {
  12587. var e = S.get.value();
  12588. S.verbose("Saving default value as", e), M.data(E.defaultValue, e);
  12589. },
  12590. defaultText: function defaultText() {
  12591. var e = S.get.text();
  12592. S.verbose("Saving default text as", e), M.data(E.defaultText, e);
  12593. },
  12594. placeholderText: function placeholderText() {
  12595. var e;
  12596. !1 !== k.placeholder && V.hasClass(T.placeholder) && (e = S.get.text(), S.verbose("Saving placeholder text as", e), M.data(E.placeholderText, e));
  12597. },
  12598. remoteData: function remoteData(e, n) {
  12599. t.Storage !== i ? (S.verbose("Saving remote data to session storage", n, e), sessionStorage.setItem(n, e)) : S.error(q.noStorage);
  12600. }
  12601. },
  12602. clear: function clear() {
  12603. S.is.multiple() && k.useLabels ? S.remove.labels() : (S.remove.activeItem(), S.remove.selectedItem()), S.set.placeholderText(), S.clearValue();
  12604. },
  12605. clearValue: function clearValue() {
  12606. S.set.value("");
  12607. },
  12608. scrollPage: function scrollPage(e, t) {
  12609. var n,
  12610. i,
  12611. o = t || S.get.selectedItem(),
  12612. a = o.closest(D.menu),
  12613. r = a.outerHeight(),
  12614. s = a.scrollTop(),
  12615. l = X.eq(0).outerHeight(),
  12616. c = Math.floor(r / l),
  12617. u = (a.prop("scrollHeight"), "up" == e ? s - l * c : s + l * c),
  12618. d = X.not(D.unselectable);
  12619. i = "up" == e ? d.index(o) - c : d.index(o) + c, (n = ("up" == e ? i >= 0 : i < d.length) ? d.eq(i) : "up" == e ? d.first() : d.last()).length > 0 && (S.debug("Scrolling page", e, n), o.removeClass(T.selected), n.addClass(T.selected), k.selectOnKeydown && S.is.single() && S.set.selectedItem(n), a.scrollTop(u));
  12620. },
  12621. set: {
  12622. filtered: function filtered() {
  12623. var e = S.is.multiple(),
  12624. t = S.is.searchSelection(),
  12625. n = e && t,
  12626. i = t ? S.get.query() : "",
  12627. o = "string" == typeof i && i.length > 0,
  12628. a = S.get.searchWidth(),
  12629. r = "" !== i;
  12630. e && o && (S.verbose("Adjusting input width", a, k.glyphWidth), N.css("width", a)), o || n && r ? (S.verbose("Hiding placeholder text"), V.addClass(T.filtered)) : (!e || n && !r) && (S.verbose("Showing placeholder text"), V.removeClass(T.filtered));
  12631. },
  12632. empty: function empty() {
  12633. M.addClass(T.empty);
  12634. },
  12635. loading: function loading() {
  12636. M.addClass(T.loading);
  12637. },
  12638. placeholderText: function placeholderText(e) {
  12639. e = e || S.get.placeholderText(), S.debug("Setting placeholder text", e), S.set.text(e), V.addClass(T.placeholder);
  12640. },
  12641. tabbable: function tabbable() {
  12642. S.is.searchSelection() ? (S.debug("Added tabindex to searchable dropdown"), N.val("").attr("tabindex", 0), Q.attr("tabindex", -1)) : (S.debug("Added tabindex to dropdown"), M.attr("tabindex") === i && (M.attr("tabindex", 0), Q.attr("tabindex", -1)));
  12643. },
  12644. initialLoad: function initialLoad() {
  12645. S.verbose("Setting initial load"), h = !0;
  12646. },
  12647. activeItem: function activeItem(e) {
  12648. k.allowAdditions && e.filter(D.addition).length > 0 ? e.addClass(T.filtered) : e.addClass(T.active);
  12649. },
  12650. partialSearch: function partialSearch(e) {
  12651. var t = S.get.query().length;
  12652. N.val(e.substr(0, t));
  12653. },
  12654. scrollPosition: function scrollPosition(e, t) {
  12655. var n, o, a, r, s, l;
  12656. n = (e = e || S.get.selectedItem()).closest(D.menu), o = e && e.length > 0, t = t !== i && t, e && n.length > 0 && o && (e.position().top, n.addClass(T.loading), a = (r = n.scrollTop()) - n.offset().top + e.offset().top, t || (l = r + n.height() < a + 5, s = a - 5 < r), S.debug("Scrolling to active item", a), (t || s || l) && n.scrollTop(a), n.removeClass(T.loading));
  12657. },
  12658. text: function text(e) {
  12659. "select" !== k.action && ("combo" == k.action ? (S.debug("Changing combo button text", e, B), k.preserveHTML ? B.html(e) : B.text(e)) : (e !== S.get.placeholderText() && V.removeClass(T.placeholder), S.debug("Changing text", e, V), V.removeClass(T.filtered), k.preserveHTML ? V.html(e) : V.text(e)));
  12660. },
  12661. selectedItem: function selectedItem(e) {
  12662. var t = S.get.choiceValue(e),
  12663. n = S.get.choiceText(e, !1),
  12664. i = S.get.choiceText(e, !0);
  12665. S.debug("Setting user selection to item", e), S.remove.activeItem(), S.set.partialSearch(n), S.set.activeItem(e), S.set.selected(t, e), S.set.text(i);
  12666. },
  12667. selectedLetter: function selectedLetter(t) {
  12668. var n,
  12669. i = X.filter("." + T.selected),
  12670. o = !1;
  12671. i.length > 0 && S.has.firstLetter(i, t) && (n = i.nextAll(X).eq(0), S.has.firstLetter(n, t) && (o = n)), o || X.each(function () {
  12672. if (S.has.firstLetter(e(this), t)) return o = e(this), !1;
  12673. }), o && (S.verbose("Scrolling to next value with letter", t), S.set.scrollPosition(o), i.removeClass(T.selected), o.addClass(T.selected), k.selectOnKeydown && S.is.single() && S.set.selectedItem(o));
  12674. },
  12675. direction: function direction(e) {
  12676. "auto" == k.direction ? (S.remove.upward(), S.can.openDownward(e) ? S.remove.upward(e) : S.set.upward(e), S.is.leftward(e) || S.can.openRightward(e) || S.set.leftward(e)) : "upward" == k.direction && S.set.upward(e);
  12677. },
  12678. upward: function upward(e) {
  12679. (e || M).addClass(T.upward);
  12680. },
  12681. leftward: function leftward(e) {
  12682. (e || Q).addClass(T.leftward);
  12683. },
  12684. value: function value(e, t, n) {
  12685. var o = S.escape.value(e),
  12686. a = U.length > 0,
  12687. r = S.get.values(),
  12688. s = e !== i ? String(e) : e;
  12689. if (a) {
  12690. if (!k.allowReselection && s == r && (S.verbose("Skipping value update already same value", e, r), !S.is.initialLoad())) return;
  12691. S.is.single() && S.has.selectInput() && S.can.extendSelect() && (S.debug("Adding user option", e), S.add.optionValue(e)), S.debug("Updating input value", o, r), Z = !0, U.val(o), !1 === k.fireOnInit && S.is.initialLoad() ? S.debug("Input native change event ignored on initial load") : S.trigger.change(), Z = !1;
  12692. } else S.verbose("Storing value in metadata", o, U), o !== r && M.data(E.value, s);
  12693. !1 === k.fireOnInit && S.is.initialLoad() ? S.verbose("No callback on initial load", k.onChange) : k.onChange.call(K, e, t, n);
  12694. },
  12695. active: function active() {
  12696. M.addClass(T.active);
  12697. },
  12698. multiple: function multiple() {
  12699. M.addClass(T.multiple);
  12700. },
  12701. visible: function visible() {
  12702. M.addClass(T.visible);
  12703. },
  12704. exactly: function exactly(e, t) {
  12705. S.debug("Setting selected to exact values"), S.clear(), S.set.selected(e, t);
  12706. },
  12707. selected: function selected(t, n) {
  12708. var i = S.is.multiple();
  12709. (n = k.allowAdditions ? n || S.get.itemWithAdditions(t) : n || S.get.item(t)) && (S.debug("Setting selected menu item to", n), S.is.multiple() && S.remove.searchWidth(), S.is.single() ? (S.remove.activeItem(), S.remove.selectedItem()) : k.useLabels && S.remove.selectedItem(), n.each(function () {
  12710. var t = e(this),
  12711. o = S.get.choiceText(t),
  12712. a = S.get.choiceValue(t, o),
  12713. r = t.hasClass(T.filtered),
  12714. s = t.hasClass(T.active),
  12715. l = t.hasClass(T.addition),
  12716. c = i && 1 == n.length;
  12717. i ? !s || l ? (k.apiSettings && k.saveRemoteData && S.save.remoteData(o, a), k.useLabels ? (S.add.label(a, o, c), S.add.value(a, o, t), S.set.activeItem(t), S.filterActive(), S.select.nextAvailable(n)) : (S.add.value(a, o, t), S.set.text(S.add.variables(A.count)), S.set.activeItem(t))) : r || (S.debug("Selected active value, removing label"), S.remove.selected(a)) : (k.apiSettings && k.saveRemoteData && S.save.remoteData(o, a), S.set.text(o), S.set.value(a, o, t), t.addClass(T.active).addClass(T.selected));
  12718. }));
  12719. }
  12720. },
  12721. add: {
  12722. label: function label(t, n, i) {
  12723. var o,
  12724. a = S.is.searchSelection() ? N : V,
  12725. r = S.escape.value(t);
  12726. k.ignoreCase && (r = r.toLowerCase()), o = e("<a />").addClass(T.label).attr("data-" + E.value, r).html(j.label(r, n)), o = k.onLabelCreate.call(o, r, n), S.has.label(t) ? S.debug("User selection already exists, skipping", r) : (k.label.variation && o.addClass(k.label.variation), !0 === i ? (S.debug("Animating in label", o), o.addClass(T.hidden).insertBefore(a).transition(k.label.transition, k.label.duration)) : (S.debug("Adding selection label", o), o.insertBefore(a)));
  12727. },
  12728. message: function message(t) {
  12729. var n = Q.children(D.message),
  12730. i = k.templates.message(S.add.variables(t));
  12731. n.length > 0 ? n.html(i) : n = e("<div/>").html(i).addClass(T.message).appendTo(Q);
  12732. },
  12733. optionValue: function optionValue(t) {
  12734. var n = S.escape.value(t);
  12735. U.find('option[value="' + S.escape.string(n) + '"]').length > 0 || (S.disconnect.selectObserver(), S.is.single() && (S.verbose("Removing previous user addition"), U.find("option." + T.addition).remove()), e("<option/>").prop("value", n).addClass(T.addition).html(t).appendTo(U), S.verbose("Adding user addition as an <option>", t), S.observe.select());
  12736. },
  12737. userSuggestion: function userSuggestion(e) {
  12738. var t,
  12739. n = Q.children(D.addition),
  12740. i = S.get.item(e),
  12741. o = i && i.not(D.addition).length,
  12742. a = n.length > 0;
  12743. k.useLabels && S.has.maxSelections() || ("" === e || o ? n.remove() : (a ? (n.data(E.value, e).data(E.text, e).attr("data-" + E.value, e).attr("data-" + E.text, e).removeClass(T.filtered), k.hideAdditions || (t = k.templates.addition(S.add.variables(A.addResult, e)), n.html(t)), S.verbose("Replacing user suggestion with new value", n)) : ((n = S.create.userChoice(e)).prependTo(Q), S.verbose("Adding item choice to menu corresponding with user choice addition", n)), k.hideAdditions && !S.is.allFiltered() || n.addClass(T.selected).siblings().removeClass(T.selected), S.refreshItems()));
  12744. },
  12745. variables: function variables(e, t) {
  12746. var n,
  12747. i,
  12748. o = -1 !== e.search("{count}"),
  12749. a = -1 !== e.search("{maxCount}"),
  12750. r = -1 !== e.search("{term}");
  12751. return S.verbose("Adding templated variables to message", e), o && (n = S.get.selectionCount(), e = e.replace("{count}", n)), a && (n = S.get.selectionCount(), e = e.replace("{maxCount}", k.maxSelections)), r && (i = t || S.get.query(), e = e.replace("{term}", i)), e;
  12752. },
  12753. value: function value(t, n, i) {
  12754. var o,
  12755. a = S.get.values();
  12756. S.has.value(t) ? S.debug("Value already selected") : "" !== t ? (e.isArray(a) ? (o = a.concat([t]), o = S.get.uniqueArray(o)) : o = [t], S.has.selectInput() ? S.can.extendSelect() && (S.debug("Adding value to select", t, o, U), S.add.optionValue(t)) : (o = o.join(k.delimiter), S.debug("Setting hidden input to delimited value", o, U)), !1 === k.fireOnInit && S.is.initialLoad() ? S.verbose("Skipping onadd callback on initial load", k.onAdd) : k.onAdd.call(K, t, n, i), S.set.value(o, t, n, i), S.check.maxSelections()) : S.debug("Cannot select blank values from multiselect");
  12757. }
  12758. },
  12759. remove: {
  12760. active: function active() {
  12761. M.removeClass(T.active);
  12762. },
  12763. activeLabel: function activeLabel() {
  12764. M.find(D.label).removeClass(T.active);
  12765. },
  12766. empty: function empty() {
  12767. M.removeClass(T.empty);
  12768. },
  12769. loading: function loading() {
  12770. M.removeClass(T.loading);
  12771. },
  12772. initialLoad: function initialLoad() {
  12773. h = !1;
  12774. },
  12775. upward: function upward(e) {
  12776. (e || M).removeClass(T.upward);
  12777. },
  12778. leftward: function leftward(e) {
  12779. (e || Q).removeClass(T.leftward);
  12780. },
  12781. visible: function visible() {
  12782. M.removeClass(T.visible);
  12783. },
  12784. activeItem: function activeItem() {
  12785. X.removeClass(T.active);
  12786. },
  12787. filteredItem: function filteredItem() {
  12788. k.useLabels && S.has.maxSelections() || (k.useLabels && S.is.multiple() ? X.not("." + T.active).removeClass(T.filtered) : X.removeClass(T.filtered), S.remove.empty());
  12789. },
  12790. optionValue: function optionValue(e) {
  12791. var t = S.escape.value(e),
  12792. n = U.find('option[value="' + S.escape.string(t) + '"]');
  12793. n.length > 0 && n.hasClass(T.addition) && (C && (C.disconnect(), S.verbose("Temporarily disconnecting mutation observer")), n.remove(), S.verbose("Removing user addition as an <option>", t), C && C.observe(U[0], {
  12794. childList: !0,
  12795. subtree: !0
  12796. }));
  12797. },
  12798. message: function message() {
  12799. Q.children(D.message).remove();
  12800. },
  12801. searchWidth: function searchWidth() {
  12802. N.css("width", "");
  12803. },
  12804. searchTerm: function searchTerm() {
  12805. S.verbose("Cleared search term"), N.val(""), S.set.filtered();
  12806. },
  12807. userAddition: function userAddition() {
  12808. X.filter(D.addition).remove();
  12809. },
  12810. selected: function selected(t, n) {
  12811. if (!(n = k.allowAdditions ? n || S.get.itemWithAdditions(t) : n || S.get.item(t))) return !1;
  12812. n.each(function () {
  12813. var t = e(this),
  12814. n = S.get.choiceText(t),
  12815. i = S.get.choiceValue(t, n);
  12816. S.is.multiple() ? k.useLabels ? (S.remove.value(i, n, t), S.remove.label(i)) : (S.remove.value(i, n, t), 0 === S.get.selectionCount() ? S.set.placeholderText() : S.set.text(S.add.variables(A.count))) : S.remove.value(i, n, t), t.removeClass(T.filtered).removeClass(T.active), k.useLabels && t.removeClass(T.selected);
  12817. });
  12818. },
  12819. selectedItem: function selectedItem() {
  12820. X.removeClass(T.selected);
  12821. },
  12822. value: function value(e, t, n) {
  12823. var i,
  12824. o = S.get.values();
  12825. S.has.selectInput() ? (S.verbose("Input is <select> removing selected option", e), i = S.remove.arrayValue(e, o), S.remove.optionValue(e)) : (S.verbose("Removing from delimited values", e), i = (i = S.remove.arrayValue(e, o)).join(k.delimiter)), !1 === k.fireOnInit && S.is.initialLoad() ? S.verbose("No callback on initial load", k.onRemove) : k.onRemove.call(K, e, t, n), S.set.value(i, t, n), S.check.maxSelections();
  12826. },
  12827. arrayValue: function arrayValue(t, n) {
  12828. return e.isArray(n) || (n = [n]), n = e.grep(n, function (e) {
  12829. return t != e;
  12830. }), S.verbose("Removed value from delimited string", t, n), n;
  12831. },
  12832. label: function label(e, t) {
  12833. var n = M.find(D.label).filter("[data-" + E.value + '="' + S.escape.string(e) + '"]');
  12834. S.verbose("Removing label", n), n.remove();
  12835. },
  12836. activeLabels: function activeLabels(e) {
  12837. e = e || M.find(D.label).filter("." + T.active), S.verbose("Removing active label selections", e), S.remove.labels(e);
  12838. },
  12839. labels: function labels(t) {
  12840. t = t || M.find(D.label), S.verbose("Removing labels", t), t.each(function () {
  12841. var t = e(this),
  12842. n = t.data(E.value),
  12843. o = n !== i ? String(n) : n,
  12844. a = S.is.userValue(o);
  12845. !1 !== k.onLabelRemove.call(t, n) ? (S.remove.message(), a ? (S.remove.value(o), S.remove.label(o)) : S.remove.selected(o)) : S.debug("Label remove callback cancelled removal");
  12846. });
  12847. },
  12848. tabbable: function tabbable() {
  12849. S.is.searchSelection() ? (S.debug("Searchable dropdown initialized"), N.removeAttr("tabindex"), Q.removeAttr("tabindex")) : (S.debug("Simple selection dropdown initialized"), M.removeAttr("tabindex"), Q.removeAttr("tabindex"));
  12850. }
  12851. },
  12852. has: {
  12853. menuSearch: function menuSearch() {
  12854. return S.has.search() && N.closest(Q).length > 0;
  12855. },
  12856. search: function search() {
  12857. return N.length > 0;
  12858. },
  12859. sizer: function sizer() {
  12860. return H.length > 0;
  12861. },
  12862. selectInput: function selectInput() {
  12863. return U.is("select");
  12864. },
  12865. minCharacters: function minCharacters(e) {
  12866. return !k.minCharacters || (e = e !== i ? String(e) : String(S.get.query())).length >= k.minCharacters;
  12867. },
  12868. firstLetter: function firstLetter(e, t) {
  12869. var n;
  12870. return !(!e || 0 === e.length || "string" != typeof t) && (n = S.get.choiceText(e, !1), (t = t.toLowerCase()) == String(n).charAt(0).toLowerCase());
  12871. },
  12872. input: function input() {
  12873. return U.length > 0;
  12874. },
  12875. items: function items() {
  12876. return X.length > 0;
  12877. },
  12878. menu: function menu() {
  12879. return Q.length > 0;
  12880. },
  12881. message: function message() {
  12882. return 0 !== Q.children(D.message).length;
  12883. },
  12884. label: function label(e) {
  12885. var t = S.escape.value(e),
  12886. n = M.find(D.label);
  12887. return k.ignoreCase && (t = t.toLowerCase()), n.filter("[data-" + E.value + '="' + S.escape.string(t) + '"]').length > 0;
  12888. },
  12889. maxSelections: function maxSelections() {
  12890. return k.maxSelections && S.get.selectionCount() >= k.maxSelections;
  12891. },
  12892. allResultsFiltered: function allResultsFiltered() {
  12893. var e = X.not(D.addition);
  12894. return e.filter(D.unselectable).length === e.length;
  12895. },
  12896. userSuggestion: function userSuggestion() {
  12897. return Q.children(D.addition).length > 0;
  12898. },
  12899. query: function query() {
  12900. return "" !== S.get.query();
  12901. },
  12902. value: function value(e) {
  12903. return k.ignoreCase ? S.has.valueIgnoringCase(e) : S.has.valueMatchingCase(e);
  12904. },
  12905. valueMatchingCase: function valueMatchingCase(t) {
  12906. var n = S.get.values();
  12907. return !!(e.isArray(n) ? n && -1 !== e.inArray(t, n) : n == t);
  12908. },
  12909. valueIgnoringCase: function valueIgnoringCase(t) {
  12910. var n = S.get.values(),
  12911. i = !1;
  12912. return e.isArray(n) || (n = [n]), e.each(n, function (e, n) {
  12913. if (String(t).toLowerCase() == String(n).toLowerCase()) return i = !0, !1;
  12914. }), i;
  12915. }
  12916. },
  12917. is: {
  12918. active: function active() {
  12919. return M.hasClass(T.active);
  12920. },
  12921. animatingInward: function animatingInward() {
  12922. return Q.transition("is inward");
  12923. },
  12924. animatingOutward: function animatingOutward() {
  12925. return Q.transition("is outward");
  12926. },
  12927. bubbledLabelClick: function bubbledLabelClick(t) {
  12928. return e(t.target).is("select, input") && M.closest("label").length > 0;
  12929. },
  12930. bubbledIconClick: function bubbledIconClick(t) {
  12931. return e(t.target).closest(W).length > 0;
  12932. },
  12933. alreadySetup: function alreadySetup() {
  12934. return M.is("select") && M.parent(D.dropdown).data(I) !== i && 0 === M.prev().length;
  12935. },
  12936. animating: function animating(e) {
  12937. return e ? e.transition && e.transition("is animating") : Q.transition && Q.transition("is animating");
  12938. },
  12939. leftward: function leftward(e) {
  12940. return (e || Q).hasClass(T.leftward);
  12941. },
  12942. disabled: function disabled() {
  12943. return M.hasClass(T.disabled);
  12944. },
  12945. focused: function focused() {
  12946. return n.activeElement === M[0];
  12947. },
  12948. focusedOnSearch: function focusedOnSearch() {
  12949. return n.activeElement === N[0];
  12950. },
  12951. allFiltered: function allFiltered() {
  12952. return (S.is.multiple() || S.has.search()) && !(0 == k.hideAdditions && S.has.userSuggestion()) && !S.has.message() && S.has.allResultsFiltered();
  12953. },
  12954. hidden: function hidden(e) {
  12955. return !S.is.visible(e);
  12956. },
  12957. initialLoad: function initialLoad() {
  12958. return h;
  12959. },
  12960. inObject: function inObject(t, n) {
  12961. var i = !1;
  12962. return e.each(n, function (e, n) {
  12963. if (n == t) return i = !0, !0;
  12964. }), i;
  12965. },
  12966. multiple: function multiple() {
  12967. return M.hasClass(T.multiple);
  12968. },
  12969. remote: function remote() {
  12970. return k.apiSettings && S.can.useAPI();
  12971. },
  12972. single: function single() {
  12973. return !S.is.multiple();
  12974. },
  12975. selectMutation: function selectMutation(t) {
  12976. var n = !1;
  12977. return e.each(t, function (t, i) {
  12978. if (i.target && e(i.target).is("select")) return n = !0, !0;
  12979. }), n;
  12980. },
  12981. search: function search() {
  12982. return M.hasClass(T.search);
  12983. },
  12984. searchSelection: function searchSelection() {
  12985. return S.has.search() && 1 === N.parent(D.dropdown).length;
  12986. },
  12987. selection: function selection() {
  12988. return M.hasClass(T.selection);
  12989. },
  12990. userValue: function userValue(t) {
  12991. return -1 !== e.inArray(t, S.get.userValues());
  12992. },
  12993. upward: function upward(e) {
  12994. return (e || M).hasClass(T.upward);
  12995. },
  12996. visible: function visible(e) {
  12997. return e ? e.hasClass(T.visible) : Q.hasClass(T.visible);
  12998. },
  12999. verticallyScrollableContext: function verticallyScrollableContext() {
  13000. var e = L.get(0) !== t && L.css("overflow-y");
  13001. return "auto" == e || "scroll" == e;
  13002. },
  13003. horizontallyScrollableContext: function horizontallyScrollableContext() {
  13004. var e = L.get(0) !== t && L.css("overflow-X");
  13005. return "auto" == e || "scroll" == e;
  13006. }
  13007. },
  13008. can: {
  13009. activate: function activate(e) {
  13010. return !!k.useLabels || !S.has.maxSelections() || !(!S.has.maxSelections() || !e.hasClass(T.active));
  13011. },
  13012. openDownward: function openDownward(e) {
  13013. var n,
  13014. i,
  13015. o = e || Q,
  13016. a = !0;
  13017. return o.addClass(T.loading), i = {
  13018. context: {
  13019. offset: L.get(0) === t ? {
  13020. top: 0,
  13021. left: 0
  13022. } : L.offset(),
  13023. scrollTop: L.scrollTop(),
  13024. height: L.outerHeight()
  13025. },
  13026. menu: {
  13027. offset: o.offset(),
  13028. height: o.outerHeight()
  13029. }
  13030. }, S.is.verticallyScrollableContext() && (i.menu.offset.top += i.context.scrollTop), (n = {
  13031. above: i.context.scrollTop <= i.menu.offset.top - i.context.offset.top - i.menu.height,
  13032. below: i.context.scrollTop + i.context.height >= i.menu.offset.top - i.context.offset.top + i.menu.height
  13033. }).below ? (S.verbose("Dropdown can fit in context downward", n), a = !0) : n.below || n.above ? (S.verbose("Dropdown cannot fit below, opening upward", n), a = !1) : (S.verbose("Dropdown cannot fit in either direction, favoring downward", n), a = !0), o.removeClass(T.loading), a;
  13034. },
  13035. openRightward: function openRightward(e) {
  13036. var n,
  13037. i,
  13038. o = e || Q,
  13039. a = !0;
  13040. return o.addClass(T.loading), i = {
  13041. context: {
  13042. offset: L.get(0) === t ? {
  13043. top: 0,
  13044. left: 0
  13045. } : L.offset(),
  13046. scrollLeft: L.scrollLeft(),
  13047. width: L.outerWidth()
  13048. },
  13049. menu: {
  13050. offset: o.offset(),
  13051. width: o.outerWidth()
  13052. }
  13053. }, S.is.horizontallyScrollableContext() && (i.menu.offset.left += i.context.scrollLeft), (n = i.menu.offset.left - i.context.offset.left + i.menu.width >= i.context.scrollLeft + i.context.width) && (S.verbose("Dropdown cannot fit in context rightward", n), a = !1), o.removeClass(T.loading), a;
  13054. },
  13055. click: function click() {
  13056. return c || "click" == k.on;
  13057. },
  13058. extendSelect: function extendSelect() {
  13059. return k.allowAdditions || k.apiSettings;
  13060. },
  13061. show: function show() {
  13062. return !S.is.disabled() && (S.has.items() || S.has.message());
  13063. },
  13064. useAPI: function useAPI() {
  13065. return e.fn.api !== i;
  13066. }
  13067. },
  13068. animate: {
  13069. show: function show(t, n) {
  13070. var o,
  13071. a = n || Q,
  13072. r = n ? function () {} : function () {
  13073. S.hideSubMenus(), S.hideOthers(), S.set.active();
  13074. };
  13075. t = e.isFunction(t) ? t : function () {}, S.verbose("Doing menu show animation", a), S.set.direction(n), o = S.get.transition(n), S.is.selection() && S.set.scrollPosition(S.get.selectedItem(), !0), (S.is.hidden(a) || S.is.animating(a)) && ("none" == o ? (r(), a.transition("show"), t.call(K)) : e.fn.transition !== i && M.transition("is supported") ? a.transition({
  13076. animation: o + " in",
  13077. debug: k.debug,
  13078. verbose: k.verbose,
  13079. duration: k.duration,
  13080. queue: !0,
  13081. onStart: r,
  13082. onComplete: function onComplete() {
  13083. t.call(K);
  13084. }
  13085. }) : S.error(q.noTransition, o));
  13086. },
  13087. hide: function hide(t, n) {
  13088. var o = n || Q,
  13089. a = (n ? k.duration : k.duration, n ? function () {} : function () {
  13090. S.can.click() && S.unbind.intent(), S.remove.active();
  13091. }),
  13092. r = S.get.transition(n);
  13093. t = e.isFunction(t) ? t : function () {}, (S.is.visible(o) || S.is.animating(o)) && (S.verbose("Doing menu hide animation", o), "none" == r ? (a(), o.transition("hide"), t.call(K)) : e.fn.transition !== i && M.transition("is supported") ? o.transition({
  13094. animation: r + " out",
  13095. duration: k.duration,
  13096. debug: k.debug,
  13097. verbose: k.verbose,
  13098. queue: !1,
  13099. onStart: a,
  13100. onComplete: function onComplete() {
  13101. t.call(K);
  13102. }
  13103. }) : S.error(q.transition));
  13104. }
  13105. },
  13106. hideAndClear: function hideAndClear() {
  13107. S.remove.searchTerm(), S.has.maxSelections() || (S.has.search() ? S.hide(function () {
  13108. S.remove.filteredItem();
  13109. }) : S.hide());
  13110. },
  13111. delay: {
  13112. show: function show() {
  13113. S.verbose("Delaying show event to ensure user intent"), clearTimeout(S.timer), S.timer = setTimeout(S.show, k.delay.show);
  13114. },
  13115. hide: function hide() {
  13116. S.verbose("Delaying hide event to ensure user intent"), clearTimeout(S.timer), S.timer = setTimeout(S.hide, k.delay.hide);
  13117. }
  13118. },
  13119. escape: {
  13120. value: function value(t) {
  13121. var n = e.isArray(t),
  13122. i = "string" == typeof t,
  13123. o = !i && !n,
  13124. a = i && -1 !== t.search(O.quote),
  13125. r = [];
  13126. return o || !a ? t : (S.debug("Encoding quote values for use in select", t), n ? (e.each(t, function (e, t) {
  13127. r.push(t.replace(O.quote, "&quot;"));
  13128. }), r) : t.replace(O.quote, "&quot;"));
  13129. },
  13130. string: function string(e) {
  13131. return (e = String(e)).replace(O.escape, "\\$&");
  13132. }
  13133. },
  13134. setting: function setting(t, n) {
  13135. if (S.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, k, t);else {
  13136. if (n === i) return k[t];
  13137. e.isPlainObject(k[t]) ? e.extend(!0, k[t], n) : k[t] = n;
  13138. }
  13139. },
  13140. internal: function internal(t, n) {
  13141. if (e.isPlainObject(t)) e.extend(!0, S, t);else {
  13142. if (n === i) return S[t];
  13143. S[t] = n;
  13144. }
  13145. },
  13146. debug: function debug() {
  13147. !k.silent && k.debug && (k.performance ? S.performance.log(arguments) : (S.debug = Function.prototype.bind.call(console.info, console, k.name + ":"), S.debug.apply(console, arguments)));
  13148. },
  13149. verbose: function verbose() {
  13150. !k.silent && k.verbose && k.debug && (k.performance ? S.performance.log(arguments) : (S.verbose = Function.prototype.bind.call(console.info, console, k.name + ":"), S.verbose.apply(console, arguments)));
  13151. },
  13152. error: function error() {
  13153. k.silent || (S.error = Function.prototype.bind.call(console.error, console, k.name + ":"), S.error.apply(console, arguments));
  13154. },
  13155. performance: {
  13156. log: function log(e) {
  13157. var t, n;
  13158. k.performance && (n = (t = new Date().getTime()) - (u || t), u = t, d.push({
  13159. Name: e[0],
  13160. Arguments: [].slice.call(e, 1) || "",
  13161. Element: K,
  13162. "Execution Time": n
  13163. })), clearTimeout(S.performance.timer), S.performance.timer = setTimeout(S.performance.display, 500);
  13164. },
  13165. display: function display() {
  13166. var t = k.name + ":",
  13167. n = 0;
  13168. u = !1, clearTimeout(S.performance.timer), e.each(d, function (e, t) {
  13169. n += t["Execution Time"];
  13170. }), t += " " + n + "ms", l && (t += " '" + l + "'"), (console.group !== i || console.table !== i) && d.length > 0 && (console.groupCollapsed(t), console.table ? console.table(d) : e.each(d, function (e, t) {
  13171. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  13172. }), console.groupEnd()), d = [];
  13173. }
  13174. },
  13175. invoke: function invoke(t, n, o) {
  13176. var r,
  13177. s,
  13178. l,
  13179. c = J;
  13180. return n = n || g, o = K || o, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  13181. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  13182. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  13183. if (c[a] !== i) return s = c[a], !1;
  13184. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (S.error(q.method, t), !1);
  13185. c = c[o];
  13186. }
  13187. })), e.isFunction(s) ? l = s.apply(o, n) : s !== i && (l = s), e.isArray(a) ? a.push(l) : a !== i ? a = [a, l] : l !== i && (a = l), s;
  13188. }
  13189. }, m ? (J === i && S.initialize(), S.invoke(f)) : (J !== i && J.invoke("destroy"), S.initialize());
  13190. }), a !== i ? a : r;
  13191. }, e.fn.dropdown.settings = {
  13192. silent: !1,
  13193. debug: !1,
  13194. verbose: !1,
  13195. performance: !0,
  13196. on: "click",
  13197. action: "activate",
  13198. values: !1,
  13199. apiSettings: !1,
  13200. selectOnKeydown: !0,
  13201. minCharacters: 0,
  13202. filterRemoteData: !1,
  13203. saveRemoteData: !0,
  13204. throttle: 200,
  13205. context: t,
  13206. direction: "auto",
  13207. keepOnScreen: !0,
  13208. match: "both",
  13209. fullTextSearch: !1,
  13210. placeholder: "auto",
  13211. preserveHTML: !0,
  13212. sortSelect: !1,
  13213. forceSelection: !0,
  13214. allowAdditions: !1,
  13215. ignoreCase: !1,
  13216. hideAdditions: !0,
  13217. maxSelections: !1,
  13218. useLabels: !0,
  13219. delimiter: ",",
  13220. showOnFocus: !0,
  13221. allowReselection: !1,
  13222. allowTab: !0,
  13223. allowCategorySelection: !1,
  13224. fireOnInit: !1,
  13225. transition: "auto",
  13226. duration: 200,
  13227. glyphWidth: 1.037,
  13228. label: {
  13229. transition: "scale",
  13230. duration: 200,
  13231. variation: !1
  13232. },
  13233. delay: {
  13234. hide: 300,
  13235. show: 200,
  13236. search: 20,
  13237. touch: 50
  13238. },
  13239. onChange: function onChange(e, t, n) {},
  13240. onAdd: function onAdd(e, t, n) {},
  13241. onRemove: function onRemove(e, t, n) {},
  13242. onLabelSelect: function onLabelSelect(e) {},
  13243. onLabelCreate: function onLabelCreate(t, n) {
  13244. return e(this);
  13245. },
  13246. onLabelRemove: function onLabelRemove(e) {
  13247. return !0;
  13248. },
  13249. onNoResults: function onNoResults(e) {
  13250. return !0;
  13251. },
  13252. onShow: function onShow() {},
  13253. onHide: function onHide() {},
  13254. name: "Dropdown",
  13255. namespace: "dropdown",
  13256. message: {
  13257. addResult: "Add <b>{term}</b>",
  13258. count: "{count} selected",
  13259. maxSelections: "Max {maxCount} selections",
  13260. noResults: "No results found.",
  13261. serverError: "There was an error contacting the server"
  13262. },
  13263. error: {
  13264. action: "You called a dropdown action that was not defined",
  13265. alreadySetup: "Once a select has been initialized behaviors must be called on the created ui dropdown",
  13266. labels: "Allowing user additions currently requires the use of labels.",
  13267. missingMultiple: "<select> requires multiple property to be set to correctly preserve multiple values",
  13268. method: "The method you called is not defined.",
  13269. noAPI: "The API module is required to load resources remotely",
  13270. noStorage: "Saving remote data requires session storage",
  13271. noTransition: "This module requires ui transitions <https://github.com/Semantic-Org/UI-Transition>"
  13272. },
  13273. regExp: {
  13274. escape: /[-[\]{}()*+?.,\\^$|#\s]/g,
  13275. quote: /"/g
  13276. },
  13277. metadata: {
  13278. defaultText: "defaultText",
  13279. defaultValue: "defaultValue",
  13280. placeholderText: "placeholder",
  13281. text: "text",
  13282. value: "value"
  13283. },
  13284. fields: {
  13285. remoteValues: "results",
  13286. values: "values",
  13287. disabled: "disabled",
  13288. name: "name",
  13289. value: "value",
  13290. text: "text"
  13291. },
  13292. keys: {
  13293. backspace: 8,
  13294. delimiter: 188,
  13295. deleteKey: 46,
  13296. enter: 13,
  13297. escape: 27,
  13298. pageUp: 33,
  13299. pageDown: 34,
  13300. leftArrow: 37,
  13301. upArrow: 38,
  13302. rightArrow: 39,
  13303. downArrow: 40
  13304. },
  13305. selector: {
  13306. addition: ".addition",
  13307. dropdown: ".ui.dropdown",
  13308. hidden: ".hidden",
  13309. icon: "> .dropdown.icon",
  13310. input: '> input[type="hidden"], > select',
  13311. item: ".item",
  13312. label: "> .label",
  13313. remove: "> .label > .delete.icon",
  13314. siblingLabel: ".label",
  13315. menu: ".menu",
  13316. message: ".message",
  13317. menuIcon: ".dropdown.icon",
  13318. search: "input.search, .menu > .search > input, .menu input.search",
  13319. sizer: "> input.sizer",
  13320. text: "> .text:not(.icon)",
  13321. unselectable: ".disabled, .filtered"
  13322. },
  13323. className: {
  13324. active: "active",
  13325. addition: "addition",
  13326. animating: "animating",
  13327. disabled: "disabled",
  13328. empty: "empty",
  13329. dropdown: "ui dropdown",
  13330. filtered: "filtered",
  13331. hidden: "hidden transition",
  13332. item: "item",
  13333. label: "ui label",
  13334. loading: "loading",
  13335. menu: "menu",
  13336. message: "message",
  13337. multiple: "multiple",
  13338. placeholder: "default",
  13339. sizer: "sizer",
  13340. search: "search",
  13341. selected: "selected",
  13342. selection: "selection",
  13343. upward: "upward",
  13344. leftward: "left",
  13345. visible: "visible"
  13346. }
  13347. }, e.fn.dropdown.settings.templates = {
  13348. dropdown: function dropdown(t) {
  13349. var n = t.placeholder || !1,
  13350. i = (t.values, "");
  13351. return i += '<i class="dropdown icon"></i>', t.placeholder ? i += '<div class="default text">' + n + "</div>" : i += '<div class="text"></div>', i += '<div class="menu">', e.each(t.values, function (e, t) {
  13352. i += t.disabled ? '<div class="disabled item" data-value="' + t.value + '">' + t.name + "</div>" : '<div class="item" data-value="' + t.value + '">' + t.name + "</div>";
  13353. }), i += "</div>";
  13354. },
  13355. menu: function menu(t, n) {
  13356. var i = t[n.values] || {},
  13357. o = "";
  13358. return e.each(i, function (e, t) {
  13359. var i = t[n.text] ? 'data-text="' + t[n.text] + '"' : "",
  13360. a = t[n.disabled] ? "disabled " : "";
  13361. o += '<div class="' + a + 'item" data-value="' + t[n.value] + '"' + i + ">", o += t[n.name], o += "</div>";
  13362. }), o;
  13363. },
  13364. label: function label(e, t) {
  13365. return t + '<i class="delete icon"></i>';
  13366. },
  13367. message: function message(e) {
  13368. return e;
  13369. },
  13370. addition: function addition(e) {
  13371. return e;
  13372. }
  13373. };
  13374. }(jQuery, window, document), function (e, t, n, i) {
  13375. "use strict";
  13376. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.embed = function (n) {
  13377. var o,
  13378. a = e(this),
  13379. r = a.selector || "",
  13380. s = new Date().getTime(),
  13381. l = [],
  13382. c = arguments[0],
  13383. u = "string" == typeof c,
  13384. d = [].slice.call(arguments, 1);
  13385. return a.each(function () {
  13386. var f,
  13387. m = e.isPlainObject(n) ? e.extend(!0, {}, e.fn.embed.settings, n) : e.extend({}, e.fn.embed.settings),
  13388. g = m.selector,
  13389. p = m.className,
  13390. h = m.sources,
  13391. v = m.error,
  13392. b = m.metadata,
  13393. y = m.namespace,
  13394. x = m.templates,
  13395. C = "." + y,
  13396. w = "module-" + y,
  13397. S = (e(t), e(this)),
  13398. k = (S.find(g.placeholder), S.find(g.icon), S.find(g.embed)),
  13399. T = this,
  13400. A = S.data(w);
  13401. f = {
  13402. initialize: function initialize() {
  13403. f.debug("Initializing embed"), f.determine.autoplay(), f.create(), f.bind.events(), f.instantiate();
  13404. },
  13405. instantiate: function instantiate() {
  13406. f.verbose("Storing instance of module", f), A = f, S.data(w, f);
  13407. },
  13408. destroy: function destroy() {
  13409. f.verbose("Destroying previous instance of embed"), f.reset(), S.removeData(w).off(C);
  13410. },
  13411. refresh: function refresh() {
  13412. f.verbose("Refreshing selector cache"), S.find(g.placeholder), S.find(g.icon), k = S.find(g.embed);
  13413. },
  13414. bind: {
  13415. events: function events() {
  13416. f.has.placeholder() && (f.debug("Adding placeholder events"), S.on("click" + C, g.placeholder, f.createAndShow).on("click" + C, g.icon, f.createAndShow));
  13417. }
  13418. },
  13419. create: function create() {
  13420. f.get.placeholder() ? f.createPlaceholder() : f.createAndShow();
  13421. },
  13422. createPlaceholder: function createPlaceholder(e) {
  13423. var t = f.get.icon(),
  13424. n = f.get.url();
  13425. f.generate.embed(n);
  13426. e = e || f.get.placeholder(), S.html(x.placeholder(e, t)), f.debug("Creating placeholder for embed", e, t);
  13427. },
  13428. createEmbed: function createEmbed(t) {
  13429. f.refresh(), t = t || f.get.url(), k = e("<div/>").addClass(p.embed).html(f.generate.embed(t)).appendTo(S), m.onCreate.call(T, t), f.debug("Creating embed object", k);
  13430. },
  13431. changeEmbed: function changeEmbed(e) {
  13432. k.html(f.generate.embed(e));
  13433. },
  13434. createAndShow: function createAndShow() {
  13435. f.createEmbed(), f.show();
  13436. },
  13437. change: function change(e, t, n) {
  13438. f.debug("Changing video to ", e, t, n), S.data(b.source, e).data(b.id, t), n ? S.data(b.url, n) : S.removeData(b.url), f.has.embed() ? f.changeEmbed() : f.create();
  13439. },
  13440. reset: function reset() {
  13441. f.debug("Clearing embed and showing placeholder"), f.remove.active(), f.remove.embed(), f.showPlaceholder(), m.onReset.call(T);
  13442. },
  13443. show: function show() {
  13444. f.debug("Showing embed"), f.set.active(), m.onDisplay.call(T);
  13445. },
  13446. hide: function hide() {
  13447. f.debug("Hiding embed"), f.showPlaceholder();
  13448. },
  13449. showPlaceholder: function showPlaceholder() {
  13450. f.debug("Showing placeholder image"), f.remove.active(), m.onPlaceholderDisplay.call(T);
  13451. },
  13452. get: {
  13453. id: function id() {
  13454. return m.id || S.data(b.id);
  13455. },
  13456. placeholder: function placeholder() {
  13457. return m.placeholder || S.data(b.placeholder);
  13458. },
  13459. icon: function icon() {
  13460. return m.icon ? m.icon : S.data(b.icon) !== i ? S.data(b.icon) : f.determine.icon();
  13461. },
  13462. source: function source(e) {
  13463. return m.source ? m.source : S.data(b.source) !== i ? S.data(b.source) : f.determine.source();
  13464. },
  13465. type: function type() {
  13466. var e = f.get.source();
  13467. return h[e] !== i && h[e].type;
  13468. },
  13469. url: function url() {
  13470. return m.url ? m.url : S.data(b.url) !== i ? S.data(b.url) : f.determine.url();
  13471. }
  13472. },
  13473. determine: {
  13474. autoplay: function autoplay() {
  13475. f.should.autoplay() && (m.autoplay = !0);
  13476. },
  13477. source: function source(t) {
  13478. var n = !1;
  13479. return (t = t || f.get.url()) && e.each(h, function (e, i) {
  13480. if (-1 !== t.search(i.domain)) return n = e, !1;
  13481. }), n;
  13482. },
  13483. icon: function icon() {
  13484. var e = f.get.source();
  13485. return h[e] !== i && h[e].icon;
  13486. },
  13487. url: function url() {
  13488. var e,
  13489. t = m.id || S.data(b.id),
  13490. n = m.source || S.data(b.source);
  13491. return (e = h[n] !== i && h[n].url.replace("{id}", t)) && S.data(b.url, e), e;
  13492. }
  13493. },
  13494. set: {
  13495. active: function active() {
  13496. S.addClass(p.active);
  13497. }
  13498. },
  13499. remove: {
  13500. active: function active() {
  13501. S.removeClass(p.active);
  13502. },
  13503. embed: function embed() {
  13504. k.empty();
  13505. }
  13506. },
  13507. encode: {
  13508. parameters: function parameters(e) {
  13509. var t,
  13510. n = [];
  13511. for (t in e) {
  13512. n.push(encodeURIComponent(t) + "=" + encodeURIComponent(e[t]));
  13513. }
  13514. return n.join("&amp;");
  13515. }
  13516. },
  13517. generate: {
  13518. embed: function embed(e) {
  13519. f.debug("Generating embed html");
  13520. var t,
  13521. n,
  13522. i = f.get.source();
  13523. return (e = f.get.url(e)) ? (n = f.generate.parameters(i), t = x.iframe(e, n)) : f.error(v.noURL, S), t;
  13524. },
  13525. parameters: function parameters(t, n) {
  13526. var o = h[t] && h[t].parameters !== i ? h[t].parameters(m) : {};
  13527. return (n = n || m.parameters) && (o = e.extend({}, o, n)), o = m.onEmbed(o), f.encode.parameters(o);
  13528. }
  13529. },
  13530. has: {
  13531. embed: function embed() {
  13532. return k.length > 0;
  13533. },
  13534. placeholder: function placeholder() {
  13535. return m.placeholder || S.data(b.placeholder);
  13536. }
  13537. },
  13538. should: {
  13539. autoplay: function autoplay() {
  13540. return "auto" === m.autoplay ? m.placeholder || S.data(b.placeholder) !== i : m.autoplay;
  13541. }
  13542. },
  13543. is: {
  13544. video: function video() {
  13545. return "video" == f.get.type();
  13546. }
  13547. },
  13548. setting: function setting(t, n) {
  13549. if (f.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, m, t);else {
  13550. if (n === i) return m[t];
  13551. e.isPlainObject(m[t]) ? e.extend(!0, m[t], n) : m[t] = n;
  13552. }
  13553. },
  13554. internal: function internal(t, n) {
  13555. if (e.isPlainObject(t)) e.extend(!0, f, t);else {
  13556. if (n === i) return f[t];
  13557. f[t] = n;
  13558. }
  13559. },
  13560. debug: function debug() {
  13561. !m.silent && m.debug && (m.performance ? f.performance.log(arguments) : (f.debug = Function.prototype.bind.call(console.info, console, m.name + ":"), f.debug.apply(console, arguments)));
  13562. },
  13563. verbose: function verbose() {
  13564. !m.silent && m.verbose && m.debug && (m.performance ? f.performance.log(arguments) : (f.verbose = Function.prototype.bind.call(console.info, console, m.name + ":"), f.verbose.apply(console, arguments)));
  13565. },
  13566. error: function error() {
  13567. m.silent || (f.error = Function.prototype.bind.call(console.error, console, m.name + ":"), f.error.apply(console, arguments));
  13568. },
  13569. performance: {
  13570. log: function log(e) {
  13571. var t, n;
  13572. m.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({
  13573. Name: e[0],
  13574. Arguments: [].slice.call(e, 1) || "",
  13575. Element: T,
  13576. "Execution Time": n
  13577. })), clearTimeout(f.performance.timer), f.performance.timer = setTimeout(f.performance.display, 500);
  13578. },
  13579. display: function display() {
  13580. var t = m.name + ":",
  13581. n = 0;
  13582. s = !1, clearTimeout(f.performance.timer), e.each(l, function (e, t) {
  13583. n += t["Execution Time"];
  13584. }), t += " " + n + "ms", r && (t += " '" + r + "'"), a.length > 1 && (t += " (" + a.length + ")"), (console.group !== i || console.table !== i) && l.length > 0 && (console.groupCollapsed(t), console.table ? console.table(l) : e.each(l, function (e, t) {
  13585. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  13586. }), console.groupEnd()), l = [];
  13587. }
  13588. },
  13589. invoke: function invoke(t, n, a) {
  13590. var r,
  13591. s,
  13592. l,
  13593. c = A;
  13594. return n = n || d, a = T || a, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  13595. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  13596. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  13597. if (c[a] !== i) return s = c[a], !1;
  13598. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (f.error(v.method, t), !1);
  13599. c = c[o];
  13600. }
  13601. })), e.isFunction(s) ? l = s.apply(a, n) : s !== i && (l = s), e.isArray(o) ? o.push(l) : o !== i ? o = [o, l] : l !== i && (o = l), s;
  13602. }
  13603. }, u ? (A === i && f.initialize(), f.invoke(c)) : (A !== i && A.invoke("destroy"), f.initialize());
  13604. }), o !== i ? o : this;
  13605. }, e.fn.embed.settings = {
  13606. name: "Embed",
  13607. namespace: "embed",
  13608. silent: !1,
  13609. debug: !1,
  13610. verbose: !1,
  13611. performance: !0,
  13612. icon: !1,
  13613. source: !1,
  13614. url: !1,
  13615. id: !1,
  13616. autoplay: "auto",
  13617. color: "#444444",
  13618. hd: !0,
  13619. brandedUI: !1,
  13620. parameters: !1,
  13621. onDisplay: function onDisplay() {},
  13622. onPlaceholderDisplay: function onPlaceholderDisplay() {},
  13623. onReset: function onReset() {},
  13624. onCreate: function onCreate(e) {},
  13625. onEmbed: function onEmbed(e) {
  13626. return e;
  13627. },
  13628. metadata: {
  13629. id: "id",
  13630. icon: "icon",
  13631. placeholder: "placeholder",
  13632. source: "source",
  13633. url: "url"
  13634. },
  13635. error: {
  13636. noURL: "No URL specified",
  13637. method: "The method you called is not defined"
  13638. },
  13639. className: {
  13640. active: "active",
  13641. embed: "embed"
  13642. },
  13643. selector: {
  13644. embed: ".embed",
  13645. placeholder: ".placeholder",
  13646. icon: ".icon"
  13647. },
  13648. sources: {
  13649. youtube: {
  13650. name: "youtube",
  13651. type: "video",
  13652. icon: "video play",
  13653. domain: "youtube.com",
  13654. url: "//www.youtube.com/embed/{id}",
  13655. parameters: function parameters(e) {
  13656. return {
  13657. autohide: !e.brandedUI,
  13658. autoplay: e.autoplay,
  13659. color: e.color || i,
  13660. hq: e.hd,
  13661. jsapi: e.api,
  13662. modestbranding: !e.brandedUI
  13663. };
  13664. }
  13665. },
  13666. vimeo: {
  13667. name: "vimeo",
  13668. type: "video",
  13669. icon: "video play",
  13670. domain: "vimeo.com",
  13671. url: "//player.vimeo.com/video/{id}",
  13672. parameters: function parameters(e) {
  13673. return {
  13674. api: e.api,
  13675. autoplay: e.autoplay,
  13676. byline: e.brandedUI,
  13677. color: e.color || i,
  13678. portrait: e.brandedUI,
  13679. title: e.brandedUI
  13680. };
  13681. }
  13682. }
  13683. },
  13684. templates: {
  13685. iframe: function iframe(e, t) {
  13686. var n = e;
  13687. return t && (n += "?" + t), '<iframe src="' + n + '" width="100%" height="100%" frameborder="0" scrolling="no" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';
  13688. },
  13689. placeholder: function placeholder(e, t) {
  13690. var n = "";
  13691. return t && (n += '<i class="' + t + ' icon"></i>'), e && (n += '<img class="placeholder" src="' + e + '">'), n;
  13692. }
  13693. },
  13694. api: !1,
  13695. onPause: function onPause() {},
  13696. onPlay: function onPlay() {},
  13697. onStop: function onStop() {}
  13698. };
  13699. }(jQuery, window, document), function (e, t, n, i) {
  13700. "use strict";
  13701. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.modal = function (o) {
  13702. var a,
  13703. r = e(this),
  13704. s = e(t),
  13705. l = e(n),
  13706. c = e("body"),
  13707. u = r.selector || "",
  13708. d = new Date().getTime(),
  13709. f = [],
  13710. m = arguments[0],
  13711. g = "string" == typeof m,
  13712. p = [].slice.call(arguments, 1),
  13713. h = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  13714. setTimeout(e, 0);
  13715. };
  13716. return r.each(function () {
  13717. var r,
  13718. v,
  13719. b,
  13720. y,
  13721. x,
  13722. C,
  13723. w,
  13724. S,
  13725. k,
  13726. T = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.modal.settings, o) : e.extend({}, e.fn.modal.settings),
  13727. A = T.selector,
  13728. R = T.className,
  13729. P = T.namespace,
  13730. E = T.error,
  13731. F = "." + P,
  13732. O = "module-" + P,
  13733. D = e(this),
  13734. q = e(T.context),
  13735. j = D.find(A.close),
  13736. z = this,
  13737. I = D.data(O),
  13738. M = !1;
  13739. k = {
  13740. initialize: function initialize() {
  13741. k.verbose("Initializing dimmer", q), k.create.id(), k.create.dimmer(), k.refreshModals(), k.bind.events(), T.observeChanges && k.observeChanges(), k.instantiate();
  13742. },
  13743. instantiate: function instantiate() {
  13744. k.verbose("Storing instance of modal"), I = k, D.data(O, I);
  13745. },
  13746. create: {
  13747. dimmer: function dimmer() {
  13748. var t = {
  13749. debug: T.debug,
  13750. variation: !T.centered && "top aligned",
  13751. dimmerName: "modals"
  13752. },
  13753. n = e.extend(!0, t, T.dimmerSettings);
  13754. e.fn.dimmer !== i ? (k.debug("Creating dimmer"), y = q.dimmer(n), T.detachable ? (k.verbose("Modal is detachable, moving content into dimmer"), y.dimmer("add content", D)) : k.set.undetached(), x = y.dimmer("get dimmer")) : k.error(E.dimmer);
  13755. },
  13756. id: function id() {
  13757. w = (Math.random().toString(16) + "000000000").substr(2, 8), C = "." + w, k.verbose("Creating unique id for element", w);
  13758. }
  13759. },
  13760. destroy: function destroy() {
  13761. k.verbose("Destroying previous modal"), D.removeData(O).off(F), s.off(C), x.off(C), j.off(F), q.dimmer("destroy");
  13762. },
  13763. observeChanges: function observeChanges() {
  13764. "MutationObserver" in t && ((S = new MutationObserver(function (e) {
  13765. k.debug("DOM tree modified, refreshing"), k.refresh();
  13766. })).observe(z, {
  13767. childList: !0,
  13768. subtree: !0
  13769. }), k.debug("Setting up mutation observer", S));
  13770. },
  13771. refresh: function refresh() {
  13772. k.remove.scrolling(), k.cacheSizes(), k.set.screenHeight(), k.set.type();
  13773. },
  13774. refreshModals: function refreshModals() {
  13775. v = D.siblings(A.modal), r = v.add(D);
  13776. },
  13777. attachEvents: function attachEvents(t, n) {
  13778. var i = e(t);
  13779. n = e.isFunction(k[n]) ? k[n] : k.toggle, i.length > 0 ? (k.debug("Attaching modal events to element", t, n), i.off(F).on("click" + F, n)) : k.error(E.notFound, t);
  13780. },
  13781. bind: {
  13782. events: function events() {
  13783. k.verbose("Attaching events"), D.on("click" + F, A.close, k.event.close).on("click" + F, A.approve, k.event.approve).on("click" + F, A.deny, k.event.deny), s.on("resize" + C, k.event.resize);
  13784. }
  13785. },
  13786. get: {
  13787. id: function id() {
  13788. return (Math.random().toString(16) + "000000000").substr(2, 8);
  13789. }
  13790. },
  13791. event: {
  13792. approve: function approve() {
  13793. M || !1 === T.onApprove.call(z, e(this)) ? k.verbose("Approve callback returned false cancelling hide") : (M = !0, k.hide(function () {
  13794. M = !1;
  13795. }));
  13796. },
  13797. deny: function deny() {
  13798. M || !1 === T.onDeny.call(z, e(this)) ? k.verbose("Deny callback returned false cancelling hide") : (M = !0, k.hide(function () {
  13799. M = !1;
  13800. }));
  13801. },
  13802. close: function close() {
  13803. k.hide();
  13804. },
  13805. click: function click(t) {
  13806. if (T.closable) {
  13807. var i = e(t.target).closest(A.modal).length > 0,
  13808. o = e.contains(n.documentElement, t.target);
  13809. !i && o && k.is.active() && (k.debug("Dimmer clicked, hiding all modals"), k.remove.clickaway(), T.allowMultiple ? k.hide() : k.hideAll());
  13810. } else k.verbose("Dimmer clicked but closable setting is disabled");
  13811. },
  13812. debounce: function debounce(e, t) {
  13813. clearTimeout(k.timer), k.timer = setTimeout(e, t);
  13814. },
  13815. keyboard: function keyboard(e) {
  13816. 27 == e.which && (T.closable ? (k.debug("Escape key pressed hiding modal"), k.hide()) : k.debug("Escape key pressed, but closable is set to false"), e.preventDefault());
  13817. },
  13818. resize: function resize() {
  13819. y.dimmer("is active") && (k.is.animating() || k.is.active()) && h(k.refresh);
  13820. }
  13821. },
  13822. toggle: function toggle() {
  13823. k.is.active() || k.is.animating() ? k.hide() : k.show();
  13824. },
  13825. show: function show(t) {
  13826. t = e.isFunction(t) ? t : function () {}, k.refreshModals(), k.set.dimmerSettings(), k.showModal(t);
  13827. },
  13828. hide: function hide(t) {
  13829. t = e.isFunction(t) ? t : function () {}, k.refreshModals(), k.hideModal(t);
  13830. },
  13831. showModal: function showModal(t) {
  13832. t = e.isFunction(t) ? t : function () {}, k.is.animating() || !k.is.active() ? (k.showDimmer(), k.cacheSizes(), k.set.screenHeight(), k.set.type(), k.set.clickaway(), !T.allowMultiple && k.others.active() ? k.hideOthers(k.showModal) : (T.allowMultiple && T.detachable && D.detach().appendTo(x), T.onShow.call(z), T.transition && e.fn.transition !== i && D.transition("is supported") ? (k.debug("Showing modal with css animations"), D.transition({
  13833. debug: T.debug,
  13834. animation: T.transition + " in",
  13835. queue: T.queue,
  13836. duration: T.duration,
  13837. useFailSafe: !0,
  13838. onComplete: function onComplete() {
  13839. T.onVisible.apply(z), T.keyboardShortcuts && k.add.keyboardShortcuts(), k.save.focus(), k.set.active(), T.autofocus && k.set.autofocus(), t();
  13840. }
  13841. })) : k.error(E.noTransition))) : k.debug("Modal is already visible");
  13842. },
  13843. hideModal: function hideModal(t, n) {
  13844. t = e.isFunction(t) ? t : function () {}, k.debug("Hiding modal"), !1 !== T.onHide.call(z, e(this)) ? (k.is.animating() || k.is.active()) && (T.transition && e.fn.transition !== i && D.transition("is supported") ? (k.remove.active(), D.transition({
  13845. debug: T.debug,
  13846. animation: T.transition + " out",
  13847. queue: T.queue,
  13848. duration: T.duration,
  13849. useFailSafe: !0,
  13850. onStart: function onStart() {
  13851. k.others.active() || n || k.hideDimmer(), T.keyboardShortcuts && k.remove.keyboardShortcuts();
  13852. },
  13853. onComplete: function onComplete() {
  13854. T.onHidden.call(z), k.restore.focus(), t();
  13855. }
  13856. })) : k.error(E.noTransition)) : k.verbose("Hide callback returned false cancelling hide");
  13857. },
  13858. showDimmer: function showDimmer() {
  13859. y.dimmer("is animating") || !y.dimmer("is active") ? (k.debug("Showing dimmer"), y.dimmer("show")) : k.debug("Dimmer already visible");
  13860. },
  13861. hideDimmer: function hideDimmer() {
  13862. y.dimmer("is animating") || y.dimmer("is active") ? y.dimmer("hide", function () {
  13863. k.remove.clickaway(), k.remove.screenHeight();
  13864. }) : k.debug("Dimmer is not visible cannot hide");
  13865. },
  13866. hideAll: function hideAll(t) {
  13867. var n = r.filter("." + R.active + ", ." + R.animating);
  13868. t = e.isFunction(t) ? t : function () {}, n.length > 0 && (k.debug("Hiding all visible modals"), k.hideDimmer(), n.modal("hide modal", t));
  13869. },
  13870. hideOthers: function hideOthers(t) {
  13871. var n = v.filter("." + R.active + ", ." + R.animating);
  13872. t = e.isFunction(t) ? t : function () {}, n.length > 0 && (k.debug("Hiding other modals", v), n.modal("hide modal", t, !0));
  13873. },
  13874. others: {
  13875. active: function active() {
  13876. return v.filter("." + R.active).length > 0;
  13877. },
  13878. animating: function animating() {
  13879. return v.filter("." + R.animating).length > 0;
  13880. }
  13881. },
  13882. add: {
  13883. keyboardShortcuts: function keyboardShortcuts() {
  13884. k.verbose("Adding keyboard shortcuts"), l.on("keyup" + F, k.event.keyboard);
  13885. }
  13886. },
  13887. save: {
  13888. focus: function focus() {
  13889. e(n.activeElement).closest(D).length > 0 || (b = e(n.activeElement).blur());
  13890. }
  13891. },
  13892. restore: {
  13893. focus: function focus() {
  13894. b && b.length > 0 && b.focus();
  13895. }
  13896. },
  13897. remove: {
  13898. active: function active() {
  13899. D.removeClass(R.active);
  13900. },
  13901. clickaway: function clickaway() {
  13902. x.off("click" + C);
  13903. },
  13904. bodyStyle: function bodyStyle() {
  13905. "" === c.attr("style") && (k.verbose("Removing style attribute"), c.removeAttr("style"));
  13906. },
  13907. screenHeight: function screenHeight() {
  13908. k.debug("Removing page height"), c.css("height", "");
  13909. },
  13910. keyboardShortcuts: function keyboardShortcuts() {
  13911. k.verbose("Removing keyboard shortcuts"), l.off("keyup" + F);
  13912. },
  13913. scrolling: function scrolling() {
  13914. y.removeClass(R.scrolling), D.removeClass(R.scrolling);
  13915. }
  13916. },
  13917. cacheSizes: function cacheSizes() {
  13918. D.addClass(R.loading);
  13919. var o = D.prop("scrollHeight"),
  13920. a = D.outerHeight();
  13921. k.cache !== i && 0 === a || (k.cache = {
  13922. pageHeight: e(n).outerHeight(),
  13923. height: a + T.offset,
  13924. scrollHeight: o + T.offset,
  13925. contextHeight: "body" == T.context ? e(t).height() : y.height()
  13926. }, k.cache.topOffset = -k.cache.height / 2), D.removeClass(R.loading), k.debug("Caching modal and container sizes", k.cache);
  13927. },
  13928. can: {
  13929. fit: function fit() {
  13930. var e = k.cache.contextHeight,
  13931. t = k.cache.contextHeight / 2,
  13932. n = k.cache.topOffset,
  13933. i = k.cache.scrollHeight,
  13934. o = k.cache.height,
  13935. a = T.padding;
  13936. return i > o ? t + n + i + a < e : o + 2 * a < e;
  13937. }
  13938. },
  13939. is: {
  13940. active: function active() {
  13941. return D.hasClass(R.active);
  13942. },
  13943. animating: function animating() {
  13944. return D.transition("is supported") ? D.transition("is animating") : D.is(":visible");
  13945. },
  13946. scrolling: function scrolling() {
  13947. return y.hasClass(R.scrolling);
  13948. },
  13949. modernBrowser: function modernBrowser() {
  13950. return !(t.ActiveXObject || "ActiveXObject" in t);
  13951. }
  13952. },
  13953. set: {
  13954. autofocus: function autofocus() {
  13955. var e = D.find("[tabindex], :input").filter(":visible"),
  13956. t = e.filter("[autofocus]"),
  13957. n = t.length > 0 ? t.first() : e.first();
  13958. n.length > 0 && n.focus();
  13959. },
  13960. clickaway: function clickaway() {
  13961. x.on("click" + C, k.event.click);
  13962. },
  13963. dimmerSettings: function dimmerSettings() {
  13964. if (e.fn.dimmer !== i) {
  13965. var t = {
  13966. debug: T.debug,
  13967. dimmerName: "modals",
  13968. closable: "auto",
  13969. variation: !T.centered && "top aligned",
  13970. duration: {
  13971. show: T.duration,
  13972. hide: T.duration
  13973. }
  13974. },
  13975. n = e.extend(!0, t, T.dimmerSettings);
  13976. T.inverted ? (n.variation = n.variation !== i ? n.variation + " inverted" : "inverted", x.addClass(R.inverted)) : x.removeClass(R.inverted), T.blurring ? y.addClass(R.blurring) : y.removeClass(R.blurring), q.dimmer("setting", n);
  13977. } else k.error(E.dimmer);
  13978. },
  13979. screenHeight: function screenHeight() {
  13980. k.can.fit() ? c.css("height", "") : (k.debug("Modal is taller than page content, resizing page height"), c.css("height", k.cache.height + 2 * T.padding));
  13981. },
  13982. active: function active() {
  13983. D.addClass(R.active);
  13984. },
  13985. scrolling: function scrolling() {
  13986. y.addClass(R.scrolling), D.addClass(R.scrolling);
  13987. },
  13988. type: function type() {
  13989. k.can.fit() ? (k.verbose("Modal fits on screen"), k.others.active() || k.others.animating() || k.remove.scrolling()) : (k.verbose("Modal cannot fit on screen setting to scrolling"), k.set.scrolling());
  13990. },
  13991. undetached: function undetached() {
  13992. y.addClass(R.undetached);
  13993. }
  13994. },
  13995. setting: function setting(t, n) {
  13996. if (k.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, T, t);else {
  13997. if (n === i) return T[t];
  13998. e.isPlainObject(T[t]) ? e.extend(!0, T[t], n) : T[t] = n;
  13999. }
  14000. },
  14001. internal: function internal(t, n) {
  14002. if (e.isPlainObject(t)) e.extend(!0, k, t);else {
  14003. if (n === i) return k[t];
  14004. k[t] = n;
  14005. }
  14006. },
  14007. debug: function debug() {
  14008. !T.silent && T.debug && (T.performance ? k.performance.log(arguments) : (k.debug = Function.prototype.bind.call(console.info, console, T.name + ":"), k.debug.apply(console, arguments)));
  14009. },
  14010. verbose: function verbose() {
  14011. !T.silent && T.verbose && T.debug && (T.performance ? k.performance.log(arguments) : (k.verbose = Function.prototype.bind.call(console.info, console, T.name + ":"), k.verbose.apply(console, arguments)));
  14012. },
  14013. error: function error() {
  14014. T.silent || (k.error = Function.prototype.bind.call(console.error, console, T.name + ":"), k.error.apply(console, arguments));
  14015. },
  14016. performance: {
  14017. log: function log(e) {
  14018. var t, n;
  14019. T.performance && (n = (t = new Date().getTime()) - (d || t), d = t, f.push({
  14020. Name: e[0],
  14021. Arguments: [].slice.call(e, 1) || "",
  14022. Element: z,
  14023. "Execution Time": n
  14024. })), clearTimeout(k.performance.timer), k.performance.timer = setTimeout(k.performance.display, 500);
  14025. },
  14026. display: function display() {
  14027. var t = T.name + ":",
  14028. n = 0;
  14029. d = !1, clearTimeout(k.performance.timer), e.each(f, function (e, t) {
  14030. n += t["Execution Time"];
  14031. }), t += " " + n + "ms", u && (t += " '" + u + "'"), (console.group !== i || console.table !== i) && f.length > 0 && (console.groupCollapsed(t), console.table ? console.table(f) : e.each(f, function (e, t) {
  14032. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  14033. }), console.groupEnd()), f = [];
  14034. }
  14035. },
  14036. invoke: function invoke(t, n, o) {
  14037. var r,
  14038. s,
  14039. l,
  14040. c = I;
  14041. return n = n || p, o = z || o, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  14042. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  14043. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  14044. if (c[a] !== i) return s = c[a], !1;
  14045. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);
  14046. c = c[o];
  14047. }
  14048. })), e.isFunction(s) ? l = s.apply(o, n) : s !== i && (l = s), e.isArray(a) ? a.push(l) : a !== i ? a = [a, l] : l !== i && (a = l), s;
  14049. }
  14050. }, g ? (I === i && k.initialize(), k.invoke(m)) : (I !== i && I.invoke("destroy"), k.initialize());
  14051. }), a !== i ? a : this;
  14052. }, e.fn.modal.settings = {
  14053. name: "Modal",
  14054. namespace: "modal",
  14055. silent: !1,
  14056. debug: !1,
  14057. verbose: !1,
  14058. performance: !0,
  14059. observeChanges: !1,
  14060. allowMultiple: !1,
  14061. detachable: !0,
  14062. closable: !0,
  14063. autofocus: !0,
  14064. inverted: !1,
  14065. blurring: !1,
  14066. centered: !0,
  14067. dimmerSettings: {
  14068. closable: !1,
  14069. useCSS: !0
  14070. },
  14071. keyboardShortcuts: !0,
  14072. context: "body",
  14073. queue: !1,
  14074. duration: 500,
  14075. offset: 0,
  14076. transition: "scale",
  14077. padding: 50,
  14078. onShow: function onShow() {},
  14079. onVisible: function onVisible() {},
  14080. onHide: function onHide() {
  14081. return !0;
  14082. },
  14083. onHidden: function onHidden() {},
  14084. onApprove: function onApprove() {
  14085. return !0;
  14086. },
  14087. onDeny: function onDeny() {
  14088. return !0;
  14089. },
  14090. selector: {
  14091. close: "> .close",
  14092. approve: ".actions .positive, .actions .approve, .actions .ok",
  14093. deny: ".actions .negative, .actions .deny, .actions .cancel",
  14094. modal: ".ui.modal"
  14095. },
  14096. error: {
  14097. dimmer: "UI Dimmer, a required component is not included in this page",
  14098. method: "The method you called is not defined.",
  14099. notFound: "The element you specified could not be found"
  14100. },
  14101. className: {
  14102. active: "active",
  14103. animating: "animating",
  14104. blurring: "blurring",
  14105. inverted: "inverted",
  14106. loading: "loading",
  14107. scrolling: "scrolling",
  14108. undetached: "undetached"
  14109. }
  14110. };
  14111. }(jQuery, window, document), function (e, t, n, i) {
  14112. "use strict";
  14113. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.nag = function (n) {
  14114. var o,
  14115. a = e(this),
  14116. r = a.selector || "",
  14117. s = new Date().getTime(),
  14118. l = [],
  14119. c = arguments[0],
  14120. u = "string" == typeof c,
  14121. d = [].slice.call(arguments, 1);
  14122. return a.each(function () {
  14123. var a,
  14124. f = e.isPlainObject(n) ? e.extend(!0, {}, e.fn.nag.settings, n) : e.extend({}, e.fn.nag.settings),
  14125. m = (f.className, f.selector),
  14126. g = f.error,
  14127. p = f.namespace,
  14128. h = "." + p,
  14129. v = p + "-module",
  14130. b = e(this),
  14131. y = (b.find(m.close), f.context ? e(f.context) : e("body")),
  14132. x = this,
  14133. C = b.data(v);
  14134. t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame;
  14135. a = {
  14136. initialize: function initialize() {
  14137. a.verbose("Initializing element"), b.on("click" + h, m.close, a.dismiss).data(v, a), f.detachable && b.parent()[0] !== y[0] && b.detach().prependTo(y), f.displayTime > 0 && setTimeout(a.hide, f.displayTime), a.show();
  14138. },
  14139. destroy: function destroy() {
  14140. a.verbose("Destroying instance"), b.removeData(v).off(h);
  14141. },
  14142. show: function show() {
  14143. a.should.show() && !b.is(":visible") && (a.debug("Showing nag", f.animation.show), "fade" == f.animation.show ? b.fadeIn(f.duration, f.easing) : b.slideDown(f.duration, f.easing));
  14144. },
  14145. hide: function hide() {
  14146. a.debug("Showing nag", f.animation.hide), "fade" == f.animation.show ? b.fadeIn(f.duration, f.easing) : b.slideUp(f.duration, f.easing);
  14147. },
  14148. onHide: function onHide() {
  14149. a.debug("Removing nag", f.animation.hide), b.remove(), f.onHide && f.onHide();
  14150. },
  14151. dismiss: function dismiss(e) {
  14152. f.storageMethod && a.storage.set(f.key, f.value), a.hide(), e.stopImmediatePropagation(), e.preventDefault();
  14153. },
  14154. should: {
  14155. show: function show() {
  14156. return f.persist ? (a.debug("Persistent nag is set, can show nag"), !0) : a.storage.get(f.key) != f.value.toString() ? (a.debug("Stored value is not set, can show nag", a.storage.get(f.key)), !0) : (a.debug("Stored value is set, cannot show nag", a.storage.get(f.key)), !1);
  14157. }
  14158. },
  14159. get: {
  14160. storageOptions: function storageOptions() {
  14161. var e = {};
  14162. return f.expires && (e.expires = f.expires), f.domain && (e.domain = f.domain), f.path && (e.path = f.path), e;
  14163. }
  14164. },
  14165. clear: function clear() {
  14166. a.storage.remove(f.key);
  14167. },
  14168. storage: {
  14169. set: function set(n, o) {
  14170. var r = a.get.storageOptions();
  14171. if ("localstorage" == f.storageMethod && t.localStorage !== i) t.localStorage.setItem(n, o), a.debug("Value stored using local storage", n, o);else if ("sessionstorage" == f.storageMethod && t.sessionStorage !== i) t.sessionStorage.setItem(n, o), a.debug("Value stored using session storage", n, o);else {
  14172. if (e.cookie === i) return void a.error(g.noCookieStorage);
  14173. e.cookie(n, o, r), a.debug("Value stored using cookie", n, o, r);
  14174. }
  14175. },
  14176. get: function get(n, o) {
  14177. var r;
  14178. return "localstorage" == f.storageMethod && t.localStorage !== i ? r = t.localStorage.getItem(n) : "sessionstorage" == f.storageMethod && t.sessionStorage !== i ? r = t.sessionStorage.getItem(n) : e.cookie !== i ? r = e.cookie(n) : a.error(g.noCookieStorage), "undefined" != r && "null" != r && r !== i && null !== r || (r = i), r;
  14179. },
  14180. remove: function remove(n) {
  14181. var o = a.get.storageOptions();
  14182. "localstorage" == f.storageMethod && t.localStorage !== i ? t.localStorage.removeItem(n) : "sessionstorage" == f.storageMethod && t.sessionStorage !== i ? t.sessionStorage.removeItem(n) : e.cookie !== i ? e.removeCookie(n, o) : a.error(g.noStorage);
  14183. }
  14184. },
  14185. setting: function setting(t, n) {
  14186. if (a.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, f, t);else {
  14187. if (n === i) return f[t];
  14188. e.isPlainObject(f[t]) ? e.extend(!0, f[t], n) : f[t] = n;
  14189. }
  14190. },
  14191. internal: function internal(t, n) {
  14192. if (e.isPlainObject(t)) e.extend(!0, a, t);else {
  14193. if (n === i) return a[t];
  14194. a[t] = n;
  14195. }
  14196. },
  14197. debug: function debug() {
  14198. !f.silent && f.debug && (f.performance ? a.performance.log(arguments) : (a.debug = Function.prototype.bind.call(console.info, console, f.name + ":"), a.debug.apply(console, arguments)));
  14199. },
  14200. verbose: function verbose() {
  14201. !f.silent && f.verbose && f.debug && (f.performance ? a.performance.log(arguments) : (a.verbose = Function.prototype.bind.call(console.info, console, f.name + ":"), a.verbose.apply(console, arguments)));
  14202. },
  14203. error: function error() {
  14204. f.silent || (a.error = Function.prototype.bind.call(console.error, console, f.name + ":"), a.error.apply(console, arguments));
  14205. },
  14206. performance: {
  14207. log: function log(e) {
  14208. var t, n;
  14209. f.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({
  14210. Name: e[0],
  14211. Arguments: [].slice.call(e, 1) || "",
  14212. Element: x,
  14213. "Execution Time": n
  14214. })), clearTimeout(a.performance.timer), a.performance.timer = setTimeout(a.performance.display, 500);
  14215. },
  14216. display: function display() {
  14217. var t = f.name + ":",
  14218. n = 0;
  14219. s = !1, clearTimeout(a.performance.timer), e.each(l, function (e, t) {
  14220. n += t["Execution Time"];
  14221. }), t += " " + n + "ms", r && (t += " '" + r + "'"), (console.group !== i || console.table !== i) && l.length > 0 && (console.groupCollapsed(t), console.table ? console.table(l) : e.each(l, function (e, t) {
  14222. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  14223. }), console.groupEnd()), l = [];
  14224. }
  14225. },
  14226. invoke: function invoke(t, n, r) {
  14227. var s,
  14228. l,
  14229. c,
  14230. u = C;
  14231. return n = n || d, r = x || r, "string" == typeof t && u !== i && (t = t.split(/[\. ]/), s = t.length - 1, e.each(t, function (n, o) {
  14232. var r = n != s ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  14233. if (e.isPlainObject(u[r]) && n != s) u = u[r];else {
  14234. if (u[r] !== i) return l = u[r], !1;
  14235. if (!e.isPlainObject(u[o]) || n == s) return u[o] !== i ? (l = u[o], !1) : (a.error(g.method, t), !1);
  14236. u = u[o];
  14237. }
  14238. })), e.isFunction(l) ? c = l.apply(r, n) : l !== i && (c = l), e.isArray(o) ? o.push(c) : o !== i ? o = [o, c] : c !== i && (o = c), l;
  14239. }
  14240. }, u ? (C === i && a.initialize(), a.invoke(c)) : (C !== i && C.invoke("destroy"), a.initialize());
  14241. }), o !== i ? o : this;
  14242. }, e.fn.nag.settings = {
  14243. name: "Nag",
  14244. silent: !1,
  14245. debug: !1,
  14246. verbose: !1,
  14247. performance: !0,
  14248. namespace: "Nag",
  14249. persist: !1,
  14250. displayTime: 0,
  14251. animation: {
  14252. show: "slide",
  14253. hide: "slide"
  14254. },
  14255. context: !1,
  14256. detachable: !1,
  14257. expires: 30,
  14258. domain: !1,
  14259. path: "/",
  14260. storageMethod: "cookie",
  14261. key: "nag",
  14262. value: "dismiss",
  14263. error: {
  14264. noCookieStorage: "$.cookie is not included. A storage solution is required.",
  14265. noStorage: "Neither $.cookie or store is defined. A storage solution is required for storing state",
  14266. method: "The method you called is not defined."
  14267. },
  14268. className: {
  14269. bottom: "bottom",
  14270. fixed: "fixed"
  14271. },
  14272. selector: {
  14273. close: ".close.icon"
  14274. },
  14275. speed: 500,
  14276. easing: "easeOutQuad",
  14277. onHide: function onHide() {}
  14278. }, e.extend(e.easing, {
  14279. easeOutQuad: function easeOutQuad(e, t, n, i, o) {
  14280. return -i * (t /= o) * (t - 2) + n;
  14281. }
  14282. });
  14283. }(jQuery, window, document), function (e, t, n, i) {
  14284. "use strict";
  14285. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.popup = function (o) {
  14286. var a,
  14287. r = e(this),
  14288. s = e(n),
  14289. l = e(t),
  14290. c = e("body"),
  14291. u = r.selector || "",
  14292. d = new Date().getTime(),
  14293. f = [],
  14294. m = arguments[0],
  14295. g = "string" == typeof m,
  14296. p = [].slice.call(arguments, 1);
  14297. return r.each(function () {
  14298. var r,
  14299. h,
  14300. v,
  14301. b,
  14302. y,
  14303. x,
  14304. C = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.popup.settings, o) : e.extend({}, e.fn.popup.settings),
  14305. w = C.selector,
  14306. S = C.className,
  14307. k = C.error,
  14308. T = C.metadata,
  14309. A = C.namespace,
  14310. R = "." + C.namespace,
  14311. P = "module-" + A,
  14312. E = e(this),
  14313. F = e(C.context),
  14314. O = e(C.scrollContext),
  14315. D = e(C.boundary),
  14316. q = C.target ? e(C.target) : E,
  14317. j = 0,
  14318. z = !1,
  14319. I = !1,
  14320. M = this,
  14321. L = E.data(P);
  14322. x = {
  14323. initialize: function initialize() {
  14324. x.debug("Initializing", E), x.createID(), x.bind.events(), !x.exists() && C.preserve && x.create(), C.observeChanges && x.observeChanges(), x.instantiate();
  14325. },
  14326. instantiate: function instantiate() {
  14327. x.verbose("Storing instance", x), L = x, E.data(P, L);
  14328. },
  14329. observeChanges: function observeChanges() {
  14330. "MutationObserver" in t && ((v = new MutationObserver(x.event.documentChanged)).observe(n, {
  14331. childList: !0,
  14332. subtree: !0
  14333. }), x.debug("Setting up mutation observer", v));
  14334. },
  14335. refresh: function refresh() {
  14336. C.popup ? r = e(C.popup).eq(0) : C.inline && (r = q.nextAll(w.popup).eq(0), C.popup = r), C.popup ? (r.addClass(S.loading), h = x.get.offsetParent(), r.removeClass(S.loading), C.movePopup && x.has.popup() && x.get.offsetParent(r)[0] !== h[0] && (x.debug("Moving popup to the same offset parent as target"), r.detach().appendTo(h))) : h = C.inline ? x.get.offsetParent(q) : x.has.popup() ? x.get.offsetParent(r) : c, h.is("html") && h[0] !== c[0] && (x.debug("Setting page as offset parent"), h = c), x.get.variation() && x.set.variation();
  14337. },
  14338. reposition: function reposition() {
  14339. x.refresh(), x.set.position();
  14340. },
  14341. destroy: function destroy() {
  14342. x.debug("Destroying previous module"), v && v.disconnect(), r && !C.preserve && x.removePopup(), clearTimeout(x.hideTimer), clearTimeout(x.showTimer), x.unbind.close(), x.unbind.events(), E.removeData(P);
  14343. },
  14344. event: {
  14345. start: function start(t) {
  14346. var n = e.isPlainObject(C.delay) ? C.delay.show : C.delay;
  14347. clearTimeout(x.hideTimer), I || (x.showTimer = setTimeout(x.show, n));
  14348. },
  14349. end: function end() {
  14350. var t = e.isPlainObject(C.delay) ? C.delay.hide : C.delay;
  14351. clearTimeout(x.showTimer), x.hideTimer = setTimeout(x.hide, t);
  14352. },
  14353. touchstart: function touchstart(e) {
  14354. I = !0, x.show();
  14355. },
  14356. resize: function resize() {
  14357. x.is.visible() && x.set.position();
  14358. },
  14359. documentChanged: function documentChanged(t) {
  14360. [].forEach.call(t, function (t) {
  14361. t.removedNodes && [].forEach.call(t.removedNodes, function (t) {
  14362. (t == M || e(t).find(M).length > 0) && (x.debug("Element removed from DOM, tearing down events"), x.destroy());
  14363. });
  14364. });
  14365. },
  14366. hideGracefully: function hideGracefully(t) {
  14367. var i = e(t.target),
  14368. o = e.contains(n.documentElement, t.target),
  14369. a = i.closest(w.popup).length > 0;
  14370. t && !a && o ? (x.debug("Click occurred outside popup hiding popup"), x.hide()) : x.debug("Click was inside popup, keeping popup open");
  14371. }
  14372. },
  14373. create: function create() {
  14374. var t = x.get.html(),
  14375. n = x.get.title(),
  14376. i = x.get.content();
  14377. t || i || n ? (x.debug("Creating pop-up html"), t || (t = C.templates.popup({
  14378. title: n,
  14379. content: i
  14380. })), r = e("<div/>").addClass(S.popup).data(T.activator, E).html(t), C.inline ? (x.verbose("Inserting popup element inline", r), r.insertAfter(E)) : (x.verbose("Appending popup element to body", r), r.appendTo(F)), x.refresh(), x.set.variation(), C.hoverable && x.bind.popup(), C.onCreate.call(r, M)) : 0 !== q.next(w.popup).length ? (x.verbose("Pre-existing popup found"), C.inline = !0, C.popup = q.next(w.popup).data(T.activator, E), x.refresh(), C.hoverable && x.bind.popup()) : C.popup ? (e(C.popup).data(T.activator, E), x.verbose("Used popup specified in settings"), x.refresh(), C.hoverable && x.bind.popup()) : x.debug("No content specified skipping display", M);
  14381. },
  14382. createID: function createID() {
  14383. y = (Math.random().toString(16) + "000000000").substr(2, 8), b = "." + y, x.verbose("Creating unique id for element", y);
  14384. },
  14385. toggle: function toggle() {
  14386. x.debug("Toggling pop-up"), x.is.hidden() ? (x.debug("Popup is hidden, showing pop-up"), x.unbind.close(), x.show()) : (x.debug("Popup is visible, hiding pop-up"), x.hide());
  14387. },
  14388. show: function show(e) {
  14389. if (e = e || function () {}, x.debug("Showing pop-up", C.transition), x.is.hidden() && (!x.is.active() || !x.is.dropdown())) {
  14390. if (x.exists() || x.create(), !1 === C.onShow.call(r, M)) return void x.debug("onShow callback returned false, cancelling popup animation");
  14391. C.preserve || C.popup || x.refresh(), r && x.set.position() && (x.save.conditions(), C.exclusive && x.hideAll(), x.animate.show(e));
  14392. }
  14393. },
  14394. hide: function hide(e) {
  14395. if (e = e || function () {}, x.is.visible() || x.is.animating()) {
  14396. if (!1 === C.onHide.call(r, M)) return void x.debug("onHide callback returned false, cancelling popup animation");
  14397. x.remove.visible(), x.unbind.close(), x.restore.conditions(), x.animate.hide(e);
  14398. }
  14399. },
  14400. hideAll: function hideAll() {
  14401. e(w.popup).filter("." + S.popupVisible).each(function () {
  14402. e(this).data(T.activator).popup("hide");
  14403. });
  14404. },
  14405. exists: function exists() {
  14406. return !!r && (C.inline || C.popup ? x.has.popup() : r.closest(F).length >= 1);
  14407. },
  14408. removePopup: function removePopup() {
  14409. x.has.popup() && !C.popup && (x.debug("Removing popup", r), r.remove(), r = i, C.onRemove.call(r, M));
  14410. },
  14411. save: {
  14412. conditions: function conditions() {
  14413. x.cache = {
  14414. title: E.attr("title")
  14415. }, x.cache.title && E.removeAttr("title"), x.verbose("Saving original attributes", x.cache.title);
  14416. }
  14417. },
  14418. restore: {
  14419. conditions: function conditions() {
  14420. return x.cache && x.cache.title && (E.attr("title", x.cache.title), x.verbose("Restoring original attributes", x.cache.title)), !0;
  14421. }
  14422. },
  14423. supports: {
  14424. svg: function svg() {
  14425. return "undefined" == typeof SVGGraphicsElement;
  14426. }
  14427. },
  14428. animate: {
  14429. show: function show(t) {
  14430. t = e.isFunction(t) ? t : function () {}, C.transition && e.fn.transition !== i && E.transition("is supported") ? (x.set.visible(), r.transition({
  14431. animation: C.transition + " in",
  14432. queue: !1,
  14433. debug: C.debug,
  14434. verbose: C.verbose,
  14435. duration: C.duration,
  14436. onComplete: function onComplete() {
  14437. x.bind.close(), t.call(r, M), C.onVisible.call(r, M);
  14438. }
  14439. })) : x.error(k.noTransition);
  14440. },
  14441. hide: function hide(t) {
  14442. t = e.isFunction(t) ? t : function () {}, x.debug("Hiding pop-up"), !1 !== C.onHide.call(r, M) ? C.transition && e.fn.transition !== i && E.transition("is supported") ? r.transition({
  14443. animation: C.transition + " out",
  14444. queue: !1,
  14445. duration: C.duration,
  14446. debug: C.debug,
  14447. verbose: C.verbose,
  14448. onComplete: function onComplete() {
  14449. x.reset(), t.call(r, M), C.onHidden.call(r, M);
  14450. }
  14451. }) : x.error(k.noTransition) : x.debug("onHide callback returned false, cancelling popup animation");
  14452. }
  14453. },
  14454. change: {
  14455. content: function content(e) {
  14456. r.html(e);
  14457. }
  14458. },
  14459. get: {
  14460. html: function html() {
  14461. return E.removeData(T.html), E.data(T.html) || C.html;
  14462. },
  14463. title: function title() {
  14464. return E.removeData(T.title), E.data(T.title) || C.title;
  14465. },
  14466. content: function content() {
  14467. return E.removeData(T.content), E.data(T.content) || C.content || E.attr("title");
  14468. },
  14469. variation: function variation() {
  14470. return E.removeData(T.variation), E.data(T.variation) || C.variation;
  14471. },
  14472. popup: function popup() {
  14473. return r;
  14474. },
  14475. popupOffset: function popupOffset() {
  14476. return r.offset();
  14477. },
  14478. calculations: function calculations() {
  14479. var e,
  14480. n = x.get.offsetParent(r),
  14481. i = q[0],
  14482. o = D[0] == t,
  14483. a = C.inline || C.popup && C.movePopup ? q.position() : q.offset(),
  14484. s = o ? {
  14485. top: 0,
  14486. left: 0
  14487. } : D.offset(),
  14488. c = {},
  14489. u = o ? {
  14490. top: l.scrollTop(),
  14491. left: l.scrollLeft()
  14492. } : {
  14493. top: 0,
  14494. left: 0
  14495. };
  14496. if (c = {
  14497. target: {
  14498. element: q[0],
  14499. width: q.outerWidth(),
  14500. height: q.outerHeight(),
  14501. top: a.top,
  14502. left: a.left,
  14503. margin: {}
  14504. },
  14505. popup: {
  14506. width: r.outerWidth(),
  14507. height: r.outerHeight()
  14508. },
  14509. parent: {
  14510. width: h.outerWidth(),
  14511. height: h.outerHeight()
  14512. },
  14513. screen: {
  14514. top: s.top,
  14515. left: s.left,
  14516. scroll: {
  14517. top: u.top,
  14518. left: u.left
  14519. },
  14520. width: D.width(),
  14521. height: D.height()
  14522. }
  14523. }, n.get(0) !== h.get(0)) {
  14524. var d = n.offset();
  14525. c.target.top -= d.top, c.target.left -= d.left, c.parent.width = n.outerWidth(), c.parent.height = n.outerHeight();
  14526. }
  14527. return C.setFluidWidth && x.is.fluid() && (c.container = {
  14528. width: r.parent().outerWidth()
  14529. }, c.popup.width = c.container.width), c.target.margin.top = C.inline ? parseInt(t.getComputedStyle(i).getPropertyValue("margin-top"), 10) : 0, c.target.margin.left = C.inline ? x.is.rtl() ? parseInt(t.getComputedStyle(i).getPropertyValue("margin-right"), 10) : parseInt(t.getComputedStyle(i).getPropertyValue("margin-left"), 10) : 0, e = c.screen, c.boundary = {
  14530. top: e.top + e.scroll.top,
  14531. bottom: e.top + e.scroll.top + e.height,
  14532. left: e.left + e.scroll.left,
  14533. right: e.left + e.scroll.left + e.width
  14534. }, c;
  14535. },
  14536. id: function id() {
  14537. return y;
  14538. },
  14539. startEvent: function startEvent() {
  14540. return "hover" == C.on ? "mouseenter" : "focus" == C.on && "focus";
  14541. },
  14542. scrollEvent: function scrollEvent() {
  14543. return "scroll";
  14544. },
  14545. endEvent: function endEvent() {
  14546. return "hover" == C.on ? "mouseleave" : "focus" == C.on && "blur";
  14547. },
  14548. distanceFromBoundary: function distanceFromBoundary(e, t) {
  14549. var n,
  14550. i,
  14551. o = {};
  14552. return n = (t = t || x.get.calculations()).popup, i = t.boundary, e && (o = {
  14553. top: e.top - i.top,
  14554. left: e.left - i.left,
  14555. right: i.right - (e.left + n.width),
  14556. bottom: i.bottom - (e.top + n.height)
  14557. }, x.verbose("Distance from boundaries determined", e, o)), o;
  14558. },
  14559. offsetParent: function offsetParent(t) {
  14560. var n = (t !== i ? t[0] : q[0]).parentNode,
  14561. o = e(n);
  14562. if (n) for (var a = "none" === o.css("transform"), r = "static" === o.css("position"), s = o.is("body"); n && !s && r && a;) {
  14563. n = n.parentNode, a = "none" === (o = e(n)).css("transform"), r = "static" === o.css("position"), s = o.is("body");
  14564. }
  14565. return o && o.length > 0 ? o : e();
  14566. },
  14567. positions: function positions() {
  14568. return {
  14569. "top left": !1,
  14570. "top center": !1,
  14571. "top right": !1,
  14572. "bottom left": !1,
  14573. "bottom center": !1,
  14574. "bottom right": !1,
  14575. "left center": !1,
  14576. "right center": !1
  14577. };
  14578. },
  14579. nextPosition: function nextPosition(e) {
  14580. var t = e.split(" "),
  14581. n = t[0],
  14582. i = t[1],
  14583. o = "top" == n || "bottom" == n,
  14584. a = !1,
  14585. r = !1,
  14586. s = !1;
  14587. return z || (x.verbose("All available positions available"), z = x.get.positions()), x.debug("Recording last position tried", e), z[e] = !0, "opposite" === C.prefer && (s = (s = [{
  14588. top: "bottom",
  14589. bottom: "top",
  14590. left: "right",
  14591. right: "left"
  14592. }[n], i]).join(" "), a = !0 === z[s], x.debug("Trying opposite strategy", s)), "adjacent" === C.prefer && o && (s = (s = [n, {
  14593. left: "center",
  14594. center: "right",
  14595. right: "left"
  14596. }[i]]).join(" "), r = !0 === z[s], x.debug("Trying adjacent strategy", s)), (r || a) && (x.debug("Using backup position", s), s = {
  14597. "top left": "top center",
  14598. "top center": "top right",
  14599. "top right": "right center",
  14600. "right center": "bottom right",
  14601. "bottom right": "bottom center",
  14602. "bottom center": "bottom left",
  14603. "bottom left": "left center",
  14604. "left center": "top left"
  14605. }[e]), s;
  14606. }
  14607. },
  14608. set: {
  14609. position: function position(e, t) {
  14610. if (0 !== q.length && 0 !== r.length) {
  14611. var n, o, a, s, l, c, u, d;
  14612. if (t = t || x.get.calculations(), e = e || E.data(T.position) || C.position, n = E.data(T.offset) || C.offset, o = C.distanceAway, a = t.target, s = t.popup, l = t.parent, x.should.centerArrow(t) && (x.verbose("Adjusting offset to center arrow on small target element"), "top left" != e && "bottom left" != e || (n += a.width / 2, n -= C.arrowPixelsFromEdge), "top right" != e && "bottom right" != e || (n -= a.width / 2, n += C.arrowPixelsFromEdge)), 0 === a.width && 0 === a.height && !x.is.svg(a.element)) return x.debug("Popup target is hidden, no action taken"), !1;
  14613. switch (C.inline && (x.debug("Adding margin to calculation", a.margin), "left center" == e || "right center" == e ? (n += a.margin.top, o += -a.margin.left) : "top left" == e || "top center" == e || "top right" == e ? (n += a.margin.left, o -= a.margin.top) : (n += a.margin.left, o += a.margin.top)), x.debug("Determining popup position from calculations", e, t), x.is.rtl() && (e = e.replace(/left|right/g, function (e) {
  14614. return "left" == e ? "right" : "left";
  14615. }), x.debug("RTL: Popup position updated", e)), j == C.maxSearchDepth && "string" == typeof C.lastResort && (e = C.lastResort), e) {
  14616. case "top left":
  14617. c = {
  14618. top: "auto",
  14619. bottom: l.height - a.top + o,
  14620. left: a.left + n,
  14621. right: "auto"
  14622. };
  14623. break;
  14624. case "top center":
  14625. c = {
  14626. bottom: l.height - a.top + o,
  14627. left: a.left + a.width / 2 - s.width / 2 + n,
  14628. top: "auto",
  14629. right: "auto"
  14630. };
  14631. break;
  14632. case "top right":
  14633. c = {
  14634. bottom: l.height - a.top + o,
  14635. right: l.width - a.left - a.width - n,
  14636. top: "auto",
  14637. left: "auto"
  14638. };
  14639. break;
  14640. case "left center":
  14641. c = {
  14642. top: a.top + a.height / 2 - s.height / 2 + n,
  14643. right: l.width - a.left + o,
  14644. left: "auto",
  14645. bottom: "auto"
  14646. };
  14647. break;
  14648. case "right center":
  14649. c = {
  14650. top: a.top + a.height / 2 - s.height / 2 + n,
  14651. left: a.left + a.width + o,
  14652. bottom: "auto",
  14653. right: "auto"
  14654. };
  14655. break;
  14656. case "bottom left":
  14657. c = {
  14658. top: a.top + a.height + o,
  14659. left: a.left + n,
  14660. bottom: "auto",
  14661. right: "auto"
  14662. };
  14663. break;
  14664. case "bottom center":
  14665. c = {
  14666. top: a.top + a.height + o,
  14667. left: a.left + a.width / 2 - s.width / 2 + n,
  14668. bottom: "auto",
  14669. right: "auto"
  14670. };
  14671. break;
  14672. case "bottom right":
  14673. c = {
  14674. top: a.top + a.height + o,
  14675. right: l.width - a.left - a.width - n,
  14676. left: "auto",
  14677. bottom: "auto"
  14678. };
  14679. }
  14680. if (c === i && x.error(k.invalidPosition, e), x.debug("Calculated popup positioning values", c), r.css(c).removeClass(S.position).addClass(e).addClass(S.loading), u = x.get.popupOffset(), d = x.get.distanceFromBoundary(u, t), x.is.offstage(d, e)) {
  14681. if (x.debug("Position is outside viewport", e), j < C.maxSearchDepth) return j++, e = x.get.nextPosition(e), x.debug("Trying new position", e), !!r && x.set.position(e, t);
  14682. if (!C.lastResort) return x.debug("Popup could not find a position to display", r), x.error(k.cannotPlace, M), x.remove.attempts(), x.remove.loading(), x.reset(), C.onUnplaceable.call(r, M), !1;
  14683. x.debug("No position found, showing with last position");
  14684. }
  14685. return x.debug("Position is on stage", e), x.remove.attempts(), x.remove.loading(), C.setFluidWidth && x.is.fluid() && x.set.fluidWidth(t), !0;
  14686. }
  14687. x.error(k.notFound);
  14688. },
  14689. fluidWidth: function fluidWidth(e) {
  14690. e = e || x.get.calculations(), x.debug("Automatically setting element width to parent width", e.parent.width), r.css("width", e.container.width);
  14691. },
  14692. variation: function variation(e) {
  14693. (e = e || x.get.variation()) && x.has.popup() && (x.verbose("Adding variation to popup", e), r.addClass(e));
  14694. },
  14695. visible: function visible() {
  14696. E.addClass(S.visible);
  14697. }
  14698. },
  14699. remove: {
  14700. loading: function loading() {
  14701. r.removeClass(S.loading);
  14702. },
  14703. variation: function variation(e) {
  14704. (e = e || x.get.variation()) && (x.verbose("Removing variation", e), r.removeClass(e));
  14705. },
  14706. visible: function visible() {
  14707. E.removeClass(S.visible);
  14708. },
  14709. attempts: function attempts() {
  14710. x.verbose("Resetting all searched positions"), j = 0, z = !1;
  14711. }
  14712. },
  14713. bind: {
  14714. events: function events() {
  14715. x.debug("Binding popup events to module"), "click" == C.on && E.on("click" + R, x.toggle), "hover" == C.on && E.on("touchstart" + R, x.event.touchstart), x.get.startEvent() && E.on(x.get.startEvent() + R, x.event.start).on(x.get.endEvent() + R, x.event.end), C.target && x.debug("Target set to element", q), l.on("resize" + b, x.event.resize);
  14716. },
  14717. popup: function popup() {
  14718. x.verbose("Allowing hover events on popup to prevent closing"), r && x.has.popup() && r.on("mouseenter" + R, x.event.start).on("mouseleave" + R, x.event.end);
  14719. },
  14720. close: function close() {
  14721. (!0 === C.hideOnScroll || "auto" == C.hideOnScroll && "click" != C.on) && x.bind.closeOnScroll(), "hover" == C.on && I && x.bind.touchClose(), "click" == C.on && C.closable && x.bind.clickaway();
  14722. },
  14723. closeOnScroll: function closeOnScroll() {
  14724. x.verbose("Binding scroll close event to document"), O.one(x.get.scrollEvent() + b, x.event.hideGracefully);
  14725. },
  14726. touchClose: function touchClose() {
  14727. x.verbose("Binding popup touchclose event to document"), s.on("touchstart" + b, function (e) {
  14728. x.verbose("Touched away from popup"), x.event.hideGracefully.call(M, e);
  14729. });
  14730. },
  14731. clickaway: function clickaway() {
  14732. x.verbose("Binding popup close event to document"), s.on("click" + b, function (e) {
  14733. x.verbose("Clicked away from popup"), x.event.hideGracefully.call(M, e);
  14734. });
  14735. }
  14736. },
  14737. unbind: {
  14738. events: function events() {
  14739. l.off(b), E.off(R);
  14740. },
  14741. close: function close() {
  14742. s.off(b), O.off(b);
  14743. }
  14744. },
  14745. has: {
  14746. popup: function popup() {
  14747. return r && r.length > 0;
  14748. }
  14749. },
  14750. should: {
  14751. centerArrow: function centerArrow(e) {
  14752. return !x.is.basic() && e.target.width <= 2 * C.arrowPixelsFromEdge;
  14753. }
  14754. },
  14755. is: {
  14756. offstage: function offstage(t, n) {
  14757. var i = [];
  14758. return e.each(t, function (e, t) {
  14759. t < -C.jitter && (x.debug("Position exceeds allowable distance from edge", e, t, n), i.push(e));
  14760. }), i.length > 0;
  14761. },
  14762. svg: function svg(e) {
  14763. return x.supports.svg() && e instanceof SVGGraphicsElement;
  14764. },
  14765. basic: function basic() {
  14766. return E.hasClass(S.basic);
  14767. },
  14768. active: function active() {
  14769. return E.hasClass(S.active);
  14770. },
  14771. animating: function animating() {
  14772. return r !== i && r.hasClass(S.animating);
  14773. },
  14774. fluid: function fluid() {
  14775. return r !== i && r.hasClass(S.fluid);
  14776. },
  14777. visible: function visible() {
  14778. return r !== i && r.hasClass(S.popupVisible);
  14779. },
  14780. dropdown: function dropdown() {
  14781. return E.hasClass(S.dropdown);
  14782. },
  14783. hidden: function hidden() {
  14784. return !x.is.visible();
  14785. },
  14786. rtl: function rtl() {
  14787. return "rtl" == E.css("direction");
  14788. }
  14789. },
  14790. reset: function reset() {
  14791. x.remove.visible(), C.preserve ? e.fn.transition !== i && r.transition("remove transition") : x.removePopup();
  14792. },
  14793. setting: function setting(t, n) {
  14794. if (e.isPlainObject(t)) e.extend(!0, C, t);else {
  14795. if (n === i) return C[t];
  14796. C[t] = n;
  14797. }
  14798. },
  14799. internal: function internal(t, n) {
  14800. if (e.isPlainObject(t)) e.extend(!0, x, t);else {
  14801. if (n === i) return x[t];
  14802. x[t] = n;
  14803. }
  14804. },
  14805. debug: function debug() {
  14806. !C.silent && C.debug && (C.performance ? x.performance.log(arguments) : (x.debug = Function.prototype.bind.call(console.info, console, C.name + ":"), x.debug.apply(console, arguments)));
  14807. },
  14808. verbose: function verbose() {
  14809. !C.silent && C.verbose && C.debug && (C.performance ? x.performance.log(arguments) : (x.verbose = Function.prototype.bind.call(console.info, console, C.name + ":"), x.verbose.apply(console, arguments)));
  14810. },
  14811. error: function error() {
  14812. C.silent || (x.error = Function.prototype.bind.call(console.error, console, C.name + ":"), x.error.apply(console, arguments));
  14813. },
  14814. performance: {
  14815. log: function log(e) {
  14816. var t, n;
  14817. C.performance && (n = (t = new Date().getTime()) - (d || t), d = t, f.push({
  14818. Name: e[0],
  14819. Arguments: [].slice.call(e, 1) || "",
  14820. Element: M,
  14821. "Execution Time": n
  14822. })), clearTimeout(x.performance.timer), x.performance.timer = setTimeout(x.performance.display, 500);
  14823. },
  14824. display: function display() {
  14825. var t = C.name + ":",
  14826. n = 0;
  14827. d = !1, clearTimeout(x.performance.timer), e.each(f, function (e, t) {
  14828. n += t["Execution Time"];
  14829. }), t += " " + n + "ms", u && (t += " '" + u + "'"), (console.group !== i || console.table !== i) && f.length > 0 && (console.groupCollapsed(t), console.table ? console.table(f) : e.each(f, function (e, t) {
  14830. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  14831. }), console.groupEnd()), f = [];
  14832. }
  14833. },
  14834. invoke: function invoke(t, n, o) {
  14835. var r,
  14836. s,
  14837. l,
  14838. c = L;
  14839. return n = n || p, o = M || o, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  14840. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  14841. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  14842. if (c[a] !== i) return s = c[a], !1;
  14843. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);
  14844. c = c[o];
  14845. }
  14846. })), e.isFunction(s) ? l = s.apply(o, n) : s !== i && (l = s), e.isArray(a) ? a.push(l) : a !== i ? a = [a, l] : l !== i && (a = l), s;
  14847. }
  14848. }, g ? (L === i && x.initialize(), x.invoke(m)) : (L !== i && L.invoke("destroy"), x.initialize());
  14849. }), a !== i ? a : this;
  14850. }, e.fn.popup.settings = {
  14851. name: "Popup",
  14852. silent: !1,
  14853. debug: !1,
  14854. verbose: !1,
  14855. performance: !0,
  14856. namespace: "popup",
  14857. observeChanges: !0,
  14858. onCreate: function onCreate() {},
  14859. onRemove: function onRemove() {},
  14860. onShow: function onShow() {},
  14861. onVisible: function onVisible() {},
  14862. onHide: function onHide() {},
  14863. onUnplaceable: function onUnplaceable() {},
  14864. onHidden: function onHidden() {},
  14865. on: "hover",
  14866. boundary: t,
  14867. addTouchEvents: !0,
  14868. position: "top left",
  14869. variation: "",
  14870. movePopup: !0,
  14871. target: !1,
  14872. popup: !1,
  14873. inline: !1,
  14874. preserve: !1,
  14875. hoverable: !1,
  14876. content: !1,
  14877. html: !1,
  14878. title: !1,
  14879. closable: !0,
  14880. hideOnScroll: "auto",
  14881. exclusive: !1,
  14882. context: "body",
  14883. scrollContext: t,
  14884. prefer: "opposite",
  14885. lastResort: !1,
  14886. arrowPixelsFromEdge: 20,
  14887. delay: {
  14888. show: 50,
  14889. hide: 70
  14890. },
  14891. setFluidWidth: !0,
  14892. duration: 200,
  14893. transition: "scale",
  14894. distanceAway: 0,
  14895. jitter: 2,
  14896. offset: 0,
  14897. maxSearchDepth: 15,
  14898. error: {
  14899. invalidPosition: "The position you specified is not a valid position",
  14900. cannotPlace: "Popup does not fit within the boundaries of the viewport",
  14901. method: "The method you called is not defined.",
  14902. noTransition: "This module requires ui transitions <https://github.com/Semantic-Org/UI-Transition>",
  14903. notFound: "The target or popup you specified does not exist on the page"
  14904. },
  14905. metadata: {
  14906. activator: "activator",
  14907. content: "content",
  14908. html: "html",
  14909. offset: "offset",
  14910. position: "position",
  14911. title: "title",
  14912. variation: "variation"
  14913. },
  14914. className: {
  14915. active: "active",
  14916. basic: "basic",
  14917. animating: "animating",
  14918. dropdown: "dropdown",
  14919. fluid: "fluid",
  14920. loading: "loading",
  14921. popup: "ui popup",
  14922. position: "top left center bottom right",
  14923. visible: "visible",
  14924. popupVisible: "visible"
  14925. },
  14926. selector: {
  14927. popup: ".ui.popup"
  14928. },
  14929. templates: {
  14930. escape: function escape(e) {
  14931. var t = {
  14932. "&": "&amp;",
  14933. "<": "&lt;",
  14934. ">": "&gt;",
  14935. '"': "&quot;",
  14936. "'": "&#x27;",
  14937. "`": "&#x60;"
  14938. };
  14939. return /[&<>"'`]/.test(e) ? e.replace(/[&<>"'`]/g, function (e) {
  14940. return t[e];
  14941. }) : e;
  14942. },
  14943. popup: function popup(t) {
  14944. var n = "",
  14945. o = e.fn.popup.settings.templates.escape;
  14946. return _typeof(t) !== i && (_typeof(t.title) !== i && t.title && (t.title = o(t.title), n += '<div class="header">' + t.title + "</div>"), _typeof(t.content) !== i && t.content && (t.content = o(t.content), n += '<div class="content">' + t.content + "</div>")), n;
  14947. }
  14948. }
  14949. };
  14950. }(jQuery, window, document), function (e, t, n, i) {
  14951. "use strict";
  14952. void 0 !== (t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")()) && t.Math == Math || ("undefined" != typeof self && self.Math == Math ? self : Function("return this")());
  14953. e.fn.progress = function (t) {
  14954. var o,
  14955. a = e(this),
  14956. r = a.selector || "",
  14957. s = new Date().getTime(),
  14958. l = [],
  14959. c = arguments[0],
  14960. u = "string" == typeof c,
  14961. d = [].slice.call(arguments, 1);
  14962. return a.each(function () {
  14963. var a,
  14964. f = e.isPlainObject(t) ? e.extend(!0, {}, e.fn.progress.settings, t) : e.extend({}, e.fn.progress.settings),
  14965. m = f.className,
  14966. g = f.metadata,
  14967. p = f.namespace,
  14968. h = f.selector,
  14969. v = f.error,
  14970. b = "." + p,
  14971. y = "module-" + p,
  14972. x = e(this),
  14973. C = e(this).find(h.bar),
  14974. w = e(this).find(h.progress),
  14975. S = e(this).find(h.label),
  14976. k = this,
  14977. T = x.data(y),
  14978. A = !1;
  14979. a = {
  14980. initialize: function initialize() {
  14981. a.debug("Initializing progress bar", f), a.set.duration(), a.set.transitionEvent(), a.read.metadata(), a.read.settings(), a.instantiate();
  14982. },
  14983. instantiate: function instantiate() {
  14984. a.verbose("Storing instance of progress", a), T = a, x.data(y, a);
  14985. },
  14986. destroy: function destroy() {
  14987. a.verbose("Destroying previous progress for", x), clearInterval(T.interval), a.remove.state(), x.removeData(y), T = i;
  14988. },
  14989. reset: function reset() {
  14990. a.remove.nextValue(), a.update.progress(0);
  14991. },
  14992. complete: function complete() {
  14993. (a.percent === i || a.percent < 100) && (a.remove.progressPoll(), a.set.percent(100));
  14994. },
  14995. read: {
  14996. metadata: function metadata() {
  14997. var e = {
  14998. percent: x.data(g.percent),
  14999. total: x.data(g.total),
  15000. value: x.data(g.value)
  15001. };
  15002. e.percent && (a.debug("Current percent value set from metadata", e.percent), a.set.percent(e.percent)), e.total && (a.debug("Total value set from metadata", e.total), a.set.total(e.total)), e.value && (a.debug("Current value set from metadata", e.value), a.set.value(e.value), a.set.progress(e.value));
  15003. },
  15004. settings: function settings() {
  15005. !1 !== f.total && (a.debug("Current total set in settings", f.total), a.set.total(f.total)), !1 !== f.value && (a.debug("Current value set in settings", f.value), a.set.value(f.value), a.set.progress(a.value)), !1 !== f.percent && (a.debug("Current percent set in settings", f.percent), a.set.percent(f.percent));
  15006. }
  15007. },
  15008. bind: {
  15009. transitionEnd: function transitionEnd(e) {
  15010. var t = a.get.transitionEnd();
  15011. C.one(t + b, function (t) {
  15012. clearTimeout(a.failSafeTimer), e.call(this, t);
  15013. }), a.failSafeTimer = setTimeout(function () {
  15014. C.triggerHandler(t);
  15015. }, f.duration + f.failSafeDelay), a.verbose("Adding fail safe timer", a.timer);
  15016. }
  15017. },
  15018. increment: function increment(e) {
  15019. var t, n;
  15020. a.has.total() ? n = (t = a.get.value()) + (e = e || 1) : (n = (t = a.get.percent()) + (e = e || a.get.randomValue()), 100, a.debug("Incrementing percentage by", t, n)), n = a.get.normalizedValue(n), a.set.progress(n);
  15021. },
  15022. decrement: function decrement(e) {
  15023. var t, n;
  15024. a.get.total() ? (n = (t = a.get.value()) - (e = e || 1), a.debug("Decrementing value by", e, t)) : (n = (t = a.get.percent()) - (e = e || a.get.randomValue()), a.debug("Decrementing percentage by", e, t)), n = a.get.normalizedValue(n), a.set.progress(n);
  15025. },
  15026. has: {
  15027. progressPoll: function progressPoll() {
  15028. return a.progressPoll;
  15029. },
  15030. total: function total() {
  15031. return !1 !== a.get.total();
  15032. }
  15033. },
  15034. get: {
  15035. text: function text(e) {
  15036. var t = a.value || 0,
  15037. n = a.total || 0,
  15038. i = A ? a.get.displayPercent() : a.percent || 0,
  15039. o = a.total > 0 ? n - t : 100 - i;
  15040. return e = (e = e || "").replace("{value}", t).replace("{total}", n).replace("{left}", o).replace("{percent}", i), a.verbose("Adding variables to progress bar text", e), e;
  15041. },
  15042. normalizedValue: function normalizedValue(e) {
  15043. if (e < 0) return a.debug("Value cannot decrement below 0"), 0;
  15044. if (a.has.total()) {
  15045. if (e > a.total) return a.debug("Value cannot increment above total", a.total), a.total;
  15046. } else if (e > 100) return a.debug("Value cannot increment above 100 percent"), 100;
  15047. return e;
  15048. },
  15049. updateInterval: function updateInterval() {
  15050. return "auto" == f.updateInterval ? f.duration : f.updateInterval;
  15051. },
  15052. randomValue: function randomValue() {
  15053. return a.debug("Generating random increment percentage"), Math.floor(Math.random() * f.random.max + f.random.min);
  15054. },
  15055. numericValue: function numericValue(e) {
  15056. return "string" == typeof e ? "" !== e.replace(/[^\d.]/g, "") && +e.replace(/[^\d.]/g, "") : e;
  15057. },
  15058. transitionEnd: function transitionEnd() {
  15059. var e,
  15060. t = n.createElement("element"),
  15061. o = {
  15062. transition: "transitionend",
  15063. OTransition: "oTransitionEnd",
  15064. MozTransition: "transitionend",
  15065. WebkitTransition: "webkitTransitionEnd"
  15066. };
  15067. for (e in o) {
  15068. if (t.style[e] !== i) return o[e];
  15069. }
  15070. },
  15071. displayPercent: function displayPercent() {
  15072. var e = C.width(),
  15073. t = x.width(),
  15074. n = e > parseInt(C.css("min-width"), 10) ? e / t * 100 : a.percent;
  15075. return f.precision > 0 ? Math.round(n * (10 * f.precision)) / (10 * f.precision) : Math.round(n);
  15076. },
  15077. percent: function percent() {
  15078. return a.percent || 0;
  15079. },
  15080. value: function value() {
  15081. return a.nextValue || a.value || 0;
  15082. },
  15083. total: function total() {
  15084. return a.total || !1;
  15085. }
  15086. },
  15087. create: {
  15088. progressPoll: function progressPoll() {
  15089. a.progressPoll = setTimeout(function () {
  15090. a.update.toNextValue(), a.remove.progressPoll();
  15091. }, a.get.updateInterval());
  15092. }
  15093. },
  15094. is: {
  15095. complete: function complete() {
  15096. return a.is.success() || a.is.warning() || a.is.error();
  15097. },
  15098. success: function success() {
  15099. return x.hasClass(m.success);
  15100. },
  15101. warning: function warning() {
  15102. return x.hasClass(m.warning);
  15103. },
  15104. error: function error() {
  15105. return x.hasClass(m.error);
  15106. },
  15107. active: function active() {
  15108. return x.hasClass(m.active);
  15109. },
  15110. visible: function visible() {
  15111. return x.is(":visible");
  15112. }
  15113. },
  15114. remove: {
  15115. progressPoll: function progressPoll() {
  15116. a.verbose("Removing progress poll timer"), a.progressPoll && (clearTimeout(a.progressPoll), delete a.progressPoll);
  15117. },
  15118. nextValue: function nextValue() {
  15119. a.verbose("Removing progress value stored for next update"), delete a.nextValue;
  15120. },
  15121. state: function state() {
  15122. a.verbose("Removing stored state"), delete a.total, delete a.percent, delete a.value;
  15123. },
  15124. active: function active() {
  15125. a.verbose("Removing active state"), x.removeClass(m.active);
  15126. },
  15127. success: function success() {
  15128. a.verbose("Removing success state"), x.removeClass(m.success);
  15129. },
  15130. warning: function warning() {
  15131. a.verbose("Removing warning state"), x.removeClass(m.warning);
  15132. },
  15133. error: function error() {
  15134. a.verbose("Removing error state"), x.removeClass(m.error);
  15135. }
  15136. },
  15137. set: {
  15138. barWidth: function barWidth(e) {
  15139. e > 100 ? a.error(v.tooHigh, e) : e < 0 ? a.error(v.tooLow, e) : (C.css("width", e + "%"), x.attr("data-percent", parseInt(e, 10)));
  15140. },
  15141. duration: function duration(e) {
  15142. e = "number" == typeof (e = e || f.duration) ? e + "ms" : e, a.verbose("Setting progress bar transition duration", e), C.css({
  15143. "transition-duration": e
  15144. });
  15145. },
  15146. percent: function percent(e) {
  15147. e = "string" == typeof e ? +e.replace("%", "") : e, e = f.precision > 0 ? Math.round(e * (10 * f.precision)) / (10 * f.precision) : Math.round(e), a.percent = e, a.has.total() || (a.value = f.precision > 0 ? Math.round(e / 100 * a.total * (10 * f.precision)) / (10 * f.precision) : Math.round(e / 100 * a.total * 10) / 10, f.limitValues && (a.value = a.value > 100 ? 100 : a.value < 0 ? 0 : a.value)), a.set.barWidth(e), a.set.labelInterval(), a.set.labels(), f.onChange.call(k, e, a.value, a.total);
  15148. },
  15149. labelInterval: function labelInterval() {
  15150. clearInterval(a.interval), a.bind.transitionEnd(function () {
  15151. a.verbose("Bar finished animating, removing continuous label updates"), clearInterval(a.interval), A = !1, a.set.labels();
  15152. }), A = !0, a.interval = setInterval(function () {
  15153. e.contains(n.documentElement, k) || (clearInterval(a.interval), A = !1), a.set.labels();
  15154. }, f.framerate);
  15155. },
  15156. labels: function labels() {
  15157. a.verbose("Setting both bar progress and outer label text"), a.set.barLabel(), a.set.state();
  15158. },
  15159. label: function label(e) {
  15160. (e = e || "") && (e = a.get.text(e), a.verbose("Setting label to text", e), S.text(e));
  15161. },
  15162. state: function state(e) {
  15163. 100 === (e = e !== i ? e : a.percent) ? f.autoSuccess && !(a.is.warning() || a.is.error() || a.is.success()) ? (a.set.success(), a.debug("Automatically triggering success at 100%")) : (a.verbose("Reached 100% removing active state"), a.remove.active(), a.remove.progressPoll()) : e > 0 ? (a.verbose("Adjusting active progress bar label", e), a.set.active()) : (a.remove.active(), a.set.label(f.text.active));
  15164. },
  15165. barLabel: function barLabel(e) {
  15166. e !== i ? w.text(a.get.text(e)) : "ratio" == f.label && a.total ? (a.verbose("Adding ratio to bar label"), w.text(a.get.text(f.text.ratio))) : "percent" == f.label && (a.verbose("Adding percentage to bar label"), w.text(a.get.text(f.text.percent)));
  15167. },
  15168. active: function active(e) {
  15169. e = e || f.text.active, a.debug("Setting active state"), f.showActivity && !a.is.active() && x.addClass(m.active), a.remove.warning(), a.remove.error(), a.remove.success(), (e = f.onLabelUpdate("active", e, a.value, a.total)) && a.set.label(e), a.bind.transitionEnd(function () {
  15170. f.onActive.call(k, a.value, a.total);
  15171. });
  15172. },
  15173. success: function success(e) {
  15174. e = e || f.text.success || f.text.active, a.debug("Setting success state"), x.addClass(m.success), a.remove.active(), a.remove.warning(), a.remove.error(), a.complete(), f.text.success ? (e = f.onLabelUpdate("success", e, a.value, a.total), a.set.label(e)) : (e = f.onLabelUpdate("active", e, a.value, a.total), a.set.label(e)), a.bind.transitionEnd(function () {
  15175. f.onSuccess.call(k, a.total);
  15176. });
  15177. },
  15178. warning: function warning(e) {
  15179. e = e || f.text.warning, a.debug("Setting warning state"), x.addClass(m.warning), a.remove.active(), a.remove.success(), a.remove.error(), a.complete(), (e = f.onLabelUpdate("warning", e, a.value, a.total)) && a.set.label(e), a.bind.transitionEnd(function () {
  15180. f.onWarning.call(k, a.value, a.total);
  15181. });
  15182. },
  15183. error: function error(e) {
  15184. e = e || f.text.error, a.debug("Setting error state"), x.addClass(m.error), a.remove.active(), a.remove.success(), a.remove.warning(), a.complete(), (e = f.onLabelUpdate("error", e, a.value, a.total)) && a.set.label(e), a.bind.transitionEnd(function () {
  15185. f.onError.call(k, a.value, a.total);
  15186. });
  15187. },
  15188. transitionEvent: function transitionEvent() {
  15189. a.get.transitionEnd();
  15190. },
  15191. total: function total(e) {
  15192. a.total = e;
  15193. },
  15194. value: function value(e) {
  15195. a.value = e;
  15196. },
  15197. progress: function progress(e) {
  15198. a.has.progressPoll() ? (a.debug("Updated within interval, setting next update to use new value", e), a.set.nextValue(e)) : (a.debug("First update in progress update interval, immediately updating", e), a.update.progress(e), a.create.progressPoll());
  15199. },
  15200. nextValue: function nextValue(e) {
  15201. a.nextValue = e;
  15202. }
  15203. },
  15204. update: {
  15205. toNextValue: function toNextValue() {
  15206. var e = a.nextValue;
  15207. e && (a.debug("Update interval complete using last updated value", e), a.update.progress(e), a.remove.nextValue());
  15208. },
  15209. progress: function progress(e) {
  15210. var t;
  15211. !1 === (e = a.get.numericValue(e)) && a.error(v.nonNumeric, e), e = a.get.normalizedValue(e), a.has.total() ? (a.set.value(e), t = e / a.total * 100, a.debug("Calculating percent complete from total", t), a.set.percent(t)) : (t = e, a.debug("Setting value to exact percentage value", t), a.set.percent(t));
  15212. }
  15213. },
  15214. setting: function setting(t, n) {
  15215. if (a.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, f, t);else {
  15216. if (n === i) return f[t];
  15217. e.isPlainObject(f[t]) ? e.extend(!0, f[t], n) : f[t] = n;
  15218. }
  15219. },
  15220. internal: function internal(t, n) {
  15221. if (e.isPlainObject(t)) e.extend(!0, a, t);else {
  15222. if (n === i) return a[t];
  15223. a[t] = n;
  15224. }
  15225. },
  15226. debug: function debug() {
  15227. !f.silent && f.debug && (f.performance ? a.performance.log(arguments) : (a.debug = Function.prototype.bind.call(console.info, console, f.name + ":"), a.debug.apply(console, arguments)));
  15228. },
  15229. verbose: function verbose() {
  15230. !f.silent && f.verbose && f.debug && (f.performance ? a.performance.log(arguments) : (a.verbose = Function.prototype.bind.call(console.info, console, f.name + ":"), a.verbose.apply(console, arguments)));
  15231. },
  15232. error: function error() {
  15233. f.silent || (a.error = Function.prototype.bind.call(console.error, console, f.name + ":"), a.error.apply(console, arguments));
  15234. },
  15235. performance: {
  15236. log: function log(e) {
  15237. var t, n;
  15238. f.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({
  15239. Name: e[0],
  15240. Arguments: [].slice.call(e, 1) || "",
  15241. Element: k,
  15242. "Execution Time": n
  15243. })), clearTimeout(a.performance.timer), a.performance.timer = setTimeout(a.performance.display, 500);
  15244. },
  15245. display: function display() {
  15246. var t = f.name + ":",
  15247. n = 0;
  15248. s = !1, clearTimeout(a.performance.timer), e.each(l, function (e, t) {
  15249. n += t["Execution Time"];
  15250. }), t += " " + n + "ms", r && (t += " '" + r + "'"), (console.group !== i || console.table !== i) && l.length > 0 && (console.groupCollapsed(t), console.table ? console.table(l) : e.each(l, function (e, t) {
  15251. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  15252. }), console.groupEnd()), l = [];
  15253. }
  15254. },
  15255. invoke: function invoke(t, n, r) {
  15256. var s,
  15257. l,
  15258. c,
  15259. u = T;
  15260. return n = n || d, r = k || r, "string" == typeof t && u !== i && (t = t.split(/[\. ]/), s = t.length - 1, e.each(t, function (n, o) {
  15261. var r = n != s ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  15262. if (e.isPlainObject(u[r]) && n != s) u = u[r];else {
  15263. if (u[r] !== i) return l = u[r], !1;
  15264. if (!e.isPlainObject(u[o]) || n == s) return u[o] !== i ? (l = u[o], !1) : (a.error(v.method, t), !1);
  15265. u = u[o];
  15266. }
  15267. })), e.isFunction(l) ? c = l.apply(r, n) : l !== i && (c = l), e.isArray(o) ? o.push(c) : o !== i ? o = [o, c] : c !== i && (o = c), l;
  15268. }
  15269. }, u ? (T === i && a.initialize(), a.invoke(c)) : (T !== i && T.invoke("destroy"), a.initialize());
  15270. }), o !== i ? o : this;
  15271. }, e.fn.progress.settings = {
  15272. name: "Progress",
  15273. namespace: "progress",
  15274. silent: !1,
  15275. debug: !1,
  15276. verbose: !1,
  15277. performance: !0,
  15278. random: {
  15279. min: 2,
  15280. max: 5
  15281. },
  15282. duration: 300,
  15283. updateInterval: "auto",
  15284. autoSuccess: !0,
  15285. showActivity: !0,
  15286. limitValues: !0,
  15287. label: "percent",
  15288. precision: 0,
  15289. framerate: 1e3 / 30,
  15290. percent: !1,
  15291. total: !1,
  15292. value: !1,
  15293. failSafeDelay: 100,
  15294. onLabelUpdate: function onLabelUpdate(e, t, n, i) {
  15295. return t;
  15296. },
  15297. onChange: function onChange(e, t, n) {},
  15298. onSuccess: function onSuccess(e) {},
  15299. onActive: function onActive(e, t) {},
  15300. onError: function onError(e, t) {},
  15301. onWarning: function onWarning(e, t) {},
  15302. error: {
  15303. method: "The method you called is not defined.",
  15304. nonNumeric: "Progress value is non numeric",
  15305. tooHigh: "Value specified is above 100%",
  15306. tooLow: "Value specified is below 0%"
  15307. },
  15308. regExp: {
  15309. variable: /\{\$*[A-z0-9]+\}/g
  15310. },
  15311. metadata: {
  15312. percent: "percent",
  15313. total: "total",
  15314. value: "value"
  15315. },
  15316. selector: {
  15317. bar: "> .bar",
  15318. label: "> .label",
  15319. progress: ".bar > .progress"
  15320. },
  15321. text: {
  15322. active: !1,
  15323. error: !1,
  15324. success: !1,
  15325. warning: !1,
  15326. percent: "{percent}%",
  15327. ratio: "{value} of {total}"
  15328. },
  15329. className: {
  15330. active: "active",
  15331. error: "error",
  15332. success: "success",
  15333. warning: "warning"
  15334. }
  15335. };
  15336. }(jQuery, window, document), function (e, t, n, i) {
  15337. "use strict";
  15338. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.rating = function (t) {
  15339. var n,
  15340. o = e(this),
  15341. a = o.selector || "",
  15342. r = new Date().getTime(),
  15343. s = [],
  15344. l = arguments[0],
  15345. c = "string" == typeof l,
  15346. u = [].slice.call(arguments, 1);
  15347. return o.each(function () {
  15348. var d,
  15349. f,
  15350. m = e.isPlainObject(t) ? e.extend(!0, {}, e.fn.rating.settings, t) : e.extend({}, e.fn.rating.settings),
  15351. g = m.namespace,
  15352. p = m.className,
  15353. h = m.metadata,
  15354. v = m.selector,
  15355. b = (m.error, "." + g),
  15356. y = "module-" + g,
  15357. x = this,
  15358. C = e(this).data(y),
  15359. w = e(this),
  15360. S = w.find(v.icon);
  15361. f = {
  15362. initialize: function initialize() {
  15363. f.verbose("Initializing rating module", m), 0 === S.length && f.setup.layout(), m.interactive ? f.enable() : f.disable(), f.set.initialLoad(), f.set.rating(f.get.initialRating()), f.remove.initialLoad(), f.instantiate();
  15364. },
  15365. instantiate: function instantiate() {
  15366. f.verbose("Instantiating module", m), C = f, w.data(y, f);
  15367. },
  15368. destroy: function destroy() {
  15369. f.verbose("Destroying previous instance", C), f.remove.events(), w.removeData(y);
  15370. },
  15371. refresh: function refresh() {
  15372. S = w.find(v.icon);
  15373. },
  15374. setup: {
  15375. layout: function layout() {
  15376. var t = f.get.maxRating(),
  15377. n = e.fn.rating.settings.templates.icon(t);
  15378. f.debug("Generating icon html dynamically"), w.html(n), f.refresh();
  15379. }
  15380. },
  15381. event: {
  15382. mouseenter: function mouseenter() {
  15383. var t = e(this);
  15384. t.nextAll().removeClass(p.selected), w.addClass(p.selected), t.addClass(p.selected).prevAll().addClass(p.selected);
  15385. },
  15386. mouseleave: function mouseleave() {
  15387. w.removeClass(p.selected), S.removeClass(p.selected);
  15388. },
  15389. click: function click() {
  15390. var t = e(this),
  15391. n = f.get.rating(),
  15392. i = S.index(t) + 1;
  15393. ("auto" == m.clearable ? 1 === S.length : m.clearable) && n == i ? f.clearRating() : f.set.rating(i);
  15394. }
  15395. },
  15396. clearRating: function clearRating() {
  15397. f.debug("Clearing current rating"), f.set.rating(0);
  15398. },
  15399. bind: {
  15400. events: function events() {
  15401. f.verbose("Binding events"), w.on("mouseenter" + b, v.icon, f.event.mouseenter).on("mouseleave" + b, v.icon, f.event.mouseleave).on("click" + b, v.icon, f.event.click);
  15402. }
  15403. },
  15404. remove: {
  15405. events: function events() {
  15406. f.verbose("Removing events"), w.off(b);
  15407. },
  15408. initialLoad: function initialLoad() {
  15409. d = !1;
  15410. }
  15411. },
  15412. enable: function enable() {
  15413. f.debug("Setting rating to interactive mode"), f.bind.events(), w.removeClass(p.disabled);
  15414. },
  15415. disable: function disable() {
  15416. f.debug("Setting rating to read-only mode"), f.remove.events(), w.addClass(p.disabled);
  15417. },
  15418. is: {
  15419. initialLoad: function initialLoad() {
  15420. return d;
  15421. }
  15422. },
  15423. get: {
  15424. initialRating: function initialRating() {
  15425. return w.data(h.rating) !== i ? (w.removeData(h.rating), w.data(h.rating)) : m.initialRating;
  15426. },
  15427. maxRating: function maxRating() {
  15428. return w.data(h.maxRating) !== i ? (w.removeData(h.maxRating), w.data(h.maxRating)) : m.maxRating;
  15429. },
  15430. rating: function rating() {
  15431. var e = S.filter("." + p.active).length;
  15432. return f.verbose("Current rating retrieved", e), e;
  15433. }
  15434. },
  15435. set: {
  15436. rating: function rating(e) {
  15437. var t = e - 1 >= 0 ? e - 1 : 0,
  15438. n = S.eq(t);
  15439. w.removeClass(p.selected), S.removeClass(p.selected).removeClass(p.active), e > 0 && (f.verbose("Setting current rating to", e), n.prevAll().addBack().addClass(p.active)), f.is.initialLoad() || m.onRate.call(x, e);
  15440. },
  15441. initialLoad: function initialLoad() {
  15442. d = !0;
  15443. }
  15444. },
  15445. setting: function setting(t, n) {
  15446. if (f.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, m, t);else {
  15447. if (n === i) return m[t];
  15448. e.isPlainObject(m[t]) ? e.extend(!0, m[t], n) : m[t] = n;
  15449. }
  15450. },
  15451. internal: function internal(t, n) {
  15452. if (e.isPlainObject(t)) e.extend(!0, f, t);else {
  15453. if (n === i) return f[t];
  15454. f[t] = n;
  15455. }
  15456. },
  15457. debug: function debug() {
  15458. !m.silent && m.debug && (m.performance ? f.performance.log(arguments) : (f.debug = Function.prototype.bind.call(console.info, console, m.name + ":"), f.debug.apply(console, arguments)));
  15459. },
  15460. verbose: function verbose() {
  15461. !m.silent && m.verbose && m.debug && (m.performance ? f.performance.log(arguments) : (f.verbose = Function.prototype.bind.call(console.info, console, m.name + ":"), f.verbose.apply(console, arguments)));
  15462. },
  15463. error: function error() {
  15464. m.silent || (f.error = Function.prototype.bind.call(console.error, console, m.name + ":"), f.error.apply(console, arguments));
  15465. },
  15466. performance: {
  15467. log: function log(e) {
  15468. var t, n;
  15469. m.performance && (n = (t = new Date().getTime()) - (r || t), r = t, s.push({
  15470. Name: e[0],
  15471. Arguments: [].slice.call(e, 1) || "",
  15472. Element: x,
  15473. "Execution Time": n
  15474. })), clearTimeout(f.performance.timer), f.performance.timer = setTimeout(f.performance.display, 500);
  15475. },
  15476. display: function display() {
  15477. var t = m.name + ":",
  15478. n = 0;
  15479. r = !1, clearTimeout(f.performance.timer), e.each(s, function (e, t) {
  15480. n += t["Execution Time"];
  15481. }), t += " " + n + "ms", a && (t += " '" + a + "'"), o.length > 1 && (t += " (" + o.length + ")"), (console.group !== i || console.table !== i) && s.length > 0 && (console.groupCollapsed(t), console.table ? console.table(s) : e.each(s, function (e, t) {
  15482. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  15483. }), console.groupEnd()), s = [];
  15484. }
  15485. },
  15486. invoke: function invoke(t, o, a) {
  15487. var r,
  15488. s,
  15489. l,
  15490. c = C;
  15491. return o = o || u, a = x || a, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  15492. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  15493. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  15494. if (c[a] !== i) return s = c[a], !1;
  15495. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);
  15496. c = c[o];
  15497. }
  15498. })), e.isFunction(s) ? l = s.apply(a, o) : s !== i && (l = s), e.isArray(n) ? n.push(l) : n !== i ? n = [n, l] : l !== i && (n = l), s;
  15499. }
  15500. }, c ? (C === i && f.initialize(), f.invoke(l)) : (C !== i && C.invoke("destroy"), f.initialize());
  15501. }), n !== i ? n : this;
  15502. }, e.fn.rating.settings = {
  15503. name: "Rating",
  15504. namespace: "rating",
  15505. slent: !1,
  15506. debug: !1,
  15507. verbose: !1,
  15508. performance: !0,
  15509. initialRating: 0,
  15510. interactive: !0,
  15511. maxRating: 4,
  15512. clearable: "auto",
  15513. fireOnInit: !1,
  15514. onRate: function onRate(e) {},
  15515. error: {
  15516. method: "The method you called is not defined",
  15517. noMaximum: "No maximum rating specified. Cannot generate HTML automatically"
  15518. },
  15519. metadata: {
  15520. rating: "rating",
  15521. maxRating: "maxRating"
  15522. },
  15523. className: {
  15524. active: "active",
  15525. disabled: "disabled",
  15526. selected: "selected",
  15527. loading: "loading"
  15528. },
  15529. selector: {
  15530. icon: ".icon"
  15531. },
  15532. templates: {
  15533. icon: function icon(e) {
  15534. for (var t = 1, n = ""; t <= e;) {
  15535. n += '<i class="icon"></i>', t++;
  15536. }
  15537. return n;
  15538. }
  15539. }
  15540. };
  15541. }(jQuery, window, document), function (e, t, n, i) {
  15542. "use strict";
  15543. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.search = function (o) {
  15544. var a,
  15545. r = e(this),
  15546. s = r.selector || "",
  15547. l = new Date().getTime(),
  15548. c = [],
  15549. u = arguments[0],
  15550. d = "string" == typeof u,
  15551. f = [].slice.call(arguments, 1);
  15552. return e(this).each(function () {
  15553. var m,
  15554. g = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.search.settings, o) : e.extend({}, e.fn.search.settings),
  15555. p = g.className,
  15556. h = g.metadata,
  15557. v = g.regExp,
  15558. b = g.fields,
  15559. y = g.selector,
  15560. x = g.error,
  15561. C = g.namespace,
  15562. w = "." + C,
  15563. S = C + "-module",
  15564. k = e(this),
  15565. T = k.find(y.prompt),
  15566. A = k.find(y.searchButton),
  15567. R = k.find(y.results),
  15568. P = k.find(y.result),
  15569. E = (k.find(y.category), this),
  15570. F = k.data(S),
  15571. O = !1,
  15572. D = !1;
  15573. m = {
  15574. initialize: function initialize() {
  15575. m.verbose("Initializing module"), m.get.settings(), m.determine.searchFields(), m.bind.events(), m.set.type(), m.create.results(), m.instantiate();
  15576. },
  15577. instantiate: function instantiate() {
  15578. m.verbose("Storing instance of module", m), F = m, k.data(S, m);
  15579. },
  15580. destroy: function destroy() {
  15581. m.verbose("Destroying instance"), k.off(w).removeData(S);
  15582. },
  15583. refresh: function refresh() {
  15584. m.debug("Refreshing selector cache"), T = k.find(y.prompt), A = k.find(y.searchButton), k.find(y.category), R = k.find(y.results), P = k.find(y.result);
  15585. },
  15586. refreshResults: function refreshResults() {
  15587. R = k.find(y.results), P = k.find(y.result);
  15588. },
  15589. bind: {
  15590. events: function events() {
  15591. m.verbose("Binding events to search"), g.automatic && (k.on(m.get.inputEvent() + w, y.prompt, m.event.input), T.attr("autocomplete", "off")), k.on("focus" + w, y.prompt, m.event.focus).on("blur" + w, y.prompt, m.event.blur).on("keydown" + w, y.prompt, m.handleKeyboard).on("click" + w, y.searchButton, m.query).on("mousedown" + w, y.results, m.event.result.mousedown).on("mouseup" + w, y.results, m.event.result.mouseup).on("click" + w, y.result, m.event.result.click);
  15592. }
  15593. },
  15594. determine: {
  15595. searchFields: function searchFields() {
  15596. o && o.searchFields !== i && (g.searchFields = o.searchFields);
  15597. }
  15598. },
  15599. event: {
  15600. input: function input() {
  15601. g.searchDelay ? (clearTimeout(m.timer), m.timer = setTimeout(function () {
  15602. m.is.focused() && m.query();
  15603. }, g.searchDelay)) : m.query();
  15604. },
  15605. focus: function focus() {
  15606. m.set.focus(), g.searchOnFocus && m.has.minimumCharacters() && m.query(function () {
  15607. m.can.show() && m.showResults();
  15608. });
  15609. },
  15610. blur: function blur(e) {
  15611. var t = function t() {
  15612. m.cancel.query(), m.remove.focus(), m.timer = setTimeout(m.hideResults, g.hideDelay);
  15613. };
  15614. n.activeElement === this || (D = !1, m.resultsClicked ? (m.debug("Determining if user action caused search to close"), k.one("click.close" + w, y.results, function (e) {
  15615. m.is.inMessage(e) || O ? T.focus() : (O = !1, m.is.animating() || m.is.hidden() || t());
  15616. })) : (m.debug("Input blurred without user action, closing results"), t()));
  15617. },
  15618. result: {
  15619. mousedown: function mousedown() {
  15620. m.resultsClicked = !0;
  15621. },
  15622. mouseup: function mouseup() {
  15623. m.resultsClicked = !1;
  15624. },
  15625. click: function click(n) {
  15626. m.debug("Search result selected");
  15627. var i = e(this),
  15628. o = i.find(y.title).eq(0),
  15629. a = i.is("a[href]") ? i : i.find("a[href]").eq(0),
  15630. r = a.attr("href") || !1,
  15631. s = a.attr("target") || !1,
  15632. l = (o.html(), o.length > 0 && o.text()),
  15633. c = m.get.results(),
  15634. u = i.data(h.result) || m.get.result(l, c);
  15635. if (e.isFunction(g.onSelect) && !1 === g.onSelect.call(E, u, c)) return m.debug("Custom onSelect callback cancelled default select action"), void (O = !0);
  15636. m.hideResults(), l && m.set.value(l), r && (m.verbose("Opening search link found in result", a), "_blank" == s || n.ctrlKey ? t.open(r) : t.location.href = r);
  15637. }
  15638. }
  15639. },
  15640. handleKeyboard: function handleKeyboard(e) {
  15641. var t,
  15642. n = k.find(y.result),
  15643. i = k.find(y.category),
  15644. o = n.filter("." + p.active),
  15645. a = n.index(o),
  15646. r = n.length,
  15647. s = o.length > 0,
  15648. l = e.which,
  15649. c = 13,
  15650. u = 38,
  15651. d = 40;
  15652. if (l == 27 && (m.verbose("Escape key pressed, blurring search field"), m.hideResults(), D = !0), m.is.visible()) {
  15653. if (l == c) {
  15654. if (m.verbose("Enter key pressed, selecting active result"), n.filter("." + p.active).length > 0) return m.event.result.click.call(n.filter("." + p.active), e), e.preventDefault(), !1;
  15655. } else l == u && s ? (m.verbose("Up key pressed, changing active result"), t = a - 1 < 0 ? a : a - 1, i.removeClass(p.active), n.removeClass(p.active).eq(t).addClass(p.active).closest(i).addClass(p.active), e.preventDefault()) : l == d && (m.verbose("Down key pressed, changing active result"), t = a + 1 >= r ? a : a + 1, i.removeClass(p.active), n.removeClass(p.active).eq(t).addClass(p.active).closest(i).addClass(p.active), e.preventDefault());
  15656. } else l == c && (m.verbose("Enter key pressed, executing query"), m.query(), m.set.buttonPressed(), T.one("keyup", m.remove.buttonFocus));
  15657. },
  15658. setup: {
  15659. api: function api(t, n) {
  15660. var i = {
  15661. debug: g.debug,
  15662. on: !1,
  15663. cache: g.cache,
  15664. action: "search",
  15665. urlData: {
  15666. query: t
  15667. },
  15668. onSuccess: function onSuccess(e) {
  15669. m.parse.response.call(E, e, t), n();
  15670. },
  15671. onFailure: function onFailure() {
  15672. m.displayMessage(x.serverError), n();
  15673. },
  15674. onAbort: function onAbort(e) {},
  15675. onError: m.error
  15676. };
  15677. e.extend(!0, i, g.apiSettings), m.verbose("Setting up API request", i), k.api(i);
  15678. }
  15679. },
  15680. can: {
  15681. useAPI: function useAPI() {
  15682. return e.fn.api !== i;
  15683. },
  15684. show: function show() {
  15685. return m.is.focused() && !m.is.visible() && !m.is.empty();
  15686. },
  15687. transition: function transition() {
  15688. return g.transition && e.fn.transition !== i && k.transition("is supported");
  15689. }
  15690. },
  15691. is: {
  15692. animating: function animating() {
  15693. return R.hasClass(p.animating);
  15694. },
  15695. hidden: function hidden() {
  15696. return R.hasClass(p.hidden);
  15697. },
  15698. inMessage: function inMessage(t) {
  15699. if (t.target) {
  15700. var i = e(t.target);
  15701. return e.contains(n.documentElement, t.target) && i.closest(y.message).length > 0;
  15702. }
  15703. },
  15704. empty: function empty() {
  15705. return "" === R.html();
  15706. },
  15707. visible: function visible() {
  15708. return R.filter(":visible").length > 0;
  15709. },
  15710. focused: function focused() {
  15711. return T.filter(":focus").length > 0;
  15712. }
  15713. },
  15714. get: {
  15715. settings: function settings() {
  15716. e.isPlainObject(o) && o.searchFullText && (g.fullTextSearch = o.searchFullText, m.error(g.error.oldSearchSyntax, E));
  15717. },
  15718. inputEvent: function inputEvent() {
  15719. var e = T[0];
  15720. return e !== i && e.oninput !== i ? "input" : e !== i && e.onpropertychange !== i ? "propertychange" : "keyup";
  15721. },
  15722. value: function value() {
  15723. return T.val();
  15724. },
  15725. results: function results() {
  15726. return k.data(h.results);
  15727. },
  15728. result: function result(t, n) {
  15729. var o = ["title", "id"],
  15730. a = !1;
  15731. return t = t !== i ? t : m.get.value(), n = n !== i ? n : m.get.results(), "category" === g.type ? (m.debug("Finding result that matches", t), e.each(n, function (n, i) {
  15732. if (e.isArray(i.results) && (a = m.search.object(t, i.results, o)[0])) return !1;
  15733. })) : (m.debug("Finding result in results object", t), a = m.search.object(t, n, o)[0]), a || !1;
  15734. }
  15735. },
  15736. select: {
  15737. firstResult: function firstResult() {
  15738. m.verbose("Selecting first result"), P.first().addClass(p.active);
  15739. }
  15740. },
  15741. set: {
  15742. focus: function focus() {
  15743. k.addClass(p.focus);
  15744. },
  15745. loading: function loading() {
  15746. k.addClass(p.loading);
  15747. },
  15748. value: function value(e) {
  15749. m.verbose("Setting search input value", e), T.val(e);
  15750. },
  15751. type: function type(e) {
  15752. e = e || g.type, "category" == g.type && k.addClass(g.type);
  15753. },
  15754. buttonPressed: function buttonPressed() {
  15755. A.addClass(p.pressed);
  15756. }
  15757. },
  15758. remove: {
  15759. loading: function loading() {
  15760. k.removeClass(p.loading);
  15761. },
  15762. focus: function focus() {
  15763. k.removeClass(p.focus);
  15764. },
  15765. buttonPressed: function buttonPressed() {
  15766. A.removeClass(p.pressed);
  15767. }
  15768. },
  15769. query: function query(t) {
  15770. t = e.isFunction(t) ? t : function () {};
  15771. var n = m.get.value(),
  15772. i = m.read.cache(n);
  15773. t = t || function () {}, m.has.minimumCharacters() ? (i ? (m.debug("Reading result from cache", n), m.save.results(i.results), m.addResults(i.html), m.inject.id(i.results), t()) : (m.debug("Querying for", n), e.isPlainObject(g.source) || e.isArray(g.source) ? (m.search.local(n), t()) : m.can.useAPI() ? m.search.remote(n, t) : (m.error(x.source), t())), g.onSearchQuery.call(E, n)) : m.hideResults();
  15774. },
  15775. search: {
  15776. local: function local(e) {
  15777. var t,
  15778. n = m.search.object(e, g.content);
  15779. m.set.loading(), m.save.results(n), m.debug("Returned full local search results", n), g.maxResults > 0 && (m.debug("Using specified max results", n), n = n.slice(0, g.maxResults)), "category" == g.type && (n = m.create.categoryResults(n)), t = m.generateResults({
  15780. results: n
  15781. }), m.remove.loading(), m.addResults(t), m.inject.id(n), m.write.cache(e, {
  15782. html: t,
  15783. results: n
  15784. });
  15785. },
  15786. remote: function remote(t, n) {
  15787. n = e.isFunction(n) ? n : function () {}, k.api("is loading") && k.api("abort"), m.setup.api(t, n), k.api("query");
  15788. },
  15789. object: function object(t, n, o) {
  15790. var a = [],
  15791. r = [],
  15792. s = [],
  15793. l = t.toString().replace(v.escape, "\\$&"),
  15794. c = new RegExp(v.beginsWith + l, "i"),
  15795. u = function u(t, n) {
  15796. var i = -1 == e.inArray(n, a),
  15797. o = -1 == e.inArray(n, s),
  15798. l = -1 == e.inArray(n, r);
  15799. i && o && l && t.push(n);
  15800. };
  15801. return n = n || g.source, o = o !== i ? o : g.searchFields, e.isArray(o) || (o = [o]), n === i || !1 === n ? (m.error(x.source), []) : (e.each(o, function (i, o) {
  15802. e.each(n, function (e, n) {
  15803. "string" == typeof n[o] && (-1 !== n[o].search(c) ? u(a, n) : "exact" === g.fullTextSearch && m.exactSearch(t, n[o]) ? u(r, n) : 1 == g.fullTextSearch && m.fuzzySearch(t, n[o]) && u(s, n));
  15804. });
  15805. }), e.merge(r, s), e.merge(a, r), a);
  15806. }
  15807. },
  15808. exactSearch: function exactSearch(e, t) {
  15809. return e = e.toLowerCase(), (t = t.toLowerCase()).indexOf(e) > -1;
  15810. },
  15811. fuzzySearch: function fuzzySearch(e, t) {
  15812. var n = t.length,
  15813. i = e.length;
  15814. if ("string" != typeof e) return !1;
  15815. if (e = e.toLowerCase(), t = t.toLowerCase(), i > n) return !1;
  15816. if (i === n) return e === t;
  15817. e: for (var o = 0, a = 0; o < i; o++) {
  15818. for (var r = e.charCodeAt(o); a < n;) {
  15819. if (t.charCodeAt(a++) === r) continue e;
  15820. }
  15821. return !1;
  15822. }
  15823. return !0;
  15824. },
  15825. parse: {
  15826. response: function response(e, t) {
  15827. var n = m.generateResults(e);
  15828. m.verbose("Parsing server response", e), e !== i && t !== i && e[b.results] !== i && (m.addResults(n), m.inject.id(e[b.results]), m.write.cache(t, {
  15829. html: n,
  15830. results: e[b.results]
  15831. }), m.save.results(e[b.results]));
  15832. }
  15833. },
  15834. cancel: {
  15835. query: function query() {
  15836. m.can.useAPI() && k.api("abort");
  15837. }
  15838. },
  15839. has: {
  15840. minimumCharacters: function minimumCharacters() {
  15841. return m.get.value().length >= g.minCharacters;
  15842. },
  15843. results: function results() {
  15844. return 0 !== R.length && "" != R.html();
  15845. }
  15846. },
  15847. clear: {
  15848. cache: function cache(e) {
  15849. var t = k.data(h.cache);
  15850. e ? e && t && t[e] && (m.debug("Removing value from cache", e), delete t[e], k.data(h.cache, t)) : (m.debug("Clearing cache", e), k.removeData(h.cache));
  15851. }
  15852. },
  15853. read: {
  15854. cache: function cache(e) {
  15855. var t = k.data(h.cache);
  15856. return !!g.cache && (m.verbose("Checking cache for generated html for query", e), "object" == _typeof(t) && t[e] !== i && t[e]);
  15857. }
  15858. },
  15859. create: {
  15860. categoryResults: function categoryResults(t) {
  15861. var n = {};
  15862. return e.each(t, function (e, t) {
  15863. t.category && (n[t.category] === i ? (m.verbose("Creating new category of results", t.category), n[t.category] = {
  15864. name: t.category,
  15865. results: [t]
  15866. }) : n[t.category].results.push(t));
  15867. }), n;
  15868. },
  15869. id: function id(e, t) {
  15870. var n,
  15871. o = e + 1;
  15872. return t !== i ? (n = String.fromCharCode(97 + t) + o, m.verbose("Creating category result id", n)) : (n = o, m.verbose("Creating result id", n)), n;
  15873. },
  15874. results: function results() {
  15875. 0 === R.length && (R = e("<div />").addClass(p.results).appendTo(k));
  15876. }
  15877. },
  15878. inject: {
  15879. result: function result(e, t, n) {
  15880. m.verbose("Injecting result into results");
  15881. var o = n !== i ? R.children().eq(n).children(y.results).first().children(y.result).eq(t) : R.children(y.result).eq(t);
  15882. m.verbose("Injecting results metadata", o), o.data(h.result, e);
  15883. },
  15884. id: function id(t) {
  15885. m.debug("Injecting unique ids into results");
  15886. var n = 0,
  15887. o = 0;
  15888. return "category" === g.type ? e.each(t, function (t, a) {
  15889. o = 0, e.each(a.results, function (e, t) {
  15890. var r = a.results[e];
  15891. r.id === i && (r.id = m.create.id(o, n)), m.inject.result(r, o, n), o++;
  15892. }), n++;
  15893. }) : e.each(t, function (e, n) {
  15894. var a = t[e];
  15895. a.id === i && (a.id = m.create.id(o)), m.inject.result(a, o), o++;
  15896. }), t;
  15897. }
  15898. },
  15899. save: {
  15900. results: function results(e) {
  15901. m.verbose("Saving current search results to metadata", e), k.data(h.results, e);
  15902. }
  15903. },
  15904. write: {
  15905. cache: function cache(e, t) {
  15906. var n = k.data(h.cache) !== i ? k.data(h.cache) : {};
  15907. g.cache && (m.verbose("Writing generated html to cache", e, t), n[e] = t, k.data(h.cache, n));
  15908. }
  15909. },
  15910. addResults: function addResults(t) {
  15911. if (e.isFunction(g.onResultsAdd) && !1 === g.onResultsAdd.call(R, t)) return m.debug("onResultsAdd callback cancelled default action"), !1;
  15912. t ? (R.html(t), m.refreshResults(), g.selectFirstResult && m.select.firstResult(), m.showResults()) : m.hideResults(function () {
  15913. R.empty();
  15914. });
  15915. },
  15916. showResults: function showResults(t) {
  15917. t = e.isFunction(t) ? t : function () {}, D || !m.is.visible() && m.has.results() && (m.can.transition() ? (m.debug("Showing results with css animations"), R.transition({
  15918. animation: g.transition + " in",
  15919. debug: g.debug,
  15920. verbose: g.verbose,
  15921. duration: g.duration,
  15922. onComplete: function onComplete() {
  15923. t();
  15924. },
  15925. queue: !0
  15926. })) : (m.debug("Showing results with javascript"), R.stop().fadeIn(g.duration, g.easing)), g.onResultsOpen.call(R));
  15927. },
  15928. hideResults: function hideResults(t) {
  15929. t = e.isFunction(t) ? t : function () {}, m.is.visible() && (m.can.transition() ? (m.debug("Hiding results with css animations"), R.transition({
  15930. animation: g.transition + " out",
  15931. debug: g.debug,
  15932. verbose: g.verbose,
  15933. duration: g.duration,
  15934. onComplete: function onComplete() {
  15935. t();
  15936. },
  15937. queue: !0
  15938. })) : (m.debug("Hiding results with javascript"), R.stop().fadeOut(g.duration, g.easing)), g.onResultsClose.call(R));
  15939. },
  15940. generateResults: function generateResults(t) {
  15941. m.debug("Generating html from response", t);
  15942. var n = g.templates[g.type],
  15943. i = e.isPlainObject(t[b.results]) && !e.isEmptyObject(t[b.results]),
  15944. o = e.isArray(t[b.results]) && t[b.results].length > 0,
  15945. a = "";
  15946. return i || o ? (g.maxResults > 0 && (i ? "standard" == g.type && m.error(x.maxResults) : t[b.results] = t[b.results].slice(0, g.maxResults)), e.isFunction(n) ? a = n(t, b) : m.error(x.noTemplate, !1)) : g.showNoResults && (a = m.displayMessage(x.noResults, "empty")), g.onResults.call(E, t), a;
  15947. },
  15948. displayMessage: function displayMessage(e, t) {
  15949. return t = t || "standard", m.debug("Displaying message", e, t), m.addResults(g.templates.message(e, t)), g.templates.message(e, t);
  15950. },
  15951. setting: function setting(t, n) {
  15952. if (e.isPlainObject(t)) e.extend(!0, g, t);else {
  15953. if (n === i) return g[t];
  15954. g[t] = n;
  15955. }
  15956. },
  15957. internal: function internal(t, n) {
  15958. if (e.isPlainObject(t)) e.extend(!0, m, t);else {
  15959. if (n === i) return m[t];
  15960. m[t] = n;
  15961. }
  15962. },
  15963. debug: function debug() {
  15964. !g.silent && g.debug && (g.performance ? m.performance.log(arguments) : (m.debug = Function.prototype.bind.call(console.info, console, g.name + ":"), m.debug.apply(console, arguments)));
  15965. },
  15966. verbose: function verbose() {
  15967. !g.silent && g.verbose && g.debug && (g.performance ? m.performance.log(arguments) : (m.verbose = Function.prototype.bind.call(console.info, console, g.name + ":"), m.verbose.apply(console, arguments)));
  15968. },
  15969. error: function error() {
  15970. g.silent || (m.error = Function.prototype.bind.call(console.error, console, g.name + ":"), m.error.apply(console, arguments));
  15971. },
  15972. performance: {
  15973. log: function log(e) {
  15974. var t, n;
  15975. g.performance && (n = (t = new Date().getTime()) - (l || t), l = t, c.push({
  15976. Name: e[0],
  15977. Arguments: [].slice.call(e, 1) || "",
  15978. Element: E,
  15979. "Execution Time": n
  15980. })), clearTimeout(m.performance.timer), m.performance.timer = setTimeout(m.performance.display, 500);
  15981. },
  15982. display: function display() {
  15983. var t = g.name + ":",
  15984. n = 0;
  15985. l = !1, clearTimeout(m.performance.timer), e.each(c, function (e, t) {
  15986. n += t["Execution Time"];
  15987. }), t += " " + n + "ms", s && (t += " '" + s + "'"), r.length > 1 && (t += " (" + r.length + ")"), (console.group !== i || console.table !== i) && c.length > 0 && (console.groupCollapsed(t), console.table ? console.table(c) : e.each(c, function (e, t) {
  15988. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  15989. }), console.groupEnd()), c = [];
  15990. }
  15991. },
  15992. invoke: function invoke(t, n, o) {
  15993. var r,
  15994. s,
  15995. l,
  15996. c = F;
  15997. return n = n || f, o = E || o, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  15998. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  15999. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  16000. if (c[a] !== i) return s = c[a], !1;
  16001. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);
  16002. c = c[o];
  16003. }
  16004. })), e.isFunction(s) ? l = s.apply(o, n) : s !== i && (l = s), e.isArray(a) ? a.push(l) : a !== i ? a = [a, l] : l !== i && (a = l), s;
  16005. }
  16006. }, d ? (F === i && m.initialize(), m.invoke(u)) : (F !== i && F.invoke("destroy"), m.initialize());
  16007. }), a !== i ? a : this;
  16008. }, e.fn.search.settings = {
  16009. name: "Search",
  16010. namespace: "search",
  16011. silent: !1,
  16012. debug: !1,
  16013. verbose: !1,
  16014. performance: !0,
  16015. type: "standard",
  16016. minCharacters: 1,
  16017. selectFirstResult: !1,
  16018. apiSettings: !1,
  16019. source: !1,
  16020. searchOnFocus: !0,
  16021. searchFields: ["title", "description"],
  16022. displayField: "",
  16023. fullTextSearch: "exact",
  16024. automatic: !0,
  16025. hideDelay: 0,
  16026. searchDelay: 200,
  16027. maxResults: 7,
  16028. cache: !0,
  16029. showNoResults: !0,
  16030. transition: "scale",
  16031. duration: 200,
  16032. easing: "easeOutExpo",
  16033. onSelect: !1,
  16034. onResultsAdd: !1,
  16035. onSearchQuery: function onSearchQuery(e) {},
  16036. onResults: function onResults(e) {},
  16037. onResultsOpen: function onResultsOpen() {},
  16038. onResultsClose: function onResultsClose() {},
  16039. className: {
  16040. animating: "animating",
  16041. active: "active",
  16042. empty: "empty",
  16043. focus: "focus",
  16044. hidden: "hidden",
  16045. loading: "loading",
  16046. results: "results",
  16047. pressed: "down"
  16048. },
  16049. error: {
  16050. source: "Cannot search. No source used, and Semantic API module was not included",
  16051. noResults: "Your search returned no results",
  16052. logging: "Error in debug logging, exiting.",
  16053. noEndpoint: "No search endpoint was specified",
  16054. noTemplate: "A valid template name was not specified.",
  16055. oldSearchSyntax: "searchFullText setting has been renamed fullTextSearch for consistency, please adjust your settings.",
  16056. serverError: "There was an issue querying the server.",
  16057. maxResults: "Results must be an array to use maxResults setting",
  16058. method: "The method you called is not defined."
  16059. },
  16060. metadata: {
  16061. cache: "cache",
  16062. results: "results",
  16063. result: "result"
  16064. },
  16065. regExp: {
  16066. escape: /[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,
  16067. beginsWith: "(?:s|^)"
  16068. },
  16069. fields: {
  16070. categories: "results",
  16071. categoryName: "name",
  16072. categoryResults: "results",
  16073. description: "description",
  16074. image: "image",
  16075. price: "price",
  16076. results: "results",
  16077. title: "title",
  16078. url: "url",
  16079. action: "action",
  16080. actionText: "text",
  16081. actionURL: "url"
  16082. },
  16083. selector: {
  16084. prompt: ".prompt",
  16085. searchButton: ".search.button",
  16086. results: ".results",
  16087. message: ".results > .message",
  16088. category: ".category",
  16089. result: ".result",
  16090. title: ".title, .name"
  16091. },
  16092. templates: {
  16093. escape: function escape(e) {
  16094. var t = {
  16095. "&": "&amp;",
  16096. "<": "&lt;",
  16097. ">": "&gt;",
  16098. '"': "&quot;",
  16099. "'": "&#x27;",
  16100. "`": "&#x60;"
  16101. };
  16102. return /[&<>"'`]/.test(e) ? e.replace(/[&<>"'`]/g, function (e) {
  16103. return t[e];
  16104. }) : e;
  16105. },
  16106. message: function message(e, t) {
  16107. var n = "";
  16108. return e !== i && t !== i && (n += '<div class="message ' + t + '">', n += "empty" == t ? '<div class="header">No Results</div class="header"><div class="description">' + e + '</div class="description">' : ' <div class="description">' + e + "</div>", n += "</div>"), n;
  16109. },
  16110. category: function category(t, n) {
  16111. var o = "";
  16112. e.fn.search.settings.templates.escape;
  16113. return t[n.categoryResults] !== i && (e.each(t[n.categoryResults], function (t, a) {
  16114. a[n.results] !== i && a.results.length > 0 && (o += '<div class="category">', a[n.categoryName] !== i && (o += '<div class="name">' + a[n.categoryName] + "</div>"), o += '<div class="results">', e.each(a.results, function (e, t) {
  16115. t[n.url] ? o += '<a class="result" href="' + t[n.url] + '">' : o += '<a class="result">', t[n.image] !== i && (o += '<div class="image"> <img src="' + t[n.image] + '"></div>'), o += '<div class="content">', t[n.price] !== i && (o += '<div class="price">' + t[n.price] + "</div>"), t[n.title] !== i && (o += '<div class="title">' + t[n.title] + "</div>"), t[n.description] !== i && (o += '<div class="description">' + t[n.description] + "</div>"), o += "</div>", o += "</a>";
  16116. }), o += "</div>", o += "</div>");
  16117. }), t[n.action] && (o += '<a href="' + t[n.action][n.actionURL] + '" class="action">' + t[n.action][n.actionText] + "</a>"), o);
  16118. },
  16119. standard: function standard(t, n) {
  16120. var o = "";
  16121. return t[n.results] !== i && (e.each(t[n.results], function (e, t) {
  16122. t[n.url] ? o += '<a class="result" href="' + t[n.url] + '">' : o += '<a class="result">', t[n.image] !== i && (o += '<div class="image"> <img src="' + t[n.image] + '"></div>'), o += '<div class="content">', t[n.price] !== i && (o += '<div class="price">' + t[n.price] + "</div>"), t[n.title] !== i && (o += '<div class="title">' + t[n.title] + "</div>"), t[n.description] !== i && (o += '<div class="description">' + t[n.description] + "</div>"), o += "</div>", o += "</a>";
  16123. }), t[n.action] && (o += '<a href="' + t[n.action][n.actionURL] + '" class="action">' + t[n.action][n.actionText] + "</a>"), o);
  16124. }
  16125. }
  16126. };
  16127. }(jQuery, window, document), function (e, t, n, i) {
  16128. "use strict";
  16129. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.shape = function (o) {
  16130. var a,
  16131. r = e(this),
  16132. s = (e("body"), new Date().getTime()),
  16133. l = [],
  16134. c = arguments[0],
  16135. u = "string" == typeof c,
  16136. d = [].slice.call(arguments, 1),
  16137. f = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  16138. setTimeout(e, 0);
  16139. };
  16140. return r.each(function () {
  16141. var t,
  16142. m,
  16143. g,
  16144. p = r.selector || "",
  16145. h = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.shape.settings, o) : e.extend({}, e.fn.shape.settings),
  16146. v = h.namespace,
  16147. b = h.selector,
  16148. y = h.error,
  16149. x = h.className,
  16150. C = "." + v,
  16151. w = "module-" + v,
  16152. S = e(this),
  16153. k = S.find(b.sides),
  16154. T = S.find(b.side),
  16155. A = !1,
  16156. R = this,
  16157. P = S.data(w);
  16158. g = {
  16159. initialize: function initialize() {
  16160. g.verbose("Initializing module for", R), g.set.defaultSide(), g.instantiate();
  16161. },
  16162. instantiate: function instantiate() {
  16163. g.verbose("Storing instance of module", g), P = g, S.data(w, P);
  16164. },
  16165. destroy: function destroy() {
  16166. g.verbose("Destroying previous module for", R), S.removeData(w).off(C);
  16167. },
  16168. refresh: function refresh() {
  16169. g.verbose("Refreshing selector cache for", R), S = e(R), k = e(this).find(b.shape), T = e(this).find(b.side);
  16170. },
  16171. repaint: function repaint() {
  16172. g.verbose("Forcing repaint event");
  16173. (k[0] || n.createElement("div")).offsetWidth;
  16174. },
  16175. animate: function animate(e, n) {
  16176. g.verbose("Animating box with properties", e), n = n || function (e) {
  16177. g.verbose("Executing animation callback"), e !== i && e.stopPropagation(), g.reset(), g.set.active();
  16178. }, h.beforeChange.call(m[0]), g.get.transitionEvent() ? (g.verbose("Starting CSS animation"), S.addClass(x.animating), k.css(e).one(g.get.transitionEvent(), n), g.set.duration(h.duration), f(function () {
  16179. S.addClass(x.animating), t.addClass(x.hidden);
  16180. })) : n();
  16181. },
  16182. queue: function queue(e) {
  16183. g.debug("Queueing animation of", e), k.one(g.get.transitionEvent(), function () {
  16184. g.debug("Executing queued animation"), setTimeout(function () {
  16185. S.shape(e);
  16186. }, 0);
  16187. });
  16188. },
  16189. reset: function reset() {
  16190. g.verbose("Animating states reset"), S.removeClass(x.animating).attr("style", "").removeAttr("style"), k.attr("style", "").removeAttr("style"), T.attr("style", "").removeAttr("style").removeClass(x.hidden), m.removeClass(x.animating).attr("style", "").removeAttr("style");
  16191. },
  16192. is: {
  16193. complete: function complete() {
  16194. return T.filter("." + x.active)[0] == m[0];
  16195. },
  16196. animating: function animating() {
  16197. return S.hasClass(x.animating);
  16198. }
  16199. },
  16200. set: {
  16201. defaultSide: function defaultSide() {
  16202. t = S.find("." + h.className.active), m = t.next(b.side).length > 0 ? t.next(b.side) : S.find(b.side).first(), A = !1, g.verbose("Active side set to", t), g.verbose("Next side set to", m);
  16203. },
  16204. duration: function duration(e) {
  16205. e = "number" == typeof (e = e || h.duration) ? e + "ms" : e, g.verbose("Setting animation duration", e), (h.duration || 0 === h.duration) && k.add(T).css({
  16206. "-webkit-transition-duration": e,
  16207. "-moz-transition-duration": e,
  16208. "-ms-transition-duration": e,
  16209. "-o-transition-duration": e,
  16210. "transition-duration": e
  16211. });
  16212. },
  16213. currentStageSize: function currentStageSize() {
  16214. var e = S.find("." + h.className.active),
  16215. t = e.outerWidth(!0),
  16216. n = e.outerHeight(!0);
  16217. S.css({
  16218. width: t,
  16219. height: n
  16220. });
  16221. },
  16222. stageSize: function stageSize() {
  16223. var e = S.clone().addClass(x.loading),
  16224. t = e.find("." + h.className.active),
  16225. n = A ? e.find(b.side).eq(A) : t.next(b.side).length > 0 ? t.next(b.side) : e.find(b.side).first(),
  16226. i = "next" == h.width ? n.outerWidth(!0) : "initial" == h.width ? S.width() : h.width,
  16227. o = "next" == h.height ? n.outerHeight(!0) : "initial" == h.height ? S.height() : h.height;
  16228. t.removeClass(x.active), n.addClass(x.active), e.insertAfter(S), e.remove(), "auto" != h.width && (S.css("width", i + h.jitter), g.verbose("Specifying width during animation", i)), "auto" != h.height && (S.css("height", o + h.jitter), g.verbose("Specifying height during animation", o));
  16229. },
  16230. nextSide: function nextSide(e) {
  16231. A = e, m = T.filter(e), A = T.index(m), 0 === m.length && (g.set.defaultSide(), g.error(y.side)), g.verbose("Next side manually set to", m);
  16232. },
  16233. active: function active() {
  16234. g.verbose("Setting new side to active", m), T.removeClass(x.active), m.addClass(x.active), h.onChange.call(m[0]), g.set.defaultSide();
  16235. }
  16236. },
  16237. flip: {
  16238. up: function up() {
  16239. if (!g.is.complete() || g.is.animating() || h.allowRepeats) {
  16240. if (g.is.animating()) g.queue("flip up");else {
  16241. g.debug("Flipping up", m);
  16242. var e = g.get.transform.up();
  16243. g.set.stageSize(), g.stage.above(), g.animate(e);
  16244. }
  16245. } else g.debug("Side already visible", m);
  16246. },
  16247. down: function down() {
  16248. if (!g.is.complete() || g.is.animating() || h.allowRepeats) {
  16249. if (g.is.animating()) g.queue("flip down");else {
  16250. g.debug("Flipping down", m);
  16251. var e = g.get.transform.down();
  16252. g.set.stageSize(), g.stage.below(), g.animate(e);
  16253. }
  16254. } else g.debug("Side already visible", m);
  16255. },
  16256. left: function left() {
  16257. if (!g.is.complete() || g.is.animating() || h.allowRepeats) {
  16258. if (g.is.animating()) g.queue("flip left");else {
  16259. g.debug("Flipping left", m);
  16260. var e = g.get.transform.left();
  16261. g.set.stageSize(), g.stage.left(), g.animate(e);
  16262. }
  16263. } else g.debug("Side already visible", m);
  16264. },
  16265. right: function right() {
  16266. if (!g.is.complete() || g.is.animating() || h.allowRepeats) {
  16267. if (g.is.animating()) g.queue("flip right");else {
  16268. g.debug("Flipping right", m);
  16269. var e = g.get.transform.right();
  16270. g.set.stageSize(), g.stage.right(), g.animate(e);
  16271. }
  16272. } else g.debug("Side already visible", m);
  16273. },
  16274. over: function over() {
  16275. !g.is.complete() || g.is.animating() || h.allowRepeats ? g.is.animating() ? g.queue("flip over") : (g.debug("Flipping over", m), g.set.stageSize(), g.stage.behind(), g.animate(g.get.transform.over())) : g.debug("Side already visible", m);
  16276. },
  16277. back: function back() {
  16278. !g.is.complete() || g.is.animating() || h.allowRepeats ? g.is.animating() ? g.queue("flip back") : (g.debug("Flipping back", m), g.set.stageSize(), g.stage.behind(), g.animate(g.get.transform.back())) : g.debug("Side already visible", m);
  16279. }
  16280. },
  16281. get: {
  16282. transform: {
  16283. up: function up() {
  16284. return {
  16285. transform: "translateY(" + -(t.outerHeight(!0) - m.outerHeight(!0)) / 2 + "px) translateZ(" + -t.outerHeight(!0) / 2 + "px) rotateX(-90deg)"
  16286. };
  16287. },
  16288. down: function down() {
  16289. return {
  16290. transform: "translateY(" + -(t.outerHeight(!0) - m.outerHeight(!0)) / 2 + "px) translateZ(" + -t.outerHeight(!0) / 2 + "px) rotateX(90deg)"
  16291. };
  16292. },
  16293. left: function left() {
  16294. return {
  16295. transform: "translateX(" + -(t.outerWidth(!0) - m.outerWidth(!0)) / 2 + "px) translateZ(" + -t.outerWidth(!0) / 2 + "px) rotateY(90deg)"
  16296. };
  16297. },
  16298. right: function right() {
  16299. return {
  16300. transform: "translateX(" + -(t.outerWidth(!0) - m.outerWidth(!0)) / 2 + "px) translateZ(" + -t.outerWidth(!0) / 2 + "px) rotateY(-90deg)"
  16301. };
  16302. },
  16303. over: function over() {
  16304. return {
  16305. transform: "translateX(" + -(t.outerWidth(!0) - m.outerWidth(!0)) / 2 + "px) rotateY(180deg)"
  16306. };
  16307. },
  16308. back: function back() {
  16309. return {
  16310. transform: "translateX(" + -(t.outerWidth(!0) - m.outerWidth(!0)) / 2 + "px) rotateY(-180deg)"
  16311. };
  16312. }
  16313. },
  16314. transitionEvent: function transitionEvent() {
  16315. var e,
  16316. t = n.createElement("element"),
  16317. o = {
  16318. transition: "transitionend",
  16319. OTransition: "oTransitionEnd",
  16320. MozTransition: "transitionend",
  16321. WebkitTransition: "webkitTransitionEnd"
  16322. };
  16323. for (e in o) {
  16324. if (t.style[e] !== i) return o[e];
  16325. }
  16326. },
  16327. nextSide: function nextSide() {
  16328. return t.next(b.side).length > 0 ? t.next(b.side) : S.find(b.side).first();
  16329. }
  16330. },
  16331. stage: {
  16332. above: function above() {
  16333. var e = {
  16334. origin: (t.outerHeight(!0) - m.outerHeight(!0)) / 2,
  16335. depth: {
  16336. active: m.outerHeight(!0) / 2,
  16337. next: t.outerHeight(!0) / 2
  16338. }
  16339. };
  16340. g.verbose("Setting the initial animation position as above", m, e), k.css({
  16341. transform: "translateZ(-" + e.depth.active + "px)"
  16342. }), t.css({
  16343. transform: "rotateY(0deg) translateZ(" + e.depth.active + "px)"
  16344. }), m.addClass(x.animating).css({
  16345. top: e.origin + "px",
  16346. transform: "rotateX(90deg) translateZ(" + e.depth.next + "px)"
  16347. });
  16348. },
  16349. below: function below() {
  16350. var e = {
  16351. origin: (t.outerHeight(!0) - m.outerHeight(!0)) / 2,
  16352. depth: {
  16353. active: m.outerHeight(!0) / 2,
  16354. next: t.outerHeight(!0) / 2
  16355. }
  16356. };
  16357. g.verbose("Setting the initial animation position as below", m, e), k.css({
  16358. transform: "translateZ(-" + e.depth.active + "px)"
  16359. }), t.css({
  16360. transform: "rotateY(0deg) translateZ(" + e.depth.active + "px)"
  16361. }), m.addClass(x.animating).css({
  16362. top: e.origin + "px",
  16363. transform: "rotateX(-90deg) translateZ(" + e.depth.next + "px)"
  16364. });
  16365. },
  16366. left: function left() {
  16367. var e = t.outerWidth(!0),
  16368. n = m.outerWidth(!0),
  16369. i = {
  16370. origin: (e - n) / 2,
  16371. depth: {
  16372. active: n / 2,
  16373. next: e / 2
  16374. }
  16375. };
  16376. g.verbose("Setting the initial animation position as left", m, i), k.css({
  16377. transform: "translateZ(-" + i.depth.active + "px)"
  16378. }), t.css({
  16379. transform: "rotateY(0deg) translateZ(" + i.depth.active + "px)"
  16380. }), m.addClass(x.animating).css({
  16381. left: i.origin + "px",
  16382. transform: "rotateY(-90deg) translateZ(" + i.depth.next + "px)"
  16383. });
  16384. },
  16385. right: function right() {
  16386. var e = t.outerWidth(!0),
  16387. n = m.outerWidth(!0),
  16388. i = {
  16389. origin: (e - n) / 2,
  16390. depth: {
  16391. active: n / 2,
  16392. next: e / 2
  16393. }
  16394. };
  16395. g.verbose("Setting the initial animation position as left", m, i), k.css({
  16396. transform: "translateZ(-" + i.depth.active + "px)"
  16397. }), t.css({
  16398. transform: "rotateY(0deg) translateZ(" + i.depth.active + "px)"
  16399. }), m.addClass(x.animating).css({
  16400. left: i.origin + "px",
  16401. transform: "rotateY(90deg) translateZ(" + i.depth.next + "px)"
  16402. });
  16403. },
  16404. behind: function behind() {
  16405. var e = t.outerWidth(!0),
  16406. n = m.outerWidth(!0),
  16407. i = {
  16408. origin: (e - n) / 2,
  16409. depth: {
  16410. active: n / 2,
  16411. next: e / 2
  16412. }
  16413. };
  16414. g.verbose("Setting the initial animation position as behind", m, i), t.css({
  16415. transform: "rotateY(0deg)"
  16416. }), m.addClass(x.animating).css({
  16417. left: i.origin + "px",
  16418. transform: "rotateY(-180deg)"
  16419. });
  16420. }
  16421. },
  16422. setting: function setting(t, n) {
  16423. if (g.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, h, t);else {
  16424. if (n === i) return h[t];
  16425. e.isPlainObject(h[t]) ? e.extend(!0, h[t], n) : h[t] = n;
  16426. }
  16427. },
  16428. internal: function internal(t, n) {
  16429. if (e.isPlainObject(t)) e.extend(!0, g, t);else {
  16430. if (n === i) return g[t];
  16431. g[t] = n;
  16432. }
  16433. },
  16434. debug: function debug() {
  16435. !h.silent && h.debug && (h.performance ? g.performance.log(arguments) : (g.debug = Function.prototype.bind.call(console.info, console, h.name + ":"), g.debug.apply(console, arguments)));
  16436. },
  16437. verbose: function verbose() {
  16438. !h.silent && h.verbose && h.debug && (h.performance ? g.performance.log(arguments) : (g.verbose = Function.prototype.bind.call(console.info, console, h.name + ":"), g.verbose.apply(console, arguments)));
  16439. },
  16440. error: function error() {
  16441. h.silent || (g.error = Function.prototype.bind.call(console.error, console, h.name + ":"), g.error.apply(console, arguments));
  16442. },
  16443. performance: {
  16444. log: function log(e) {
  16445. var t, n;
  16446. h.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({
  16447. Name: e[0],
  16448. Arguments: [].slice.call(e, 1) || "",
  16449. Element: R,
  16450. "Execution Time": n
  16451. })), clearTimeout(g.performance.timer), g.performance.timer = setTimeout(g.performance.display, 500);
  16452. },
  16453. display: function display() {
  16454. var t = h.name + ":",
  16455. n = 0;
  16456. s = !1, clearTimeout(g.performance.timer), e.each(l, function (e, t) {
  16457. n += t["Execution Time"];
  16458. }), t += " " + n + "ms", p && (t += " '" + p + "'"), r.length > 1 && (t += " (" + r.length + ")"), (console.group !== i || console.table !== i) && l.length > 0 && (console.groupCollapsed(t), console.table ? console.table(l) : e.each(l, function (e, t) {
  16459. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  16460. }), console.groupEnd()), l = [];
  16461. }
  16462. },
  16463. invoke: function invoke(t, n, o) {
  16464. var r,
  16465. s,
  16466. l,
  16467. c = P;
  16468. return n = n || d, o = R || o, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  16469. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  16470. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  16471. if (c[a] !== i) return s = c[a], !1;
  16472. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);
  16473. c = c[o];
  16474. }
  16475. })), e.isFunction(s) ? l = s.apply(o, n) : s !== i && (l = s), e.isArray(a) ? a.push(l) : a !== i ? a = [a, l] : l !== i && (a = l), s;
  16476. }
  16477. }, u ? (P === i && g.initialize(), g.invoke(c)) : (P !== i && P.invoke("destroy"), g.initialize());
  16478. }), a !== i ? a : this;
  16479. }, e.fn.shape.settings = {
  16480. name: "Shape",
  16481. silent: !1,
  16482. debug: !1,
  16483. verbose: !1,
  16484. jitter: 0,
  16485. performance: !0,
  16486. namespace: "shape",
  16487. width: "initial",
  16488. height: "initial",
  16489. beforeChange: function beforeChange() {},
  16490. onChange: function onChange() {},
  16491. allowRepeats: !1,
  16492. duration: !1,
  16493. error: {
  16494. side: "You tried to switch to a side that does not exist.",
  16495. method: "The method you called is not defined"
  16496. },
  16497. className: {
  16498. animating: "animating",
  16499. hidden: "hidden",
  16500. loading: "loading",
  16501. active: "active"
  16502. },
  16503. selector: {
  16504. sides: ".sides",
  16505. side: ".side"
  16506. }
  16507. };
  16508. }(jQuery, window, document), function (e, t, n, i) {
  16509. "use strict";
  16510. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.sidebar = function (o) {
  16511. var a,
  16512. r = e(this),
  16513. s = e(t),
  16514. l = e(n),
  16515. c = e("html"),
  16516. u = e("head"),
  16517. d = r.selector || "",
  16518. f = new Date().getTime(),
  16519. m = [],
  16520. g = arguments[0],
  16521. p = "string" == typeof g,
  16522. h = [].slice.call(arguments, 1),
  16523. v = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  16524. setTimeout(e, 0);
  16525. };
  16526. return r.each(function () {
  16527. var r,
  16528. b,
  16529. y,
  16530. x,
  16531. C,
  16532. w,
  16533. S = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.sidebar.settings, o) : e.extend({}, e.fn.sidebar.settings),
  16534. k = S.selector,
  16535. T = S.className,
  16536. A = S.namespace,
  16537. R = S.regExp,
  16538. P = S.error,
  16539. E = "." + A,
  16540. F = "module-" + A,
  16541. O = e(this),
  16542. D = e(S.context),
  16543. q = O.children(k.sidebar),
  16544. j = (D.children(k.fixed), D.children(k.pusher)),
  16545. z = this,
  16546. I = O.data(F);
  16547. w = {
  16548. initialize: function initialize() {
  16549. w.debug("Initializing sidebar", o), w.create.id(), C = w.get.transitionEvent(), S.delaySetup ? v(w.setup.layout) : w.setup.layout(), v(function () {
  16550. w.setup.cache();
  16551. }), w.instantiate();
  16552. },
  16553. instantiate: function instantiate() {
  16554. w.verbose("Storing instance of module", w), I = w, O.data(F, w);
  16555. },
  16556. create: {
  16557. id: function id() {
  16558. y = (Math.random().toString(16) + "000000000").substr(2, 8), b = "." + y, w.verbose("Creating unique id for element", y);
  16559. }
  16560. },
  16561. destroy: function destroy() {
  16562. w.verbose("Destroying previous module for", O), O.off(E).removeData(F), w.is.ios() && w.remove.ios(), D.off(b), s.off(b), l.off(b);
  16563. },
  16564. event: {
  16565. clickaway: function clickaway(e) {
  16566. var t = j.find(e.target).length > 0 || j.is(e.target),
  16567. n = D.is(e.target);
  16568. t && (w.verbose("User clicked on dimmed page"), w.hide()), n && (w.verbose("User clicked on dimmable context (scaled out page)"), w.hide());
  16569. },
  16570. touch: function touch(e) {},
  16571. containScroll: function containScroll(e) {
  16572. z.scrollTop <= 0 && (z.scrollTop = 1), z.scrollTop + z.offsetHeight >= z.scrollHeight && (z.scrollTop = z.scrollHeight - z.offsetHeight - 1);
  16573. },
  16574. scroll: function scroll(t) {
  16575. 0 === e(t.target).closest(k.sidebar).length && t.preventDefault();
  16576. }
  16577. },
  16578. bind: {
  16579. clickaway: function clickaway() {
  16580. w.verbose("Adding clickaway events to context", D), S.closable && D.on("click" + b, w.event.clickaway).on("touchend" + b, w.event.clickaway);
  16581. },
  16582. scrollLock: function scrollLock() {
  16583. S.scrollLock && (w.debug("Disabling page scroll"), s.on("DOMMouseScroll" + b, w.event.scroll)), w.verbose("Adding events to contain sidebar scroll"), l.on("touchmove" + b, w.event.touch), O.on("scroll" + E, w.event.containScroll);
  16584. }
  16585. },
  16586. unbind: {
  16587. clickaway: function clickaway() {
  16588. w.verbose("Removing clickaway events from context", D), D.off(b);
  16589. },
  16590. scrollLock: function scrollLock() {
  16591. w.verbose("Removing scroll lock from page"), l.off(b), s.off(b), O.off("scroll" + E);
  16592. }
  16593. },
  16594. add: {
  16595. inlineCSS: function inlineCSS() {
  16596. var t,
  16597. n = w.cache.width || O.outerWidth(),
  16598. i = w.cache.height || O.outerHeight(),
  16599. o = w.is.rtl(),
  16600. a = w.get.direction(),
  16601. s = {
  16602. left: n,
  16603. right: -n,
  16604. top: i,
  16605. bottom: -i
  16606. };
  16607. o && (w.verbose("RTL detected, flipping widths"), s.left = -n, s.right = n), t = "<style>", "left" === a || "right" === a ? (w.debug("Adding CSS rules for animation distance", n), t += " .ui.visible." + a + ".sidebar ~ .fixed, .ui.visible." + a + ".sidebar ~ .pusher { -webkit-transform: translate3d(" + s[a] + "px, 0, 0); transform: translate3d(" + s[a] + "px, 0, 0); }") : "top" !== a && "bottom" != a || (t += " .ui.visible." + a + ".sidebar ~ .fixed, .ui.visible." + a + ".sidebar ~ .pusher { -webkit-transform: translate3d(0, " + s[a] + "px, 0); transform: translate3d(0, " + s[a] + "px, 0); }"), w.is.ie() && ("left" === a || "right" === a ? (w.debug("Adding CSS rules for animation distance", n), t += " body.pushable > .ui.visible." + a + ".sidebar ~ .pusher:after { -webkit-transform: translate3d(" + s[a] + "px, 0, 0); transform: translate3d(" + s[a] + "px, 0, 0); }") : "top" !== a && "bottom" != a || (t += " body.pushable > .ui.visible." + a + ".sidebar ~ .pusher:after { -webkit-transform: translate3d(0, " + s[a] + "px, 0); transform: translate3d(0, " + s[a] + "px, 0); }"), t += " body.pushable > .ui.visible.left.sidebar ~ .ui.visible.right.sidebar ~ .pusher:after, body.pushable > .ui.visible.right.sidebar ~ .ui.visible.left.sidebar ~ .pusher:after { -webkit-transform: translate3d(0px, 0, 0); transform: translate3d(0px, 0, 0); }"), r = e(t += "</style>").appendTo(u), w.debug("Adding sizing css to head", r);
  16608. }
  16609. },
  16610. refresh: function refresh() {
  16611. w.verbose("Refreshing selector cache"), D = e(S.context), q = D.children(k.sidebar), j = D.children(k.pusher), D.children(k.fixed), w.clear.cache();
  16612. },
  16613. refreshSidebars: function refreshSidebars() {
  16614. w.verbose("Refreshing other sidebars"), q = D.children(k.sidebar);
  16615. },
  16616. repaint: function repaint() {
  16617. w.verbose("Forcing repaint event"), z.style.display = "none";
  16618. z.offsetHeight;
  16619. z.scrollTop = z.scrollTop, z.style.display = "";
  16620. },
  16621. setup: {
  16622. cache: function cache() {
  16623. w.cache = {
  16624. width: O.outerWidth(),
  16625. height: O.outerHeight(),
  16626. rtl: "rtl" == O.css("direction")
  16627. };
  16628. },
  16629. layout: function layout() {
  16630. 0 === D.children(k.pusher).length && (w.debug("Adding wrapper element for sidebar"), w.error(P.pusher), j = e('<div class="pusher" />'), D.children().not(k.omitted).not(q).wrapAll(j), w.refresh()), 0 !== O.nextAll(k.pusher).length && O.nextAll(k.pusher)[0] === j[0] || (w.debug("Moved sidebar to correct parent element"), w.error(P.movedSidebar, z), O.detach().prependTo(D), w.refresh()), w.clear.cache(), w.set.pushable(), w.set.direction();
  16631. }
  16632. },
  16633. attachEvents: function attachEvents(t, n) {
  16634. var i = e(t);
  16635. n = e.isFunction(w[n]) ? w[n] : w.toggle, i.length > 0 ? (w.debug("Attaching sidebar events to element", t, n), i.on("click" + E, n)) : w.error(P.notFound, t);
  16636. },
  16637. show: function show(t) {
  16638. if (t = e.isFunction(t) ? t : function () {}, w.is.hidden()) {
  16639. if (w.refreshSidebars(), S.overlay && (w.error(P.overlay), S.transition = "overlay"), w.refresh(), w.othersActive()) if (w.debug("Other sidebars currently visible"), S.exclusive) {
  16640. if ("overlay" != S.transition) return void w.hideOthers(w.show);
  16641. w.hideOthers();
  16642. } else S.transition = "overlay";
  16643. w.pushPage(function () {
  16644. t.call(z), S.onShow.call(z);
  16645. }), S.onChange.call(z), S.onVisible.call(z);
  16646. } else w.debug("Sidebar is already visible");
  16647. },
  16648. hide: function hide(t) {
  16649. t = e.isFunction(t) ? t : function () {}, (w.is.visible() || w.is.animating()) && (w.debug("Hiding sidebar", t), w.refreshSidebars(), w.pullPage(function () {
  16650. t.call(z), S.onHidden.call(z);
  16651. }), S.onChange.call(z), S.onHide.call(z));
  16652. },
  16653. othersAnimating: function othersAnimating() {
  16654. return q.not(O).filter("." + T.animating).length > 0;
  16655. },
  16656. othersVisible: function othersVisible() {
  16657. return q.not(O).filter("." + T.visible).length > 0;
  16658. },
  16659. othersActive: function othersActive() {
  16660. return w.othersVisible() || w.othersAnimating();
  16661. },
  16662. hideOthers: function hideOthers(e) {
  16663. var t = q.not(O).filter("." + T.visible),
  16664. n = t.length,
  16665. i = 0;
  16666. e = e || function () {}, t.sidebar("hide", function () {
  16667. ++i == n && e();
  16668. });
  16669. },
  16670. toggle: function toggle() {
  16671. w.verbose("Determining toggled direction"), w.is.hidden() ? w.show() : w.hide();
  16672. },
  16673. pushPage: function pushPage(t) {
  16674. var n,
  16675. i,
  16676. _o,
  16677. a = w.get.transition(),
  16678. r = "overlay" === a || w.othersActive() ? O : j;
  16679. t = e.isFunction(t) ? t : function () {}, "scale down" == S.transition && w.scrollToTop(), w.set.transition(a), w.repaint(), n = function n() {
  16680. w.bind.clickaway(), w.add.inlineCSS(), w.set.animating(), w.set.visible();
  16681. }, i = function i() {
  16682. w.set.dimmed();
  16683. }, _o = function o(e) {
  16684. e.target == r[0] && (r.off(C + b, _o), w.remove.animating(), w.bind.scrollLock(), t.call(z));
  16685. }, r.off(C + b), r.on(C + b, _o), v(n), S.dimPage && !w.othersVisible() && v(i);
  16686. },
  16687. pullPage: function pullPage(t) {
  16688. var n,
  16689. _i,
  16690. o = w.get.transition(),
  16691. a = "overlay" == o || w.othersActive() ? O : j;
  16692. t = e.isFunction(t) ? t : function () {}, w.verbose("Removing context push state", w.get.direction()), w.unbind.clickaway(), w.unbind.scrollLock(), n = function n() {
  16693. w.set.transition(o), w.set.animating(), w.remove.visible(), S.dimPage && !w.othersVisible() && j.removeClass(T.dimmed);
  16694. }, _i = function i(e) {
  16695. e.target == a[0] && (a.off(C + b, _i), w.remove.animating(), w.remove.transition(), w.remove.inlineCSS(), ("scale down" == o || S.returnScroll && w.is.mobile()) && w.scrollBack(), t.call(z));
  16696. }, a.off(C + b), a.on(C + b, _i), v(n);
  16697. },
  16698. scrollToTop: function scrollToTop() {
  16699. w.verbose("Scrolling to top of page to avoid animation issues"), x = e(t).scrollTop(), O.scrollTop(0), t.scrollTo(0, 0);
  16700. },
  16701. scrollBack: function scrollBack() {
  16702. w.verbose("Scrolling back to original page position"), t.scrollTo(0, x);
  16703. },
  16704. clear: {
  16705. cache: function cache() {
  16706. w.verbose("Clearing cached dimensions"), w.cache = {};
  16707. }
  16708. },
  16709. set: {
  16710. ios: function ios() {
  16711. c.addClass(T.ios);
  16712. },
  16713. pushed: function pushed() {
  16714. D.addClass(T.pushed);
  16715. },
  16716. pushable: function pushable() {
  16717. D.addClass(T.pushable);
  16718. },
  16719. dimmed: function dimmed() {
  16720. j.addClass(T.dimmed);
  16721. },
  16722. active: function active() {
  16723. O.addClass(T.active);
  16724. },
  16725. animating: function animating() {
  16726. O.addClass(T.animating);
  16727. },
  16728. transition: function transition(e) {
  16729. e = e || w.get.transition(), O.addClass(e);
  16730. },
  16731. direction: function direction(e) {
  16732. e = e || w.get.direction(), O.addClass(T[e]);
  16733. },
  16734. visible: function visible() {
  16735. O.addClass(T.visible);
  16736. },
  16737. overlay: function overlay() {
  16738. O.addClass(T.overlay);
  16739. }
  16740. },
  16741. remove: {
  16742. inlineCSS: function inlineCSS() {
  16743. w.debug("Removing inline css styles", r), r && r.length > 0 && r.remove();
  16744. },
  16745. ios: function ios() {
  16746. c.removeClass(T.ios);
  16747. },
  16748. pushed: function pushed() {
  16749. D.removeClass(T.pushed);
  16750. },
  16751. pushable: function pushable() {
  16752. D.removeClass(T.pushable);
  16753. },
  16754. active: function active() {
  16755. O.removeClass(T.active);
  16756. },
  16757. animating: function animating() {
  16758. O.removeClass(T.animating);
  16759. },
  16760. transition: function transition(e) {
  16761. e = e || w.get.transition(), O.removeClass(e);
  16762. },
  16763. direction: function direction(e) {
  16764. e = e || w.get.direction(), O.removeClass(T[e]);
  16765. },
  16766. visible: function visible() {
  16767. O.removeClass(T.visible);
  16768. },
  16769. overlay: function overlay() {
  16770. O.removeClass(T.overlay);
  16771. }
  16772. },
  16773. get: {
  16774. direction: function direction() {
  16775. return O.hasClass(T.top) ? T.top : O.hasClass(T.right) ? T.right : O.hasClass(T.bottom) ? T.bottom : T.left;
  16776. },
  16777. transition: function transition() {
  16778. var e,
  16779. t = w.get.direction();
  16780. return e = w.is.mobile() ? "auto" == S.mobileTransition ? S.defaultTransition.mobile[t] : S.mobileTransition : "auto" == S.transition ? S.defaultTransition.computer[t] : S.transition, w.verbose("Determined transition", e), e;
  16781. },
  16782. transitionEvent: function transitionEvent() {
  16783. var e,
  16784. t = n.createElement("element"),
  16785. o = {
  16786. transition: "transitionend",
  16787. OTransition: "oTransitionEnd",
  16788. MozTransition: "transitionend",
  16789. WebkitTransition: "webkitTransitionEnd"
  16790. };
  16791. for (e in o) {
  16792. if (t.style[e] !== i) return o[e];
  16793. }
  16794. }
  16795. },
  16796. is: {
  16797. ie: function ie() {
  16798. return !t.ActiveXObject && "ActiveXObject" in t || "ActiveXObject" in t;
  16799. },
  16800. ios: function ios() {
  16801. var e = navigator.userAgent,
  16802. t = e.match(R.ios),
  16803. n = e.match(R.mobileChrome);
  16804. return !(!t || n) && (w.verbose("Browser was found to be iOS", e), !0);
  16805. },
  16806. mobile: function mobile() {
  16807. var e = navigator.userAgent;
  16808. return e.match(R.mobile) ? (w.verbose("Browser was found to be mobile", e), !0) : (w.verbose("Browser is not mobile, using regular transition", e), !1);
  16809. },
  16810. hidden: function hidden() {
  16811. return !w.is.visible();
  16812. },
  16813. visible: function visible() {
  16814. return O.hasClass(T.visible);
  16815. },
  16816. open: function open() {
  16817. return w.is.visible();
  16818. },
  16819. closed: function closed() {
  16820. return w.is.hidden();
  16821. },
  16822. vertical: function vertical() {
  16823. return O.hasClass(T.top);
  16824. },
  16825. animating: function animating() {
  16826. return D.hasClass(T.animating);
  16827. },
  16828. rtl: function rtl() {
  16829. return w.cache.rtl === i && (w.cache.rtl = "rtl" == O.css("direction")), w.cache.rtl;
  16830. }
  16831. },
  16832. setting: function setting(t, n) {
  16833. if (w.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, S, t);else {
  16834. if (n === i) return S[t];
  16835. e.isPlainObject(S[t]) ? e.extend(!0, S[t], n) : S[t] = n;
  16836. }
  16837. },
  16838. internal: function internal(t, n) {
  16839. if (e.isPlainObject(t)) e.extend(!0, w, t);else {
  16840. if (n === i) return w[t];
  16841. w[t] = n;
  16842. }
  16843. },
  16844. debug: function debug() {
  16845. !S.silent && S.debug && (S.performance ? w.performance.log(arguments) : (w.debug = Function.prototype.bind.call(console.info, console, S.name + ":"), w.debug.apply(console, arguments)));
  16846. },
  16847. verbose: function verbose() {
  16848. !S.silent && S.verbose && S.debug && (S.performance ? w.performance.log(arguments) : (w.verbose = Function.prototype.bind.call(console.info, console, S.name + ":"), w.verbose.apply(console, arguments)));
  16849. },
  16850. error: function error() {
  16851. S.silent || (w.error = Function.prototype.bind.call(console.error, console, S.name + ":"), w.error.apply(console, arguments));
  16852. },
  16853. performance: {
  16854. log: function log(e) {
  16855. var t, n;
  16856. S.performance && (n = (t = new Date().getTime()) - (f || t), f = t, m.push({
  16857. Name: e[0],
  16858. Arguments: [].slice.call(e, 1) || "",
  16859. Element: z,
  16860. "Execution Time": n
  16861. })), clearTimeout(w.performance.timer), w.performance.timer = setTimeout(w.performance.display, 500);
  16862. },
  16863. display: function display() {
  16864. var t = S.name + ":",
  16865. n = 0;
  16866. f = !1, clearTimeout(w.performance.timer), e.each(m, function (e, t) {
  16867. n += t["Execution Time"];
  16868. }), t += " " + n + "ms", d && (t += " '" + d + "'"), (console.group !== i || console.table !== i) && m.length > 0 && (console.groupCollapsed(t), console.table ? console.table(m) : e.each(m, function (e, t) {
  16869. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  16870. }), console.groupEnd()), m = [];
  16871. }
  16872. },
  16873. invoke: function invoke(t, n, o) {
  16874. var r,
  16875. s,
  16876. l,
  16877. c = I;
  16878. return n = n || h, o = z || o, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  16879. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  16880. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  16881. if (c[a] !== i) return s = c[a], !1;
  16882. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (w.error(P.method, t), !1);
  16883. c = c[o];
  16884. }
  16885. })), e.isFunction(s) ? l = s.apply(o, n) : s !== i && (l = s), e.isArray(a) ? a.push(l) : a !== i ? a = [a, l] : l !== i && (a = l), s;
  16886. }
  16887. }, p ? (I === i && w.initialize(), w.invoke(g)) : (I !== i && w.invoke("destroy"), w.initialize());
  16888. }), a !== i ? a : this;
  16889. }, e.fn.sidebar.settings = {
  16890. name: "Sidebar",
  16891. namespace: "sidebar",
  16892. silent: !1,
  16893. debug: !1,
  16894. verbose: !1,
  16895. performance: !0,
  16896. transition: "auto",
  16897. mobileTransition: "auto",
  16898. defaultTransition: {
  16899. computer: {
  16900. left: "uncover",
  16901. right: "uncover",
  16902. top: "overlay",
  16903. bottom: "overlay"
  16904. },
  16905. mobile: {
  16906. left: "uncover",
  16907. right: "uncover",
  16908. top: "overlay",
  16909. bottom: "overlay"
  16910. }
  16911. },
  16912. context: "body",
  16913. exclusive: !1,
  16914. closable: !0,
  16915. dimPage: !0,
  16916. scrollLock: !1,
  16917. returnScroll: !1,
  16918. delaySetup: !1,
  16919. duration: 500,
  16920. onChange: function onChange() {},
  16921. onShow: function onShow() {},
  16922. onHide: function onHide() {},
  16923. onHidden: function onHidden() {},
  16924. onVisible: function onVisible() {},
  16925. className: {
  16926. active: "active",
  16927. animating: "animating",
  16928. dimmed: "dimmed",
  16929. ios: "ios",
  16930. pushable: "pushable",
  16931. pushed: "pushed",
  16932. right: "right",
  16933. top: "top",
  16934. left: "left",
  16935. bottom: "bottom",
  16936. visible: "visible"
  16937. },
  16938. selector: {
  16939. fixed: ".fixed",
  16940. omitted: "script, link, style, .ui.modal, .ui.dimmer, .ui.nag, .ui.fixed",
  16941. pusher: ".pusher",
  16942. sidebar: ".ui.sidebar"
  16943. },
  16944. regExp: {
  16945. ios: /(iPad|iPhone|iPod)/g,
  16946. mobileChrome: /(CriOS)/g,
  16947. mobile: /Mobile|iP(hone|od|ad)|Android|BlackBerry|IEMobile|Kindle|NetFront|Silk-Accelerated|(hpw|web)OS|Fennec|Minimo|Opera M(obi|ini)|Blazer|Dolfin|Dolphin|Skyfire|Zune/g
  16948. },
  16949. error: {
  16950. method: "The method you called is not defined.",
  16951. pusher: "Had to add pusher element. For optimal performance make sure body content is inside a pusher element",
  16952. movedSidebar: "Had to move sidebar. For optimal performance make sure sidebar and pusher are direct children of your body tag",
  16953. overlay: "The overlay setting is no longer supported, use animation: overlay",
  16954. notFound: "There were no elements that matched the specified selector"
  16955. }
  16956. };
  16957. }(jQuery, window, document), function (e, t, n, i) {
  16958. "use strict";
  16959. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.sticky = function (o) {
  16960. var a,
  16961. r = e(this),
  16962. s = r.selector || "",
  16963. l = new Date().getTime(),
  16964. c = [],
  16965. u = arguments[0],
  16966. d = "string" == typeof u,
  16967. f = [].slice.call(arguments, 1);
  16968. return r.each(function () {
  16969. var r,
  16970. m,
  16971. g,
  16972. p,
  16973. h,
  16974. v = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.sticky.settings, o) : e.extend({}, e.fn.sticky.settings),
  16975. b = v.className,
  16976. y = v.namespace,
  16977. x = v.error,
  16978. C = "." + y,
  16979. w = "module-" + y,
  16980. S = e(this),
  16981. k = e(t),
  16982. T = e(v.scrollContext),
  16983. A = (S.selector, S.data(w)),
  16984. R = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  16985. setTimeout(e, 0);
  16986. },
  16987. P = this;
  16988. h = {
  16989. initialize: function initialize() {
  16990. h.determineContainer(), h.determineContext(), h.verbose("Initializing sticky", v, r), h.save.positions(), h.checkErrors(), h.bind.events(), v.observeChanges && h.observeChanges(), h.instantiate();
  16991. },
  16992. instantiate: function instantiate() {
  16993. h.verbose("Storing instance of module", h), A = h, S.data(w, h);
  16994. },
  16995. destroy: function destroy() {
  16996. h.verbose("Destroying previous instance"), h.reset(), g && g.disconnect(), p && p.disconnect(), k.off("load" + C, h.event.load).off("resize" + C, h.event.resize), T.off("scrollchange" + C, h.event.scrollchange), S.removeData(w);
  16997. },
  16998. observeChanges: function observeChanges() {
  16999. "MutationObserver" in t && (g = new MutationObserver(h.event.documentChanged), p = new MutationObserver(h.event.changed), g.observe(n, {
  17000. childList: !0,
  17001. subtree: !0
  17002. }), p.observe(P, {
  17003. childList: !0,
  17004. subtree: !0
  17005. }), p.observe(m[0], {
  17006. childList: !0,
  17007. subtree: !0
  17008. }), h.debug("Setting up mutation observer", p));
  17009. },
  17010. determineContainer: function determineContainer() {
  17011. r = v.container ? e(v.container) : S.offsetParent();
  17012. },
  17013. determineContext: function determineContext() {
  17014. 0 !== (m = v.context ? e(v.context) : r).length || h.error(x.invalidContext, v.context, S);
  17015. },
  17016. checkErrors: function checkErrors() {
  17017. if (h.is.hidden() && h.error(x.visible, S), h.cache.element.height > h.cache.context.height) return h.reset(), void h.error(x.elementSize, S);
  17018. },
  17019. bind: {
  17020. events: function events() {
  17021. k.on("load" + C, h.event.load).on("resize" + C, h.event.resize), T.off("scroll" + C).on("scroll" + C, h.event.scroll).on("scrollchange" + C, h.event.scrollchange);
  17022. }
  17023. },
  17024. event: {
  17025. changed: function changed(e) {
  17026. clearTimeout(h.timer), h.timer = setTimeout(function () {
  17027. h.verbose("DOM tree modified, updating sticky menu", e), h.refresh();
  17028. }, 100);
  17029. },
  17030. documentChanged: function documentChanged(t) {
  17031. [].forEach.call(t, function (t) {
  17032. t.removedNodes && [].forEach.call(t.removedNodes, function (t) {
  17033. (t == P || e(t).find(P).length > 0) && (h.debug("Element removed from DOM, tearing down events"), h.destroy());
  17034. });
  17035. });
  17036. },
  17037. load: function load() {
  17038. h.verbose("Page contents finished loading"), R(h.refresh);
  17039. },
  17040. resize: function resize() {
  17041. h.verbose("Window resized"), R(h.refresh);
  17042. },
  17043. scroll: function scroll() {
  17044. R(function () {
  17045. T.triggerHandler("scrollchange" + C, T.scrollTop());
  17046. });
  17047. },
  17048. scrollchange: function scrollchange(e, t) {
  17049. h.stick(t), v.onScroll.call(P);
  17050. }
  17051. },
  17052. refresh: function refresh(e) {
  17053. h.reset(), v.context || h.determineContext(), e && h.determineContainer(), h.save.positions(), h.stick(), v.onReposition.call(P);
  17054. },
  17055. supports: {
  17056. sticky: function sticky() {
  17057. var t = e("<div/>");
  17058. t[0];
  17059. return t.addClass(b.supported), t.css("position").match("sticky");
  17060. }
  17061. },
  17062. save: {
  17063. lastScroll: function lastScroll(e) {
  17064. h.lastScroll = e;
  17065. },
  17066. elementScroll: function elementScroll(e) {
  17067. h.elementScroll = e;
  17068. },
  17069. positions: function positions() {
  17070. var e = {
  17071. height: T.height()
  17072. },
  17073. t = {
  17074. margin: {
  17075. top: parseInt(S.css("margin-top"), 10),
  17076. bottom: parseInt(S.css("margin-bottom"), 10)
  17077. },
  17078. offset: S.offset(),
  17079. width: S.outerWidth(),
  17080. height: S.outerHeight()
  17081. },
  17082. n = {
  17083. offset: m.offset(),
  17084. height: m.outerHeight()
  17085. };
  17086. r.outerHeight();
  17087. h.is.standardScroll() || (h.debug("Non-standard scroll. Removing scroll offset from element offset"), e.top = T.scrollTop(), e.left = T.scrollLeft(), t.offset.top += e.top, n.offset.top += e.top, t.offset.left += e.left, n.offset.left += e.left), h.cache = {
  17088. fits: t.height + v.offset <= e.height,
  17089. sameHeight: t.height == n.height,
  17090. scrollContext: {
  17091. height: e.height
  17092. },
  17093. element: {
  17094. margin: t.margin,
  17095. top: t.offset.top - t.margin.top,
  17096. left: t.offset.left,
  17097. width: t.width,
  17098. height: t.height,
  17099. bottom: t.offset.top + t.height
  17100. },
  17101. context: {
  17102. top: n.offset.top,
  17103. height: n.height,
  17104. bottom: n.offset.top + n.height
  17105. }
  17106. }, h.set.containerSize(), h.stick(), h.debug("Caching element positions", h.cache);
  17107. }
  17108. },
  17109. get: {
  17110. direction: function direction(e) {
  17111. var t = "down";
  17112. return e = e || T.scrollTop(), h.lastScroll !== i && (h.lastScroll < e ? t = "down" : h.lastScroll > e && (t = "up")), t;
  17113. },
  17114. scrollChange: function scrollChange(e) {
  17115. return e = e || T.scrollTop(), h.lastScroll ? e - h.lastScroll : 0;
  17116. },
  17117. currentElementScroll: function currentElementScroll() {
  17118. return h.elementScroll ? h.elementScroll : h.is.top() ? Math.abs(parseInt(S.css("top"), 10)) || 0 : Math.abs(parseInt(S.css("bottom"), 10)) || 0;
  17119. },
  17120. elementScroll: function elementScroll(e) {
  17121. e = e || T.scrollTop();
  17122. var t = h.cache.element,
  17123. n = h.cache.scrollContext,
  17124. i = h.get.scrollChange(e),
  17125. o = t.height - n.height + v.offset,
  17126. a = h.get.currentElementScroll(),
  17127. r = a + i;
  17128. return a = h.cache.fits || r < 0 ? 0 : r > o ? o : r;
  17129. }
  17130. },
  17131. remove: {
  17132. lastScroll: function lastScroll() {
  17133. delete h.lastScroll;
  17134. },
  17135. elementScroll: function elementScroll(e) {
  17136. delete h.elementScroll;
  17137. },
  17138. minimumSize: function minimumSize() {
  17139. r.css("min-height", "");
  17140. },
  17141. offset: function offset() {
  17142. S.css("margin-top", "");
  17143. }
  17144. },
  17145. set: {
  17146. offset: function offset() {
  17147. h.verbose("Setting offset on element", v.offset), S.css("margin-top", v.offset);
  17148. },
  17149. containerSize: function containerSize() {
  17150. var e = r.get(0).tagName;
  17151. "HTML" === e || "body" == e ? h.determineContainer() : Math.abs(r.outerHeight() - h.cache.context.height) > v.jitter && (h.debug("Context has padding, specifying exact height for container", h.cache.context.height), r.css({
  17152. height: h.cache.context.height
  17153. }));
  17154. },
  17155. minimumSize: function minimumSize() {
  17156. var e = h.cache.element;
  17157. r.css("min-height", e.height);
  17158. },
  17159. scroll: function scroll(e) {
  17160. h.debug("Setting scroll on element", e), h.elementScroll != e && (h.is.top() && S.css("bottom", "").css("top", -e), h.is.bottom() && S.css("top", "").css("bottom", e));
  17161. },
  17162. size: function size() {
  17163. 0 !== h.cache.element.height && 0 !== h.cache.element.width && (P.style.setProperty("width", h.cache.element.width + "px", "important"), P.style.setProperty("height", h.cache.element.height + "px", "important"));
  17164. }
  17165. },
  17166. is: {
  17167. standardScroll: function standardScroll() {
  17168. return T[0] == t;
  17169. },
  17170. top: function top() {
  17171. return S.hasClass(b.top);
  17172. },
  17173. bottom: function bottom() {
  17174. return S.hasClass(b.bottom);
  17175. },
  17176. initialPosition: function initialPosition() {
  17177. return !h.is.fixed() && !h.is.bound();
  17178. },
  17179. hidden: function hidden() {
  17180. return !S.is(":visible");
  17181. },
  17182. bound: function bound() {
  17183. return S.hasClass(b.bound);
  17184. },
  17185. fixed: function fixed() {
  17186. return S.hasClass(b.fixed);
  17187. }
  17188. },
  17189. stick: function stick(e) {
  17190. var t = e || T.scrollTop(),
  17191. n = h.cache,
  17192. i = n.fits,
  17193. o = n.sameHeight,
  17194. a = n.element,
  17195. r = n.scrollContext,
  17196. s = n.context,
  17197. l = h.is.bottom() && v.pushing ? v.bottomOffset : v.offset,
  17198. c = (e = {
  17199. top: t + l,
  17200. bottom: t + l + r.height
  17201. }, h.get.direction(e.top), i ? 0 : h.get.elementScroll(e.top)),
  17202. u = !i;
  17203. 0 !== a.height && !o && (h.is.initialPosition() ? e.top >= s.bottom ? (h.debug("Initial element position is bottom of container"), h.bindBottom()) : e.top > a.top && (a.height + e.top - c >= s.bottom ? (h.debug("Initial element position is bottom of container"), h.bindBottom()) : (h.debug("Initial element position is fixed"), h.fixTop())) : h.is.fixed() ? h.is.top() ? e.top <= a.top ? (h.debug("Fixed element reached top of container"), h.setInitialPosition()) : a.height + e.top - c >= s.bottom ? (h.debug("Fixed element reached bottom of container"), h.bindBottom()) : u && (h.set.scroll(c), h.save.lastScroll(e.top), h.save.elementScroll(c)) : h.is.bottom() && (e.bottom - a.height <= a.top ? (h.debug("Bottom fixed rail has reached top of container"), h.setInitialPosition()) : e.bottom >= s.bottom ? (h.debug("Bottom fixed rail has reached bottom of container"), h.bindBottom()) : u && (h.set.scroll(c), h.save.lastScroll(e.top), h.save.elementScroll(c))) : h.is.bottom() && (e.top <= a.top ? (h.debug("Jumped from bottom fixed to top fixed, most likely used home/end button"), h.setInitialPosition()) : v.pushing ? h.is.bound() && e.bottom <= s.bottom && (h.debug("Fixing bottom attached element to bottom of browser."), h.fixBottom()) : h.is.bound() && e.top <= s.bottom - a.height && (h.debug("Fixing bottom attached element to top of browser."), h.fixTop())));
  17204. },
  17205. bindTop: function bindTop() {
  17206. h.debug("Binding element to top of parent container"), h.remove.offset(), S.css({
  17207. left: "",
  17208. top: "",
  17209. marginBottom: ""
  17210. }).removeClass(b.fixed).removeClass(b.bottom).addClass(b.bound).addClass(b.top), v.onTop.call(P), v.onUnstick.call(P);
  17211. },
  17212. bindBottom: function bindBottom() {
  17213. h.debug("Binding element to bottom of parent container"), h.remove.offset(), S.css({
  17214. left: "",
  17215. top: ""
  17216. }).removeClass(b.fixed).removeClass(b.top).addClass(b.bound).addClass(b.bottom), v.onBottom.call(P), v.onUnstick.call(P);
  17217. },
  17218. setInitialPosition: function setInitialPosition() {
  17219. h.debug("Returning to initial position"), h.unfix(), h.unbind();
  17220. },
  17221. fixTop: function fixTop() {
  17222. h.debug("Fixing element to top of page"), v.setSize && h.set.size(), h.set.minimumSize(), h.set.offset(), S.css({
  17223. left: h.cache.element.left,
  17224. bottom: "",
  17225. marginBottom: ""
  17226. }).removeClass(b.bound).removeClass(b.bottom).addClass(b.fixed).addClass(b.top), v.onStick.call(P);
  17227. },
  17228. fixBottom: function fixBottom() {
  17229. h.debug("Sticking element to bottom of page"), v.setSize && h.set.size(), h.set.minimumSize(), h.set.offset(), S.css({
  17230. left: h.cache.element.left,
  17231. bottom: "",
  17232. marginBottom: ""
  17233. }).removeClass(b.bound).removeClass(b.top).addClass(b.fixed).addClass(b.bottom), v.onStick.call(P);
  17234. },
  17235. unbind: function unbind() {
  17236. h.is.bound() && (h.debug("Removing container bound position on element"), h.remove.offset(), S.removeClass(b.bound).removeClass(b.top).removeClass(b.bottom));
  17237. },
  17238. unfix: function unfix() {
  17239. h.is.fixed() && (h.debug("Removing fixed position on element"), h.remove.minimumSize(), h.remove.offset(), S.removeClass(b.fixed).removeClass(b.top).removeClass(b.bottom), v.onUnstick.call(P));
  17240. },
  17241. reset: function reset() {
  17242. h.debug("Resetting elements position"), h.unbind(), h.unfix(), h.resetCSS(), h.remove.offset(), h.remove.lastScroll();
  17243. },
  17244. resetCSS: function resetCSS() {
  17245. S.css({
  17246. width: "",
  17247. height: ""
  17248. }), r.css({
  17249. height: ""
  17250. });
  17251. },
  17252. setting: function setting(t, n) {
  17253. if (e.isPlainObject(t)) e.extend(!0, v, t);else {
  17254. if (n === i) return v[t];
  17255. v[t] = n;
  17256. }
  17257. },
  17258. internal: function internal(t, n) {
  17259. if (e.isPlainObject(t)) e.extend(!0, h, t);else {
  17260. if (n === i) return h[t];
  17261. h[t] = n;
  17262. }
  17263. },
  17264. debug: function debug() {
  17265. !v.silent && v.debug && (v.performance ? h.performance.log(arguments) : (h.debug = Function.prototype.bind.call(console.info, console, v.name + ":"), h.debug.apply(console, arguments)));
  17266. },
  17267. verbose: function verbose() {
  17268. !v.silent && v.verbose && v.debug && (v.performance ? h.performance.log(arguments) : (h.verbose = Function.prototype.bind.call(console.info, console, v.name + ":"), h.verbose.apply(console, arguments)));
  17269. },
  17270. error: function error() {
  17271. v.silent || (h.error = Function.prototype.bind.call(console.error, console, v.name + ":"), h.error.apply(console, arguments));
  17272. },
  17273. performance: {
  17274. log: function log(e) {
  17275. var t, n;
  17276. v.performance && (n = (t = new Date().getTime()) - (l || t), l = t, c.push({
  17277. Name: e[0],
  17278. Arguments: [].slice.call(e, 1) || "",
  17279. Element: P,
  17280. "Execution Time": n
  17281. })), clearTimeout(h.performance.timer), h.performance.timer = setTimeout(h.performance.display, 0);
  17282. },
  17283. display: function display() {
  17284. var t = v.name + ":",
  17285. n = 0;
  17286. l = !1, clearTimeout(h.performance.timer), e.each(c, function (e, t) {
  17287. n += t["Execution Time"];
  17288. }), t += " " + n + "ms", s && (t += " '" + s + "'"), (console.group !== i || console.table !== i) && c.length > 0 && (console.groupCollapsed(t), console.table ? console.table(c) : e.each(c, function (e, t) {
  17289. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  17290. }), console.groupEnd()), c = [];
  17291. }
  17292. },
  17293. invoke: function invoke(t, n, o) {
  17294. var r,
  17295. s,
  17296. l,
  17297. c = A;
  17298. return n = n || f, o = P || o, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  17299. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  17300. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  17301. if (c[a] !== i) return s = c[a], !1;
  17302. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);
  17303. c = c[o];
  17304. }
  17305. })), e.isFunction(s) ? l = s.apply(o, n) : s !== i && (l = s), e.isArray(a) ? a.push(l) : a !== i ? a = [a, l] : l !== i && (a = l), s;
  17306. }
  17307. }, d ? (A === i && h.initialize(), h.invoke(u)) : (A !== i && A.invoke("destroy"), h.initialize());
  17308. }), a !== i ? a : this;
  17309. }, e.fn.sticky.settings = {
  17310. name: "Sticky",
  17311. namespace: "sticky",
  17312. silent: !1,
  17313. debug: !1,
  17314. verbose: !0,
  17315. performance: !0,
  17316. pushing: !1,
  17317. context: !1,
  17318. container: !1,
  17319. scrollContext: t,
  17320. offset: 0,
  17321. bottomOffset: 0,
  17322. jitter: 5,
  17323. setSize: !0,
  17324. observeChanges: !1,
  17325. onReposition: function onReposition() {},
  17326. onScroll: function onScroll() {},
  17327. onStick: function onStick() {},
  17328. onUnstick: function onUnstick() {},
  17329. onTop: function onTop() {},
  17330. onBottom: function onBottom() {},
  17331. error: {
  17332. container: "Sticky element must be inside a relative container",
  17333. visible: "Element is hidden, you must call refresh after element becomes visible. Use silent setting to surpress this warning in production.",
  17334. method: "The method you called is not defined.",
  17335. invalidContext: "Context specified does not exist",
  17336. elementSize: "Sticky element is larger than its container, cannot create sticky."
  17337. },
  17338. className: {
  17339. bound: "bound",
  17340. fixed: "fixed",
  17341. supported: "native",
  17342. top: "top",
  17343. bottom: "bottom"
  17344. }
  17345. };
  17346. }(jQuery, window, document), function (e, t, n, i) {
  17347. "use strict";
  17348. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.tab = function (o) {
  17349. var a,
  17350. r = e.isFunction(this) ? e(t) : e(this),
  17351. s = r.selector || "",
  17352. l = new Date().getTime(),
  17353. c = [],
  17354. u = arguments[0],
  17355. d = "string" == typeof u,
  17356. f = [].slice.call(arguments, 1),
  17357. m = !1;
  17358. return r.each(function () {
  17359. var g,
  17360. p,
  17361. h,
  17362. v,
  17363. b,
  17364. y,
  17365. x = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.tab.settings, o) : e.extend({}, e.fn.tab.settings),
  17366. C = x.className,
  17367. w = x.metadata,
  17368. S = x.selector,
  17369. k = x.error,
  17370. T = "." + x.namespace,
  17371. A = "module-" + x.namespace,
  17372. R = e(this),
  17373. P = {},
  17374. E = !0,
  17375. F = 0,
  17376. O = this,
  17377. D = R.data(A);
  17378. b = {
  17379. initialize: function initialize() {
  17380. b.debug("Initializing tab menu item", R), b.fix.callbacks(), b.determineTabs(), b.debug("Determining tabs", x.context, p), x.auto && b.set.auto(), b.bind.events(), x.history && !m && (b.initializeHistory(), m = !0), b.instantiate();
  17381. },
  17382. instantiate: function instantiate() {
  17383. b.verbose("Storing instance of module", b), D = b, R.data(A, b);
  17384. },
  17385. destroy: function destroy() {
  17386. b.debug("Destroying tabs", R), R.removeData(A).off(T);
  17387. },
  17388. bind: {
  17389. events: function events() {
  17390. e.isWindow(O) || (b.debug("Attaching tab activation events to element", R), R.on("click" + T, b.event.click));
  17391. }
  17392. },
  17393. determineTabs: function determineTabs() {
  17394. var t;
  17395. "parent" === x.context ? (R.closest(S.ui).length > 0 ? (t = R.closest(S.ui), b.verbose("Using closest UI element as parent", t)) : t = R, g = t.parent(), b.verbose("Determined parent element for creating context", g)) : x.context ? (g = e(x.context), b.verbose("Using selector for tab context", x.context, g)) : g = e("body"), x.childrenOnly ? (p = g.children(S.tabs), b.debug("Searching tab context children for tabs", g, p)) : (p = g.find(S.tabs), b.debug("Searching tab context for tabs", g, p));
  17396. },
  17397. fix: {
  17398. callbacks: function callbacks() {
  17399. e.isPlainObject(o) && (o.onTabLoad || o.onTabInit) && (o.onTabLoad && (o.onLoad = o.onTabLoad, delete o.onTabLoad, b.error(k.legacyLoad, o.onLoad)), o.onTabInit && (o.onFirstLoad = o.onTabInit, delete o.onTabInit, b.error(k.legacyInit, o.onFirstLoad)), x = e.extend(!0, {}, e.fn.tab.settings, o));
  17400. }
  17401. },
  17402. initializeHistory: function initializeHistory() {
  17403. if (b.debug("Initializing page state"), e.address === i) return b.error(k.state), !1;
  17404. if ("state" == x.historyType) {
  17405. if (b.debug("Using HTML5 to manage state"), !1 === x.path) return b.error(k.path), !1;
  17406. e.address.history(!0).state(x.path);
  17407. }
  17408. e.address.bind("change", b.event.history.change);
  17409. },
  17410. event: {
  17411. click: function click(t) {
  17412. var n = e(this).data(w.tab);
  17413. n !== i ? (x.history ? (b.verbose("Updating page state", t), e.address.value(n)) : (b.verbose("Changing tab", t), b.changeTab(n)), t.preventDefault()) : b.debug("No tab specified");
  17414. },
  17415. history: {
  17416. change: function change(t) {
  17417. var n = t.pathNames.join("/") || b.get.initialPath(),
  17418. o = x.templates.determineTitle(n) || !1;
  17419. b.performance.display(), b.debug("History change event", n, t), y = t, n !== i && b.changeTab(n), o && e.address.title(o);
  17420. }
  17421. }
  17422. },
  17423. refresh: function refresh() {
  17424. h && (b.debug("Refreshing tab", h), b.changeTab(h));
  17425. },
  17426. cache: {
  17427. read: function read(e) {
  17428. return e !== i && P[e];
  17429. },
  17430. add: function add(e, t) {
  17431. e = e || h, b.debug("Adding cached content for", e), P[e] = t;
  17432. },
  17433. remove: function remove(e) {
  17434. e = e || h, b.debug("Removing cached content for", e), delete P[e];
  17435. }
  17436. },
  17437. set: {
  17438. auto: function auto() {
  17439. var t = "string" == typeof x.path ? x.path.replace(/\/$/, "") + "/{$tab}" : "/{$tab}";
  17440. b.verbose("Setting up automatic tab retrieval from server", t), e.isPlainObject(x.apiSettings) ? x.apiSettings.url = t : x.apiSettings = {
  17441. url: t
  17442. };
  17443. },
  17444. loading: function loading(e) {
  17445. var t = b.get.tabElement(e);
  17446. t.hasClass(C.loading) || (b.verbose("Setting loading state for", t), t.addClass(C.loading).siblings(p).removeClass(C.active + " " + C.loading), t.length > 0 && x.onRequest.call(t[0], e));
  17447. },
  17448. state: function state(t) {
  17449. e.address.value(t);
  17450. }
  17451. },
  17452. changeTab: function changeTab(n) {
  17453. var i = t.history && t.history.pushState && x.ignoreFirstLoad && E,
  17454. o = x.auto || e.isPlainObject(x.apiSettings),
  17455. a = o && !i ? b.utilities.pathToArray(n) : b.get.defaultPathArray(n);
  17456. n = b.utilities.arrayToPath(a), e.each(a, function (t, r) {
  17457. var s,
  17458. l,
  17459. c,
  17460. u,
  17461. d = a.slice(0, t + 1),
  17462. f = b.utilities.arrayToPath(d),
  17463. m = b.is.tab(f),
  17464. p = t + 1 == a.length,
  17465. S = b.get.tabElement(f);
  17466. if (b.verbose("Looking for tab", r), m) {
  17467. if (b.verbose("Tab was found", r), h = f, v = b.utilities.filterArray(a, d), p ? u = !0 : (l = a.slice(0, t + 2), c = b.utilities.arrayToPath(l), (u = !b.is.tab(c)) && b.verbose("Tab parameters found", l)), u && o) return i ? (b.debug("Ignoring remote content on first tab load", f), E = !1, b.cache.add(n, S.html()), b.activate.all(f), x.onFirstLoad.call(S[0], f, v, y), x.onLoad.call(S[0], f, v, y)) : (b.activate.navigation(f), b.fetch.content(f, n)), !1;
  17468. b.debug("Opened local tab", f), b.activate.all(f), b.cache.read(f) || (b.cache.add(f, !0), b.debug("First time tab loaded calling tab init"), x.onFirstLoad.call(S[0], f, v, y)), x.onLoad.call(S[0], f, v, y);
  17469. } else {
  17470. if (-1 != n.search("/") || "" === n) return b.error(k.missingTab, R, g, f), !1;
  17471. if (f = (s = e("#" + n + ', a[name="' + n + '"]')).closest("[data-tab]").data(w.tab), S = b.get.tabElement(f), s && s.length > 0 && f) return b.debug("Anchor link used, opening parent tab", S, s), S.hasClass(C.active) || setTimeout(function () {
  17472. b.scrollTo(s);
  17473. }, 0), b.activate.all(f), b.cache.read(f) || (b.cache.add(f, !0), b.debug("First time tab loaded calling tab init"), x.onFirstLoad.call(S[0], f, v, y)), x.onLoad.call(S[0], f, v, y), !1;
  17474. }
  17475. });
  17476. },
  17477. scrollTo: function scrollTo(t) {
  17478. var i = !!(t && t.length > 0) && t.offset().top;
  17479. !1 !== i && (b.debug("Forcing scroll to an in-page link in a hidden tab", i, t), e(n).scrollTop(i));
  17480. },
  17481. update: {
  17482. content: function content(t, n, o) {
  17483. var a = b.get.tabElement(t),
  17484. r = a[0];
  17485. o = o !== i ? o : x.evaluateScripts, "string" == typeof x.cacheType && "dom" == x.cacheType.toLowerCase() && "string" != typeof n ? a.empty().append(e(n).clone(!0)) : o ? (b.debug("Updating HTML and evaluating inline scripts", t, n), a.html(n)) : (b.debug("Updating HTML", t, n), r.innerHTML = n);
  17486. }
  17487. },
  17488. fetch: {
  17489. content: function content(t, n) {
  17490. var o,
  17491. a,
  17492. r = b.get.tabElement(t),
  17493. s = {
  17494. dataType: "html",
  17495. encodeParameters: !1,
  17496. on: "now",
  17497. cache: x.alwaysRefresh,
  17498. headers: {
  17499. "X-Remote": !0
  17500. },
  17501. onSuccess: function onSuccess(e) {
  17502. "response" == x.cacheType && b.cache.add(n, e), b.update.content(t, e), t == h ? (b.debug("Content loaded", t), b.activate.tab(t)) : b.debug("Content loaded in background", t), x.onFirstLoad.call(r[0], t, v, y), x.onLoad.call(r[0], t, v, y), x.loadOnce ? b.cache.add(n, !0) : "string" == typeof x.cacheType && "dom" == x.cacheType.toLowerCase() && r.children().length > 0 ? setTimeout(function () {
  17503. var e = r.children().clone(!0);
  17504. e = e.not("script"), b.cache.add(n, e);
  17505. }, 0) : b.cache.add(n, r.html());
  17506. },
  17507. urlData: {
  17508. tab: n
  17509. }
  17510. },
  17511. l = r.api("get request") || !1,
  17512. c = l && "pending" === l.state();
  17513. n = n || t, a = b.cache.read(n), x.cache && a ? (b.activate.tab(t), b.debug("Adding cached content", n), x.loadOnce || ("once" == x.evaluateScripts ? b.update.content(t, a, !1) : b.update.content(t, a)), x.onLoad.call(r[0], t, v, y)) : c ? (b.set.loading(t), b.debug("Content is already loading", n)) : e.api !== i ? (o = e.extend(!0, {}, x.apiSettings, s), b.debug("Retrieving remote content", n, o), b.set.loading(t), r.api(o)) : b.error(k.api);
  17514. }
  17515. },
  17516. activate: {
  17517. all: function all(e) {
  17518. b.activate.tab(e), b.activate.navigation(e);
  17519. },
  17520. tab: function tab(e) {
  17521. var t = b.get.tabElement(e),
  17522. n = "siblings" == x.deactivate ? t.siblings(p) : p.not(t),
  17523. i = t.hasClass(C.active);
  17524. b.verbose("Showing tab content for", t), i || (t.addClass(C.active), n.removeClass(C.active + " " + C.loading), t.length > 0 && x.onVisible.call(t[0], e));
  17525. },
  17526. navigation: function navigation(e) {
  17527. var t = b.get.navElement(e),
  17528. n = "siblings" == x.deactivate ? t.siblings(r) : r.not(t),
  17529. i = t.hasClass(C.active);
  17530. b.verbose("Activating tab navigation for", t, e), i || (t.addClass(C.active), n.removeClass(C.active + " " + C.loading));
  17531. }
  17532. },
  17533. deactivate: {
  17534. all: function all() {
  17535. b.deactivate.navigation(), b.deactivate.tabs();
  17536. },
  17537. navigation: function navigation() {
  17538. r.removeClass(C.active);
  17539. },
  17540. tabs: function tabs() {
  17541. p.removeClass(C.active + " " + C.loading);
  17542. }
  17543. },
  17544. is: {
  17545. tab: function tab(e) {
  17546. return e !== i && b.get.tabElement(e).length > 0;
  17547. }
  17548. },
  17549. get: {
  17550. initialPath: function initialPath() {
  17551. return r.eq(0).data(w.tab) || p.eq(0).data(w.tab);
  17552. },
  17553. path: function path() {
  17554. return e.address.value();
  17555. },
  17556. defaultPathArray: function defaultPathArray(e) {
  17557. return b.utilities.pathToArray(b.get.defaultPath(e));
  17558. },
  17559. defaultPath: function defaultPath(e) {
  17560. var t = r.filter("[data-" + w.tab + '^="' + e + '/"]').eq(0).data(w.tab) || !1;
  17561. if (t) {
  17562. if (b.debug("Found default tab", t), F < x.maxDepth) return F++, b.get.defaultPath(t);
  17563. b.error(k.recursion);
  17564. } else b.debug("No default tabs found for", e, p);
  17565. return F = 0, e;
  17566. },
  17567. navElement: function navElement(e) {
  17568. return e = e || h, r.filter("[data-" + w.tab + '="' + e + '"]');
  17569. },
  17570. tabElement: function tabElement(e) {
  17571. var t, n, i, o;
  17572. return e = e || h, i = b.utilities.pathToArray(e), o = b.utilities.last(i), t = p.filter("[data-" + w.tab + '="' + e + '"]'), n = p.filter("[data-" + w.tab + '="' + o + '"]'), t.length > 0 ? t : n;
  17573. },
  17574. tab: function tab() {
  17575. return h;
  17576. }
  17577. },
  17578. utilities: {
  17579. filterArray: function filterArray(t, n) {
  17580. return e.grep(t, function (t) {
  17581. return -1 == e.inArray(t, n);
  17582. });
  17583. },
  17584. last: function last(t) {
  17585. return !!e.isArray(t) && t[t.length - 1];
  17586. },
  17587. pathToArray: function pathToArray(e) {
  17588. return e === i && (e = h), "string" == typeof e ? e.split("/") : [e];
  17589. },
  17590. arrayToPath: function arrayToPath(t) {
  17591. return !!e.isArray(t) && t.join("/");
  17592. }
  17593. },
  17594. setting: function setting(t, n) {
  17595. if (b.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, x, t);else {
  17596. if (n === i) return x[t];
  17597. e.isPlainObject(x[t]) ? e.extend(!0, x[t], n) : x[t] = n;
  17598. }
  17599. },
  17600. internal: function internal(t, n) {
  17601. if (e.isPlainObject(t)) e.extend(!0, b, t);else {
  17602. if (n === i) return b[t];
  17603. b[t] = n;
  17604. }
  17605. },
  17606. debug: function debug() {
  17607. !x.silent && x.debug && (x.performance ? b.performance.log(arguments) : (b.debug = Function.prototype.bind.call(console.info, console, x.name + ":"), b.debug.apply(console, arguments)));
  17608. },
  17609. verbose: function verbose() {
  17610. !x.silent && x.verbose && x.debug && (x.performance ? b.performance.log(arguments) : (b.verbose = Function.prototype.bind.call(console.info, console, x.name + ":"), b.verbose.apply(console, arguments)));
  17611. },
  17612. error: function error() {
  17613. x.silent || (b.error = Function.prototype.bind.call(console.error, console, x.name + ":"), b.error.apply(console, arguments));
  17614. },
  17615. performance: {
  17616. log: function log(e) {
  17617. var t, n;
  17618. x.performance && (n = (t = new Date().getTime()) - (l || t), l = t, c.push({
  17619. Name: e[0],
  17620. Arguments: [].slice.call(e, 1) || "",
  17621. Element: O,
  17622. "Execution Time": n
  17623. })), clearTimeout(b.performance.timer), b.performance.timer = setTimeout(b.performance.display, 500);
  17624. },
  17625. display: function display() {
  17626. var t = x.name + ":",
  17627. n = 0;
  17628. l = !1, clearTimeout(b.performance.timer), e.each(c, function (e, t) {
  17629. n += t["Execution Time"];
  17630. }), t += " " + n + "ms", s && (t += " '" + s + "'"), (console.group !== i || console.table !== i) && c.length > 0 && (console.groupCollapsed(t), console.table ? console.table(c) : e.each(c, function (e, t) {
  17631. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  17632. }), console.groupEnd()), c = [];
  17633. }
  17634. },
  17635. invoke: function invoke(t, n, o) {
  17636. var r,
  17637. s,
  17638. l,
  17639. c = D;
  17640. return n = n || f, o = O || o, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  17641. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  17642. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  17643. if (c[a] !== i) return s = c[a], !1;
  17644. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (b.error(k.method, t), !1);
  17645. c = c[o];
  17646. }
  17647. })), e.isFunction(s) ? l = s.apply(o, n) : s !== i && (l = s), e.isArray(a) ? a.push(l) : a !== i ? a = [a, l] : l !== i && (a = l), s;
  17648. }
  17649. }, d ? (D === i && b.initialize(), b.invoke(u)) : (D !== i && D.invoke("destroy"), b.initialize());
  17650. }), a !== i ? a : this;
  17651. }, e.tab = function () {
  17652. e(t).tab.apply(this, arguments);
  17653. }, e.fn.tab.settings = {
  17654. name: "Tab",
  17655. namespace: "tab",
  17656. silent: !1,
  17657. debug: !1,
  17658. verbose: !1,
  17659. performance: !0,
  17660. auto: !1,
  17661. history: !1,
  17662. historyType: "hash",
  17663. path: !1,
  17664. context: !1,
  17665. childrenOnly: !1,
  17666. maxDepth: 25,
  17667. deactivate: "siblings",
  17668. alwaysRefresh: !1,
  17669. cache: !0,
  17670. loadOnce: !1,
  17671. cacheType: "response",
  17672. ignoreFirstLoad: !1,
  17673. apiSettings: !1,
  17674. evaluateScripts: "once",
  17675. onFirstLoad: function onFirstLoad(e, t, n) {},
  17676. onLoad: function onLoad(e, t, n) {},
  17677. onVisible: function onVisible(e, t, n) {},
  17678. onRequest: function onRequest(e, t, n) {},
  17679. templates: {
  17680. determineTitle: function determineTitle(e) {}
  17681. },
  17682. error: {
  17683. api: "You attempted to load content without API module",
  17684. method: "The method you called is not defined",
  17685. missingTab: "Activated tab cannot be found. Tabs are case-sensitive.",
  17686. noContent: "The tab you specified is missing a content url.",
  17687. path: "History enabled, but no path was specified",
  17688. recursion: "Max recursive depth reached",
  17689. legacyInit: "onTabInit has been renamed to onFirstLoad in 2.0, please adjust your code.",
  17690. legacyLoad: "onTabLoad has been renamed to onLoad in 2.0. Please adjust your code",
  17691. state: "History requires Asual's Address library <https://github.com/asual/jquery-address>"
  17692. },
  17693. metadata: {
  17694. tab: "tab",
  17695. loaded: "loaded",
  17696. promise: "promise"
  17697. },
  17698. className: {
  17699. loading: "loading",
  17700. active: "active"
  17701. },
  17702. selector: {
  17703. tabs: ".ui.tab",
  17704. ui: ".ui"
  17705. }
  17706. };
  17707. }(jQuery, window, document), function (e, t, n, i) {
  17708. "use strict";
  17709. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.transition = function () {
  17710. var o,
  17711. a = e(this),
  17712. r = a.selector || "",
  17713. s = new Date().getTime(),
  17714. l = [],
  17715. c = arguments,
  17716. u = c[0],
  17717. d = [].slice.call(arguments, 1),
  17718. f = "string" == typeof u;
  17719. t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame;
  17720. return a.each(function (t) {
  17721. var m,
  17722. g,
  17723. p,
  17724. h,
  17725. v,
  17726. b,
  17727. y,
  17728. x,
  17729. C,
  17730. w = e(this),
  17731. S = this;
  17732. (C = {
  17733. initialize: function initialize() {
  17734. m = C.get.settings.apply(S, c), h = m.className, p = m.error, v = m.metadata, x = "." + m.namespace, y = "module-" + m.namespace, g = w.data(y) || C, b = C.get.animationEndEvent(), f && (f = C.invoke(u)), !1 === f && (C.verbose("Converted arguments into settings object", m), m.interval ? C.delay(m.animate) : C.animate(), C.instantiate());
  17735. },
  17736. instantiate: function instantiate() {
  17737. C.verbose("Storing instance of module", C), g = C, w.data(y, g);
  17738. },
  17739. destroy: function destroy() {
  17740. C.verbose("Destroying previous module for", S), w.removeData(y);
  17741. },
  17742. refresh: function refresh() {
  17743. C.verbose("Refreshing display type on next animation"), delete C.displayType;
  17744. },
  17745. forceRepaint: function forceRepaint() {
  17746. C.verbose("Forcing element repaint");
  17747. var e = w.parent(),
  17748. t = w.next();
  17749. 0 === t.length ? w.detach().appendTo(e) : w.detach().insertBefore(t);
  17750. },
  17751. repaint: function repaint() {
  17752. C.verbose("Repainting element");
  17753. S.offsetWidth;
  17754. },
  17755. delay: function delay(e) {
  17756. var n,
  17757. o = C.get.animationDirection();
  17758. o || (o = C.can.transition() ? C.get.direction() : "static"), e = e !== i ? e : m.interval, n = "auto" == m.reverse && o == h.outward || 1 == m.reverse ? (a.length - t) * m.interval : t * m.interval, C.debug("Delaying animation by", n), setTimeout(C.animate, n);
  17759. },
  17760. animate: function animate(e) {
  17761. if (m = e || m, !C.is.supported()) return C.error(p.support), !1;
  17762. if (C.debug("Preparing animation", m.animation), C.is.animating()) {
  17763. if (m.queue) return !m.allowRepeats && C.has.direction() && C.is.occurring() && !0 !== C.queuing ? C.debug("Animation is currently occurring, preventing queueing same animation", m.animation) : C.queue(m.animation), !1;
  17764. if (!m.allowRepeats && C.is.occurring()) return C.debug("Animation is already occurring, will not execute repeated animation", m.animation), !1;
  17765. C.debug("New animation started, completing previous early", m.animation), g.complete();
  17766. }
  17767. C.can.animate() ? C.set.animating(m.animation) : C.error(p.noAnimation, m.animation, S);
  17768. },
  17769. reset: function reset() {
  17770. C.debug("Resetting animation to beginning conditions"), C.remove.animationCallbacks(), C.restore.conditions(), C.remove.animating();
  17771. },
  17772. queue: function queue(e) {
  17773. C.debug("Queueing animation of", e), C.queuing = !0, w.one(b + ".queue" + x, function () {
  17774. C.queuing = !1, C.repaint(), C.animate.apply(this, m);
  17775. });
  17776. },
  17777. complete: function complete(e) {
  17778. C.debug("Animation complete", m.animation), C.remove.completeCallback(), C.remove.failSafe(), C.is.looping() || (C.is.outward() ? (C.verbose("Animation is outward, hiding element"), C.restore.conditions(), C.hide()) : C.is.inward() ? (C.verbose("Animation is outward, showing element"), C.restore.conditions(), C.show()) : (C.verbose("Static animation completed"), C.restore.conditions(), m.onComplete.call(S)));
  17779. },
  17780. force: {
  17781. visible: function visible() {
  17782. var e = w.attr("style"),
  17783. t = C.get.userStyle(),
  17784. n = C.get.displayType(),
  17785. o = t + "display: " + n + " !important;",
  17786. a = w.css("display"),
  17787. r = e === i || "" === e;
  17788. a !== n ? (C.verbose("Overriding default display to show element", n), w.attr("style", o)) : r && w.removeAttr("style");
  17789. },
  17790. hidden: function hidden() {
  17791. var e = w.attr("style"),
  17792. t = w.css("display"),
  17793. n = e === i || "" === e;
  17794. "none" === t || C.is.hidden() ? n && w.removeAttr("style") : (C.verbose("Overriding default display to hide element"), w.css("display", "none"));
  17795. }
  17796. },
  17797. has: {
  17798. direction: function direction(t) {
  17799. var n = !1;
  17800. return "string" == typeof (t = t || m.animation) && (t = t.split(" "), e.each(t, function (e, t) {
  17801. t !== h.inward && t !== h.outward || (n = !0);
  17802. })), n;
  17803. },
  17804. inlineDisplay: function inlineDisplay() {
  17805. var t = w.attr("style") || "";
  17806. return e.isArray(t.match(/display.*?;/, ""));
  17807. }
  17808. },
  17809. set: {
  17810. animating: function animating(e) {
  17811. var t;
  17812. C.remove.completeCallback(), e = e || m.animation, t = C.get.animationClass(e), C.save.animation(t), C.force.visible(), C.remove.hidden(), C.remove.direction(), C.start.animation(t);
  17813. },
  17814. duration: function duration(e, t) {
  17815. ((t = "number" == typeof (t = t || m.duration) ? t + "ms" : t) || 0 === t) && (C.verbose("Setting animation duration", t), w.css({
  17816. "animation-duration": t
  17817. }));
  17818. },
  17819. direction: function direction(e) {
  17820. (e = e || C.get.direction()) == h.inward ? C.set.inward() : C.set.outward();
  17821. },
  17822. looping: function looping() {
  17823. C.debug("Transition set to loop"), w.addClass(h.looping);
  17824. },
  17825. hidden: function hidden() {
  17826. w.addClass(h.transition).addClass(h.hidden);
  17827. },
  17828. inward: function inward() {
  17829. C.debug("Setting direction to inward"), w.removeClass(h.outward).addClass(h.inward);
  17830. },
  17831. outward: function outward() {
  17832. C.debug("Setting direction to outward"), w.removeClass(h.inward).addClass(h.outward);
  17833. },
  17834. visible: function visible() {
  17835. w.addClass(h.transition).addClass(h.visible);
  17836. }
  17837. },
  17838. start: {
  17839. animation: function animation(e) {
  17840. e = e || C.get.animationClass(), C.debug("Starting tween", e), w.addClass(e).one(b + ".complete" + x, C.complete), m.useFailSafe && C.add.failSafe(), C.set.duration(m.duration), m.onStart.call(S);
  17841. }
  17842. },
  17843. save: {
  17844. animation: function animation(e) {
  17845. C.cache || (C.cache = {}), C.cache.animation = e;
  17846. },
  17847. displayType: function displayType(e) {
  17848. "none" !== e && w.data(v.displayType, e);
  17849. },
  17850. transitionExists: function transitionExists(t, n) {
  17851. e.fn.transition.exists[t] = n, C.verbose("Saving existence of transition", t, n);
  17852. }
  17853. },
  17854. restore: {
  17855. conditions: function conditions() {
  17856. var e = C.get.currentAnimation();
  17857. e && (w.removeClass(e), C.verbose("Removing animation class", C.cache)), C.remove.duration();
  17858. }
  17859. },
  17860. add: {
  17861. failSafe: function failSafe() {
  17862. var e = C.get.duration();
  17863. C.timer = setTimeout(function () {
  17864. w.triggerHandler(b);
  17865. }, e + m.failSafeDelay), C.verbose("Adding fail safe timer", C.timer);
  17866. }
  17867. },
  17868. remove: {
  17869. animating: function animating() {
  17870. w.removeClass(h.animating);
  17871. },
  17872. animationCallbacks: function animationCallbacks() {
  17873. C.remove.queueCallback(), C.remove.completeCallback();
  17874. },
  17875. queueCallback: function queueCallback() {
  17876. w.off(".queue" + x);
  17877. },
  17878. completeCallback: function completeCallback() {
  17879. w.off(".complete" + x);
  17880. },
  17881. display: function display() {
  17882. w.css("display", "");
  17883. },
  17884. direction: function direction() {
  17885. w.removeClass(h.inward).removeClass(h.outward);
  17886. },
  17887. duration: function duration() {
  17888. w.css("animation-duration", "");
  17889. },
  17890. failSafe: function failSafe() {
  17891. C.verbose("Removing fail safe timer", C.timer), C.timer && clearTimeout(C.timer);
  17892. },
  17893. hidden: function hidden() {
  17894. w.removeClass(h.hidden);
  17895. },
  17896. visible: function visible() {
  17897. w.removeClass(h.visible);
  17898. },
  17899. looping: function looping() {
  17900. C.debug("Transitions are no longer looping"), C.is.looping() && (C.reset(), w.removeClass(h.looping));
  17901. },
  17902. transition: function transition() {
  17903. w.removeClass(h.visible).removeClass(h.hidden);
  17904. }
  17905. },
  17906. get: {
  17907. settings: function settings(t, n, i) {
  17908. return "object" == _typeof(t) ? e.extend(!0, {}, e.fn.transition.settings, t) : "function" == typeof i ? e.extend({}, e.fn.transition.settings, {
  17909. animation: t,
  17910. onComplete: i,
  17911. duration: n
  17912. }) : "string" == typeof n || "number" == typeof n ? e.extend({}, e.fn.transition.settings, {
  17913. animation: t,
  17914. duration: n
  17915. }) : "object" == _typeof(n) ? e.extend({}, e.fn.transition.settings, n, {
  17916. animation: t
  17917. }) : "function" == typeof n ? e.extend({}, e.fn.transition.settings, {
  17918. animation: t,
  17919. onComplete: n
  17920. }) : e.extend({}, e.fn.transition.settings, {
  17921. animation: t
  17922. });
  17923. },
  17924. animationClass: function animationClass(e) {
  17925. var t = e || m.animation,
  17926. n = C.can.transition() && !C.has.direction() ? C.get.direction() + " " : "";
  17927. return h.animating + " " + h.transition + " " + n + t;
  17928. },
  17929. currentAnimation: function currentAnimation() {
  17930. return !(!C.cache || C.cache.animation === i) && C.cache.animation;
  17931. },
  17932. currentDirection: function currentDirection() {
  17933. return C.is.inward() ? h.inward : h.outward;
  17934. },
  17935. direction: function direction() {
  17936. return C.is.hidden() || !C.is.visible() ? h.inward : h.outward;
  17937. },
  17938. animationDirection: function animationDirection(t) {
  17939. var n;
  17940. return "string" == typeof (t = t || m.animation) && (t = t.split(" "), e.each(t, function (e, t) {
  17941. t === h.inward ? n = h.inward : t === h.outward && (n = h.outward);
  17942. })), n || !1;
  17943. },
  17944. duration: function duration(e) {
  17945. return !1 === (e = e || m.duration) && (e = w.css("animation-duration") || 0), "string" == typeof e ? e.indexOf("ms") > -1 ? parseFloat(e) : 1e3 * parseFloat(e) : e;
  17946. },
  17947. displayType: function displayType(e) {
  17948. return e = e === i || e, m.displayType ? m.displayType : (e && w.data(v.displayType) === i && C.can.transition(!0), w.data(v.displayType));
  17949. },
  17950. userStyle: function userStyle(e) {
  17951. return (e = e || w.attr("style") || "").replace(/display.*?;/, "");
  17952. },
  17953. transitionExists: function transitionExists(t) {
  17954. return e.fn.transition.exists[t];
  17955. },
  17956. animationStartEvent: function animationStartEvent() {
  17957. var e,
  17958. t = n.createElement("div"),
  17959. o = {
  17960. animation: "animationstart",
  17961. OAnimation: "oAnimationStart",
  17962. MozAnimation: "mozAnimationStart",
  17963. WebkitAnimation: "webkitAnimationStart"
  17964. };
  17965. for (e in o) {
  17966. if (t.style[e] !== i) return o[e];
  17967. }
  17968. return !1;
  17969. },
  17970. animationEndEvent: function animationEndEvent() {
  17971. var e,
  17972. t = n.createElement("div"),
  17973. o = {
  17974. animation: "animationend",
  17975. OAnimation: "oAnimationEnd",
  17976. MozAnimation: "mozAnimationEnd",
  17977. WebkitAnimation: "webkitAnimationEnd"
  17978. };
  17979. for (e in o) {
  17980. if (t.style[e] !== i) return o[e];
  17981. }
  17982. return !1;
  17983. }
  17984. },
  17985. can: {
  17986. transition: function transition(t) {
  17987. var n,
  17988. o,
  17989. a,
  17990. r,
  17991. s,
  17992. l,
  17993. c = m.animation,
  17994. u = C.get.transitionExists(c),
  17995. d = C.get.displayType(!1);
  17996. if (u === i || t) {
  17997. if (C.verbose("Determining whether animation exists"), n = w.attr("class"), o = w.prop("tagName"), r = (a = e("<" + o + " />").addClass(n).insertAfter(w)).addClass(c).removeClass(h.inward).removeClass(h.outward).addClass(h.animating).addClass(h.transition).css("animationName"), s = a.addClass(h.inward).css("animationName"), d || (d = a.attr("class", n).removeAttr("style").removeClass(h.hidden).removeClass(h.visible).show().css("display"), C.verbose("Determining final display state", d), C.save.displayType(d)), a.remove(), r != s) C.debug("Direction exists for animation", c), l = !0;else {
  17998. if ("none" == r || !r) return void C.debug("No animation defined in css", c);
  17999. C.debug("Static animation found", c, d), l = !1;
  18000. }
  18001. C.save.transitionExists(c, l);
  18002. }
  18003. return u !== i ? u : l;
  18004. },
  18005. animate: function animate() {
  18006. return C.can.transition() !== i;
  18007. }
  18008. },
  18009. is: {
  18010. animating: function animating() {
  18011. return w.hasClass(h.animating);
  18012. },
  18013. inward: function inward() {
  18014. return w.hasClass(h.inward);
  18015. },
  18016. outward: function outward() {
  18017. return w.hasClass(h.outward);
  18018. },
  18019. looping: function looping() {
  18020. return w.hasClass(h.looping);
  18021. },
  18022. occurring: function occurring(e) {
  18023. return e = "." + (e = e || m.animation).replace(" ", "."), w.filter(e).length > 0;
  18024. },
  18025. visible: function visible() {
  18026. return w.is(":visible");
  18027. },
  18028. hidden: function hidden() {
  18029. return "hidden" === w.css("visibility");
  18030. },
  18031. supported: function supported() {
  18032. return !1 !== b;
  18033. }
  18034. },
  18035. hide: function hide() {
  18036. C.verbose("Hiding element"), C.is.animating() && C.reset(), S.blur(), C.remove.display(), C.remove.visible(), C.set.hidden(), C.force.hidden(), m.onHide.call(S), m.onComplete.call(S);
  18037. },
  18038. show: function show(e) {
  18039. C.verbose("Showing element", e), C.remove.hidden(), C.set.visible(), C.force.visible(), m.onShow.call(S), m.onComplete.call(S);
  18040. },
  18041. toggle: function toggle() {
  18042. C.is.visible() ? C.hide() : C.show();
  18043. },
  18044. stop: function stop() {
  18045. C.debug("Stopping current animation"), w.triggerHandler(b);
  18046. },
  18047. stopAll: function stopAll() {
  18048. C.debug("Stopping all animation"), C.remove.queueCallback(), w.triggerHandler(b);
  18049. },
  18050. clear: {
  18051. queue: function queue() {
  18052. C.debug("Clearing animation queue"), C.remove.queueCallback();
  18053. }
  18054. },
  18055. enable: function enable() {
  18056. C.verbose("Starting animation"), w.removeClass(h.disabled);
  18057. },
  18058. disable: function disable() {
  18059. C.debug("Stopping animation"), w.addClass(h.disabled);
  18060. },
  18061. setting: function setting(t, n) {
  18062. if (C.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, m, t);else {
  18063. if (n === i) return m[t];
  18064. e.isPlainObject(m[t]) ? e.extend(!0, m[t], n) : m[t] = n;
  18065. }
  18066. },
  18067. internal: function internal(t, n) {
  18068. if (e.isPlainObject(t)) e.extend(!0, C, t);else {
  18069. if (n === i) return C[t];
  18070. C[t] = n;
  18071. }
  18072. },
  18073. debug: function debug() {
  18074. !m.silent && m.debug && (m.performance ? C.performance.log(arguments) : (C.debug = Function.prototype.bind.call(console.info, console, m.name + ":"), C.debug.apply(console, arguments)));
  18075. },
  18076. verbose: function verbose() {
  18077. !m.silent && m.verbose && m.debug && (m.performance ? C.performance.log(arguments) : (C.verbose = Function.prototype.bind.call(console.info, console, m.name + ":"), C.verbose.apply(console, arguments)));
  18078. },
  18079. error: function error() {
  18080. m.silent || (C.error = Function.prototype.bind.call(console.error, console, m.name + ":"), C.error.apply(console, arguments));
  18081. },
  18082. performance: {
  18083. log: function log(e) {
  18084. var t, n;
  18085. m.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({
  18086. Name: e[0],
  18087. Arguments: [].slice.call(e, 1) || "",
  18088. Element: S,
  18089. "Execution Time": n
  18090. })), clearTimeout(C.performance.timer), C.performance.timer = setTimeout(C.performance.display, 500);
  18091. },
  18092. display: function display() {
  18093. var t = m.name + ":",
  18094. n = 0;
  18095. s = !1, clearTimeout(C.performance.timer), e.each(l, function (e, t) {
  18096. n += t["Execution Time"];
  18097. }), t += " " + n + "ms", r && (t += " '" + r + "'"), a.length > 1 && (t += " (" + a.length + ")"), (console.group !== i || console.table !== i) && l.length > 0 && (console.groupCollapsed(t), console.table ? console.table(l) : e.each(l, function (e, t) {
  18098. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  18099. }), console.groupEnd()), l = [];
  18100. }
  18101. },
  18102. invoke: function invoke(t, n, a) {
  18103. var r,
  18104. s,
  18105. l,
  18106. c = g;
  18107. return n = n || d, a = S || a, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  18108. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  18109. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  18110. if (c[a] !== i) return s = c[a], !1;
  18111. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);
  18112. c = c[o];
  18113. }
  18114. })), e.isFunction(s) ? l = s.apply(a, n) : s !== i && (l = s), e.isArray(o) ? o.push(l) : o !== i ? o = [o, l] : l !== i && (o = l), s !== i && s;
  18115. }
  18116. }).initialize();
  18117. }), o !== i ? o : this;
  18118. }, e.fn.transition.exists = {}, e.fn.transition.settings = {
  18119. name: "Transition",
  18120. silent: !1,
  18121. debug: !1,
  18122. verbose: !1,
  18123. performance: !0,
  18124. namespace: "transition",
  18125. interval: 0,
  18126. reverse: "auto",
  18127. onStart: function onStart() {},
  18128. onComplete: function onComplete() {},
  18129. onShow: function onShow() {},
  18130. onHide: function onHide() {},
  18131. useFailSafe: !0,
  18132. failSafeDelay: 100,
  18133. allowRepeats: !1,
  18134. displayType: !1,
  18135. animation: "fade",
  18136. duration: !1,
  18137. queue: !0,
  18138. metadata: {
  18139. displayType: "display"
  18140. },
  18141. className: {
  18142. animating: "animating",
  18143. disabled: "disabled",
  18144. hidden: "hidden",
  18145. inward: "in",
  18146. loading: "loading",
  18147. looping: "looping",
  18148. outward: "out",
  18149. transition: "transition",
  18150. visible: "visible"
  18151. },
  18152. error: {
  18153. noAnimation: "Element is no longer attached to DOM. Unable to animate. Use silent setting to surpress this warning in production.",
  18154. repeated: "That animation is already occurring, cancelling repeated animation",
  18155. method: "The method you called is not defined",
  18156. support: "This browser does not support CSS animations"
  18157. }
  18158. };
  18159. }(jQuery, window, document), function (e, t, n, i) {
  18160. "use strict";
  18161. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")();
  18162. e.api = e.fn.api = function (n) {
  18163. var o,
  18164. a = e.isFunction(this) ? e(t) : e(this),
  18165. r = a.selector || "",
  18166. s = new Date().getTime(),
  18167. l = [],
  18168. c = arguments[0],
  18169. u = "string" == typeof c,
  18170. d = [].slice.call(arguments, 1);
  18171. return a.each(function () {
  18172. var a,
  18173. f,
  18174. m,
  18175. g,
  18176. p,
  18177. h,
  18178. v = e.isPlainObject(n) ? e.extend(!0, {}, e.fn.api.settings, n) : e.extend({}, e.fn.api.settings),
  18179. b = v.namespace,
  18180. y = v.metadata,
  18181. x = v.selector,
  18182. C = v.error,
  18183. w = v.className,
  18184. S = "." + b,
  18185. k = "module-" + b,
  18186. T = e(this),
  18187. A = T.closest(x.form),
  18188. R = v.stateContext ? e(v.stateContext) : T,
  18189. P = this,
  18190. E = R[0],
  18191. F = T.data(k);
  18192. h = {
  18193. initialize: function initialize() {
  18194. u || h.bind.events(), h.instantiate();
  18195. },
  18196. instantiate: function instantiate() {
  18197. h.verbose("Storing instance of module", h), F = h, T.data(k, F);
  18198. },
  18199. destroy: function destroy() {
  18200. h.verbose("Destroying previous module for", P), T.removeData(k).off(S);
  18201. },
  18202. bind: {
  18203. events: function events() {
  18204. var e = h.get.event();
  18205. e ? (h.verbose("Attaching API events to element", e), T.on(e + S, h.event.trigger)) : "now" == v.on && (h.debug("Querying API endpoint immediately"), h.query());
  18206. }
  18207. },
  18208. decode: {
  18209. json: function json(e) {
  18210. if (e !== i && "string" == typeof e) try {
  18211. e = JSON.parse(e);
  18212. } catch (e) {}
  18213. return e;
  18214. }
  18215. },
  18216. read: {
  18217. cachedResponse: function cachedResponse(e) {
  18218. var n;
  18219. if (t.Storage !== i) return n = sessionStorage.getItem(e), h.debug("Using cached response", e, n), n = h.decode.json(n);
  18220. h.error(C.noStorage);
  18221. }
  18222. },
  18223. write: {
  18224. cachedResponse: function cachedResponse(n, o) {
  18225. o && "" === o ? h.debug("Response empty, not caching", o) : t.Storage !== i ? (e.isPlainObject(o) && (o = JSON.stringify(o)), sessionStorage.setItem(n, o), h.verbose("Storing cached response for url", n, o)) : h.error(C.noStorage);
  18226. }
  18227. },
  18228. query: function query() {
  18229. if (h.is.disabled()) h.debug("Element is disabled API request aborted");else {
  18230. if (h.is.loading()) {
  18231. if (!v.interruptRequests) return void h.debug("Cancelling request, previous request is still pending");
  18232. h.debug("Interrupting previous request"), h.abort();
  18233. }
  18234. if (v.defaultData && e.extend(!0, v.urlData, h.get.defaultData()), v.serializeForm && (v.data = h.add.formData(v.data)), !1 === (f = h.get.settings())) return h.cancelled = !0, void h.error(C.beforeSend);
  18235. if (h.cancelled = !1, (m = h.get.templatedURL()) || h.is.mocked()) {
  18236. if ((m = h.add.urlData(m)) || h.is.mocked()) {
  18237. if (f.url = v.base + m, a = e.extend(!0, {}, v, {
  18238. type: v.method || v.type,
  18239. data: g,
  18240. url: v.base + m,
  18241. beforeSend: v.beforeXHR,
  18242. success: function success() {},
  18243. failure: function failure() {},
  18244. complete: function complete() {}
  18245. }), h.debug("Querying URL", a.url), h.verbose("Using AJAX settings", a), "local" === v.cache && h.read.cachedResponse(m)) return h.debug("Response returned from local cache"), h.request = h.create.request(), void h.request.resolveWith(E, [h.read.cachedResponse(m)]);
  18246. v.throttle ? v.throttleFirstRequest || h.timer ? (h.debug("Throttling request", v.throttle), clearTimeout(h.timer), h.timer = setTimeout(function () {
  18247. h.timer && delete h.timer, h.debug("Sending throttled request", g, a.method), h.send.request();
  18248. }, v.throttle)) : (h.debug("Sending request", g, a.method), h.send.request(), h.timer = setTimeout(function () {}, v.throttle)) : (h.debug("Sending request", g, a.method), h.send.request());
  18249. }
  18250. } else h.error(C.missingURL);
  18251. }
  18252. },
  18253. should: {
  18254. removeError: function removeError() {
  18255. return !0 === v.hideError || "auto" === v.hideError && !h.is.form();
  18256. }
  18257. },
  18258. is: {
  18259. disabled: function disabled() {
  18260. return T.filter(x.disabled).length > 0;
  18261. },
  18262. expectingJSON: function expectingJSON() {
  18263. return "json" === v.dataType || "jsonp" === v.dataType;
  18264. },
  18265. form: function form() {
  18266. return T.is("form") || R.is("form");
  18267. },
  18268. mocked: function mocked() {
  18269. return v.mockResponse || v.mockResponseAsync || v.response || v.responseAsync;
  18270. },
  18271. input: function input() {
  18272. return T.is("input");
  18273. },
  18274. loading: function loading() {
  18275. return !!h.request && "pending" == h.request.state();
  18276. },
  18277. abortedRequest: function abortedRequest(e) {
  18278. return e && e.readyState !== i && 0 === e.readyState ? (h.verbose("XHR request determined to be aborted"), !0) : (h.verbose("XHR request was not aborted"), !1);
  18279. },
  18280. validResponse: function validResponse(t) {
  18281. return h.is.expectingJSON() && e.isFunction(v.successTest) ? (h.debug("Checking JSON returned success", v.successTest, t), v.successTest(t) ? (h.debug("Response passed success test", t), !0) : (h.debug("Response failed success test", t), !1)) : (h.verbose("Response is not JSON, skipping validation", v.successTest, t), !0);
  18282. }
  18283. },
  18284. was: {
  18285. cancelled: function cancelled() {
  18286. return h.cancelled || !1;
  18287. },
  18288. succesful: function succesful() {
  18289. return h.request && "resolved" == h.request.state();
  18290. },
  18291. failure: function failure() {
  18292. return h.request && "rejected" == h.request.state();
  18293. },
  18294. complete: function complete() {
  18295. return h.request && ("resolved" == h.request.state() || "rejected" == h.request.state());
  18296. }
  18297. },
  18298. add: {
  18299. urlData: function urlData(t, n) {
  18300. var o, a;
  18301. return t && (o = t.match(v.regExp.required), a = t.match(v.regExp.optional), n = n || v.urlData, o && (h.debug("Looking for required URL variables", o), e.each(o, function (o, a) {
  18302. var r = -1 !== a.indexOf("$") ? a.substr(2, a.length - 3) : a.substr(1, a.length - 2),
  18303. s = e.isPlainObject(n) && n[r] !== i ? n[r] : T.data(r) !== i ? T.data(r) : R.data(r) !== i ? R.data(r) : n[r];
  18304. if (s === i) return h.error(C.requiredParameter, r, t), t = !1, !1;
  18305. h.verbose("Found required variable", r, s), s = v.encodeParameters ? h.get.urlEncodedValue(s) : s, t = t.replace(a, s);
  18306. })), a && (h.debug("Looking for optional URL variables", o), e.each(a, function (o, a) {
  18307. var r = -1 !== a.indexOf("$") ? a.substr(3, a.length - 4) : a.substr(2, a.length - 3),
  18308. s = e.isPlainObject(n) && n[r] !== i ? n[r] : T.data(r) !== i ? T.data(r) : R.data(r) !== i ? R.data(r) : n[r];
  18309. s !== i ? (h.verbose("Optional variable Found", r, s), t = t.replace(a, s)) : (h.verbose("Optional variable not found", r), t = -1 !== t.indexOf("/" + a) ? t.replace("/" + a, "") : t.replace(a, ""));
  18310. }))), t;
  18311. },
  18312. formData: function formData(t) {
  18313. var n = e.fn.serializeObject !== i,
  18314. o = n ? A.serializeObject() : A.serialize();
  18315. return t = t || v.data, e.isPlainObject(t) ? n ? (h.debug("Extending existing data with form data", t, o), t = e.extend(!0, {}, t, o)) : (h.error(C.missingSerialize), h.debug("Cant extend data. Replacing data with form data", t, o), t = o) : (h.debug("Adding form data", o), t = o), t;
  18316. }
  18317. },
  18318. send: {
  18319. request: function request() {
  18320. h.set.loading(), h.request = h.create.request(), h.is.mocked() ? h.mockedXHR = h.create.mockedXHR() : h.xhr = h.create.xhr(), v.onRequest.call(E, h.request, h.xhr);
  18321. }
  18322. },
  18323. event: {
  18324. trigger: function trigger(e) {
  18325. h.query(), "submit" != e.type && "click" != e.type || e.preventDefault();
  18326. },
  18327. xhr: {
  18328. always: function always() {},
  18329. done: function done(t, n, i) {
  18330. var o = this,
  18331. a = new Date().getTime() - p,
  18332. r = v.loadingDuration - a,
  18333. s = !!e.isFunction(v.onResponse) && (h.is.expectingJSON() ? v.onResponse.call(o, e.extend(!0, {}, t)) : v.onResponse.call(o, t));
  18334. r = r > 0 ? r : 0, s && (h.debug("Modified API response in onResponse callback", v.onResponse, s, t), t = s), r > 0 && h.debug("Response completed early delaying state change by", r), setTimeout(function () {
  18335. h.is.validResponse(t) ? h.request.resolveWith(o, [t, i]) : h.request.rejectWith(o, [i, "invalid"]);
  18336. }, r);
  18337. },
  18338. fail: function fail(e, t, n) {
  18339. var i = this,
  18340. o = new Date().getTime() - p,
  18341. a = v.loadingDuration - o;
  18342. (a = a > 0 ? a : 0) > 0 && h.debug("Response completed early delaying state change by", a), setTimeout(function () {
  18343. h.is.abortedRequest(e) ? h.request.rejectWith(i, [e, "aborted", n]) : h.request.rejectWith(i, [e, "error", t, n]);
  18344. }, a);
  18345. }
  18346. },
  18347. request: {
  18348. done: function done(e, t) {
  18349. h.debug("Successful API Response", e), "local" === v.cache && m && (h.write.cachedResponse(m, e), h.debug("Saving server response locally", h.cache)), v.onSuccess.call(E, e, T, t);
  18350. },
  18351. complete: function complete(e, t) {
  18352. var n, i;
  18353. h.was.succesful() ? (i = e, n = t) : (n = e, i = h.get.responseFromXHR(n)), h.remove.loading(), v.onComplete.call(E, i, T, n);
  18354. },
  18355. fail: function fail(e, t, n) {
  18356. var o = h.get.responseFromXHR(e),
  18357. r = h.get.errorFromRequest(o, t, n);
  18358. if ("aborted" == t) return h.debug("XHR Aborted (Most likely caused by page navigation or CORS Policy)", t, n), v.onAbort.call(E, t, T, e), !0;
  18359. "invalid" == t ? h.debug("JSON did not pass success test. A server-side error has most likely occurred", o) : "error" == t && e !== i && (h.debug("XHR produced a server error", t, n), 200 != e.status && n !== i && "" !== n && h.error(C.statusMessage + n, a.url), v.onError.call(E, r, T, e)), v.errorDuration && "aborted" !== t && (h.debug("Adding error state"), h.set.error(), h.should.removeError() && setTimeout(h.remove.error, v.errorDuration)), h.debug("API Request failed", r, e), v.onFailure.call(E, o, T, e);
  18360. }
  18361. }
  18362. },
  18363. create: {
  18364. request: function request() {
  18365. return e.Deferred().always(h.event.request.complete).done(h.event.request.done).fail(h.event.request.fail);
  18366. },
  18367. mockedXHR: function mockedXHR() {
  18368. var t,
  18369. n,
  18370. i,
  18371. o = v.mockResponse || v.response,
  18372. a = v.mockResponseAsync || v.responseAsync;
  18373. return i = e.Deferred().always(h.event.xhr.complete).done(h.event.xhr.done).fail(h.event.xhr.fail), o ? (e.isFunction(o) ? (h.debug("Using specified synchronous callback", o), n = o.call(E, f)) : (h.debug("Using settings specified response", o), n = o), i.resolveWith(E, [n, !1, {
  18374. responseText: n
  18375. }])) : e.isFunction(a) && (t = function t(e) {
  18376. h.debug("Async callback returned response", e), e ? i.resolveWith(E, [e, !1, {
  18377. responseText: e
  18378. }]) : i.rejectWith(E, [{
  18379. responseText: e
  18380. }, !1, !1]);
  18381. }, h.debug("Using specified async response callback", a), a.call(E, f, t)), i;
  18382. },
  18383. xhr: function xhr() {
  18384. var t;
  18385. return t = e.ajax(a).always(h.event.xhr.always).done(h.event.xhr.done).fail(h.event.xhr.fail), h.verbose("Created server request", t, a), t;
  18386. }
  18387. },
  18388. set: {
  18389. error: function error() {
  18390. h.verbose("Adding error state to element", R), R.addClass(w.error);
  18391. },
  18392. loading: function loading() {
  18393. h.verbose("Adding loading state to element", R), R.addClass(w.loading), p = new Date().getTime();
  18394. }
  18395. },
  18396. remove: {
  18397. error: function error() {
  18398. h.verbose("Removing error state from element", R), R.removeClass(w.error);
  18399. },
  18400. loading: function loading() {
  18401. h.verbose("Removing loading state from element", R), R.removeClass(w.loading);
  18402. }
  18403. },
  18404. get: {
  18405. responseFromXHR: function responseFromXHR(t) {
  18406. return !!e.isPlainObject(t) && (h.is.expectingJSON() ? h.decode.json(t.responseText) : t.responseText);
  18407. },
  18408. errorFromRequest: function errorFromRequest(t, n, o) {
  18409. return e.isPlainObject(t) && t.error !== i ? t.error : v.error[n] !== i ? v.error[n] : o;
  18410. },
  18411. request: function request() {
  18412. return h.request || !1;
  18413. },
  18414. xhr: function xhr() {
  18415. return h.xhr || !1;
  18416. },
  18417. settings: function settings() {
  18418. var t;
  18419. return (t = v.beforeSend.call(E, v)) && (t.success !== i && (h.debug("Legacy success callback detected", t), h.error(C.legacyParameters, t.success), t.onSuccess = t.success), t.failure !== i && (h.debug("Legacy failure callback detected", t), h.error(C.legacyParameters, t.failure), t.onFailure = t.failure), t.complete !== i && (h.debug("Legacy complete callback detected", t), h.error(C.legacyParameters, t.complete), t.onComplete = t.complete)), t === i && h.error(C.noReturnedValue), !1 === t ? t : t !== i ? e.extend(!0, {}, t) : e.extend(!0, {}, v);
  18420. },
  18421. urlEncodedValue: function urlEncodedValue(e) {
  18422. var n = t.decodeURIComponent(e),
  18423. i = t.encodeURIComponent(e);
  18424. return n !== e ? (h.debug("URL value is already encoded, avoiding double encoding", e), e) : (h.verbose("Encoding value using encodeURIComponent", e, i), i);
  18425. },
  18426. defaultData: function defaultData() {
  18427. var t = {};
  18428. return e.isWindow(P) || (h.is.input() ? t.value = T.val() : h.is.form() || (t.text = T.text())), t;
  18429. },
  18430. event: function event() {
  18431. return e.isWindow(P) || "now" == v.on ? (h.debug("API called without element, no events attached"), !1) : "auto" == v.on ? T.is("input") ? P.oninput !== i ? "input" : P.onpropertychange !== i ? "propertychange" : "keyup" : T.is("form") ? "submit" : "click" : v.on;
  18432. },
  18433. templatedURL: function templatedURL(e) {
  18434. if (e = e || T.data(y.action) || v.action || !1, m = T.data(y.url) || v.url || !1) return h.debug("Using specified url", m), m;
  18435. if (e) {
  18436. if (h.debug("Looking up url for action", e, v.api), v.api[e] === i && !h.is.mocked()) return void h.error(C.missingAction, v.action, v.api);
  18437. m = v.api[e];
  18438. } else h.is.form() && (m = T.attr("action") || R.attr("action") || !1, h.debug("No url or action specified, defaulting to form action", m));
  18439. return m;
  18440. }
  18441. },
  18442. abort: function abort() {
  18443. var e = h.get.xhr();
  18444. e && "resolved" !== e.state() && (h.debug("Cancelling API request"), e.abort());
  18445. },
  18446. reset: function reset() {
  18447. h.remove.error(), h.remove.loading();
  18448. },
  18449. setting: function setting(t, n) {
  18450. if (h.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, v, t);else {
  18451. if (n === i) return v[t];
  18452. e.isPlainObject(v[t]) ? e.extend(!0, v[t], n) : v[t] = n;
  18453. }
  18454. },
  18455. internal: function internal(t, n) {
  18456. if (e.isPlainObject(t)) e.extend(!0, h, t);else {
  18457. if (n === i) return h[t];
  18458. h[t] = n;
  18459. }
  18460. },
  18461. debug: function debug() {
  18462. !v.silent && v.debug && (v.performance ? h.performance.log(arguments) : (h.debug = Function.prototype.bind.call(console.info, console, v.name + ":"), h.debug.apply(console, arguments)));
  18463. },
  18464. verbose: function verbose() {
  18465. !v.silent && v.verbose && v.debug && (v.performance ? h.performance.log(arguments) : (h.verbose = Function.prototype.bind.call(console.info, console, v.name + ":"), h.verbose.apply(console, arguments)));
  18466. },
  18467. error: function error() {
  18468. v.silent || (h.error = Function.prototype.bind.call(console.error, console, v.name + ":"), h.error.apply(console, arguments));
  18469. },
  18470. performance: {
  18471. log: function log(e) {
  18472. var t, n;
  18473. v.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({
  18474. Name: e[0],
  18475. Arguments: [].slice.call(e, 1) || "",
  18476. "Execution Time": n
  18477. })), clearTimeout(h.performance.timer), h.performance.timer = setTimeout(h.performance.display, 500);
  18478. },
  18479. display: function display() {
  18480. var t = v.name + ":",
  18481. n = 0;
  18482. s = !1, clearTimeout(h.performance.timer), e.each(l, function (e, t) {
  18483. n += t["Execution Time"];
  18484. }), t += " " + n + "ms", r && (t += " '" + r + "'"), (console.group !== i || console.table !== i) && l.length > 0 && (console.groupCollapsed(t), console.table ? console.table(l) : e.each(l, function (e, t) {
  18485. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  18486. }), console.groupEnd()), l = [];
  18487. }
  18488. },
  18489. invoke: function invoke(t, n, a) {
  18490. var r,
  18491. s,
  18492. l,
  18493. c = F;
  18494. return n = n || d, a = P || a, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  18495. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  18496. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  18497. if (c[a] !== i) return s = c[a], !1;
  18498. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (h.error(C.method, t), !1);
  18499. c = c[o];
  18500. }
  18501. })), e.isFunction(s) ? l = s.apply(a, n) : s !== i && (l = s), e.isArray(o) ? o.push(l) : o !== i ? o = [o, l] : l !== i && (o = l), s;
  18502. }
  18503. }, u ? (F === i && h.initialize(), h.invoke(c)) : (F !== i && F.invoke("destroy"), h.initialize());
  18504. }), o !== i ? o : this;
  18505. }, e.api.settings = {
  18506. name: "API",
  18507. namespace: "api",
  18508. debug: !1,
  18509. verbose: !1,
  18510. performance: !0,
  18511. api: {},
  18512. cache: !0,
  18513. interruptRequests: !0,
  18514. on: "auto",
  18515. stateContext: !1,
  18516. loadingDuration: 0,
  18517. hideError: "auto",
  18518. errorDuration: 2e3,
  18519. encodeParameters: !0,
  18520. action: !1,
  18521. url: !1,
  18522. base: "",
  18523. urlData: {},
  18524. defaultData: !0,
  18525. serializeForm: !1,
  18526. throttle: 0,
  18527. throttleFirstRequest: !0,
  18528. method: "get",
  18529. data: {},
  18530. dataType: "json",
  18531. mockResponse: !1,
  18532. mockResponseAsync: !1,
  18533. response: !1,
  18534. responseAsync: !1,
  18535. beforeSend: function beforeSend(e) {
  18536. return e;
  18537. },
  18538. beforeXHR: function beforeXHR(e) {},
  18539. onRequest: function onRequest(e, t) {},
  18540. onResponse: !1,
  18541. onSuccess: function onSuccess(e, t) {},
  18542. onComplete: function onComplete(e, t) {},
  18543. onFailure: function onFailure(e, t) {},
  18544. onError: function onError(e, t) {},
  18545. onAbort: function onAbort(e, t) {},
  18546. successTest: !1,
  18547. error: {
  18548. beforeSend: "The before send function has aborted the request",
  18549. error: "There was an error with your request",
  18550. exitConditions: "API Request Aborted. Exit conditions met",
  18551. JSONParse: "JSON could not be parsed during error handling",
  18552. legacyParameters: "You are using legacy API success callback names",
  18553. method: "The method you called is not defined",
  18554. missingAction: "API action used but no url was defined",
  18555. missingSerialize: "jquery-serialize-object is required to add form data to an existing data object",
  18556. missingURL: "No URL specified for api event",
  18557. noReturnedValue: "The beforeSend callback must return a settings object, beforeSend ignored.",
  18558. noStorage: "Caching responses locally requires session storage",
  18559. parseError: "There was an error parsing your request",
  18560. requiredParameter: "Missing a required URL parameter: ",
  18561. statusMessage: "Server gave an error: ",
  18562. timeout: "Your request timed out"
  18563. },
  18564. regExp: {
  18565. required: /\{\$*[A-z0-9]+\}/g,
  18566. optional: /\{\/\$*[A-z0-9]+\}/g
  18567. },
  18568. className: {
  18569. loading: "loading",
  18570. error: "error"
  18571. },
  18572. selector: {
  18573. disabled: ".disabled",
  18574. form: "form"
  18575. },
  18576. metadata: {
  18577. action: "action",
  18578. url: "url"
  18579. }
  18580. };
  18581. }(jQuery, window, document), function (e, t, n, i) {
  18582. "use strict";
  18583. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.visibility = function (o) {
  18584. var a,
  18585. r = e(this),
  18586. s = r.selector || "",
  18587. l = new Date().getTime(),
  18588. c = [],
  18589. u = arguments[0],
  18590. d = "string" == typeof u,
  18591. f = [].slice.call(arguments, 1),
  18592. m = r.length,
  18593. g = 0;
  18594. return r.each(function () {
  18595. var r,
  18596. p,
  18597. h,
  18598. v,
  18599. b = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.visibility.settings, o) : e.extend({}, e.fn.visibility.settings),
  18600. y = b.className,
  18601. x = b.namespace,
  18602. C = b.error,
  18603. w = b.metadata,
  18604. S = "." + x,
  18605. k = "module-" + x,
  18606. T = e(t),
  18607. A = e(this),
  18608. R = e(b.context),
  18609. P = (A.selector, A.data(k)),
  18610. E = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  18611. setTimeout(e, 0);
  18612. },
  18613. F = this,
  18614. O = !1;
  18615. v = {
  18616. initialize: function initialize() {
  18617. v.debug("Initializing", b), v.setup.cache(), v.should.trackChanges() && ("image" == b.type && v.setup.image(), "fixed" == b.type && v.setup.fixed(), b.observeChanges && v.observeChanges(), v.bind.events()), v.save.position(), v.is.visible() || v.error(C.visible, A), b.initialCheck && v.checkVisibility(), v.instantiate();
  18618. },
  18619. instantiate: function instantiate() {
  18620. v.debug("Storing instance", v), A.data(k, v), P = v;
  18621. },
  18622. destroy: function destroy() {
  18623. v.verbose("Destroying previous module"), h && h.disconnect(), p && p.disconnect(), T.off("load" + S, v.event.load).off("resize" + S, v.event.resize), R.off("scroll" + S, v.event.scroll).off("scrollchange" + S, v.event.scrollchange), "fixed" == b.type && (v.resetFixed(), v.remove.placeholder()), A.off(S).removeData(k);
  18624. },
  18625. observeChanges: function observeChanges() {
  18626. "MutationObserver" in t && (p = new MutationObserver(v.event.contextChanged), h = new MutationObserver(v.event.changed), p.observe(n, {
  18627. childList: !0,
  18628. subtree: !0
  18629. }), h.observe(F, {
  18630. childList: !0,
  18631. subtree: !0
  18632. }), v.debug("Setting up mutation observer", h));
  18633. },
  18634. bind: {
  18635. events: function events() {
  18636. v.verbose("Binding visibility events to scroll and resize"), b.refreshOnLoad && T.on("load" + S, v.event.load), T.on("resize" + S, v.event.resize), R.off("scroll" + S).on("scroll" + S, v.event.scroll).on("scrollchange" + S, v.event.scrollchange);
  18637. }
  18638. },
  18639. event: {
  18640. changed: function changed(e) {
  18641. v.verbose("DOM tree modified, updating visibility calculations"), v.timer = setTimeout(function () {
  18642. v.verbose("DOM tree modified, updating sticky menu"), v.refresh();
  18643. }, 100);
  18644. },
  18645. contextChanged: function contextChanged(t) {
  18646. [].forEach.call(t, function (t) {
  18647. t.removedNodes && [].forEach.call(t.removedNodes, function (t) {
  18648. (t == F || e(t).find(F).length > 0) && (v.debug("Element removed from DOM, tearing down events"), v.destroy());
  18649. });
  18650. });
  18651. },
  18652. resize: function resize() {
  18653. v.debug("Window resized"), b.refreshOnResize && E(v.refresh);
  18654. },
  18655. load: function load() {
  18656. v.debug("Page finished loading"), E(v.refresh);
  18657. },
  18658. scroll: function scroll() {
  18659. b.throttle ? (clearTimeout(v.timer), v.timer = setTimeout(function () {
  18660. R.triggerHandler("scrollchange" + S, [R.scrollTop()]);
  18661. }, b.throttle)) : E(function () {
  18662. R.triggerHandler("scrollchange" + S, [R.scrollTop()]);
  18663. });
  18664. },
  18665. scrollchange: function scrollchange(e, t) {
  18666. v.checkVisibility(t);
  18667. }
  18668. },
  18669. precache: function precache(t, i) {
  18670. t instanceof Array || (t = [t]);
  18671. for (var o = t.length, a = 0, r = [], s = n.createElement("img"), l = function l() {
  18672. ++a >= t.length && e.isFunction(i) && i();
  18673. }; o--;) {
  18674. (s = n.createElement("img")).onload = l, s.onerror = l, s.src = t[o], r.push(s);
  18675. }
  18676. },
  18677. enableCallbacks: function enableCallbacks() {
  18678. v.debug("Allowing callbacks to occur"), O = !1;
  18679. },
  18680. disableCallbacks: function disableCallbacks() {
  18681. v.debug("Disabling all callbacks temporarily"), O = !0;
  18682. },
  18683. should: {
  18684. trackChanges: function trackChanges() {
  18685. return d ? (v.debug("One time query, no need to bind events"), !1) : (v.debug("Callbacks being attached"), !0);
  18686. }
  18687. },
  18688. setup: {
  18689. cache: function cache() {
  18690. v.cache = {
  18691. occurred: {},
  18692. screen: {},
  18693. element: {}
  18694. };
  18695. },
  18696. image: function image() {
  18697. var e = A.data(w.src);
  18698. e && (v.verbose("Lazy loading image", e), b.once = !0, b.observeChanges = !1, b.onOnScreen = function () {
  18699. v.debug("Image on screen", F), v.precache(e, function () {
  18700. v.set.image(e, function () {
  18701. ++g == m && b.onAllLoaded.call(this), b.onLoad.call(this);
  18702. });
  18703. });
  18704. });
  18705. },
  18706. fixed: function fixed() {
  18707. v.debug("Setting up fixed"), b.once = !1, b.observeChanges = !1, b.initialCheck = !0, b.refreshOnLoad = !0, o.transition || (b.transition = !1), v.create.placeholder(), v.debug("Added placeholder", r), b.onTopPassed = function () {
  18708. v.debug("Element passed, adding fixed position", A), v.show.placeholder(), v.set.fixed(), b.transition && e.fn.transition !== i && A.transition(b.transition, b.duration);
  18709. }, b.onTopPassedReverse = function () {
  18710. v.debug("Element returned to position, removing fixed", A), v.hide.placeholder(), v.remove.fixed();
  18711. };
  18712. }
  18713. },
  18714. create: {
  18715. placeholder: function placeholder() {
  18716. v.verbose("Creating fixed position placeholder"), r = A.clone(!1).css("display", "none").addClass(y.placeholder).insertAfter(A);
  18717. }
  18718. },
  18719. show: {
  18720. placeholder: function placeholder() {
  18721. v.verbose("Showing placeholder"), r.css("display", "block").css("visibility", "hidden");
  18722. }
  18723. },
  18724. hide: {
  18725. placeholder: function placeholder() {
  18726. v.verbose("Hiding placeholder"), r.css("display", "none").css("visibility", "");
  18727. }
  18728. },
  18729. set: {
  18730. fixed: function fixed() {
  18731. v.verbose("Setting element to fixed position"), A.addClass(y.fixed).css({
  18732. position: "fixed",
  18733. top: b.offset + "px",
  18734. left: "auto",
  18735. zIndex: b.zIndex
  18736. }), b.onFixed.call(F);
  18737. },
  18738. image: function image(t, n) {
  18739. if (A.attr("src", t), b.transition) {
  18740. if (e.fn.transition !== i) {
  18741. if (A.hasClass(y.visible)) return void v.debug("Transition already occurred on this image, skipping animation");
  18742. A.transition(b.transition, b.duration, n);
  18743. } else A.fadeIn(b.duration, n);
  18744. } else A.show();
  18745. }
  18746. },
  18747. is: {
  18748. onScreen: function onScreen() {
  18749. return v.get.elementCalculations().onScreen;
  18750. },
  18751. offScreen: function offScreen() {
  18752. return v.get.elementCalculations().offScreen;
  18753. },
  18754. visible: function visible() {
  18755. return !(!v.cache || !v.cache.element) && !(0 === v.cache.element.width && 0 === v.cache.element.offset.top);
  18756. },
  18757. verticallyScrollableContext: function verticallyScrollableContext() {
  18758. var e = R.get(0) !== t && R.css("overflow-y");
  18759. return "auto" == e || "scroll" == e;
  18760. },
  18761. horizontallyScrollableContext: function horizontallyScrollableContext() {
  18762. var e = R.get(0) !== t && R.css("overflow-x");
  18763. return "auto" == e || "scroll" == e;
  18764. }
  18765. },
  18766. refresh: function refresh() {
  18767. v.debug("Refreshing constants (width/height)"), "fixed" == b.type && v.resetFixed(), v.reset(), v.save.position(), b.checkOnRefresh && v.checkVisibility(), b.onRefresh.call(F);
  18768. },
  18769. resetFixed: function resetFixed() {
  18770. v.remove.fixed(), v.remove.occurred();
  18771. },
  18772. reset: function reset() {
  18773. v.verbose("Resetting all cached values"), e.isPlainObject(v.cache) && (v.cache.screen = {}, v.cache.element = {});
  18774. },
  18775. checkVisibility: function checkVisibility(e) {
  18776. v.verbose("Checking visibility of element", v.cache.element), !O && v.is.visible() && (v.save.scroll(e), v.save.calculations(), v.passed(), v.passingReverse(), v.topVisibleReverse(), v.bottomVisibleReverse(), v.topPassedReverse(), v.bottomPassedReverse(), v.onScreen(), v.offScreen(), v.passing(), v.topVisible(), v.bottomVisible(), v.topPassed(), v.bottomPassed(), b.onUpdate && b.onUpdate.call(F, v.get.elementCalculations()));
  18777. },
  18778. passed: function passed(t, n) {
  18779. var o = v.get.elementCalculations();
  18780. if (t && n) b.onPassed[t] = n;else {
  18781. if (t !== i) return v.get.pixelsPassed(t) > o.pixelsPassed;
  18782. o.passing && e.each(b.onPassed, function (e, t) {
  18783. o.bottomVisible || o.pixelsPassed > v.get.pixelsPassed(e) ? v.execute(t, e) : b.once || v.remove.occurred(t);
  18784. });
  18785. }
  18786. },
  18787. onScreen: function onScreen(e) {
  18788. var t = v.get.elementCalculations(),
  18789. n = e || b.onOnScreen,
  18790. o = "onScreen";
  18791. if (e && (v.debug("Adding callback for onScreen", e), b.onOnScreen = e), t.onScreen ? v.execute(n, o) : b.once || v.remove.occurred(o), e !== i) return t.onOnScreen;
  18792. },
  18793. offScreen: function offScreen(e) {
  18794. var t = v.get.elementCalculations(),
  18795. n = e || b.onOffScreen,
  18796. o = "offScreen";
  18797. if (e && (v.debug("Adding callback for offScreen", e), b.onOffScreen = e), t.offScreen ? v.execute(n, o) : b.once || v.remove.occurred(o), e !== i) return t.onOffScreen;
  18798. },
  18799. passing: function passing(e) {
  18800. var t = v.get.elementCalculations(),
  18801. n = e || b.onPassing,
  18802. o = "passing";
  18803. if (e && (v.debug("Adding callback for passing", e), b.onPassing = e), t.passing ? v.execute(n, o) : b.once || v.remove.occurred(o), e !== i) return t.passing;
  18804. },
  18805. topVisible: function topVisible(e) {
  18806. var t = v.get.elementCalculations(),
  18807. n = e || b.onTopVisible,
  18808. o = "topVisible";
  18809. if (e && (v.debug("Adding callback for top visible", e), b.onTopVisible = e), t.topVisible ? v.execute(n, o) : b.once || v.remove.occurred(o), e === i) return t.topVisible;
  18810. },
  18811. bottomVisible: function bottomVisible(e) {
  18812. var t = v.get.elementCalculations(),
  18813. n = e || b.onBottomVisible,
  18814. o = "bottomVisible";
  18815. if (e && (v.debug("Adding callback for bottom visible", e), b.onBottomVisible = e), t.bottomVisible ? v.execute(n, o) : b.once || v.remove.occurred(o), e === i) return t.bottomVisible;
  18816. },
  18817. topPassed: function topPassed(e) {
  18818. var t = v.get.elementCalculations(),
  18819. n = e || b.onTopPassed,
  18820. o = "topPassed";
  18821. if (e && (v.debug("Adding callback for top passed", e), b.onTopPassed = e), t.topPassed ? v.execute(n, o) : b.once || v.remove.occurred(o), e === i) return t.topPassed;
  18822. },
  18823. bottomPassed: function bottomPassed(e) {
  18824. var t = v.get.elementCalculations(),
  18825. n = e || b.onBottomPassed,
  18826. o = "bottomPassed";
  18827. if (e && (v.debug("Adding callback for bottom passed", e), b.onBottomPassed = e), t.bottomPassed ? v.execute(n, o) : b.once || v.remove.occurred(o), e === i) return t.bottomPassed;
  18828. },
  18829. passingReverse: function passingReverse(e) {
  18830. var t = v.get.elementCalculations(),
  18831. n = e || b.onPassingReverse,
  18832. o = "passingReverse";
  18833. if (e && (v.debug("Adding callback for passing reverse", e), b.onPassingReverse = e), t.passing ? b.once || v.remove.occurred(o) : v.get.occurred("passing") && v.execute(n, o), e !== i) return !t.passing;
  18834. },
  18835. topVisibleReverse: function topVisibleReverse(e) {
  18836. var t = v.get.elementCalculations(),
  18837. n = e || b.onTopVisibleReverse,
  18838. o = "topVisibleReverse";
  18839. if (e && (v.debug("Adding callback for top visible reverse", e), b.onTopVisibleReverse = e), t.topVisible ? b.once || v.remove.occurred(o) : v.get.occurred("topVisible") && v.execute(n, o), e === i) return !t.topVisible;
  18840. },
  18841. bottomVisibleReverse: function bottomVisibleReverse(e) {
  18842. var t = v.get.elementCalculations(),
  18843. n = e || b.onBottomVisibleReverse,
  18844. o = "bottomVisibleReverse";
  18845. if (e && (v.debug("Adding callback for bottom visible reverse", e), b.onBottomVisibleReverse = e), t.bottomVisible ? b.once || v.remove.occurred(o) : v.get.occurred("bottomVisible") && v.execute(n, o), e === i) return !t.bottomVisible;
  18846. },
  18847. topPassedReverse: function topPassedReverse(e) {
  18848. var t = v.get.elementCalculations(),
  18849. n = e || b.onTopPassedReverse,
  18850. o = "topPassedReverse";
  18851. if (e && (v.debug("Adding callback for top passed reverse", e), b.onTopPassedReverse = e), t.topPassed ? b.once || v.remove.occurred(o) : v.get.occurred("topPassed") && v.execute(n, o), e === i) return !t.onTopPassed;
  18852. },
  18853. bottomPassedReverse: function bottomPassedReverse(e) {
  18854. var t = v.get.elementCalculations(),
  18855. n = e || b.onBottomPassedReverse,
  18856. o = "bottomPassedReverse";
  18857. if (e && (v.debug("Adding callback for bottom passed reverse", e), b.onBottomPassedReverse = e), t.bottomPassed ? b.once || v.remove.occurred(o) : v.get.occurred("bottomPassed") && v.execute(n, o), e === i) return !t.bottomPassed;
  18858. },
  18859. execute: function execute(e, t) {
  18860. var n = v.get.elementCalculations(),
  18861. i = v.get.screenCalculations();
  18862. (e = e || !1) && (b.continuous ? (v.debug("Callback being called continuously", t, n), e.call(F, n, i)) : v.get.occurred(t) || (v.debug("Conditions met", t, n), e.call(F, n, i))), v.save.occurred(t);
  18863. },
  18864. remove: {
  18865. fixed: function fixed() {
  18866. v.debug("Removing fixed position"), A.removeClass(y.fixed).css({
  18867. position: "",
  18868. top: "",
  18869. left: "",
  18870. zIndex: ""
  18871. }), b.onUnfixed.call(F);
  18872. },
  18873. placeholder: function placeholder() {
  18874. v.debug("Removing placeholder content"), r && r.remove();
  18875. },
  18876. occurred: function occurred(e) {
  18877. if (e) {
  18878. var t = v.cache.occurred;
  18879. t[e] !== i && !0 === t[e] && (v.debug("Callback can now be called again", e), v.cache.occurred[e] = !1);
  18880. } else v.cache.occurred = {};
  18881. }
  18882. },
  18883. save: {
  18884. calculations: function calculations() {
  18885. v.verbose("Saving all calculations necessary to determine positioning"), v.save.direction(), v.save.screenCalculations(), v.save.elementCalculations();
  18886. },
  18887. occurred: function occurred(e) {
  18888. e && (v.cache.occurred[e] !== i && !0 === v.cache.occurred[e] || (v.verbose("Saving callback occurred", e), v.cache.occurred[e] = !0));
  18889. },
  18890. scroll: function scroll(e) {
  18891. e = e + b.offset || R.scrollTop() + b.offset, v.cache.scroll = e;
  18892. },
  18893. direction: function direction() {
  18894. var e,
  18895. t = v.get.scroll(),
  18896. n = v.get.lastScroll();
  18897. return e = t > n && n ? "down" : t < n && n ? "up" : "static", v.cache.direction = e, v.cache.direction;
  18898. },
  18899. elementPosition: function elementPosition() {
  18900. var e = v.cache.element,
  18901. t = v.get.screenSize();
  18902. return v.verbose("Saving element position"), e.fits = e.height < t.height, e.offset = A.offset(), e.width = A.outerWidth(), e.height = A.outerHeight(), v.is.verticallyScrollableContext() && (e.offset.top += R.scrollTop() - R.offset().top), v.is.horizontallyScrollableContext() && (e.offset.left += R.scrollLeft - R.offset().left), v.cache.element = e, e;
  18903. },
  18904. elementCalculations: function elementCalculations() {
  18905. var e = v.get.screenCalculations(),
  18906. t = v.get.elementPosition();
  18907. return b.includeMargin ? (t.margin = {}, t.margin.top = parseInt(A.css("margin-top"), 10), t.margin.bottom = parseInt(A.css("margin-bottom"), 10), t.top = t.offset.top - t.margin.top, t.bottom = t.offset.top + t.height + t.margin.bottom) : (t.top = t.offset.top, t.bottom = t.offset.top + t.height), t.topPassed = e.top >= t.top, t.bottomPassed = e.top >= t.bottom, t.topVisible = e.bottom >= t.top && !t.topPassed, t.bottomVisible = e.bottom >= t.bottom && !t.bottomPassed, t.pixelsPassed = 0, t.percentagePassed = 0, t.onScreen = (t.topVisible || t.passing) && !t.bottomPassed, t.passing = t.topPassed && !t.bottomPassed, t.offScreen = !t.onScreen, t.passing && (t.pixelsPassed = e.top - t.top, t.percentagePassed = (e.top - t.top) / t.height), v.cache.element = t, v.verbose("Updated element calculations", t), t;
  18908. },
  18909. screenCalculations: function screenCalculations() {
  18910. var e = v.get.scroll();
  18911. return v.save.direction(), v.cache.screen.top = e, v.cache.screen.bottom = e + v.cache.screen.height, v.cache.screen;
  18912. },
  18913. screenSize: function screenSize() {
  18914. v.verbose("Saving window position"), v.cache.screen = {
  18915. height: R.height()
  18916. };
  18917. },
  18918. position: function position() {
  18919. v.save.screenSize(), v.save.elementPosition();
  18920. }
  18921. },
  18922. get: {
  18923. pixelsPassed: function pixelsPassed(e) {
  18924. var t = v.get.elementCalculations();
  18925. return e.search("%") > -1 ? t.height * (parseInt(e, 10) / 100) : parseInt(e, 10);
  18926. },
  18927. occurred: function occurred(e) {
  18928. return v.cache.occurred !== i && v.cache.occurred[e] || !1;
  18929. },
  18930. direction: function direction() {
  18931. return v.cache.direction === i && v.save.direction(), v.cache.direction;
  18932. },
  18933. elementPosition: function elementPosition() {
  18934. return v.cache.element === i && v.save.elementPosition(), v.cache.element;
  18935. },
  18936. elementCalculations: function elementCalculations() {
  18937. return v.cache.element === i && v.save.elementCalculations(), v.cache.element;
  18938. },
  18939. screenCalculations: function screenCalculations() {
  18940. return v.cache.screen === i && v.save.screenCalculations(), v.cache.screen;
  18941. },
  18942. screenSize: function screenSize() {
  18943. return v.cache.screen === i && v.save.screenSize(), v.cache.screen;
  18944. },
  18945. scroll: function scroll() {
  18946. return v.cache.scroll === i && v.save.scroll(), v.cache.scroll;
  18947. },
  18948. lastScroll: function lastScroll() {
  18949. return v.cache.screen === i ? (v.debug("First scroll event, no last scroll could be found"), !1) : v.cache.screen.top;
  18950. }
  18951. },
  18952. setting: function setting(t, n) {
  18953. if (e.isPlainObject(t)) e.extend(!0, b, t);else {
  18954. if (n === i) return b[t];
  18955. b[t] = n;
  18956. }
  18957. },
  18958. internal: function internal(t, n) {
  18959. if (e.isPlainObject(t)) e.extend(!0, v, t);else {
  18960. if (n === i) return v[t];
  18961. v[t] = n;
  18962. }
  18963. },
  18964. debug: function debug() {
  18965. !b.silent && b.debug && (b.performance ? v.performance.log(arguments) : (v.debug = Function.prototype.bind.call(console.info, console, b.name + ":"), v.debug.apply(console, arguments)));
  18966. },
  18967. verbose: function verbose() {
  18968. !b.silent && b.verbose && b.debug && (b.performance ? v.performance.log(arguments) : (v.verbose = Function.prototype.bind.call(console.info, console, b.name + ":"), v.verbose.apply(console, arguments)));
  18969. },
  18970. error: function error() {
  18971. b.silent || (v.error = Function.prototype.bind.call(console.error, console, b.name + ":"), v.error.apply(console, arguments));
  18972. },
  18973. performance: {
  18974. log: function log(e) {
  18975. var t, n;
  18976. b.performance && (n = (t = new Date().getTime()) - (l || t), l = t, c.push({
  18977. Name: e[0],
  18978. Arguments: [].slice.call(e, 1) || "",
  18979. Element: F,
  18980. "Execution Time": n
  18981. })), clearTimeout(v.performance.timer), v.performance.timer = setTimeout(v.performance.display, 500);
  18982. },
  18983. display: function display() {
  18984. var t = b.name + ":",
  18985. n = 0;
  18986. l = !1, clearTimeout(v.performance.timer), e.each(c, function (e, t) {
  18987. n += t["Execution Time"];
  18988. }), t += " " + n + "ms", s && (t += " '" + s + "'"), (console.group !== i || console.table !== i) && c.length > 0 && (console.groupCollapsed(t), console.table ? console.table(c) : e.each(c, function (e, t) {
  18989. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  18990. }), console.groupEnd()), c = [];
  18991. }
  18992. },
  18993. invoke: function invoke(t, n, o) {
  18994. var r,
  18995. s,
  18996. l,
  18997. c = P;
  18998. return n = n || f, o = F || o, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  18999. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  19000. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  19001. if (c[a] !== i) return s = c[a], !1;
  19002. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (v.error(C.method, t), !1);
  19003. c = c[o];
  19004. }
  19005. })), e.isFunction(s) ? l = s.apply(o, n) : s !== i && (l = s), e.isArray(a) ? a.push(l) : a !== i ? a = [a, l] : l !== i && (a = l), s;
  19006. }
  19007. }, d ? (P === i && v.initialize(), P.save.scroll(), P.save.calculations(), v.invoke(u)) : (P !== i && P.invoke("destroy"), v.initialize());
  19008. }), a !== i ? a : this;
  19009. }, e.fn.visibility.settings = {
  19010. name: "Visibility",
  19011. namespace: "visibility",
  19012. debug: !1,
  19013. verbose: !1,
  19014. performance: !0,
  19015. observeChanges: !0,
  19016. initialCheck: !0,
  19017. refreshOnLoad: !0,
  19018. refreshOnResize: !0,
  19019. checkOnRefresh: !0,
  19020. once: !0,
  19021. continuous: !1,
  19022. offset: 0,
  19023. includeMargin: !1,
  19024. context: t,
  19025. throttle: !1,
  19026. type: !1,
  19027. zIndex: "10",
  19028. transition: "fade in",
  19029. duration: 1e3,
  19030. onPassed: {},
  19031. onOnScreen: !1,
  19032. onOffScreen: !1,
  19033. onPassing: !1,
  19034. onTopVisible: !1,
  19035. onBottomVisible: !1,
  19036. onTopPassed: !1,
  19037. onBottomPassed: !1,
  19038. onPassingReverse: !1,
  19039. onTopVisibleReverse: !1,
  19040. onBottomVisibleReverse: !1,
  19041. onTopPassedReverse: !1,
  19042. onBottomPassedReverse: !1,
  19043. onLoad: function onLoad() {},
  19044. onAllLoaded: function onAllLoaded() {},
  19045. onFixed: function onFixed() {},
  19046. onUnfixed: function onUnfixed() {},
  19047. onUpdate: !1,
  19048. onRefresh: function onRefresh() {},
  19049. metadata: {
  19050. src: "src"
  19051. },
  19052. className: {
  19053. fixed: "fixed",
  19054. placeholder: "placeholder",
  19055. visible: "visible"
  19056. },
  19057. error: {
  19058. method: "The method you called is not defined.",
  19059. visible: "Element is hidden, you must call refresh after element becomes visible"
  19060. }
  19061. };
  19062. }(jQuery, window, document);
  19063. /***/ }),
  19064. /***/ "./js/services/i18nHelper.js":
  19065. /*!***********************************!*\
  19066. !*** ./js/services/i18nHelper.js ***!
  19067. \***********************************/
  19068. /*! exports provided: i18nHelper */
  19069. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  19070. "use strict";
  19071. __webpack_require__.r(__webpack_exports__);
  19072. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i18nHelper", function() { return i18nHelper; });
  19073. /* harmony import */ var line_i18n__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! line-i18n */ "./node_modules/line-i18n/dist/index.js");
  19074. /* harmony import */ var _localizedStringsService__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./localizedStringsService */ "./js/services/localizedStringsService.js");
  19075. var StringTypes = line_i18n__WEBPACK_IMPORTED_MODULE_0__["default"].StringTypes;
  19076. var i18nHelper = Object.freeze({
  19077. i18n: function i18n(identifier) {
  19078. var opts = identifier.split(':');
  19079. var type = opts[0].toLowerCase();
  19080. var id = opts[1];
  19081. if (StringTypes.ERROR === type) {
  19082. return _localizedStringsService__WEBPACK_IMPORTED_MODULE_1__["LocalizedStrings"].getError(id);
  19083. } else if (StringTypes.MESSAGE === type) {
  19084. return _localizedStringsService__WEBPACK_IMPORTED_MODULE_1__["LocalizedStrings"].getMessage(id);
  19085. } else if (StringTypes.UI === type) {
  19086. return _localizedStringsService__WEBPACK_IMPORTED_MODULE_1__["LocalizedStrings"].getUI(id);
  19087. } else {
  19088. console.warn("A string has been passed to the i18n helper function that was not in the form type:id -> " + identifier);
  19089. return _localizedStringsService__WEBPACK_IMPORTED_MODULE_1__["LocalizedStrings"].getString(identifier, type);
  19090. }
  19091. }
  19092. });
  19093. /***/ }),
  19094. /***/ "./js/services/languageService.js":
  19095. /*!****************************************!*\
  19096. !*** ./js/services/languageService.js ***!
  19097. \****************************************/
  19098. /*! exports provided: LanguageService */
  19099. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  19100. "use strict";
  19101. __webpack_require__.r(__webpack_exports__);
  19102. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LanguageService", function() { return LanguageService; });
  19103. /* harmony import */ var _grammar___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./../../grammar/ */ "./grammar/index.js");
  19104. /* harmony import */ var line_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! line-i18n */ "./node_modules/line-i18n/dist/index.js");
  19105. /* harmony import */ var _util_config__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../util/config */ "./js/util/config.js");
  19106. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  19107. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  19108. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  19109. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  19110. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  19111. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  19112. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  19113. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  19114. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  19115. var LanguageServiceExtended =
  19116. /*#__PURE__*/
  19117. function (_line_i18n$LanguageSe) {
  19118. _inherits(LanguageServiceExtended, _line_i18n$LanguageSe);
  19119. function LanguageServiceExtended() {
  19120. _classCallCheck(this, LanguageServiceExtended);
  19121. return _possibleConstructorReturn(this, _getPrototypeOf(LanguageServiceExtended).call(this, typeof iLMparameters === 'undefined' ? _util_config__WEBPACK_IMPORTED_MODULE_2__["Config"].default_lang : iLMparameters.lang));
  19122. }
  19123. _createClass(LanguageServiceExtended, [{
  19124. key: "getCurrentLexer",
  19125. value: function getCurrentLexer() {
  19126. var langInfo = _grammar___WEBPACK_IMPORTED_MODULE_0__["default"][this.getLang()];
  19127. if (langInfo === null || langInfo === undefined) {
  19128. return _grammar___WEBPACK_IMPORTED_MODULE_0__["default"][this.getDefaultLang()].lexer;
  19129. } else {
  19130. return langInfo.lexer;
  19131. }
  19132. }
  19133. }, {
  19134. key: "getCurrentLangFuncs",
  19135. value: function getCurrentLangFuncs() {
  19136. var langInfo = _grammar___WEBPACK_IMPORTED_MODULE_0__["default"][this.getLang()];
  19137. if (langInfo === null || langInfo === undefined) {
  19138. return _grammar___WEBPACK_IMPORTED_MODULE_0__["default"][this.getDefaultLang()].langFuncs;
  19139. } else {
  19140. return langInfo.langFuncs;
  19141. }
  19142. }
  19143. }, {
  19144. key: "getCurrentLangLibs",
  19145. value: function getCurrentLangLibs() {
  19146. var langInfo = _grammar___WEBPACK_IMPORTED_MODULE_0__["default"][this.getLang()];
  19147. if (langInfo === null || langInfo === undefined) {
  19148. return _grammar___WEBPACK_IMPORTED_MODULE_0__["default"][this.getDefaultLang()].langLibs;
  19149. }
  19150. return langInfo.langLibs;
  19151. }
  19152. }]);
  19153. return LanguageServiceExtended;
  19154. }(line_i18n__WEBPACK_IMPORTED_MODULE_1__["default"].LanguageServiceNoLS);
  19155. var LanguageService = new LanguageServiceExtended();
  19156. /***/ }),
  19157. /***/ "./js/services/localizedStringsService.js":
  19158. /*!************************************************!*\
  19159. !*** ./js/services/localizedStringsService.js ***!
  19160. \************************************************/
  19161. /*! exports provided: LocalizedStrings, getInstance */
  19162. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  19163. "use strict";
  19164. __webpack_require__.r(__webpack_exports__);
  19165. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LocalizedStrings", function() { return LocalizedStrings; });
  19166. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getInstance", function() { return getInstance; });
  19167. /* harmony import */ var _languageService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./languageService */ "./js/services/languageService.js");
  19168. /* harmony import */ var line_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! line-i18n */ "./node_modules/line-i18n/dist/index.js");
  19169. /* harmony import */ var _i18n__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../../i18n */ "./i18n/index.js");
  19170. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  19171. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  19172. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  19173. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  19174. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  19175. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  19176. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  19177. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  19178. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  19179. var IVProgLocalizedStrings =
  19180. /*#__PURE__*/
  19181. function (_line_i18n$LocalizedS) {
  19182. _inherits(IVProgLocalizedStrings, _line_i18n$LocalizedS);
  19183. function IVProgLocalizedStrings(langService, langsJsons) {
  19184. var shouldListenToChange = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  19185. _classCallCheck(this, IVProgLocalizedStrings);
  19186. return _possibleConstructorReturn(this, _getPrototypeOf(IVProgLocalizedStrings).call(this, langService, langsJsons, shouldListenToChange));
  19187. }
  19188. _createClass(IVProgLocalizedStrings, [{
  19189. key: "translateType",
  19190. value: function translateType(type, dim) {
  19191. switch (dim) {
  19192. case 0:
  19193. return this.getUI(type);
  19194. default:
  19195. var transType = this.getUI(type);
  19196. if (dim === 1) return this.getUI("vector_string", [transType]);else return this.getUI("matrix_string", [transType]);
  19197. }
  19198. }
  19199. }, {
  19200. key: "translateOp",
  19201. value: function translateOp(op) {
  19202. switch (op.ord) {
  19203. case Operators.AND.ord:
  19204. case Operators.OR.ord:
  19205. case Operators.NOT.ord:
  19206. return this.getUI(op.value);
  19207. default:
  19208. return op.value;
  19209. }
  19210. }
  19211. }]);
  19212. return IVProgLocalizedStrings;
  19213. }(line_i18n__WEBPACK_IMPORTED_MODULE_1__["default"].LocalizedStrings);
  19214. var LocalizedStrings = Object.freeze(new IVProgLocalizedStrings(_languageService__WEBPACK_IMPORTED_MODULE_0__["LanguageService"], _i18n__WEBPACK_IMPORTED_MODULE_2__["default"], true));
  19215. var _instance = null;
  19216. function getInstance() {
  19217. if (_instance == null) {
  19218. _instance = new IVProgLocalizedStrings(_languageService__WEBPACK_IMPORTED_MODULE_0__["LanguageService"], _i18n__WEBPACK_IMPORTED_MODULE_2__["default"]);
  19219. }
  19220. return _instance;
  19221. }
  19222. /***/ }),
  19223. /***/ "./js/typeSystem/baseTypes.js":
  19224. /*!************************************!*\
  19225. !*** ./js/typeSystem/baseTypes.js ***!
  19226. \************************************/
  19227. /*! exports provided: BaseTypes */
  19228. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  19229. "use strict";
  19230. __webpack_require__.r(__webpack_exports__);
  19231. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BaseTypes", function() { return BaseTypes; });
  19232. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  19233. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  19234. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  19235. var BaseType =
  19236. /*#__PURE__*/
  19237. function () {
  19238. function BaseType(name, ord) {
  19239. _classCallCheck(this, BaseType);
  19240. this.name = name;
  19241. this.ord = ord;
  19242. }
  19243. _createClass(BaseType, [{
  19244. key: "isCompatible",
  19245. value: function isCompatible(another) {
  19246. if (another instanceof BaseType) {
  19247. return this.name === another.name && this.ord === another.ord;
  19248. }
  19249. return false;
  19250. }
  19251. }, {
  19252. key: "value",
  19253. get: function get() {
  19254. return this.name;
  19255. }
  19256. }]);
  19257. return BaseType;
  19258. }(); // Base types names are the same as i18n ui type keys
  19259. var BaseTypes = Object.freeze({
  19260. INTEGER: new BaseType("integer", 0),
  19261. REAL: new BaseType("real", 1),
  19262. STRING: new BaseType("text", 2),
  19263. BOOLEAN: new BaseType("boolean", 3),
  19264. VOID: new BaseType("void", 4),
  19265. UNDEFINED: new BaseType("undefined", 5)
  19266. });
  19267. /***/ }),
  19268. /***/ "./js/typeSystem/compoundType.js":
  19269. /*!***************************************!*\
  19270. !*** ./js/typeSystem/compoundType.js ***!
  19271. \***************************************/
  19272. /*! exports provided: CompoundType */
  19273. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  19274. "use strict";
  19275. __webpack_require__.r(__webpack_exports__);
  19276. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CompoundType", function() { return CompoundType; });
  19277. /* harmony import */ var _type__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./type */ "./js/typeSystem/type.js");
  19278. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  19279. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  19280. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  19281. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  19282. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  19283. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  19284. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  19285. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  19286. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  19287. var CompoundType =
  19288. /*#__PURE__*/
  19289. function (_Type) {
  19290. _inherits(CompoundType, _Type);
  19291. function CompoundType(type, dimensions) {
  19292. var _this;
  19293. _classCallCheck(this, CompoundType);
  19294. _this = _possibleConstructorReturn(this, _getPrototypeOf(CompoundType).call(this, null));
  19295. _this.innerType = type;
  19296. _this.dimensions = dimensions;
  19297. return _this;
  19298. }
  19299. _createClass(CompoundType, [{
  19300. key: "isCompatible",
  19301. value: function isCompatible(another) {
  19302. if (another instanceof CompoundType) {
  19303. if (this.dimensions !== another.dimensions) {
  19304. return false;
  19305. }
  19306. return this.innerType.isCompatible(another.innerType);
  19307. }
  19308. return false;
  19309. }
  19310. }, {
  19311. key: "stringInfo",
  19312. value: function stringInfo() {
  19313. var _this2 = this;
  19314. var list = this.innerType.stringInfo();
  19315. list.forEach(function (v) {
  19316. v.dim = _this2.dimensions;
  19317. });
  19318. return list;
  19319. }
  19320. }, {
  19321. key: "canAccept",
  19322. value: function canAccept(another) {
  19323. if (another instanceof CompoundType) {
  19324. return this.dimensions > another.dimensions && this.innerType.isCompatible(another.innerType);
  19325. } else {
  19326. return this.innerType.isCompatible(another);
  19327. }
  19328. }
  19329. }]);
  19330. return CompoundType;
  19331. }(_type__WEBPACK_IMPORTED_MODULE_0__["Type"]);
  19332. /***/ }),
  19333. /***/ "./js/typeSystem/multiType.js":
  19334. /*!************************************!*\
  19335. !*** ./js/typeSystem/multiType.js ***!
  19336. \************************************/
  19337. /*! exports provided: MultiType */
  19338. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  19339. "use strict";
  19340. __webpack_require__.r(__webpack_exports__);
  19341. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MultiType", function() { return MultiType; });
  19342. /* harmony import */ var _type__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./type */ "./js/typeSystem/type.js");
  19343. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  19344. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  19345. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  19346. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  19347. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  19348. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  19349. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  19350. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  19351. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  19352. var MultiType =
  19353. /*#__PURE__*/
  19354. function (_Type) {
  19355. _inherits(MultiType, _Type);
  19356. function MultiType(types) {
  19357. var _this;
  19358. _classCallCheck(this, MultiType);
  19359. _this = _possibleConstructorReturn(this, _getPrototypeOf(MultiType).call(this, null));
  19360. _this.types = types;
  19361. return _this;
  19362. }
  19363. _createClass(MultiType, [{
  19364. key: "stringInfo",
  19365. value: function stringInfo() {
  19366. var list = [];
  19367. for (var i = 0; i < this.types.length; i++) {
  19368. var t = this.types[i];
  19369. list = list.concat(t.stringInfo());
  19370. }
  19371. return list;
  19372. }
  19373. }, {
  19374. key: "isCompatible",
  19375. value: function isCompatible(another) {
  19376. if (another instanceof _type__WEBPACK_IMPORTED_MODULE_0__["Type"]) {
  19377. for (var i = 0; i < this.types.length; i++) {
  19378. var t = this.types[i];
  19379. if (another.isCompatible(t)) {
  19380. return true;
  19381. }
  19382. }
  19383. }
  19384. return false;
  19385. }
  19386. }, {
  19387. key: "value",
  19388. get: function get() {
  19389. return null;
  19390. }
  19391. }, {
  19392. key: "ord",
  19393. get: function get() {
  19394. return null;
  19395. }
  19396. }]);
  19397. return MultiType;
  19398. }(_type__WEBPACK_IMPORTED_MODULE_0__["Type"]);
  19399. /***/ }),
  19400. /***/ "./js/typeSystem/parsers.js":
  19401. /*!**********************************!*\
  19402. !*** ./js/typeSystem/parsers.js ***!
  19403. \**********************************/
  19404. /*! exports provided: toInt, toString, toReal, toBool, convertBoolToString, convertToString */
  19405. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  19406. "use strict";
  19407. __webpack_require__.r(__webpack_exports__);
  19408. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toInt", function() { return toInt; });
  19409. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toString", function() { return toString; });
  19410. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toReal", function() { return toReal; });
  19411. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toBool", function() { return toBool; });
  19412. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "convertBoolToString", function() { return convertBoolToString; });
  19413. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "convertToString", function() { return convertToString; });
  19414. /* harmony import */ var _services_languageService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js");
  19415. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./types */ "./js/typeSystem/types.js");
  19416. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  19417. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(decimal_js__WEBPACK_IMPORTED_MODULE_2__);
  19418. function toInt(str) {
  19419. return new decimal_js__WEBPACK_IMPORTED_MODULE_2___default.a(str);
  19420. }
  19421. function toString(str) {
  19422. var value = str.replace(/^"/, '');
  19423. value = value.replace(/"$/, '');
  19424. value = value.replace(/\\b/g, "\b");
  19425. value = value.replace(/\\t/g, "\t");
  19426. value = value.replace(/\\n/g, "\n");
  19427. value = value.replace(/\\r/g, "\r");
  19428. value = value.replace(/\\\"/g, "\"");
  19429. value = value.replace(/\\\'/g, "\'");
  19430. value = value.replace(/\\\\/g, "\\");
  19431. return value;
  19432. }
  19433. function toReal(value) {
  19434. return new decimal_js__WEBPACK_IMPORTED_MODULE_2___default.a(value);
  19435. }
  19436. function toBool(str) {
  19437. var val = "'" + str + "'";
  19438. var lexer = _services_languageService__WEBPACK_IMPORTED_MODULE_0__["LanguageService"].getCurrentLexer();
  19439. var instance = new lexer(null);
  19440. if (instance.literalNames[lexer.RK_TRUE] === val) {
  19441. return true;
  19442. } else if (instance.literalNames[lexer.RK_FALSE] === val) {
  19443. return false;
  19444. } else {
  19445. // TODO: better error message
  19446. throw new Error(str + "not a valid boolean");
  19447. }
  19448. }
  19449. function convertBoolToString(bool) {
  19450. var lexer = _services_languageService__WEBPACK_IMPORTED_MODULE_0__["LanguageService"].getCurrentLexer();
  19451. var instance = new lexer(null);
  19452. if (bool) {
  19453. return instance.literalNames[lexer.RK_TRUE];
  19454. } else {
  19455. return instance.literalNames[lexer.RK_FALSE];
  19456. }
  19457. }
  19458. function convertToString(value, type) {
  19459. switch (type.ord) {
  19460. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER.ord:
  19461. return value.toString();
  19462. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL.ord:
  19463. {
  19464. if (value.dp() <= 0) {
  19465. return value.toFixed(1);
  19466. } else {
  19467. return value.toNumber();
  19468. }
  19469. }
  19470. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN.ord:
  19471. return convertBoolToString(value);
  19472. default:
  19473. return value;
  19474. }
  19475. }
  19476. /***/ }),
  19477. /***/ "./js/typeSystem/type.js":
  19478. /*!*******************************!*\
  19479. !*** ./js/typeSystem/type.js ***!
  19480. \*******************************/
  19481. /*! exports provided: Type */
  19482. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  19483. "use strict";
  19484. __webpack_require__.r(__webpack_exports__);
  19485. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Type", function() { return Type; });
  19486. /* harmony import */ var _util_config__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util/config */ "./js/util/config.js");
  19487. /* harmony import */ var _baseTypes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./baseTypes */ "./js/typeSystem/baseTypes.js");
  19488. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  19489. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  19490. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  19491. var Type =
  19492. /*#__PURE__*/
  19493. function () {
  19494. function Type(baseType) {
  19495. _classCallCheck(this, Type);
  19496. this.baseType = baseType;
  19497. }
  19498. _createClass(Type, [{
  19499. key: "stringInfo",
  19500. value: function stringInfo() {
  19501. return [{
  19502. type: this.baseType.name,
  19503. dim: 0
  19504. }];
  19505. }
  19506. }, {
  19507. key: "isCompatible",
  19508. value: function isCompatible(another) {
  19509. if (another instanceof Type) {
  19510. return this.baseType.isCompatible(another.baseType);
  19511. }
  19512. return false;
  19513. }
  19514. }, {
  19515. key: "value",
  19516. get: function get() {
  19517. return this.baseType.value;
  19518. }
  19519. }, {
  19520. key: "ord",
  19521. get: function get() {
  19522. return this.baseType.ord;
  19523. }
  19524. }]);
  19525. return Type;
  19526. }();
  19527. /***/ }),
  19528. /***/ "./js/typeSystem/types.js":
  19529. /*!********************************!*\
  19530. !*** ./js/typeSystem/types.js ***!
  19531. \********************************/
  19532. /*! exports provided: Types */
  19533. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  19534. "use strict";
  19535. __webpack_require__.r(__webpack_exports__);
  19536. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Types", function() { return Types; });
  19537. /* harmony import */ var _baseTypes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./baseTypes */ "./js/typeSystem/baseTypes.js");
  19538. /* harmony import */ var _type__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./type */ "./js/typeSystem/type.js");
  19539. /* harmony import */ var _multiType__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./multiType */ "./js/typeSystem/multiType.js");
  19540. var INTEGER = new _type__WEBPACK_IMPORTED_MODULE_1__["Type"](_baseTypes__WEBPACK_IMPORTED_MODULE_0__["BaseTypes"].INTEGER);
  19541. var REAL = new _type__WEBPACK_IMPORTED_MODULE_1__["Type"](_baseTypes__WEBPACK_IMPORTED_MODULE_0__["BaseTypes"].REAL);
  19542. var STRING = new _type__WEBPACK_IMPORTED_MODULE_1__["Type"](_baseTypes__WEBPACK_IMPORTED_MODULE_0__["BaseTypes"].STRING);
  19543. var BOOLEAN = new _type__WEBPACK_IMPORTED_MODULE_1__["Type"](_baseTypes__WEBPACK_IMPORTED_MODULE_0__["BaseTypes"].BOOLEAN);
  19544. var VOID = new _type__WEBPACK_IMPORTED_MODULE_1__["Type"](_baseTypes__WEBPACK_IMPORTED_MODULE_0__["BaseTypes"].VOID);
  19545. var UNDEFINED = new _type__WEBPACK_IMPORTED_MODULE_1__["Type"](_baseTypes__WEBPACK_IMPORTED_MODULE_0__["BaseTypes"].UNDEFINED);
  19546. var ALL = new _multiType__WEBPACK_IMPORTED_MODULE_2__["MultiType"]([INTEGER, REAL, STRING, BOOLEAN]);
  19547. var Types = Object.freeze({
  19548. INTEGER: INTEGER,
  19549. REAL: REAL,
  19550. STRING: STRING,
  19551. BOOLEAN: BOOLEAN,
  19552. VOID: VOID,
  19553. UNDEFINED: UNDEFINED,
  19554. ALL: ALL
  19555. });
  19556. /***/ }),
  19557. /***/ "./js/util/config.js":
  19558. /*!***************************!*\
  19559. !*** ./js/util/config.js ***!
  19560. \***************************/
  19561. /*! exports provided: Config */
  19562. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  19563. "use strict";
  19564. __webpack_require__.r(__webpack_exports__);
  19565. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Config", function() { return Config; });
  19566. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  19567. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  19568. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  19569. var ConfigObject =
  19570. /*#__PURE__*/
  19571. function () {
  19572. function ConfigObject() {
  19573. _classCallCheck(this, ConfigObject);
  19574. this.loopTimeout = 5000;
  19575. this.decimalPlaces = 8;
  19576. this.intConvertRoundMode = 2;
  19577. this.default_lang = 'pt';
  19578. this.enable_type_casting = true;
  19579. }
  19580. _createClass(ConfigObject, [{
  19581. key: "setConfig",
  19582. value: function setConfig(opts) {
  19583. for (var key in opts) {
  19584. if (this.hasOwnProperty(key)) {
  19585. this[key] = opts[key];
  19586. }
  19587. }
  19588. }
  19589. }]);
  19590. return ConfigObject;
  19591. }();
  19592. var config = new ConfigObject();
  19593. var Config = config;
  19594. /***/ }),
  19595. /***/ "./js/util/inputTest.js":
  19596. /*!******************************!*\
  19597. !*** ./js/util/inputTest.js ***!
  19598. \******************************/
  19599. /*! exports provided: InputTest */
  19600. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  19601. "use strict";
  19602. __webpack_require__.r(__webpack_exports__);
  19603. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "InputTest", function() { return InputTest; });
  19604. /* harmony import */ var _io_input__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./../io/input */ "./js/io/input.js");
  19605. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  19606. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  19607. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  19608. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  19609. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  19610. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  19611. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  19612. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  19613. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  19614. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  19615. var InputTest =
  19616. /*#__PURE__*/
  19617. function (_Input) {
  19618. _inherits(InputTest, _Input);
  19619. function InputTest(inputList) {
  19620. var _this;
  19621. _classCallCheck(this, InputTest);
  19622. _this = _possibleConstructorReturn(this, _getPrototypeOf(InputTest).call(this));
  19623. _this.index = 0;
  19624. _this.inputList = inputList;
  19625. return _this;
  19626. }
  19627. _createClass(InputTest, [{
  19628. key: "requestInput",
  19629. value: function requestInput(callback) {
  19630. if (this.index < this.inputList.length) {
  19631. callback(this.inputList[this.index]);
  19632. this.index++;
  19633. } else {
  19634. throw new Error(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__["LocalizedStrings"].getError("exceeded_input_request"));
  19635. }
  19636. }
  19637. }]);
  19638. return InputTest;
  19639. }(_io_input__WEBPACK_IMPORTED_MODULE_0__["Input"]);
  19640. /***/ }),
  19641. /***/ "./js/util/outputTest.js":
  19642. /*!*******************************!*\
  19643. !*** ./js/util/outputTest.js ***!
  19644. \*******************************/
  19645. /*! exports provided: OutputTest */
  19646. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  19647. "use strict";
  19648. __webpack_require__.r(__webpack_exports__);
  19649. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "OutputTest", function() { return OutputTest; });
  19650. /* harmony import */ var _io_output__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./../io/output */ "./js/io/output.js");
  19651. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  19652. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  19653. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  19654. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  19655. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  19656. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  19657. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  19658. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  19659. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  19660. var OutputTest =
  19661. /*#__PURE__*/
  19662. function (_Output) {
  19663. _inherits(OutputTest, _Output);
  19664. function OutputTest() {
  19665. var _this;
  19666. _classCallCheck(this, OutputTest);
  19667. _this = _possibleConstructorReturn(this, _getPrototypeOf(OutputTest).call(this));
  19668. _this.list = [];
  19669. return _this;
  19670. }
  19671. _createClass(OutputTest, [{
  19672. key: "sendOutput",
  19673. value: function sendOutput(text) {
  19674. this.list.push(text);
  19675. }
  19676. }]);
  19677. return OutputTest;
  19678. }(_io_output__WEBPACK_IMPORTED_MODULE_0__["Output"]);
  19679. /***/ }),
  19680. /***/ "./js/visualUI/algorithm.js":
  19681. /*!**********************************!*\
  19682. !*** ./js/visualUI/algorithm.js ***!
  19683. \**********************************/
  19684. /*! exports provided: renderAlgorithm */
  19685. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  19686. "use strict";
  19687. __webpack_require__.r(__webpack_exports__);
  19688. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderAlgorithm", function() { return renderAlgorithm; });
  19689. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  19690. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  19691. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  19692. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  19693. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  19694. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  19695. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  19696. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./commands */ "./js/visualUI/commands.js");
  19697. /* harmony import */ var _code_generator__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./code_generator */ "./js/visualUI/code_generator.js");
  19698. /* harmony import */ var _commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  19699. /* harmony import */ var _functions__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./functions */ "./js/visualUI/functions.js");
  19700. /* harmony import */ var _io_domConsole__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./../io/domConsole */ "./js/io/domConsole.js");
  19701. /* harmony import */ var _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  19702. /* harmony import */ var _processor_ivprogProcessor__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./../processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  19703. /* harmony import */ var _services_languageService__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js");
  19704. window.block_render = false;
  19705. function renderAlgorithm() {
  19706. if (window.block_render) {
  19707. return;
  19708. }
  19709. if (window.draging) {
  19710. return;
  19711. }
  19712. window.block_render = true;
  19713. console.log('rendering algorithm');
  19714. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.all_functions').children().off();
  19715. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.all_functions').empty();
  19716. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.list_globals').children().off();
  19717. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.list_globals').empty();
  19718. for (var i = 0; i < window.program_obj.functions.length; i++) {
  19719. _functions__WEBPACK_IMPORTED_MODULE_9__["renderFunction"](window.program_obj.functions[i]);
  19720. }
  19721. for (var i = 0; i < window.program_obj.globals.length; i++) {
  19722. _globals__WEBPACK_IMPORTED_MODULE_4__["renderGlobal"](window.program_obj.globals[i]);
  19723. }
  19724. setTimeout(function () {
  19725. window.block_render = false;
  19726. }, 100);
  19727. console.log('fim do render');
  19728. }
  19729. /***/ }),
  19730. /***/ "./js/visualUI/code_generator.js":
  19731. /*!***************************************!*\
  19732. !*** ./js/visualUI/code_generator.js ***!
  19733. \***************************************/
  19734. /*! exports provided: generate */
  19735. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  19736. "use strict";
  19737. __webpack_require__.r(__webpack_exports__);
  19738. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "generate", function() { return generate; });
  19739. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  19740. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  19741. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  19742. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  19743. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  19744. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  19745. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  19746. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./commands */ "./js/visualUI/commands.js");
  19747. /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./utils */ "./js/visualUI/utils.js");
  19748. function generate() {
  19749. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ivprog_visual_panel').find('.error_icon').remove();
  19750. var code = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('program') + ' { ';
  19751. code += globalsCode();
  19752. code += '\n';
  19753. var has_error = false;
  19754. for (var i = 0; i < window.program_obj.functions.length; i++) {
  19755. var n_code = functionsCode(window.program_obj.functions[i]);
  19756. if (n_code == null) {
  19757. has_error = true;
  19758. }
  19759. code += n_code;
  19760. code += '\n';
  19761. }
  19762. code += '\n}';
  19763. if (has_error) {
  19764. return null;
  19765. } else {
  19766. return code;
  19767. }
  19768. }
  19769. function functionsCode(function_obj) {
  19770. var ret = '\n\t' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('function') + ' ';
  19771. var has_error = false;
  19772. switch (function_obj.return_type) {
  19773. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER:
  19774. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('integer');
  19775. break;
  19776. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL:
  19777. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('real');
  19778. break;
  19779. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT:
  19780. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text');
  19781. break;
  19782. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN:
  19783. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('boolean');
  19784. break;
  19785. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].VOID:
  19786. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('void');
  19787. break;
  19788. }
  19789. ret += ' ';
  19790. if (function_obj.return_dimensions == 1) {
  19791. ret += '[] ';
  19792. } else if (function_obj.return_dimensions == 2) {
  19793. ret += '[][] ';
  19794. }
  19795. ret += function_obj.name + ' ( ';
  19796. for (var j = 0; j < function_obj.parameters_list.length; j++) {
  19797. ret += parametersCode(function_obj.parameters_list[j]);
  19798. if (j + 1 < function_obj.parameters_list.length) {
  19799. ret += ',';
  19800. }
  19801. }
  19802. ret += ' ) {';
  19803. for (var j = 0; j < function_obj.variables_list.length; j++) {
  19804. ret += variablesCode(function_obj.variables_list[j]);
  19805. }
  19806. for (var j = 0; j < function_obj.commands.length; j++) {
  19807. try {
  19808. ret += commandsCode(function_obj.commands[j]);
  19809. } catch (err) {
  19810. has_error = true;
  19811. console.error(err.message);
  19812. var todos = jquery__WEBPACK_IMPORTED_MODULE_0___default()('body').find('.command_container');
  19813. for (var i = 0; i < todos.length; i++) {
  19814. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(todos[i]).data('command') == function_obj.commands[j]) {
  19815. jquery__WEBPACK_IMPORTED_MODULE_0___default()(todos[i]).prepend(' <i class="ui icon red exclamation triangle error_icon"></i> ');
  19816. break;
  19817. }
  19818. }
  19819. }
  19820. }
  19821. ret += '\n\t}';
  19822. if (has_error) {
  19823. return null;
  19824. } else {
  19825. return ret;
  19826. }
  19827. }
  19828. function commandsCode(command_obj) {
  19829. var indentation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
  19830. switch (command_obj.type) {
  19831. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].break:
  19832. return breaksCode(command_obj, indentation);
  19833. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].comment:
  19834. return commentsCode(command_obj, indentation);
  19835. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].reader:
  19836. return readersCode(command_obj, indentation);
  19837. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].writer:
  19838. return writersCode(command_obj, indentation);
  19839. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].functioncall:
  19840. return functioncallsCode(command_obj, indentation);
  19841. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution:
  19842. return attributionsCode(command_obj, indentation);
  19843. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].whiletrue:
  19844. return whiletruesCode(command_obj, indentation);
  19845. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].dowhiletrue:
  19846. return doWhilesCode(command_obj, indentation);
  19847. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].iftrue:
  19848. return iftruesCode(command_obj, indentation);
  19849. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes:
  19850. return repeatNtimesCode(command_obj, indentation);
  19851. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].switch:
  19852. return switchsCode(command_obj, indentation);
  19853. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].return:
  19854. return returnsCode(command_obj, indentation);
  19855. }
  19856. }
  19857. function returnsCode(command_obj, indentation) {
  19858. var ret = '\n';
  19859. for (var i = 0; i < indentation; i++) {
  19860. ret += '\t';
  19861. }
  19862. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_return');
  19863. if (command_obj.variable_value_menu) {
  19864. try {
  19865. ret += ' ' + variableValueMenuCode(command_obj.variable_value_menu, true);
  19866. } catch (err) {}
  19867. }
  19868. return ret;
  19869. }
  19870. function breaksCode(command_obj, indentation) {
  19871. var ret = '\n';
  19872. for (var i = 0; i < indentation; i++) {
  19873. ret += '\t';
  19874. }
  19875. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_break');
  19876. return ret;
  19877. }
  19878. function switchsCode(command_obj, indentation) {
  19879. var ret = '\n';
  19880. for (var i = 0; i < indentation; i++) {
  19881. ret += '\t';
  19882. }
  19883. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_code_switch') + ' ( ';
  19884. ret += variableValueMenuCode(command_obj.variable);
  19885. ret += ' ) { ';
  19886. if (command_obj.cases) {
  19887. for (var i = 0; i < command_obj.cases.length; i++) {
  19888. ret += switchcasesCode(command_obj.cases[i], indentation + 1);
  19889. }
  19890. }
  19891. ret += '\n';
  19892. for (var i = 0; i < indentation; i++) {
  19893. ret += '\t';
  19894. }
  19895. ret += '} ';
  19896. return ret;
  19897. }
  19898. function switchcasesCode(switchcase, indentation) {
  19899. var ret = '\n';
  19900. for (var i = 0; i < indentation; i++) {
  19901. ret += '\t';
  19902. }
  19903. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_code_case') + ' ';
  19904. ret += variableValueMenuCode(switchcase.variable_value_menu);
  19905. ret += ' :';
  19906. if (switchcase.commands_block) {
  19907. for (var i = 0; i < switchcase.commands_block.length; i++) {
  19908. ret += commandsCode(switchcase.commands_block[i], indentation + 1);
  19909. }
  19910. }
  19911. return ret;
  19912. }
  19913. function repeatNtimesCode(command_obj, indentation) {
  19914. var ret = '\n';
  19915. for (var i = 0; i < indentation; i++) {
  19916. ret += '\t';
  19917. }
  19918. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_for') + ' ( ';
  19919. if (command_obj.var_attribution) {
  19920. ret += variableValueMenuCode(command_obj.var_attribution);
  19921. ret += ' = ';
  19922. ret += variableValueMenuCode(command_obj.expression1);
  19923. }
  19924. ret += ' ; ';
  19925. if (command_obj.expression2) {
  19926. switch (command_obj.expression2.expression.type) {
  19927. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic:
  19928. ret += logicExpressionCode(command_obj.expression2.expression);
  19929. break;
  19930. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic:
  19931. ret += arithmeticExpressionCode(command_obj.expression2.expression);
  19932. break;
  19933. }
  19934. }
  19935. ret += ' ; ';
  19936. if (command_obj.var_incrementation) {
  19937. ret += variableValueMenuCode(command_obj.var_incrementation);
  19938. ret += ' = ';
  19939. ret += variableValueMenuCode(command_obj.expression3.itens[0]);
  19940. switch (command_obj.expression3.itens[1]) {
  19941. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus:
  19942. ret += ' + ';
  19943. break;
  19944. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].minus:
  19945. ret += ' - ';
  19946. break;
  19947. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].multiplication:
  19948. ret += ' * ';
  19949. break;
  19950. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].division:
  19951. ret += ' / ';
  19952. break;
  19953. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].module:
  19954. ret += ' % ';
  19955. break;
  19956. }
  19957. ret += variableValueMenuCode(command_obj.expression3.itens[2]);
  19958. }
  19959. ret += ' ) { ';
  19960. if (command_obj.commands_block) {
  19961. for (var i = 0; i < command_obj.commands_block.length; i++) {
  19962. ret += commandsCode(command_obj.commands_block[i], indentation + 1);
  19963. }
  19964. }
  19965. ret += '\n';
  19966. for (var i = 0; i < indentation; i++) {
  19967. ret += '\t';
  19968. }
  19969. ret += '}';
  19970. return ret;
  19971. }
  19972. function iftruesCode(command_obj, indentation) {
  19973. var ret = '\n';
  19974. for (var i = 0; i < indentation; i++) {
  19975. ret += '\t';
  19976. }
  19977. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_if');
  19978. if (!command_obj.expression.expression) {
  19979. _utils__WEBPACK_IMPORTED_MODULE_7__["renderErrorMessage"](command_obj.expression.dom_object, _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('inform_valid_expression'));
  19980. }
  19981. switch (command_obj.expression.expression.type) {
  19982. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic:
  19983. ret += logicExpressionCode(command_obj.expression.expression);
  19984. break;
  19985. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic:
  19986. ret += arithmeticExpressionCode(command_obj.expression.expression);
  19987. break;
  19988. }
  19989. ret += ' { ';
  19990. if (command_obj.commands_block) {
  19991. for (var i = 0; i < command_obj.commands_block.length; i++) {
  19992. ret += commandsCode(command_obj.commands_block[i], indentation + 1);
  19993. }
  19994. }
  19995. ret += '\n';
  19996. for (var i = 0; i < indentation; i++) {
  19997. ret += '\t';
  19998. }
  19999. ret += '} ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_else') + ' {';
  20000. if (command_obj.commands_else) {
  20001. for (var i = 0; i < command_obj.commands_else.length; i++) {
  20002. ret += commandsCode(command_obj.commands_else[i], indentation + 1);
  20003. }
  20004. }
  20005. ret += '\n';
  20006. for (var i = 0; i < indentation; i++) {
  20007. ret += '\t';
  20008. }
  20009. ret += '}';
  20010. return ret;
  20011. }
  20012. function doWhilesCode(command_obj, indentation) {
  20013. var ret = '\n';
  20014. for (var i = 0; i < indentation; i++) {
  20015. ret += '\t';
  20016. }
  20017. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_code_do') + ' { ';
  20018. if (command_obj.commands_block) {
  20019. for (var i = 0; i < command_obj.commands_block.length; i++) {
  20020. ret += commandsCode(command_obj.commands_block[i], indentation + 1);
  20021. }
  20022. }
  20023. ret += '\n';
  20024. for (var i = 0; i < indentation; i++) {
  20025. ret += '\t';
  20026. }
  20027. ret += '} ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_code_while');
  20028. if (!command_obj.expression.expression) {
  20029. _utils__WEBPACK_IMPORTED_MODULE_7__["renderErrorMessage"](command_obj.expression.dom_object, _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('inform_valid_expression'));
  20030. }
  20031. switch (command_obj.expression.expression.type) {
  20032. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic:
  20033. ret += logicExpressionCode(command_obj.expression.expression);
  20034. break;
  20035. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic:
  20036. ret += arithmeticExpressionCode(command_obj.expression.expression);
  20037. break;
  20038. }
  20039. return ret;
  20040. }
  20041. function whiletruesCode(command_obj, indentation) {
  20042. var ret = '\n';
  20043. for (var i = 0; i < indentation; i++) {
  20044. ret += '\t';
  20045. }
  20046. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_code_while');
  20047. if (!command_obj.expression.expression) {
  20048. _utils__WEBPACK_IMPORTED_MODULE_7__["renderErrorMessage"](command_obj.expression.dom_object, _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('inform_valid_expression'));
  20049. }
  20050. switch (command_obj.expression.expression.type) {
  20051. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic:
  20052. ret += logicExpressionCode(command_obj.expression.expression);
  20053. break;
  20054. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic:
  20055. ret += arithmeticExpressionCode(command_obj.expression.expression);
  20056. break;
  20057. }
  20058. ret += ' { ';
  20059. if (command_obj.commands_block) {
  20060. for (var i = 0; i < command_obj.commands_block.length; i++) {
  20061. ret += commandsCode(command_obj.commands_block[i], indentation + 1);
  20062. }
  20063. }
  20064. ret += '\n';
  20065. for (var i = 0; i < indentation; i++) {
  20066. ret += '\t';
  20067. }
  20068. ret += '}';
  20069. return ret;
  20070. }
  20071. function logicExpressionCode(expression) {
  20072. var ret = ' ( ';
  20073. if (expression.first_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic) {
  20074. ret += logicExpressionCode(expression.first_operand);
  20075. } else if (expression.first_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic) {
  20076. ret += arithmeticExpressionCode(expression.first_operand);
  20077. } else {
  20078. ret += variableValueMenuCode(expression.first_operand);
  20079. }
  20080. if (expression.operator) {
  20081. switch (expression.operator) {
  20082. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].equals_to:
  20083. ret += ' == ';
  20084. break;
  20085. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].not_equals_to:
  20086. ret += ' != ';
  20087. break;
  20088. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].and:
  20089. ret += ' && ';
  20090. break;
  20091. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].or:
  20092. ret += ' || ';
  20093. break;
  20094. }
  20095. if (expression.second_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic) {
  20096. ret += logicExpressionCode(expression.second_operand);
  20097. } else if (expression.second_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic) {
  20098. ret += arithmeticExpressionCode(expression.second_operand);
  20099. } else {
  20100. ret += variableValueMenuCode(expression.second_operand);
  20101. }
  20102. }
  20103. ret += ' ) ';
  20104. return ret;
  20105. }
  20106. function arithmeticExpressionCode(expression) {
  20107. var ret = ' ( ';
  20108. if (expression.first_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic) {
  20109. ret += logicExpressionCode(expression.first_operand);
  20110. } else if (expression.first_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic) {
  20111. ret += arithmeticExpressionCode(expression.first_operand);
  20112. } else {
  20113. ret += variableValueMenuCode(expression.first_operand);
  20114. }
  20115. switch (expression.operator) {
  20116. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].greater_than:
  20117. ret += ' > ';
  20118. break;
  20119. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].less_than:
  20120. ret += ' < ';
  20121. break;
  20122. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].equals_to:
  20123. ret += ' == ';
  20124. break;
  20125. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].not_equals_to:
  20126. ret += ' != ';
  20127. break;
  20128. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].greater_than_or_equals_to:
  20129. ret += ' >= ';
  20130. break;
  20131. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].less_than_or_equals_to:
  20132. ret += ' <= ';
  20133. break;
  20134. }
  20135. if (expression.second_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic) {
  20136. ret += logicExpressionCode(expression.second_operand);
  20137. } else if (expression.second_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic) {
  20138. ret += arithmeticExpressionCode(expression.second_operand);
  20139. } else {
  20140. ret += variableValueMenuCode(expression.second_operand);
  20141. }
  20142. ret += ' ) ';
  20143. return ret;
  20144. }
  20145. function attributionsCode(command_obj, indentation) {
  20146. var ret = '\n';
  20147. for (var i = 0; i < indentation; i++) {
  20148. ret += '\t';
  20149. }
  20150. ret += variableValueMenuCode(command_obj.variable) + ' = ';
  20151. for (var i = 0; i < command_obj.expression.length; i++) {
  20152. ret += elementExpressionCode(command_obj.expression[i]);
  20153. }
  20154. return ret;
  20155. }
  20156. function elementExpressionCode(expression_obj) {
  20157. var ret = '';
  20158. for (var i = 0; i < expression_obj.itens.length; i++) {
  20159. if (expression_obj.itens[i].type) {
  20160. ret += variableValueMenuCode(expression_obj.itens[i]);
  20161. } else if (expression_obj.itens[i].type_exp) {
  20162. if (expression_obj.itens[i].type_exp == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par) {
  20163. ret += ' ( ';
  20164. }
  20165. ret += elementExpressionCode(expression_obj.itens[i]);
  20166. if (expression_obj.itens[i].type_exp == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par) {
  20167. ret += ' ) ';
  20168. }
  20169. } else {
  20170. switch (expression_obj.itens[i]) {
  20171. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus:
  20172. ret += ' + ';
  20173. break;
  20174. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].minus:
  20175. ret += ' - ';
  20176. break;
  20177. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].multiplication:
  20178. ret += ' * ';
  20179. break;
  20180. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].division:
  20181. ret += ' / ';
  20182. break;
  20183. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].module:
  20184. ret += ' % ';
  20185. break;
  20186. }
  20187. }
  20188. }
  20189. return ret;
  20190. }
  20191. function functioncallsCode(command_obj, indentation) {
  20192. var ret = '\n';
  20193. for (var i = 0; i < indentation; i++) {
  20194. ret += '\t';
  20195. }
  20196. ret += variableValueMenuCode(command_obj.function_called);
  20197. return ret;
  20198. }
  20199. function readersCode(command_obj, indentation) {
  20200. var ret = '\n';
  20201. for (var i = 0; i < indentation; i++) {
  20202. ret += '\t';
  20203. }
  20204. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_command_read') + ' ( ';
  20205. ret += variableValueMenuCode(command_obj.variable_value_menu);
  20206. ret += ' ) ';
  20207. return ret;
  20208. }
  20209. function variableValueMenuCode(variable_obj) {
  20210. var is_return = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  20211. var ret = '';
  20212. try {
  20213. if (variable_obj.function_called) {
  20214. if (variable_obj.function_called.name) {
  20215. ret += variable_obj.function_called.name + ' ( ';
  20216. } else {
  20217. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(variable_obj.function_called.category) + '.' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(variable_obj.function_called.identifier) + ' ( ';
  20218. }
  20219. if (variable_obj.parameters_list) {
  20220. for (var i = 0; i < variable_obj.parameters_list.length; i++) {
  20221. ret += variableValueMenuCode(variable_obj.parameters_list[i]);
  20222. if (i + 1 < variable_obj.parameters_list.length) {
  20223. ret += ', ';
  20224. }
  20225. }
  20226. }
  20227. ret += ' )';
  20228. } else if (variable_obj.content.type) {
  20229. ret += variable_obj.content.name;
  20230. if (variable_obj.content.dimensions == 1 && variable_obj.dimensions != 1) {
  20231. ret += ' [ ' + variableValueMenuCode(variable_obj.column) + ' ] ';
  20232. }
  20233. if (variable_obj.content.dimensions == 2 && variable_obj.dimensions != 2) {
  20234. ret += ' [ ' + variableValueMenuCode(variable_obj.row) + ' ] ';
  20235. ret += ' [ ' + variableValueMenuCode(variable_obj.column) + ' ] ';
  20236. }
  20237. } else {
  20238. if (isNaN(variable_obj.content)) {
  20239. ret += '"' + variable_obj.content + '"';
  20240. } else {
  20241. ret += variable_obj.content;
  20242. }
  20243. }
  20244. } catch (err) {
  20245. if (!is_return) {
  20246. _utils__WEBPACK_IMPORTED_MODULE_7__["renderErrorMessage"](variable_obj.dom_object, _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('inform_valid_content'));
  20247. throw err;
  20248. }
  20249. }
  20250. return ret;
  20251. }
  20252. function writersCode(command_obj, indentation) {
  20253. var ret = '\n';
  20254. for (var i = 0; i < indentation; i++) {
  20255. ret += '\t';
  20256. }
  20257. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_command_write') + ' ( ';
  20258. for (var i = 0; i < command_obj.content.length; i++) {
  20259. ret += variableValueMenuCode(command_obj.content[i]);
  20260. if (i + 1 < command_obj.content.length) {
  20261. ret += ' + ';
  20262. }
  20263. }
  20264. ret += ' ) ';
  20265. return ret;
  20266. }
  20267. function commentsCode(command_obj, indentation) {
  20268. var ret = '\n';
  20269. for (var i = 0; i < indentation; i++) {
  20270. ret += '\t';
  20271. }
  20272. ret += '// ';
  20273. ret += command_obj.comment_text.content;
  20274. return ret;
  20275. }
  20276. function parametersCode(parameter_obj) {
  20277. var ret = '';
  20278. switch (parameter_obj.type) {
  20279. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER:
  20280. ret += ' ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('integer') + ' ';
  20281. break;
  20282. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL:
  20283. ret += ' ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('real') + ' ';
  20284. break;
  20285. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT:
  20286. ret += ' ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text') + ' ';
  20287. break;
  20288. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN:
  20289. ret += ' ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('boolean') + ' ';
  20290. break;
  20291. }
  20292. ret += parameter_obj.name + '';
  20293. if (parameter_obj.dimensions == 1) {
  20294. ret += ' []';
  20295. } else if (parameter_obj.dimensions == 2) {
  20296. ret += ' [][]';
  20297. }
  20298. return ret;
  20299. }
  20300. function variablesCode(variable_obj) {
  20301. var ret = '';
  20302. var temp = variable_obj;
  20303. ret += '\n\t\t';
  20304. if (temp.is_constant) {
  20305. ret += 'const ';
  20306. }
  20307. switch (temp.type) {
  20308. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER:
  20309. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('integer') + ' ';
  20310. break;
  20311. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL:
  20312. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('real') + ' ';
  20313. break;
  20314. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT:
  20315. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text') + ' ';
  20316. break;
  20317. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN:
  20318. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('boolean') + ' ';
  20319. break;
  20320. }
  20321. ret += temp.name + ' ';
  20322. if (temp.dimensions == 1) {
  20323. ret += '[' + temp.columns + '] ';
  20324. switch (temp.type) {
  20325. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER:
  20326. ret += '= {' + temp.value + '}';
  20327. break;
  20328. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL:
  20329. ret += '= {' + temp.value.toFixed(2) + '}';
  20330. break;
  20331. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT:
  20332. ret += '= {';
  20333. for (var j = 0; j < temp.value.length; j++) {
  20334. ret += '"' + temp.value[j] + '"';
  20335. if (j + 1 < temp.value.length) {
  20336. ret += ',';
  20337. }
  20338. }
  20339. ret += '}';
  20340. break;
  20341. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN:
  20342. ret += '= {';
  20343. for (var j = 0; j < temp.value.length; j++) {
  20344. if (temp.value[j]) {
  20345. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("true");
  20346. } else {
  20347. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("false");
  20348. }
  20349. if (j + 1 < temp.value.length) {
  20350. ret += ',';
  20351. }
  20352. }
  20353. ret += '}';
  20354. break;
  20355. }
  20356. } else if (temp.dimensions == 2) {
  20357. ret += '[' + temp.rows + '][' + temp.columns + '] ';
  20358. switch (temp.type) {
  20359. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER:
  20360. ret += '= {';
  20361. for (var j = 0; j < temp.rows; j++) {
  20362. ret += '{' + temp.value[j] + '}';
  20363. if (j + 1 < temp.rows) {
  20364. ret += ',';
  20365. }
  20366. }
  20367. ret += '}';
  20368. break;
  20369. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL:
  20370. ret += '= {';
  20371. for (var j = 0; j < temp.rows; j++) {
  20372. ret += '{' + temp.value[j].toFixed(2) + '}';
  20373. if (j + 1 < temp.rows) {
  20374. ret += ',';
  20375. }
  20376. }
  20377. ret += '}';
  20378. break;
  20379. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT:
  20380. ret += '= {';
  20381. for (var j = 0; j < temp.rows; j++) {
  20382. ret += '{';
  20383. for (var k = 0; k < temp.columns; k++) {
  20384. ret += '"' + temp.value[j][k] + '"';
  20385. if (k + 1 < temp.columns) {
  20386. ret += ',';
  20387. }
  20388. }
  20389. ret += '}';
  20390. if (j + 1 < temp.rows) {
  20391. ret += ',';
  20392. }
  20393. }
  20394. ret += '}';
  20395. break;
  20396. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN:
  20397. ret += '= {';
  20398. for (var j = 0; j < temp.rows; j++) {
  20399. ret += '{';
  20400. for (var k = 0; k < temp.columns; k++) {
  20401. if (temp.value[j][k]) {
  20402. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("true");
  20403. } else {
  20404. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("false");
  20405. }
  20406. if (k + 1 < temp.columns) {
  20407. ret += ',';
  20408. }
  20409. }
  20410. ret += '}';
  20411. if (j + 1 < temp.rows) {
  20412. ret += ',';
  20413. }
  20414. }
  20415. ret += '}';
  20416. break;
  20417. }
  20418. } else {
  20419. switch (temp.type) {
  20420. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER:
  20421. ret += '= ' + temp.value;
  20422. break;
  20423. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL:
  20424. ret += '= ' + temp.value.toFixed(2);
  20425. break;
  20426. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT:
  20427. ret += '= "' + temp.value + '"';
  20428. break;
  20429. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN:
  20430. ret += '= ';
  20431. if (temp.value) {
  20432. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("true");
  20433. } else {
  20434. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("false");
  20435. }
  20436. break;
  20437. }
  20438. }
  20439. return ret;
  20440. }
  20441. function globalsCode() {
  20442. var ret = '';
  20443. if (window.program_obj.globals) {
  20444. for (var i = 0; i < window.program_obj.globals.length; i++) {
  20445. var temp = window.program_obj.globals[i];
  20446. ret += '\n\t';
  20447. if (temp.is_constant) {
  20448. ret += 'const ';
  20449. }
  20450. switch (temp.type) {
  20451. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER:
  20452. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('integer');
  20453. break;
  20454. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL:
  20455. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('real');
  20456. break;
  20457. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT:
  20458. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text');
  20459. break;
  20460. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN:
  20461. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('boolean');
  20462. break;
  20463. }
  20464. ret += ' ' + temp.name + ' ';
  20465. if (temp.dimensions == 1) {
  20466. ret += '[' + temp.columns + '] ';
  20467. switch (temp.type) {
  20468. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER:
  20469. ret += '= {' + temp.value + '}';
  20470. break;
  20471. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL:
  20472. ret += '= {';
  20473. for (var j = 0; j < temp.value.length; j++) {
  20474. ret += temp.value[j].toFixed(2);
  20475. if (j + 1 < temp.value.length) {
  20476. ret += ',';
  20477. }
  20478. }
  20479. ret += '}';
  20480. break;
  20481. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT:
  20482. ret += '= {';
  20483. for (var j = 0; j < temp.value.length; j++) {
  20484. ret += '"' + temp.value[j] + '"';
  20485. if (j + 1 < temp.value.length) {
  20486. ret += ',';
  20487. }
  20488. }
  20489. ret += '}';
  20490. break;
  20491. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN:
  20492. ret += '= {';
  20493. for (var j = 0; j < temp.value.length; j++) {
  20494. if (temp.value[j]) {
  20495. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("true");
  20496. } else {
  20497. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("false");
  20498. }
  20499. if (j + 1 < temp.value.length) {
  20500. ret += ',';
  20501. }
  20502. }
  20503. ret += '}';
  20504. break;
  20505. }
  20506. } else if (temp.dimensions == 2) {
  20507. ret += '[' + temp.rows + '][' + temp.columns + '] ';
  20508. switch (temp.type) {
  20509. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER:
  20510. ret += '= {';
  20511. for (var j = 0; j < temp.rows; j++) {
  20512. ret += '{' + temp.value[j] + '}';
  20513. if (j + 1 < temp.rows) {
  20514. ret += ',';
  20515. }
  20516. }
  20517. ret += '}';
  20518. break;
  20519. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL:
  20520. ret += '= {';
  20521. for (var j = 0; j < temp.rows; j++) {
  20522. ret += '{';
  20523. for (var k = 0; k < temp.columns; k++) {
  20524. ret += temp.value[j][k].toFixed(2);
  20525. if (k + 1 < temp.columns) {
  20526. ret += ',';
  20527. }
  20528. }
  20529. ret += '}';
  20530. if (j + 1 < temp.rows) {
  20531. ret += ',';
  20532. }
  20533. }
  20534. ret += '}';
  20535. break;
  20536. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT:
  20537. ret += '= {';
  20538. for (var j = 0; j < temp.rows; j++) {
  20539. ret += '{';
  20540. for (var k = 0; k < temp.columns; k++) {
  20541. ret += '"' + temp.value[j][k] + '"';
  20542. if (k + 1 < temp.columns) {
  20543. ret += ',';
  20544. }
  20545. }
  20546. ret += '}';
  20547. if (j + 1 < temp.rows) {
  20548. ret += ',';
  20549. }
  20550. }
  20551. ret += '}';
  20552. break;
  20553. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN:
  20554. ret += '= {';
  20555. for (var j = 0; j < temp.rows; j++) {
  20556. ret += '{';
  20557. for (var k = 0; k < temp.columns; k++) {
  20558. if (temp.value[j][k]) {
  20559. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("true");
  20560. } else {
  20561. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("false");
  20562. }
  20563. if (k + 1 < temp.columns) {
  20564. ret += ',';
  20565. }
  20566. }
  20567. ret += '}';
  20568. if (j + 1 < temp.rows) {
  20569. ret += ',';
  20570. }
  20571. }
  20572. ret += '}';
  20573. break;
  20574. }
  20575. } else {
  20576. switch (temp.type) {
  20577. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER:
  20578. ret += '= ' + temp.value;
  20579. break;
  20580. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL:
  20581. ret += '= ' + temp.value.toFixed(2);
  20582. break;
  20583. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT:
  20584. ret += '= "' + temp.value + '"';
  20585. break;
  20586. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN:
  20587. ret += '= ';
  20588. if (temp.value) {
  20589. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("true");
  20590. ;
  20591. } else {
  20592. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("false");
  20593. ;
  20594. }
  20595. break;
  20596. }
  20597. }
  20598. }
  20599. }
  20600. return ret;
  20601. }
  20602. /***/ }),
  20603. /***/ "./js/visualUI/commands.js":
  20604. /*!*********************************!*\
  20605. !*** ./js/visualUI/commands.js ***!
  20606. \*********************************/
  20607. /*! exports provided: removeCommand, createFloatingCommand, renderCommand, genericCreateCommand */
  20608. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  20609. "use strict";
  20610. __webpack_require__.r(__webpack_exports__);
  20611. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeCommand", function() { return removeCommand; });
  20612. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  20613. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  20614. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "genericCreateCommand", function() { return genericCreateCommand; });
  20615. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  20616. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  20617. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  20618. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  20619. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  20620. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  20621. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  20622. /* harmony import */ var _commands_comment__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./commands/comment */ "./js/visualUI/commands/comment.js");
  20623. /* harmony import */ var _commands_reader__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./commands/reader */ "./js/visualUI/commands/reader.js");
  20624. /* harmony import */ var _commands_writer__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./commands/writer */ "./js/visualUI/commands/writer.js");
  20625. /* harmony import */ var _commands_attribution__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./commands/attribution */ "./js/visualUI/commands/attribution.js");
  20626. /* harmony import */ var _commands_iftrue__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./commands/iftrue */ "./js/visualUI/commands/iftrue.js");
  20627. /* harmony import */ var _commands_repeatNtimes__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./commands/repeatNtimes */ "./js/visualUI/commands/repeatNtimes.js");
  20628. /* harmony import */ var _commands_whiletrue__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./commands/whiletrue */ "./js/visualUI/commands/whiletrue.js");
  20629. /* harmony import */ var _commands_dowhiletrue__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./commands/dowhiletrue */ "./js/visualUI/commands/dowhiletrue.js");
  20630. /* harmony import */ var _commands_switch__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./commands/switch */ "./js/visualUI/commands/switch.js");
  20631. /* harmony import */ var _commands_functioncall__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./commands/functioncall */ "./js/visualUI/commands/functioncall.js");
  20632. /* harmony import */ var _commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  20633. /* harmony import */ var _commands_break__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./commands/break */ "./js/visualUI/commands/break.js");
  20634. /* harmony import */ var _commands_return__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./commands/return */ "./js/visualUI/commands/return.js");
  20635. var has_element_created_draged = false;
  20636. var which_element_is_draged = null;
  20637. function removeCommand(command, function_obj, dom_obj) {
  20638. if (function_obj.commands.indexOf(command) > -1) {
  20639. function_obj.commands.splice(function_obj.commands.indexOf(command), 1);
  20640. return true;
  20641. } // Utilize dois parantNode, pois o primeiro é o div de comandos
  20642. try {
  20643. if (dom_obj.parent().parent().data('command').commands_block.indexOf(command) > -1) {
  20644. dom_obj.parent().parent().data('command').commands_block.splice(dom_obj.parent().parent().data('command').commands_block.indexOf(command), 1);
  20645. return true;
  20646. }
  20647. } catch (err) {}
  20648. try {
  20649. if (dom_obj.parent().parent().data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].iftrue) {
  20650. if (dom_obj.parent().parent().data('command').commands_else.indexOf(command) > -1) {
  20651. dom_obj.parent().parent().data('command').commands_else.splice(dom_obj.parent().parent().data('command').commands_else.indexOf(command), 1);
  20652. return true;
  20653. }
  20654. }
  20655. } catch (err) {}
  20656. if (dom_obj.parent().data('switchcase')) {
  20657. console.log("o que encontrei: ");
  20658. console.log(dom_obj.parent().data('switchcase'));
  20659. dom_obj.parent().data('switchcase').commands_block.splice(dom_obj.parent().data('switchcase').commands_block.indexOf(command), 1);
  20660. return true;
  20661. }
  20662. return false;
  20663. }
  20664. window.function_container_active = null;
  20665. function createFloatingCommand(function_obj, function_container, command_type, mouse_event) {
  20666. var floatingObject;
  20667. switch (command_type) {
  20668. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].break:
  20669. floatingObject = _commands_break__WEBPACK_IMPORTED_MODULE_17__["createFloatingCommand"]();
  20670. break;
  20671. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].comment:
  20672. floatingObject = _commands_comment__WEBPACK_IMPORTED_MODULE_6__["createFloatingCommand"]();
  20673. break;
  20674. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].reader:
  20675. floatingObject = _commands_reader__WEBPACK_IMPORTED_MODULE_7__["createFloatingCommand"]();
  20676. break;
  20677. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].writer:
  20678. floatingObject = _commands_writer__WEBPACK_IMPORTED_MODULE_8__["createFloatingCommand"]();
  20679. break;
  20680. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution:
  20681. floatingObject = _commands_attribution__WEBPACK_IMPORTED_MODULE_9__["createFloatingCommand"]();
  20682. break;
  20683. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].iftrue:
  20684. floatingObject = _commands_iftrue__WEBPACK_IMPORTED_MODULE_10__["createFloatingCommand"]();
  20685. break;
  20686. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes:
  20687. floatingObject = _commands_repeatNtimes__WEBPACK_IMPORTED_MODULE_11__["createFloatingCommand"]();
  20688. break;
  20689. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].whiletrue:
  20690. floatingObject = _commands_whiletrue__WEBPACK_IMPORTED_MODULE_12__["createFloatingCommand"]();
  20691. break;
  20692. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].dowhiletrue:
  20693. floatingObject = _commands_dowhiletrue__WEBPACK_IMPORTED_MODULE_13__["createFloatingCommand"]();
  20694. break;
  20695. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].switch:
  20696. floatingObject = _commands_switch__WEBPACK_IMPORTED_MODULE_14__["createFloatingCommand"]();
  20697. break;
  20698. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].functioncall:
  20699. floatingObject = _commands_functioncall__WEBPACK_IMPORTED_MODULE_15__["createFloatingCommand"]();
  20700. break;
  20701. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].return:
  20702. floatingObject = _commands_return__WEBPACK_IMPORTED_MODULE_18__["createFloatingCommand"]();
  20703. break;
  20704. }
  20705. floatingObject.draggable().appendTo("body");
  20706. jquery__WEBPACK_IMPORTED_MODULE_0___default()('body').mouseup(function (evt) {
  20707. manageCommand(function_obj, function_container, evt, command_type);
  20708. jquery__WEBPACK_IMPORTED_MODULE_0___default()('body').off('mouseup');
  20709. jquery__WEBPACK_IMPORTED_MODULE_0___default()('body').off('mouseover');
  20710. });
  20711. if (!function_container.hasClass('function_div') || function_container.length < 1) {
  20712. window.mouse_event = mouse_event;
  20713. function_container = jquery__WEBPACK_IMPORTED_MODULE_0___default()(mouse_event.originalEvent.srcElement.closest('.function_div'));
  20714. }
  20715. console.log('function_container', function_container);
  20716. function_container_active = function_container;
  20717. function_container.find('.commands_list_div').on('mousemove', function (evt) {
  20718. addGhostDiv(evt);
  20719. });
  20720. function_container.find('.commands_list_div').find("*").on('mousemove', function (evt) {
  20721. addGhostDiv(evt);
  20722. });
  20723. function_container.on('mouseout', function (event) {
  20724. var el = jquery__WEBPACK_IMPORTED_MODULE_0___default()(document.elementFromPoint(event.clientX, event.clientY));
  20725. if (el.closest('.commands_list_div').length < 1) {
  20726. window.ghostDiv.remove();
  20727. }
  20728. });
  20729. floatingObject.css("position", "absolute");
  20730. mouse_event.type = "mousedown.draggable";
  20731. mouse_event.target = floatingObject[0];
  20732. floatingObject.css("left", mouse_event.pageX - window.divx);
  20733. floatingObject.css("top", mouse_event.pageY);
  20734. floatingObject.trigger(mouse_event);
  20735. }
  20736. window.divx = 100;
  20737. window.ghostDiv = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ghost_div">');
  20738. window.active_container = null;
  20739. function addGhostToEmptyBlock(element, evt) {
  20740. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ghost_div').remove();
  20741. var container = element.closest('.command_container');
  20742. if (container.hasClass('switch')) {
  20743. container = jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.target).closest('.case_div');
  20744. }
  20745. if (!container.hasClass('dowhiletrue') && !container.hasClass('iftrue') && !container.hasClass('repeatNtimes') && !container.hasClass('case_div') && !container.hasClass('whiletrue')) {
  20746. addGhostToNotEmptyBlock(element, evt);
  20747. return;
  20748. }
  20749. if (window.active_container != null) {
  20750. if (window.active_container.is(container)) {
  20751. console.log('é o mesmo, não mudou!');
  20752. } else {
  20753. if (container.length < 1) {
  20754. container = element.closest('.commands_list_div');
  20755. if (window.active_container.is(container)) {
  20756. console.log('é o mesmo command list');
  20757. } else {
  20758. console.log('mudou para um command list');
  20759. window.active_container = container;
  20760. }
  20761. } else {
  20762. console.log('mudou para um outro container?');
  20763. }
  20764. }
  20765. }
  20766. window.active_container = container;
  20767. if (container.hasClass('iftrue')) {
  20768. var containerIf = container.find('.commands_if').get(0);
  20769. var containerElse = container.find('.commands_else').get(0);
  20770. var topIfDistance = Math.abs(evt.clientY - containerIf.getBoundingClientRect().top);
  20771. var bottomIfDistance = Math.abs(containerIf.getBoundingClientRect().top + containerIf.getBoundingClientRect().height - evt.clientY);
  20772. var topElseDistance = Math.abs(evt.clientY - containerElse.getBoundingClientRect().top);
  20773. var bottomElseDistance = Math.abs(containerElse.getBoundingClientRect().top + containerElse.getBoundingClientRect().height - evt.clientY);
  20774. if (topIfDistance < topElseDistance && topIfDistance < bottomElseDistance) {
  20775. jquery__WEBPACK_IMPORTED_MODULE_0___default()(containerIf).append(window.ghostDiv);
  20776. } else {
  20777. jquery__WEBPACK_IMPORTED_MODULE_0___default()(containerElse).append(window.ghostDiv);
  20778. }
  20779. } else if (container.hasClass('case_div')) {
  20780. container.find('.case_commands_block').append(window.ghostDiv);
  20781. } else {
  20782. container.find('.block_commands').append(window.ghostDiv);
  20783. }
  20784. }
  20785. function addGhostToNotEmptyBlock(element, evt) {
  20786. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ghost_div').remove();
  20787. var container = element.closest('.dowhiletrue, .iftrue, .repeatNtimes, .case_div, .whiletrue'); //console.log("\n\nNOT EMPTY: ", container);
  20788. //if (window.active_container != null) {
  20789. //}
  20790. if (container.length < 1) {
  20791. container = element.closest('.commands_list_div');
  20792. window.active_container = container;
  20793. addGhostToFunctionArea(element, evt);
  20794. } else {//console.log('mudou para um outro container?');
  20795. }
  20796. window.active_container = container; // quem está mais próximo? // Essa regra se aplica somente quando o over está sobre um comando
  20797. var allfilhos;
  20798. console.log('olha o container: ', container);
  20799. if (container.hasClass('iftrue')) {
  20800. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.target).closest('.data_block_if').length > 0) {
  20801. allfilhos = container.find('.commands_if').children('.command_container');
  20802. } else if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.target).closest('.data_block_else').length > 0) {
  20803. allfilhos = container.find('.commands_else').children('.command_container');
  20804. } else {
  20805. var containerIf = container.find('.commands_if').get(0);
  20806. var containerElse = container.find('.commands_else').get(0);
  20807. var topIfDistance = Math.abs(evt.clientY - containerIf.getBoundingClientRect().top);
  20808. var bottomIfDistance = Math.abs(containerIf.getBoundingClientRect().top + containerIf.getBoundingClientRect().height - evt.clientY);
  20809. var topElseDistance = Math.abs(evt.clientY - containerElse.getBoundingClientRect().top);
  20810. var bottomElseDistance = Math.abs(containerElse.getBoundingClientRect().top + containerElse.getBoundingClientRect().height - evt.clientY);
  20811. if (topIfDistance < topElseDistance && topIfDistance < bottomElseDistance) {
  20812. allfilhos = jquery__WEBPACK_IMPORTED_MODULE_0___default()(containerIf).children('.command_container');
  20813. } else {
  20814. allfilhos = jquery__WEBPACK_IMPORTED_MODULE_0___default()(containerElse).children('.command_container');
  20815. }
  20816. }
  20817. } else if (container.hasClass('case_div')) {
  20818. allfilhos = container.children('.case_commands_block').children('.command_container');
  20819. } else if (container.hasClass('commands_list_div')) {
  20820. allfilhos = container.children('.command_container');
  20821. } else {
  20822. allfilhos = container.children('.block_commands').children('.command_container');
  20823. }
  20824. var topDistances = [];
  20825. var bottomDistances = [];
  20826. for (var i = 0; i < allfilhos.length; i++) {
  20827. var topD = Math.abs(evt.clientY - allfilhos.get(i).getBoundingClientRect().top);
  20828. topDistances.push(topD);
  20829. var botD = Math.abs(allfilhos.get(i).getBoundingClientRect().top + allfilhos.get(i).getBoundingClientRect().height - evt.clientY);
  20830. bottomDistances.push(botD);
  20831. }
  20832. console.log('topDistances\n', topDistances, '\nbottomDistances\n', bottomDistances);
  20833. var menorTop = Math.min.apply(null, topDistances);
  20834. var indiceTop = topDistances.indexOf(menorTop);
  20835. var menorBot = Math.min.apply(null, bottomDistances);
  20836. var indiceBot = bottomDistances.indexOf(menorBot);
  20837. if (menorTop < menorBot) {
  20838. window.ghostDiv.insertBefore(jquery__WEBPACK_IMPORTED_MODULE_0___default()(allfilhos.get(indiceTop)));
  20839. } else {
  20840. window.ghostDiv.insertAfter(jquery__WEBPACK_IMPORTED_MODULE_0___default()(allfilhos.get(indiceBot)));
  20841. }
  20842. console.log('distancias: menorTop ', menorTop, ' menorBot ', menorBot);
  20843. }
  20844. function addGhostToFunctionArea(undermouse, evt) {
  20845. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ghost_div').remove();
  20846. var allfilhos = undermouse.closest('.commands_list_div').children('.command_container');
  20847. var topDistances = [];
  20848. var bottomDistances = [];
  20849. for (var i = 0; i < allfilhos.length; i++) {
  20850. var topD = Math.abs(evt.clientY - allfilhos.get(i).getBoundingClientRect().top);
  20851. topDistances.push(topD);
  20852. var botD = Math.abs(allfilhos.get(i).getBoundingClientRect().top + allfilhos.get(i).getBoundingClientRect().height - evt.clientY);
  20853. bottomDistances.push(botD);
  20854. }
  20855. var menorTop = Math.min.apply(null, topDistances);
  20856. var indiceTop = topDistances.indexOf(menorTop);
  20857. var menorBot = Math.min.apply(null, bottomDistances);
  20858. var indiceBot = bottomDistances.indexOf(menorBot);
  20859. if (menorTop < menorBot) {
  20860. window.ghostDiv.insertBefore(jquery__WEBPACK_IMPORTED_MODULE_0___default()(allfilhos.get(indiceTop)));
  20861. } else {
  20862. window.ghostDiv.insertAfter(jquery__WEBPACK_IMPORTED_MODULE_0___default()(allfilhos.get(indiceBot)));
  20863. }
  20864. }
  20865. function addGhostDiv(evt) {
  20866. console.log('a');
  20867. var undermouse = jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.target);
  20868. console.log('undermouse', undermouse);
  20869. if (undermouse.hasClass('ghost_div')) {
  20870. return;
  20871. } else if (undermouse.hasClass('commands_list_div')) {
  20872. addGhostToFunctionArea(undermouse, evt);
  20873. return;
  20874. } else if (undermouse.hasClass('block_commands')) {
  20875. if (undermouse.find('.command_container').length > 0) {
  20876. addGhostToNotEmptyBlock(undermouse, evt);
  20877. } else {
  20878. addGhostToEmptyBlock(undermouse, evt);
  20879. }
  20880. } else if (undermouse.hasClass('case_div')) {
  20881. if (undermouse.find('.case_commands_block').find('.command_container').length > 0) {
  20882. addGhostToNotEmptyBlock(undermouse, evt);
  20883. } else {
  20884. addGhostToEmptyBlock(undermouse, evt);
  20885. }
  20886. } else {
  20887. addGhostToNotEmptyBlock(undermouse, evt);
  20888. }
  20889. }
  20890. function borderMouseDragCommand(function_obj, function_container, evt) {
  20891. function_container.find('.over_command_drag').each(function (index) {
  20892. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).removeClass('over_command_drag');
  20893. });
  20894. var prev = null;
  20895. function_container.find('.commands_list_div').each(function (index) {
  20896. prev = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this);
  20897. if (prev) {
  20898. var objLeft = prev.offset().left;
  20899. var objTop = prev.offset().top;
  20900. var objRight = objLeft + prev.width();
  20901. var objBottom = objTop + prev.height();
  20902. if (evt.pageX > objLeft && evt.pageX < objRight && evt.pageY > objTop && evt.pageY < objBottom) {
  20903. prev.addClass("over_command_drag");
  20904. }
  20905. }
  20906. });
  20907. function_container.find('.command_container').each(function (index) {
  20908. var obj = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this);
  20909. var objLeft = obj.offset().left;
  20910. var objTop = obj.offset().top;
  20911. var objRight = objLeft + obj.width();
  20912. var objBottom = objTop + obj.height();
  20913. if (evt.pageX > objLeft && evt.pageX < objRight && evt.pageY > objTop && evt.pageY < objBottom) {
  20914. if (prev) {
  20915. prev.removeClass('over_command_drag');
  20916. }
  20917. obj.addClass("over_command_drag");
  20918. return;
  20919. }
  20920. });
  20921. } // before_after_inside: 1 -> before, 2 -> after, 3 -> inside
  20922. function renderCommand(command, element_reference, before_after_inside, function_obj) {
  20923. var createdElement;
  20924. switch (command.type) {
  20925. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].comment:
  20926. createdElement = _commands_comment__WEBPACK_IMPORTED_MODULE_6__["renderCommand"](command, function_obj);
  20927. break;
  20928. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].break:
  20929. createdElement = _commands_break__WEBPACK_IMPORTED_MODULE_17__["renderCommand"](command, function_obj);
  20930. break;
  20931. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].reader:
  20932. createdElement = _commands_reader__WEBPACK_IMPORTED_MODULE_7__["renderCommand"](command, function_obj);
  20933. break;
  20934. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].writer:
  20935. createdElement = _commands_writer__WEBPACK_IMPORTED_MODULE_8__["renderCommand"](command, function_obj);
  20936. break;
  20937. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution:
  20938. createdElement = _commands_attribution__WEBPACK_IMPORTED_MODULE_9__["renderCommand"](command, function_obj);
  20939. break;
  20940. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].functioncall:
  20941. createdElement = _commands_functioncall__WEBPACK_IMPORTED_MODULE_15__["renderCommand"](command, function_obj);
  20942. break;
  20943. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].iftrue:
  20944. createdElement = _commands_iftrue__WEBPACK_IMPORTED_MODULE_10__["renderCommand"](command, function_obj);
  20945. break;
  20946. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes:
  20947. createdElement = _commands_repeatNtimes__WEBPACK_IMPORTED_MODULE_11__["renderCommand"](command, function_obj);
  20948. break;
  20949. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].whiletrue:
  20950. createdElement = _commands_whiletrue__WEBPACK_IMPORTED_MODULE_12__["renderCommand"](command, function_obj);
  20951. break;
  20952. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].dowhiletrue:
  20953. createdElement = _commands_dowhiletrue__WEBPACK_IMPORTED_MODULE_13__["renderCommand"](command, function_obj);
  20954. break;
  20955. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].switch:
  20956. createdElement = _commands_switch__WEBPACK_IMPORTED_MODULE_14__["renderCommand"](command, function_obj);
  20957. break;
  20958. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].return:
  20959. createdElement = _commands_return__WEBPACK_IMPORTED_MODULE_18__["renderCommand"](command, function_obj);
  20960. break;
  20961. }
  20962. switch (before_after_inside) {
  20963. case 1:
  20964. createdElement.insertBefore(element_reference);
  20965. break;
  20966. case 2:
  20967. createdElement.insertAfter(element_reference);
  20968. break;
  20969. case 3:
  20970. element_reference.append(createdElement);
  20971. break;
  20972. }
  20973. }
  20974. function genericCreateCommand(command_type) {
  20975. switch (command_type) {
  20976. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].break:
  20977. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Break"]();
  20978. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].comment:
  20979. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Comment"](new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_16__["VAR_OR_VALUE_TYPES"].only_value, _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_comment'), null, null, false));
  20980. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].reader:
  20981. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Reader"](new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_16__["VAR_OR_VALUE_TYPES"].only_variable, null, null, null, false));
  20982. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].writer:
  20983. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Writer"]([new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_16__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)]);
  20984. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution:
  20985. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Attribution"](new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_16__["VAR_OR_VALUE_TYPES"].only_variable, null, null, null, false), []);
  20986. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].functioncall:
  20987. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["FunctionCall"](new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_16__["VAR_OR_VALUE_TYPES"].only_function, null, null, null, false), null);
  20988. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].iftrue:
  20989. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["IfTrue"](new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ConditionalExpression"](null), null, null);
  20990. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes:
  20991. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["RepeatNTimes"](new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_16__["VAR_OR_VALUE_TYPES"].only_variable, null, null, null, false), new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_16__["VAR_OR_VALUE_TYPES"].only_variable, null, null, null, false), null, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ConditionalExpression"](null), null, null);
  20992. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].whiletrue:
  20993. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["WhileTrue"](new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ConditionalExpression"](null), null);
  20994. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].dowhiletrue:
  20995. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["DoWhileTrue"](new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ConditionalExpression"](null), null);
  20996. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].switch:
  20997. var sc = [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SwitchCase"](new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_16__["VAR_OR_VALUE_TYPES"].all, null, null, null, true))];
  20998. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Switch"](new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_16__["VAR_OR_VALUE_TYPES"].variable_and_function, null, null, null, true), sc);
  20999. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].return:
  21000. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Return"](new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_16__["VAR_OR_VALUE_TYPES"].all, null, null, null, true));
  21001. }
  21002. }
  21003. function dragTrash(event) {
  21004. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ghost_div').remove();
  21005. var trash = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<i class="ui icon trash alternate outline"></i>');
  21006. jquery__WEBPACK_IMPORTED_MODULE_0___default()('body').append(trash);
  21007. trash.css('position', 'absolute');
  21008. trash.css('top', event.clientY);
  21009. trash.css('left', event.clientX - 20);
  21010. trash.css('font-size', '3em');
  21011. trash.css('display', 'none');
  21012. function_container_active.find('.commands_list_div').off('mousemove');
  21013. function_container_active.find('.commands_list_div').find("*").off('mousemove');
  21014. trash.fadeIn(200, function () {
  21015. trash.fadeOut(200, function () {
  21016. trash.remove();
  21017. });
  21018. });
  21019. }
  21020. function manageCommand(function_obj, function_container, event, command_type) {
  21021. jquery__WEBPACK_IMPORTED_MODULE_0___default()(".created_element").each(function (index) {
  21022. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).remove();
  21023. });
  21024. var el = jquery__WEBPACK_IMPORTED_MODULE_0___default()(document.elementFromPoint(event.clientX, event.clientY));
  21025. if (el.hasClass('ghost_div')) {
  21026. if (el.closest('.command_container').length < 1) {
  21027. console.log('\n\nvou tentar!!!!');
  21028. console.log(el.closest('.commands_list_div'), '\n\n');
  21029. el.closest('.commands_list_div').css('height', el.closest('.commands_list_div').css('height') + 30); //$('.ghost_div').remove();
  21030. el = el.closest('.commands_list_div');
  21031. }
  21032. }
  21033. console.log('soltou no: ');
  21034. console.log(el);
  21035. console.log(el.data('fun')); // Primeiro verificar se ele soltou no espaço da função correta:
  21036. var hier = el.parentsUntil(".all_functions");
  21037. var esta_correto = false;
  21038. var esta_na_div_correta = false;
  21039. if (el.hasClass("commands_list_div")) {
  21040. esta_na_div_correta = true;
  21041. }
  21042. for (var i = 0; i < hier.length; i++) {
  21043. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]);
  21044. if (temp.hasClass("commands_list_div")) {
  21045. esta_na_div_correta = true;
  21046. }
  21047. if (temp.data('fun') == function_obj) {
  21048. esta_correto = true;
  21049. break;
  21050. }
  21051. }
  21052. if (!esta_correto) {
  21053. has_element_created_draged = false;
  21054. which_element_is_draged = null;
  21055. dragTrash(event);
  21056. return;
  21057. } else {
  21058. if (!esta_na_div_correta) {
  21059. has_element_created_draged = false;
  21060. which_element_is_draged = null;
  21061. dragTrash(event);
  21062. return;
  21063. }
  21064. } // Agora é descobrir qual o escopo para adicionar o comando:
  21065. // Se o elemento clicado possuir o atributo "fun", então, é direto na div dos comandos:
  21066. if (typeof el.data('fun') !== 'undefined') {
  21067. // Se a lista de comandos estiver vazia, então é o primeiro.
  21068. // Portanto, ele deve soltar o elemento obrigatoriamente no objeto vazio
  21069. if (el.data('fun').commands == null || el.data('fun').commands.length == 0) {
  21070. // pode adicionar
  21071. el.data('fun').commands = [];
  21072. var new_cmd = genericCreateCommand(command_type);
  21073. el.data('fun').commands.push(new_cmd);
  21074. renderCommand(new_cmd, jquery__WEBPACK_IMPORTED_MODULE_0___default()(function_container).find('.commands_list_div'), 3, function_obj);
  21075. } else {
  21076. // Entra nesse else, caso já existam outros comandos no bloco:
  21077. findNearbyCommandToAddInFunctionScope(el, event, jquery__WEBPACK_IMPORTED_MODULE_0___default()(function_container).find('.commands_list_div'), function_obj, command_type);
  21078. }
  21079. } else {
  21080. console.log("soltou em um comando"); // descobrir em qual comando ele soltou:
  21081. var hier_find = el.parentsUntil(".commands_list_div");
  21082. var hierarquia_bottom_up = [];
  21083. if (typeof el.data('command') !== 'undefined') {
  21084. hierarquia_bottom_up.push(el.data('command'));
  21085. }
  21086. for (var i = 0; i < hier_find.length; i++) {
  21087. if (typeof jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier_find[i]).data('command') !== 'undefined') {
  21088. hierarquia_bottom_up.push(jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier_find[i]).data('command'));
  21089. }
  21090. }
  21091. console.log("comando em que soltou: ");
  21092. console.log(hierarquia_bottom_up[0]);
  21093. console.log("hierarquia de baixo para cima na árvore, de onde ele soltou: ");
  21094. for (var i = 0; i < hierarquia_bottom_up.length; i++) {
  21095. console.log(hierarquia_bottom_up[i]);
  21096. } // Se for do tipo break, verificar se está no contexto correto:
  21097. // Caso não esteja no contexto, apenas retorna sem dar continuidade:
  21098. var is_correct_context = false;
  21099. if (command_type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].break) {
  21100. for (var i = 0; i < hierarquia_bottom_up.length; i++) {
  21101. if (hierarquia_bottom_up[i].type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes || hierarquia_bottom_up[i].type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].whiletrue || hierarquia_bottom_up[i].type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].dowhiletrue || hierarquia_bottom_up[i].type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].switch) {
  21102. is_correct_context = true;
  21103. break;
  21104. }
  21105. }
  21106. if (!is_correct_context) {
  21107. console.error("Context not allowed to insert BREAK COMMAND!");
  21108. return;
  21109. }
  21110. } // se a hierarquia possuir apenas um elemento, então está na raiz dos comandos:
  21111. if (hierarquia_bottom_up.length == 1) {
  21112. console.log('QQ1');
  21113. var sub_elemento = false;
  21114. for (var i = 0; i < hier_find.length; i++) {
  21115. if (typeof jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier_find[i]).data('command') !== 'undefined') {
  21116. console.log('QQ2');
  21117. findBeforeOrAfterCommandToAdd(hier_find[i], event, function_obj, command_type);
  21118. sub_elemento = true;
  21119. break;
  21120. }
  21121. }
  21122. if (!sub_elemento) {
  21123. console.log('QQ3');
  21124. findBeforeOrAfterCommandToAdd(el[0], event, function_obj, command_type);
  21125. }
  21126. } else {
  21127. console.log('QQ4'); // caso exista mais de um elemento na hierarquia:
  21128. if (typeof jquery__WEBPACK_IMPORTED_MODULE_0___default()(el).data('command') !== 'undefined') {
  21129. console.log('QQ5');
  21130. console.log("PPP1");
  21131. insertCommandInBlockHierar(el[0], event, function_obj, command_type, hier_find, hierarquia_bottom_up);
  21132. } else {
  21133. console.log('QQ6');
  21134. var sub_elemento = false;
  21135. for (var i = 0; i < hier_find.length; i++) {
  21136. if (typeof jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier_find[i]).data('command') !== 'undefined') {
  21137. console.log('QQ7');
  21138. insertCommandInBlockHierar(hier_find[i], event, function_obj, command_type, hier_find, hierarquia_bottom_up);
  21139. sub_elemento = true;
  21140. break;
  21141. }
  21142. }
  21143. }
  21144. }
  21145. }
  21146. has_element_created_draged = false;
  21147. which_element_is_draged = null;
  21148. renderAlgorithm();
  21149. }
  21150. function insertCommandInBlockHierar(el, event, function_obj, command_type, hier_dom, hier_obj) {
  21151. var el_jq = jquery__WEBPACK_IMPORTED_MODULE_0___default()(el);
  21152. var command_parent = el_jq.data('command');
  21153. if (el_jq.data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes || el_jq.data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].whiletrue || el_jq.data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].dowhiletrue || el_jq.data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].switch) {
  21154. console.log('QQ17');
  21155. if (el_jq.data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes || el_jq.data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].whiletrue || el_jq.data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].dowhiletrue) {
  21156. console.log('QQ18'); // Se não tiver outro comando ainda no bloco, só adiciona:
  21157. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  21158. command_parent.commands_block = [];
  21159. var recentComand = genericCreateCommand(command_type);
  21160. command_parent.commands_block.push(recentComand);
  21161. renderCommand(recentComand, el_jq.find('.block_commands'), 3, function_obj);
  21162. } else {
  21163. // Se já tem algum comando no bloco:
  21164. findNearbyCommandToAddInBlockScope(el, event, el, function_obj, command_type, command_parent);
  21165. }
  21166. } else {
  21167. // QUANDO FOR BLOCO DO TIPO IF OU SWITCH/CASE:
  21168. addCommandToSwitchCase(event, function_obj, command_type);
  21169. }
  21170. } else {
  21171. console.log('QQ19'); // entra neste bloco, se soltou o comando sobre outro comando dentro de um subbloco:
  21172. findBeforeOrAfterCommandToAddInsertBlock(el, event, function_obj, command_type);
  21173. }
  21174. }
  21175. function findNearbyCommandToAddInBlockScope(el, event, node_list_commands, function_obj, command_type, command_parent) {
  21176. var all_sub = jquery__WEBPACK_IMPORTED_MODULE_0___default()(node_list_commands).find('div.command_container');
  21177. var menor_distancia = 999999999;
  21178. var elemento_menor_distancia = null;
  21179. var antes = true;
  21180. var t_bot;
  21181. var t_top; // Descobrindo o elemento mais próximo:
  21182. for (var i = 0; i < all_sub.length; i++) {
  21183. t_top = all_sub[i].getBoundingClientRect().top;
  21184. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  21185. if (t_top - event.clientY < menor_distancia) {
  21186. menor_distancia = event.clientY - t_top;
  21187. elemento_menor_distancia = all_sub[i];
  21188. }
  21189. }
  21190. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height; // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  21191. if (borda_inferior - event.clientY < menor_distancia) {
  21192. var recentComand = genericCreateCommand(command_type);
  21193. command_parent.commands_block.push(recentComand); //
  21194. renderCommand(recentComand, node_list_commands, 3, function_obj);
  21195. } else {
  21196. var recentComand = genericCreateCommand(command_type);
  21197. var index = command_parent.commands_block.indexOf(jquery__WEBPACK_IMPORTED_MODULE_0___default()(elemento_menor_distancia).data('command'));
  21198. if (index > -1) {
  21199. command_parent.commands_block.splice(index, 0, recentComand);
  21200. }
  21201. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  21202. }
  21203. }
  21204. function findBeforeOrAfterCommandToAddInsertBlock(el, event, function_obj, command_type) {
  21205. var el_jq = jquery__WEBPACK_IMPORTED_MODULE_0___default()(el);
  21206. var command_parent = jquery__WEBPACK_IMPORTED_MODULE_0___default()(el.parentNode.parentNode).data('command');
  21207. var command_target = el_jq.data('command');
  21208. var temp_parent = jquery__WEBPACK_IMPORTED_MODULE_0___default()(el.parentNode.parentNode);
  21209. var is_in_else = false;
  21210. if (!command_parent) {
  21211. command_parent = el_jq.data('command');
  21212. temp_parent = el_jq;
  21213. var hier = el_jq.parentsUntil(".command_container");
  21214. for (var i = 0; i < hier.length; i++) {
  21215. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]);
  21216. if (typeof temp.data('else') != 'undefined') {
  21217. is_in_else = true;
  21218. }
  21219. if (typeof temp.data('command') != 'undefined') {
  21220. command_parent = temp.data('command');
  21221. temp_parent = temp;
  21222. }
  21223. }
  21224. }
  21225. var hier = el_jq.parentsUntil(".command_container");
  21226. for (var i = 0; i < hier.length; i++) {
  21227. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]);
  21228. if (typeof temp.data('else') != 'undefined') {
  21229. is_in_else = true;
  21230. }
  21231. }
  21232. if (command_parent == command_target) {
  21233. var hier = el_jq.parentsUntil(".command_container");
  21234. for (var i = 0; i < hier.length; i++) {
  21235. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]);
  21236. if (typeof temp.data('else') !== 'undefined') {
  21237. is_in_else = true;
  21238. break;
  21239. }
  21240. }
  21241. }
  21242. if (command_parent.type != _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].iftrue && command_parent.type != _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].switch) {
  21243. var hier = temp_parent.parentsUntil(".all_cases_div");
  21244. console.log("vou procurar!!");
  21245. for (var i = 0; i < hier.length; i++) {
  21246. console.log("estou vasculhando...");
  21247. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]);
  21248. if (typeof temp.data('switchcase') !== 'undefined') {
  21249. console.log("encontrei");
  21250. command_parent = temp.data('switchcase');
  21251. is_in_else = false;
  21252. break;
  21253. }
  21254. }
  21255. }
  21256. console.log('debugging:');
  21257. console.log('el_jq');
  21258. console.log(el_jq);
  21259. console.log('command_parent');
  21260. console.log(command_parent);
  21261. console.log('command_target');
  21262. console.log(command_target);
  21263. var menor_distancia = 999999999;
  21264. var antes = true;
  21265. var t_bot;
  21266. var t_top;
  21267. t_top = el.getBoundingClientRect().top;
  21268. t_bot = el.getBoundingClientRect().top + el.getBoundingClientRect().height;
  21269. var d_top = event.clientY - t_top; // distancia topo
  21270. var d_bot = t_bot - event.clientY; // distancia baixo
  21271. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  21272. if (d_top < d_bot) {
  21273. var recentComand = genericCreateCommand(command_type);
  21274. console.log('MMM1');
  21275. if (is_in_else) {
  21276. console.log('MMM2');
  21277. if (command_parent == command_target) {
  21278. console.log('MMM3');
  21279. if (command_parent.commands_else == null || command_parent.commands_else.length == 0) {
  21280. command_parent.commands_else = [];
  21281. var recentComand = genericCreateCommand(command_type);
  21282. command_parent.commands_else.push(recentComand);
  21283. renderCommand(recentComand, el_jq, 3, function_obj);
  21284. } else {
  21285. // Se já tem algum comando no bloco:
  21286. findInBlockCorrectPlace(el_jq, event, function_obj, command_type, true);
  21287. }
  21288. return;
  21289. }
  21290. console.log('MMM7');
  21291. var index = command_parent.commands_else.indexOf(command_target);
  21292. if (index > -1) {
  21293. command_parent.commands_else.splice(index, 0, recentComand);
  21294. }
  21295. renderCommand(recentComand, el, 1, function_obj);
  21296. } else {
  21297. console.log('MMM4');
  21298. if (command_parent == command_target) {
  21299. console.log('Nxxxx5');
  21300. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  21301. command_parent.commands_block = [];
  21302. console.log('SSS4');
  21303. var recentComand = genericCreateCommand(command_type);
  21304. command_parent.commands_block.push(recentComand);
  21305. renderCommand(recentComand, el_jq, 3, function_obj);
  21306. } else {
  21307. console.log('SSS5');
  21308. findInBlockCorrectPlace(el_jq, event, function_obj, command_type);
  21309. }
  21310. return;
  21311. }
  21312. console.log('MMM6');
  21313. var index = command_parent.commands_block.indexOf(command_target);
  21314. if (index > -1) {
  21315. command_parent.commands_block.splice(index, 0, recentComand);
  21316. }
  21317. renderCommand(recentComand, el, 1, function_obj);
  21318. }
  21319. } else {
  21320. console.log('XXX1');
  21321. var recentComand = genericCreateCommand(command_type);
  21322. if (is_in_else) {
  21323. if (command_parent == command_target) {
  21324. console.log('MMM3');
  21325. if (command_parent.commands_else == null || command_parent.commands_else.length == 0) {
  21326. command_parent.commands_else = [];
  21327. console.log('SSS1');
  21328. var recentComand = genericCreateCommand(command_type);
  21329. command_parent.commands_else.push(recentComand);
  21330. renderCommand(recentComand, el_jq, 3, function_obj);
  21331. } else {
  21332. // Se já tem algum comando no bloco:
  21333. console.log('SSS2');
  21334. findInBlockCorrectPlace(el_jq, event, function_obj, command_type, true);
  21335. }
  21336. return;
  21337. }
  21338. console.log('XXX2');
  21339. var index = command_parent.commands_else.indexOf(command_target);
  21340. if (index > -1) {
  21341. command_parent.commands_else.splice(index + 1, 0, recentComand);
  21342. }
  21343. renderCommand(recentComand, el, 2, function_obj);
  21344. } else {
  21345. if (command_parent == command_target) {
  21346. console.log('Nxxxx78');
  21347. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  21348. command_parent.commands_block = [];
  21349. var recentComand = genericCreateCommand(command_type);
  21350. command_parent.commands_block.push(recentComand);
  21351. console.log('SSS6');
  21352. renderCommand(recentComand, el_jq, 3, function_obj);
  21353. } else {
  21354. console.log('SSS7');
  21355. findInBlockCorrectPlace(el_jq, event, function_obj, command_type);
  21356. }
  21357. return;
  21358. }
  21359. console.log('XXX3');
  21360. var index = command_parent.commands_block.indexOf(command_target);
  21361. if (index > -1) {
  21362. command_parent.commands_block.splice(index + 1, 0, recentComand);
  21363. }
  21364. renderCommand(recentComand, el, 2, function_obj);
  21365. }
  21366. }
  21367. }
  21368. function insertCommandInBlock(el, event, function_obj, command_type) {
  21369. var el_jq = jquery__WEBPACK_IMPORTED_MODULE_0___default()(el);
  21370. var command_parent = el_jq.data('command');
  21371. if (el_jq.data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes || el_jq.data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].whiletrue || el_jq.data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].dowhiletrue) {
  21372. // Se não tiver outro comando ainda no bloco, só adiciona:
  21373. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  21374. command_parent.commands_block = [];
  21375. var recentComand = genericCreateCommand(command_type);
  21376. command_parent.commands_block.push(recentComand);
  21377. renderCommand(recentComand, el_jq.find('.block_commands'), 3, function_obj);
  21378. } else {
  21379. // Se já tem algum comando no bloco:
  21380. findInBlockCorrectPlace(el, event, function_obj, command_type);
  21381. }
  21382. } else if (el_jq.data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].iftrue) {
  21383. console.log('QQ9'); // no if ou no else?
  21384. var correct_div = jquery__WEBPACK_IMPORTED_MODULE_0___default()(document.elementFromPoint(event.pageX, event.pageY));
  21385. var is_in_if = true;
  21386. if (correct_div.data('if')) {
  21387. is_in_if = true;
  21388. } else if (correct_div.data('else')) {
  21389. is_in_if = false;
  21390. } else {
  21391. var hier = correct_div.parentsUntil(".command_container");
  21392. for (var i = 0; i < hier.length; i++) {
  21393. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]);
  21394. if (typeof temp.data('if') !== 'undefined') {
  21395. is_in_if = true;
  21396. break;
  21397. }
  21398. if (typeof temp.data('else') !== 'undefined') {
  21399. is_in_if = false;
  21400. break;
  21401. }
  21402. }
  21403. }
  21404. if (is_in_if) {
  21405. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  21406. command_parent.commands_block = [];
  21407. var recentComand = genericCreateCommand(command_type);
  21408. command_parent.commands_block.push(recentComand);
  21409. renderCommand(recentComand, el_jq.find('.commands_if'), 3, function_obj);
  21410. } else {
  21411. // Se já tem algum comando no bloco:
  21412. findInBlockCorrectPlace(el_jq.find('.commands_if'), event, function_obj, command_type);
  21413. }
  21414. } else {
  21415. if (command_parent.commands_else == null || command_parent.commands_else.length == 0) {
  21416. command_parent.commands_else = [];
  21417. var recentComand = genericCreateCommand(command_type);
  21418. command_parent.commands_else.push(recentComand);
  21419. renderCommand(recentComand, el_jq.find('.commands_else'), 3, function_obj);
  21420. } else {
  21421. // Se já tem algum comando no bloco:
  21422. findInBlockCorrectPlace(el_jq.find('.commands_else'), event, function_obj, command_type, true);
  21423. }
  21424. }
  21425. } else {
  21426. // é do tipo switch
  21427. console.log("está tentando inserir em um switch que está na raiz!");
  21428. addCommandToSwitchCase(event, function_obj, command_type);
  21429. }
  21430. }
  21431. function addCommandToSwitchCase(event, function_obj, command_type) {
  21432. var el = jquery__WEBPACK_IMPORTED_MODULE_0___default()(document.elementFromPoint(event.clientX, event.clientY));
  21433. var which_case = el.data('switchcase');
  21434. var case_div = el;
  21435. if (!which_case) {
  21436. var hier_find = el.parentsUntil(".all_cases_div");
  21437. for (var i = 0; i < hier_find.length; i++) {
  21438. if (typeof jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier_find[i]).data('switchcase') !== 'undefined') {
  21439. which_case = jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier_find[i]).data('switchcase');
  21440. case_div = jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier_find[i]);
  21441. break;
  21442. }
  21443. }
  21444. }
  21445. if (which_case.commands_block == null || which_case.commands_block.length < 1) {
  21446. which_case.commands_block = [];
  21447. var recentComand = genericCreateCommand(command_type);
  21448. which_case.commands_block.push(recentComand);
  21449. renderCommand(recentComand, case_div.find('.case_commands_block'), 3, function_obj);
  21450. } else {
  21451. findInBlockCorrectPlaceInSwitchCase(which_case, case_div, event, function_obj, command_type);
  21452. }
  21453. }
  21454. function findInBlockCorrectPlaceInSwitchCase(which_case, case_div, event, function_obj, command_type) {
  21455. var all_sub = case_div.find('div.command_container');
  21456. var menor_distancia = 999999999;
  21457. var elemento_menor_distancia = null;
  21458. var antes = true;
  21459. var t_bot;
  21460. var t_top; // Descobrindo o elemento mais próximo:
  21461. for (var i = 0; i < all_sub.length; i++) {
  21462. t_top = all_sub[i].getBoundingClientRect().top;
  21463. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  21464. if (t_top - event.clientY < menor_distancia) {
  21465. menor_distancia = event.clientY - t_top;
  21466. elemento_menor_distancia = all_sub[i];
  21467. }
  21468. }
  21469. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height; // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  21470. if (borda_inferior - event.clientY < menor_distancia) {
  21471. var recentComand = genericCreateCommand(command_type);
  21472. which_case.commands_block.push(recentComand);
  21473. renderCommand(recentComand, jquery__WEBPACK_IMPORTED_MODULE_0___default()(case_div.find('.case_commands_block')[0]), 3, function_obj);
  21474. } else {
  21475. var recentComand = genericCreateCommand(command_type);
  21476. var index = which_case.commands_block.indexOf(jquery__WEBPACK_IMPORTED_MODULE_0___default()(elemento_menor_distancia).data('command'));
  21477. if (index > -1) {
  21478. which_case.commands_block.splice(index, 0, recentComand);
  21479. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  21480. }
  21481. }
  21482. }
  21483. function findInBlockCorrectPlace(el, event, function_obj, command_type) {
  21484. var is_in_else = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  21485. var el_jq = jquery__WEBPACK_IMPORTED_MODULE_0___default()(el);
  21486. var all_sub = el_jq.find('div.command_container');
  21487. var menor_distancia = 999999999;
  21488. var elemento_menor_distancia = null;
  21489. var antes = true;
  21490. var t_bot;
  21491. var t_top; // Descobrindo o elemento mais próximo:
  21492. for (var i = 0; i < all_sub.length; i++) {
  21493. t_top = all_sub[i].getBoundingClientRect().top;
  21494. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  21495. if (t_top - event.clientY < menor_distancia) {
  21496. menor_distancia = event.clientY - t_top;
  21497. elemento_menor_distancia = all_sub[i];
  21498. }
  21499. }
  21500. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height;
  21501. console.log("menor_distancia: ");
  21502. console.log(elemento_menor_distancia); // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  21503. if (borda_inferior - event.clientY < menor_distancia) {
  21504. console.log('QQ11');
  21505. var recentComand = genericCreateCommand(command_type);
  21506. var command_parent = el_jq.data('command');
  21507. if (is_in_else) {
  21508. console.log('QQ15');
  21509. command_parent.commands_else.push(recentComand);
  21510. console.log('el_jq');
  21511. console.log(el_jq);
  21512. console.log("$(el_jq.find('.commands_else')[0]):: ");
  21513. console.log(jquery__WEBPACK_IMPORTED_MODULE_0___default()(el_jq.find('.commands_else')[0]));
  21514. renderCommand(recentComand, el_jq, 3, function_obj);
  21515. } else {
  21516. console.log('QQ16');
  21517. command_parent.commands_block.push(recentComand);
  21518. renderCommand(recentComand, jquery__WEBPACK_IMPORTED_MODULE_0___default()(el_jq.find('.block_commands')[0]), 3, function_obj);
  21519. }
  21520. } else {
  21521. console.log('QQ12');
  21522. var recentComand = genericCreateCommand(command_type);
  21523. var command_parent = el_jq.data('command');
  21524. if (is_in_else) {
  21525. var index = command_parent.commands_else.indexOf(jquery__WEBPACK_IMPORTED_MODULE_0___default()(elemento_menor_distancia).data('command'));
  21526. if (index > -1) {
  21527. command_parent.commands_else.splice(index, 0, recentComand);
  21528. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  21529. }
  21530. } else {
  21531. var index = command_parent.commands_block.indexOf(jquery__WEBPACK_IMPORTED_MODULE_0___default()(elemento_menor_distancia).data('command'));
  21532. if (index > -1) {
  21533. command_parent.commands_block.splice(index, 0, recentComand);
  21534. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  21535. }
  21536. }
  21537. }
  21538. }
  21539. function findBeforeOrAfterCommandToAdd(el, event, function_obj, command_type) {
  21540. switch (jquery__WEBPACK_IMPORTED_MODULE_0___default()(el).data('command').type) {
  21541. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].iftrue:
  21542. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].switch:
  21543. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes:
  21544. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].whiletrue:
  21545. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].dowhiletrue:
  21546. insertCommandInBlock(el, event, function_obj, command_type);
  21547. return;
  21548. }
  21549. var menor_distancia = 999999999;
  21550. var antes = true;
  21551. var t_bot;
  21552. var t_top;
  21553. t_top = el.getBoundingClientRect().top;
  21554. t_bot = el.getBoundingClientRect().top + el.getBoundingClientRect().height;
  21555. var d_top = event.clientY - t_top; // distancia topo
  21556. var d_bot = t_bot - event.clientY; // distancia baixo
  21557. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  21558. if (d_top < d_bot) {
  21559. var recentComand = genericCreateCommand(command_type);
  21560. var index = function_obj.commands.indexOf(jquery__WEBPACK_IMPORTED_MODULE_0___default()(el).data('command'));
  21561. if (index > -1) {
  21562. function_obj.commands.splice(index, 0, recentComand);
  21563. }
  21564. renderCommand(recentComand, el, 1, function_obj);
  21565. } else {
  21566. var recentComand = genericCreateCommand(command_type);
  21567. var index = function_obj.commands.indexOf(jquery__WEBPACK_IMPORTED_MODULE_0___default()(el).data('command'));
  21568. if (index > -1) {
  21569. function_obj.commands.splice(index + 1, 0, recentComand);
  21570. }
  21571. renderCommand(recentComand, el, 2, function_obj);
  21572. }
  21573. }
  21574. function findNearbyCommandToAddInFunctionScope(el, event, node_list_commands, function_obj, command_type) {
  21575. var all_sub = jquery__WEBPACK_IMPORTED_MODULE_0___default()(node_list_commands).find('div.command_container');
  21576. var menor_distancia = 999999999;
  21577. var elemento_menor_distancia = null;
  21578. var antes = true;
  21579. var t_bot;
  21580. var t_top; // Descobrindo o elemento mais próximo:
  21581. for (var i = 0; i < all_sub.length; i++) {
  21582. t_top = all_sub[i].getBoundingClientRect().top;
  21583. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  21584. if (t_top - event.clientY < menor_distancia) {
  21585. menor_distancia = event.clientY - t_top;
  21586. elemento_menor_distancia = all_sub[i];
  21587. }
  21588. }
  21589. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height; // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  21590. if (borda_inferior - event.clientY < menor_distancia) {
  21591. var recentComand = genericCreateCommand(command_type);
  21592. function_obj.commands.push(recentComand); //
  21593. renderCommand(recentComand, node_list_commands, 3, function_obj);
  21594. } else {
  21595. var recentComand = genericCreateCommand(command_type);
  21596. var index = function_obj.commands.indexOf(jquery__WEBPACK_IMPORTED_MODULE_0___default()(elemento_menor_distancia).data('command'));
  21597. if (index > -1) {
  21598. function_obj.commands.splice(index, 0, recentComand);
  21599. }
  21600. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  21601. }
  21602. }
  21603. /***/ }),
  21604. /***/ "./js/visualUI/commands/attribution.js":
  21605. /*!*********************************************!*\
  21606. !*** ./js/visualUI/commands/attribution.js ***!
  21607. \*********************************************/
  21608. /*! exports provided: createFloatingCommand, renderCommand, manageExpressionElements, renderMenuOperations */
  21609. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  21610. "use strict";
  21611. __webpack_require__.r(__webpack_exports__);
  21612. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  21613. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  21614. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "manageExpressionElements", function() { return manageExpressionElements; });
  21615. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderMenuOperations", function() { return renderMenuOperations; });
  21616. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  21617. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  21618. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  21619. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  21620. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  21621. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  21622. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  21623. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  21624. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  21625. function createFloatingCommand() {
  21626. return jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui attribution created_element"> <i class="ui icon small arrow left"></i> <span> x = 1 + 1 </span></div>');
  21627. }
  21628. function renderCommand(command, function_obj) {
  21629. var el = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui attribution command_container"><i class="ui icon small arrow left command_drag"></i> <i class="ui icon times red button_remove_command"></i> <div class="var_attributed"></div> <span class="text_attr_receives span_command_spec">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_receives') + '</span> ' + '<div class="expression_elements"></div> </div>');
  21630. el.data('command', command);
  21631. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, command.variable, el.find('.var_attributed'), function_obj);
  21632. if (!command.expression || command.expression.length < 1) {
  21633. var exp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ExpressionElement"](_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp, [_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].none, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)]);
  21634. command.expression.push(exp);
  21635. }
  21636. addHandlers(command, function_obj, el);
  21637. renderExpressionElements(command, function_obj, el);
  21638. return el;
  21639. }
  21640. function manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, selectedItem, expression_element) {
  21641. var index_to_move = expression_element.itens.indexOf(ref_object);
  21642. switch (selectedItem.data('exp')) {
  21643. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp:
  21644. var exp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ExpressionElement"](_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp, [expression_element.itens[index_to_move], _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)]);
  21645. expression_element.itens[index_to_move] = exp;
  21646. break;
  21647. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp:
  21648. var exp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ExpressionElement"](_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp, [_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus, expression_element.itens[index_to_move]]);
  21649. expression_element.itens[index_to_move] = exp;
  21650. break;
  21651. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par:
  21652. var exp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ExpressionElement"](_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par, [expression_element.itens[index_to_move]]);
  21653. expression_element.itens[index_to_move] = exp;
  21654. break;
  21655. }
  21656. renderExpressionElements(command, function_obj, dom_object);
  21657. }
  21658. function renderExpressionElements(command, function_obj, el) {
  21659. var expression_div = el.find('.expression_elements');
  21660. var command_container;
  21661. if (el.hasClass("command_container") == false) {
  21662. var hier = el.parentsUntil(".command_container");
  21663. for (var i = 0; i < hier.length; i++) {
  21664. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]).hasClass("command_container")) {
  21665. command_container = jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]);
  21666. break;
  21667. }
  21668. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]).hasClass("expression_elements")) {
  21669. expression_div = jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]);
  21670. break;
  21671. }
  21672. }
  21673. }
  21674. if (command_container) {
  21675. expression_div = command_container.find('.expression_elements');
  21676. }
  21677. expression_div.text('');
  21678. for (var i = 0; i < command.expression.length; i++) {
  21679. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="expression_element"></div>');
  21680. temp.data('ref_element', command.expression[i]);
  21681. temp.data('ref_index', i);
  21682. expression_div.append(temp);
  21683. renderElement(command, function_obj, temp, command.expression[i]);
  21684. }
  21685. }
  21686. function renderOperator(command, function_obj, temp_op, expression_element, index_op) {
  21687. var context_menu = '<div class="ui dropdown"><div class="text">';
  21688. switch (expression_element.itens[index_op]) {
  21689. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus:
  21690. context_menu += '+';
  21691. break;
  21692. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].minus:
  21693. context_menu += '-';
  21694. break;
  21695. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].multiplication:
  21696. context_menu += '*';
  21697. break;
  21698. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].division:
  21699. context_menu += '/';
  21700. break;
  21701. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].module:
  21702. context_menu += '%';
  21703. break;
  21704. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].none:
  21705. context_menu += '...';
  21706. break;
  21707. }
  21708. context_menu += '</div><div class="menu">';
  21709. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus + '">+</div>';
  21710. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].minus + '">-</div>';
  21711. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].multiplication + '">*</div>';
  21712. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].division + '">/</div>';
  21713. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].module + '">%</div>';
  21714. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].none + '" data-text="...">Nenhum</div>';
  21715. context_menu += '</div></div>';
  21716. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  21717. temp_op.append(context_menu);
  21718. context_menu.dropdown({
  21719. onChange: function onChange(value, text, $selectedItem) {
  21720. expression_element.itens[index_op] = value;
  21721. }
  21722. });
  21723. }
  21724. function renderMenuAddExpression(command, function_obj, el, dom_append_menu, expression_append_new_expression) {
  21725. if (el.hasClass("command_container") == false) {
  21726. var hier = el.parentsUntil(".commands_list_div");
  21727. for (var i = 0; i < hier.length; i++) {
  21728. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]).hasClass("command_container")) {
  21729. el = jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]);
  21730. break;
  21731. }
  21732. }
  21733. }
  21734. if (dom_append_menu.hasClass("expression_elements") == false) {
  21735. var hier = el.parentsUntil(".commands_list_div");
  21736. for (var i = 0; i < hier.length; i++) {
  21737. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]).hasClass("expression_elements")) {
  21738. dom_append_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]);
  21739. break;
  21740. }
  21741. }
  21742. }
  21743. var context_menu = '<div class="ui dropdown"><div class="text"></div><i class="ui icon arrow alternate circle right outline"></i><div class="menu">';
  21744. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp + '">EXP OP EXP</div>';
  21745. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp + '">OP EXP</div>';
  21746. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par + '">( EXP )</div>';
  21747. context_menu += '</div></div>';
  21748. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  21749. dom_append_menu.append(context_menu);
  21750. context_menu.dropdown({
  21751. onChange: function onChange(value, text, $selectedItem) {
  21752. switch (value) {
  21753. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp:
  21754. var exp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ExpressionElement"](_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true), _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)]);
  21755. expression_append_new_expression.push(exp);
  21756. break;
  21757. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp:
  21758. var exp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ExpressionElement"](_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp, [_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)]);
  21759. expression_append_new_expression.push(exp);
  21760. break;
  21761. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par:
  21762. var exp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ExpressionElement"](_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)]);
  21763. expression_append_new_expression.push(exp);
  21764. break;
  21765. }
  21766. renderExpressionElements(command, function_obj, el);
  21767. }
  21768. });
  21769. }
  21770. function renderElement(command, function_obj, el, expression_element) {
  21771. switch (expression_element.type_exp) {
  21772. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp:
  21773. var temp_op = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="component_element"></div>');
  21774. var temp_exp_1 = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="component_element"></div>');
  21775. var temp_exp_2 = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="component_element"></div>');
  21776. el.append(temp_exp_1);
  21777. el.append(temp_op);
  21778. el.append(temp_exp_2);
  21779. if (expression_element.itens[0].type) {
  21780. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, expression_element.itens[0], temp_exp_1, function_obj, 2, expression_element);
  21781. } else {
  21782. renderElement(command, function_obj, temp_exp_1, expression_element.itens[0]);
  21783. }
  21784. renderOperator(command, function_obj, temp_op, expression_element, 1);
  21785. if (expression_element.itens[2].type) {
  21786. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, expression_element.itens[2], temp_exp_2, function_obj, 2, expression_element);
  21787. } else {
  21788. renderElement(command, function_obj, temp_exp_2, expression_element.itens[2]);
  21789. }
  21790. break;
  21791. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp:
  21792. var temp_op = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="component_element"></div>');
  21793. var temp_exp = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="component_element"></div>');
  21794. el.append(temp_op);
  21795. el.append(temp_exp);
  21796. renderOperator(command, function_obj, temp_op, expression_element, 0);
  21797. if (expression_element.itens[1].type) {
  21798. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, expression_element.itens[1], temp_exp, function_obj, 2, expression_element);
  21799. } else {
  21800. renderElement(command, function_obj, temp_exp, expression_element.itens[1]);
  21801. }
  21802. break;
  21803. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par:
  21804. var temp_par_1 = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="component_element"> ( </div>');
  21805. var temp_exp = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="component_element"></div>');
  21806. var temp_par_2 = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="component_element"> ) </div>');
  21807. el.append(temp_par_1);
  21808. el.append(temp_exp);
  21809. for (var j = 0; j < expression_element.itens.length; j++) {
  21810. if (expression_element.itens[j].type) {
  21811. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, expression_element.itens[j], temp_exp, function_obj, 2, expression_element);
  21812. } else {
  21813. renderElement(command, function_obj, temp_exp, expression_element.itens[j]);
  21814. }
  21815. } //renderMenuAddExpression(command, function_obj, el, el, expression_element.itens);
  21816. el.append(temp_par_2);
  21817. break;
  21818. }
  21819. }
  21820. function renderExpression(command, function_obj, el) {
  21821. var expression_div = el.find('.expression_elements');
  21822. expression_div.text('');
  21823. var menu_add_item = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="menu_add_item"></div>');
  21824. menu_add_item.data('index_add', 0);
  21825. expression_div.append(menu_add_item);
  21826. for (var i = 0; i < command.expression.length; i++) {
  21827. if (command.expression[i].type) {
  21828. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="expression_element"></div>');
  21829. temp.data('ref_element', command.expression[i]);
  21830. temp.data('ref_index', i);
  21831. expression_div.append(temp);
  21832. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, command.expression[i], temp, function_obj);
  21833. } else if (command.expression[i] == "(" || command.expression[i] == ")") {
  21834. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="expression_element">' + command.expression[i] + '</div>');
  21835. temp.data('ref_element', command.expression[i]);
  21836. temp.data('ref_index', i);
  21837. expression_div.append(temp);
  21838. } else {
  21839. var temp = '<div class="expression_element">';
  21840. switch (command.expression[i]) {
  21841. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus:
  21842. temp += '+';
  21843. break;
  21844. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].minus:
  21845. temp += '-';
  21846. break;
  21847. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].multiplication:
  21848. temp += '*';
  21849. break;
  21850. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].division:
  21851. temp += '/';
  21852. break;
  21853. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].module:
  21854. temp += '%';
  21855. break;
  21856. }
  21857. temp += '</div>';
  21858. temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()(temp);
  21859. temp.data('ref_element', command.expression[i]);
  21860. temp.data('ref_index', i);
  21861. expression_div.append(temp);
  21862. }
  21863. var menu_add_item_seq = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="menu_add_item"></div>');
  21864. var index_temp = i + 1;
  21865. menu_add_item_seq.data('index_add', index_temp);
  21866. expression_div.append(menu_add_item_seq);
  21867. }
  21868. addMenuItens(command, function_obj, el);
  21869. }
  21870. function addMenuItens(command, function_obj, expression_div) {
  21871. var divs_expression = expression_div.find('.menu_add_item');
  21872. for (var i = 0; i < divs_expression.length; i++) {
  21873. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()(divs_expression[i]).data('index_add');
  21874. var context_menu = '<div class="ui dropdown context_menu_clear"><i class="ui icon plus square outline"></i><div class="menu">';
  21875. context_menu += '<div class="item" data-option="value" data-index="' + temp + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_value') + '</div>';
  21876. context_menu += '<div class="item" data-option="operator" data-index="' + temp + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_operator') + '</div>';
  21877. context_menu += '<div class="item" data-option="parentheses" data-index="' + temp + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_parentheses') + '</div>';
  21878. context_menu += '</div></div>';
  21879. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  21880. jquery__WEBPACK_IMPORTED_MODULE_0___default()(divs_expression[i]).append(context_menu);
  21881. context_menu.dropdown({
  21882. on: 'hover',
  21883. onChange: function onChange(value, text, $selectedItem) {
  21884. switch ($selectedItem.data('option')) {
  21885. case "value":
  21886. command.expression.splice($selectedItem.data('index'), 0, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true));
  21887. renderExpression(command, function_obj, expression_div);
  21888. break;
  21889. case "operator":
  21890. command.expression.splice($selectedItem.data('index'), 0, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus);
  21891. renderExpression(command, function_obj, expression_div);
  21892. break;
  21893. case "parentheses":
  21894. command.expression.splice($selectedItem.data('index'), 0, "(");
  21895. command.expression.splice($selectedItem.data('index') + 1, 0, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true));
  21896. command.expression.splice($selectedItem.data('index') + 2, 0, ")");
  21897. renderExpression(command, function_obj, expression_div);
  21898. break;
  21899. }
  21900. }
  21901. });
  21902. }
  21903. }
  21904. function addHandlers(command, function_obj, attribution_dom) {
  21905. attribution_dom.find('.button_remove_command').on('click', function () {
  21906. if (_commands__WEBPACK_IMPORTED_MODULE_7__["removeCommand"](command, function_obj, attribution_dom)) {
  21907. attribution_dom.fadeOut(400, function () {
  21908. attribution_dom.remove();
  21909. });
  21910. }
  21911. });
  21912. attribution_dom.find('.button_refresh_attribution').on('click', function () {
  21913. renderExpressionElements(command, function_obj, attribution_dom);
  21914. });
  21915. }
  21916. function renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected) {
  21917. /*console.log("recebido o seguinte DOM: ");
  21918. console.log(dom_object);
  21919. if (dom_object.hasClass('var_attributed')) {
  21920. return;
  21921. } else {
  21922. var hier = dom_object.parentsUntil(".command_container");
  21923. for (var i = 0; i < hier.length; i++) {
  21924. if ($(hier[i]).hasClass('var_attributed') || $(hier[i]).hasClass('parameters_function_called')) {
  21925. return;
  21926. }
  21927. }
  21928. }
  21929. dom_object.find('.context_menu_clear').remove();
  21930. var menu_operations = '<div class="ui dropdown menu_operations"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  21931. for (var tm in Models.ARITHMETIC_TYPES) {
  21932. menu_operations += '<div class="item" data-option="'+tm+'">'+LocalizedStrings.getUI('btn_arithmetic_' + tm)+'</div>';
  21933. }
  21934. menu_operations += '<div class="item" data-option="clear">'+LocalizedStrings.getUI('btn_clear')+'</div>';
  21935. menu_operations += '</div></div>';
  21936. menu_operations = $(menu_operations);
  21937. dom_object.append(menu_operations);
  21938. menu_operations.dropdown({
  21939. onChange: function(value, text, $selectedItem) {
  21940. switch ($($selectedItem).data('option')) {
  21941. case "clear":
  21942. $(dom_object).text('');
  21943. VariableValueMenu.renderMenu(command, ref_object, dom_object, function_obj);
  21944. break;
  21945. default:
  21946. createExpressionAround(command, ref_object, dom_object, function_obj);
  21947. menu_operations.find('.text').text('');
  21948. }
  21949. }
  21950. });*/
  21951. }
  21952. function createExpressionAround(command, ref_object, dom_object, function_obj) {
  21953. jquery__WEBPACK_IMPORTED_MODULE_0___default()('<span> ( </span>').insertBefore(dom_object);
  21954. jquery__WEBPACK_IMPORTED_MODULE_0___default()('<span> ) </span>').insertAfter(dom_object);
  21955. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true), dom_object, function_obj);
  21956. }
  21957. /***/ }),
  21958. /***/ "./js/visualUI/commands/break.js":
  21959. /*!***************************************!*\
  21960. !*** ./js/visualUI/commands/break.js ***!
  21961. \***************************************/
  21962. /*! exports provided: createFloatingCommand, renderCommand */
  21963. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  21964. "use strict";
  21965. __webpack_require__.r(__webpack_exports__);
  21966. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  21967. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  21968. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  21969. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  21970. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  21971. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  21972. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  21973. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  21974. function createFloatingCommand() {
  21975. return jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui comment created_element"> <i class="ui icon small quote left"></i> <span> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_break') + ' </span></div>');
  21976. }
  21977. function renderCommand(command, function_obj) {
  21978. var el = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui comment command_container"> <i class="ui icon small quote left"></i> <i class="ui icon times red button_remove_command"></i> <span>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_break') + '</span> </div>');
  21979. el.data('command', command);
  21980. addHandlers(command, function_obj, el);
  21981. return el;
  21982. }
  21983. function addHandlers(command, function_obj, break_dom) {
  21984. break_dom.find('.button_remove_command').on('click', function () {
  21985. if (_commands__WEBPACK_IMPORTED_MODULE_4__["removeCommand"](command, function_obj, break_dom)) {
  21986. break_dom.fadeOut(400, function () {
  21987. break_dom.remove();
  21988. });
  21989. }
  21990. });
  21991. }
  21992. /***/ }),
  21993. /***/ "./js/visualUI/commands/comment.js":
  21994. /*!*****************************************!*\
  21995. !*** ./js/visualUI/commands/comment.js ***!
  21996. \*****************************************/
  21997. /*! exports provided: createFloatingCommand, renderCommand */
  21998. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  21999. "use strict";
  22000. __webpack_require__.r(__webpack_exports__);
  22001. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  22002. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  22003. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  22004. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  22005. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  22006. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  22007. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  22008. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  22009. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  22010. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  22011. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  22012. function createFloatingCommand() {
  22013. return jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui comment created_element"> <i class="ui icon small quote left"></i> <span class="span_comment_text" "> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_comment') + ' </span></div>');
  22014. }
  22015. function renderCommand(command, function_obj) {
  22016. var el = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui comment command_container"> <i class="ui icon small quote left command_drag"></i> <i class="ui icon times red button_remove_command"></i> <div class="var_value_menu_div"></div> <div class="div_comment_text">' + '</div> </div>');
  22017. el.data('command', command);
  22018. addHandlers(command, function_obj, el);
  22019. renderTextComment(command, function_obj, el);
  22020. return el;
  22021. }
  22022. function renderTextComment(command, function_obj, el) {
  22023. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, command.comment_text, el.find('.var_value_menu_div'), function_obj, 20);
  22024. }
  22025. function addHandlers(command, function_obj, comment_dom) {
  22026. comment_dom.find('.button_remove_command').on('click', function () {
  22027. if (_commands__WEBPACK_IMPORTED_MODULE_7__["removeCommand"](command, function_obj, comment_dom)) {
  22028. comment_dom.fadeOut(400, function () {
  22029. comment_dom.remove();
  22030. });
  22031. }
  22032. });
  22033. }
  22034. /***/ }),
  22035. /***/ "./js/visualUI/commands/conditional_expression.js":
  22036. /*!********************************************************!*\
  22037. !*** ./js/visualUI/commands/conditional_expression.js ***!
  22038. \********************************************************/
  22039. /*! exports provided: renderExpression */
  22040. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  22041. "use strict";
  22042. __webpack_require__.r(__webpack_exports__);
  22043. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderExpression", function() { return renderExpression; });
  22044. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  22045. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  22046. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  22047. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  22048. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  22049. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  22050. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  22051. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  22052. function renderExpression(command, expression, function_obj, initial_el_to_render) {
  22053. expression.dom_object = initial_el_to_render;
  22054. if (expression.expression == null || expression.expression.length < 1) {
  22055. renderStartMenu(command, expression, function_obj, initial_el_to_render);
  22056. } else {
  22057. var main_div = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="expression_elements"></div>');
  22058. switch (expression.expression.type) {
  22059. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic:
  22060. renderLogicExpression(command, expression, expression.expression, function_obj, main_div, initial_el_to_render);
  22061. break;
  22062. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic:
  22063. renderArithmeticExpression(command, expression, expression.expression, function_obj, main_div);
  22064. break;
  22065. }
  22066. initial_el_to_render.append(main_div);
  22067. var restartMenu = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui restart_expression"><i class="ui icon undo"></i></div>');
  22068. initial_el_to_render.append(restartMenu);
  22069. restartMenu.on('click', function (e) {
  22070. expression.expression = null;
  22071. initial_el_to_render.empty();
  22072. renderExpression(command, expression, function_obj, initial_el_to_render);
  22073. });
  22074. }
  22075. }
  22076. function renderArithmeticOperator(command, all_expression, expression_arithmetic, arithmetic_operator, function_obj, element_to_append) {
  22077. var menu_operator = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui dropdown"><div class="text"></div><i class="dropdown icon"></i></div>');
  22078. menu_operator.dropdown({
  22079. values: [{
  22080. name: '>',
  22081. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].greater_than,
  22082. selected: arithmetic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].greater_than
  22083. }, {
  22084. name: '<',
  22085. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].less_than,
  22086. selected: arithmetic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].less_than
  22087. }, {
  22088. name: '==',
  22089. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].equals_to,
  22090. selected: arithmetic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].equals_to
  22091. }, {
  22092. name: '!=',
  22093. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].not_equals_to,
  22094. selected: arithmetic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].not_equals_to
  22095. }, {
  22096. name: '>=',
  22097. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].greater_than_or_equals_to,
  22098. selected: arithmetic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].greater_than_or_equals_to
  22099. }, {
  22100. name: '<=',
  22101. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].less_than_or_equals_to,
  22102. selected: arithmetic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].less_than_or_equals_to
  22103. }],
  22104. onChange: function onChange(value, text, $selectedItem) {
  22105. expression_arithmetic.operator = value;
  22106. }
  22107. });
  22108. element_to_append.append(menu_operator);
  22109. }
  22110. function renderLogicOperator(command, all_expression, expression_logic, logic_operator, function_obj, element_to_append, initial_el_to_render) {
  22111. var menu_operator = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui dropdown"><div class="text"></div><i class="dropdown icon"></i></div>');
  22112. menu_operator.dropdown({
  22113. values: [{
  22114. name: '==',
  22115. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].equals_to,
  22116. selected: logic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].equals_to
  22117. }, {
  22118. name: '!=',
  22119. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].not_equals_to,
  22120. selected: logic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].not_equals_to
  22121. }, {
  22122. name: '&&',
  22123. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].and,
  22124. selected: logic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].and
  22125. }, {
  22126. name: '||',
  22127. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].or,
  22128. selected: logic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].or
  22129. }],
  22130. onChange: function onChange(value, text, $selectedItem) {
  22131. if ($selectedItem) {
  22132. expression_logic.operator = value;
  22133. if (expression_logic.second_operand == null) {
  22134. expression_logic.second_operand = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true);
  22135. initial_el_to_render.empty();
  22136. renderExpression(command, all_expression, function_obj, initial_el_to_render);
  22137. }
  22138. }
  22139. }
  22140. });
  22141. element_to_append.append(menu_operator);
  22142. }
  22143. function renderLogicExpression(command, all_expression, expression_logic, function_obj, element_to_append, initial_el_to_render) {
  22144. var exp_el_par_1 = jquery__WEBPACK_IMPORTED_MODULE_0___default()(' <span class="span_command_spec"> </span> ');
  22145. var exp_el_expr_el_1 = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="expression_element"></div>');
  22146. var exp_el_expr_operand = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="expression_element"></div>');
  22147. var exp_el_expr_el_2 = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="expression_element"></div>');
  22148. var exp_el_par_2 = jquery__WEBPACK_IMPORTED_MODULE_0___default()(' <span class="span_command_spec"> </span> ');
  22149. if (expression_logic.first_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic) {
  22150. renderLogicExpression(command, all_expression, expression_logic.first_operand, function_obj, exp_el_expr_el_1);
  22151. } else if (expression_logic.first_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic) {
  22152. renderArithmeticExpression(command, all_expression, expression_logic.first_operand, function_obj, exp_el_expr_el_1);
  22153. } else {
  22154. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, expression_logic.first_operand, exp_el_expr_el_1, function_obj);
  22155. }
  22156. element_to_append.append(exp_el_par_1);
  22157. element_to_append.append(exp_el_expr_el_1);
  22158. renderLogicOperator(command, all_expression, expression_logic, expression_logic.operator, function_obj, exp_el_expr_operand, initial_el_to_render);
  22159. element_to_append.append(exp_el_expr_operand);
  22160. if (expression_logic.second_operand) {
  22161. if (expression_logic.second_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic) {
  22162. renderLogicExpression(command, all_expression, expression_logic.second_operand, function_obj, exp_el_expr_el_2);
  22163. } else if (expression_logic.second_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic) {
  22164. renderArithmeticExpression(command, all_expression, expression_logic.second_operand, function_obj, exp_el_expr_el_2);
  22165. } else {
  22166. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, expression_logic.second_operand, exp_el_expr_el_2, function_obj);
  22167. }
  22168. element_to_append.append(exp_el_expr_el_2);
  22169. }
  22170. element_to_append.append(exp_el_par_2);
  22171. }
  22172. function renderArithmeticExpression(command, all_expression, expression_arithmetic, function_obj, element_to_append) {
  22173. var exp_el_par_1 = jquery__WEBPACK_IMPORTED_MODULE_0___default()(' <span class="span_command_spec"> </span> ');
  22174. var exp_el_expr_el_1 = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="expression_element"></div>');
  22175. var exp_el_expr_operand = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="expression_element"></div>');
  22176. var exp_el_expr_el_2 = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="expression_element"></div>');
  22177. var exp_el_par_2 = jquery__WEBPACK_IMPORTED_MODULE_0___default()(' <span class="span_command_spec"> </span> ');
  22178. if (expression_arithmetic.first_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic) {
  22179. renderLogicExpression(command, all_expression, expression_arithmetic.first_operand, function_obj, exp_el_expr_el_1);
  22180. } else if (expression_arithmetic.first_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic) {
  22181. renderArithmeticExpression(command, all_expression, expression_arithmetic.first_operand, function_obj, exp_el_expr_el_1);
  22182. } else {
  22183. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, expression_arithmetic.first_operand, exp_el_expr_el_1, function_obj);
  22184. }
  22185. if (expression_arithmetic.second_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic) {
  22186. renderLogicExpression(command, all_expression, expression_arithmetic.second_operand, function_obj, exp_el_expr_el_2);
  22187. } else if (expression_arithmetic.second_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic) {
  22188. renderArithmeticExpression(command, all_expression, expression_arithmetic.second_operand, function_obj, exp_el_expr_el_2);
  22189. } else {
  22190. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, expression_arithmetic.second_operand, exp_el_expr_el_2, function_obj);
  22191. }
  22192. renderArithmeticOperator(command, all_expression, expression_arithmetic, expression_arithmetic.operator, function_obj, exp_el_expr_operand);
  22193. element_to_append.append(exp_el_par_1);
  22194. element_to_append.append(exp_el_expr_el_1);
  22195. element_to_append.append(exp_el_expr_operand);
  22196. element_to_append.append(exp_el_expr_el_2);
  22197. element_to_append.append(exp_el_par_2);
  22198. }
  22199. function renderStartMenu(command, expression, function_obj, initial_el_to_render) {
  22200. var start_menu = '';
  22201. start_menu += '<div class="ui dropdown menu_start_rendered"><div class="text"><i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('expression_menu_select') + '</i></div><i class="dropdown icon"></i><div class="menu">';
  22202. start_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_logic_expression') + ' (EL == EL and EL)</div>';
  22203. start_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_arithmetic_expression') + ' (EA < EA)</div>';
  22204. start_menu += '</div></div>';
  22205. start_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(start_menu);
  22206. start_menu.dropdown({
  22207. onChange: function onChange(value, text, $selectedItem) {
  22208. switch ($selectedItem.data('exp')) {
  22209. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic:
  22210. expression.expression = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LogicExpression"](false, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true));
  22211. break;
  22212. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic:
  22213. expression.expression = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ArithmeticExpression"](new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true), new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true), _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].less_than);
  22214. break;
  22215. }
  22216. initial_el_to_render.html('');
  22217. renderExpression(command, expression, function_obj, initial_el_to_render);
  22218. },
  22219. selectOnKeydown: false
  22220. });
  22221. initial_el_to_render.append(' <span class="span_command_spec"> </span> ');
  22222. initial_el_to_render.append(start_menu);
  22223. initial_el_to_render.append(' <span class="span_command_spec"> </span> ');
  22224. }
  22225. /***/ }),
  22226. /***/ "./js/visualUI/commands/contextualized_menu.js":
  22227. /*!*****************************************************!*\
  22228. !*** ./js/visualUI/commands/contextualized_menu.js ***!
  22229. \*****************************************************/
  22230. /*! exports provided: renderMenu */
  22231. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  22232. "use strict";
  22233. __webpack_require__.r(__webpack_exports__);
  22234. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderMenu", function() { return renderMenu; });
  22235. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  22236. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  22237. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  22238. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  22239. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  22240. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  22241. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  22242. /* harmony import */ var _switch__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./switch */ "./js/visualUI/commands/switch.js");
  22243. /* harmony import */ var _repeatNtimes__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./repeatNtimes */ "./js/visualUI/commands/repeatNtimes.js");
  22244. function renderMenu(command, dom_where_render, function_obj, dom_command) {
  22245. var menu_div = '<div class="ui dropdown menu_commands" ><i class="icon code"></i> <div class="menu"> ';
  22246. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes || command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].whiletrue || command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].dowhiletrue) {
  22247. menu_div += '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].break + '"><i class="download icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_break') + ' </a>';
  22248. } else {
  22249. menu_div += '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].break + '"><i class="download icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_break') + ' </a>';
  22250. menu_div += '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].switchcase + '"><i class="download icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_case') + ' </a>';
  22251. }
  22252. menu_div += '</div></div>';
  22253. menu_div = jquery__WEBPACK_IMPORTED_MODULE_0___default()(menu_div);
  22254. dom_where_render.append(menu_div);
  22255. addHandlers(command, dom_where_render, function_obj, dom_command);
  22256. }
  22257. function addHandlers(command, dom_where_render, function_obj, dom_command) {
  22258. dom_where_render.find('.menu_commands').dropdown({
  22259. on: 'hover'
  22260. });
  22261. dom_where_render.find('.menu_commands a').on('click', function (evt) {
  22262. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes || command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].whiletrue || command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].dowhiletrue) {
  22263. if (command.commands_block == null || command.commands_block.length == 0) {
  22264. command.commands_block = [];
  22265. var new_cmd = _commands__WEBPACK_IMPORTED_MODULE_4__["genericCreateCommand"](jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('command'));
  22266. command.commands_block.push(new_cmd);
  22267. _commands__WEBPACK_IMPORTED_MODULE_4__["renderCommand"](new_cmd, dom_command.find('.block_commands'), 3, function_obj);
  22268. } else {
  22269. _commands__WEBPACK_IMPORTED_MODULE_4__["createFloatingCommand"](function_obj, dom_command.find('.block_commands'), jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('command'), evt);
  22270. }
  22271. } else {
  22272. switch (jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('command')) {
  22273. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].break:
  22274. _commands__WEBPACK_IMPORTED_MODULE_4__["createFloatingCommand"](function_obj, dom_command.find('.block_commands'), jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('command'), evt);
  22275. break;
  22276. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].switchcase:
  22277. addCaseToSwitch(command, dom_where_render, function_obj, dom_command);
  22278. break;
  22279. }
  22280. }
  22281. });
  22282. }
  22283. function addCaseToSwitch(command, dom_where_render, function_obj, dom_command) {
  22284. if (command.cases == null) {
  22285. command.cases = [];
  22286. }
  22287. var sc = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SwitchCase"](new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_5__["VAR_OR_VALUE_TYPES"].all, null, null, null, true));
  22288. command.cases.push(sc);
  22289. _switch__WEBPACK_IMPORTED_MODULE_6__["renderCase"](sc, command, function_obj, dom_command.find('.all_cases_div'));
  22290. }
  22291. /***/ }),
  22292. /***/ "./js/visualUI/commands/dowhiletrue.js":
  22293. /*!*********************************************!*\
  22294. !*** ./js/visualUI/commands/dowhiletrue.js ***!
  22295. \*********************************************/
  22296. /*! exports provided: createFloatingCommand, renderCommand */
  22297. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  22298. "use strict";
  22299. __webpack_require__.r(__webpack_exports__);
  22300. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  22301. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  22302. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  22303. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  22304. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  22305. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  22306. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  22307. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  22308. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  22309. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  22310. /* harmony import */ var _conditional_expression__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  22311. /* harmony import */ var _contextualized_menu__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  22312. function createFloatingCommand() {
  22313. return jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui dowhiletrue created_element"> <i class="ui icon small sync"></i> <span> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_command_do') + ' <br> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_code_while') + '(x < 10) </span></div>');
  22314. }
  22315. function renderCommand(command, function_obj) {
  22316. var ret = '';
  22317. ret += '<div class="ui dowhiletrue command_container"> <i class="ui icon small sync command_drag"></i> <i class="ui icon times red button_remove_command"></i> <div class="ui context_menu"></div> <span class="span_command_spec"> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_command_do') + ' </span>';
  22318. ret += '<div class="ui block_commands" data-subblock="" data-idcommand="">';
  22319. ret += '</div>';
  22320. ret += ' <span class="span_command_spec"> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_code_while') + ' </span> <span class="span_command_spec"> ( </span> <div class="conditional_expression"></div> <span class="span_command_spec"> ) </span>';
  22321. ret += '</div>';
  22322. var el = jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret);
  22323. el.data('command', command);
  22324. el.find('.block_commands').data('command', command);
  22325. addHandlers(command, function_obj, el);
  22326. _contextualized_menu__WEBPACK_IMPORTED_MODULE_8__["renderMenu"](command, el.find('.context_menu'), function_obj, el);
  22327. _conditional_expression__WEBPACK_IMPORTED_MODULE_7__["renderExpression"](command, command.expression, function_obj, el.find('.conditional_expression'));
  22328. if (command.commands_block) {
  22329. for (var j = 0; j < command.commands_block.length; j++) {
  22330. _commands__WEBPACK_IMPORTED_MODULE_6__["renderCommand"](command.commands_block[j], jquery__WEBPACK_IMPORTED_MODULE_0___default()(el.find('.block_commands')[0]), 3, function_obj);
  22331. }
  22332. }
  22333. return el;
  22334. }
  22335. function addHandlers(command, function_obj, dowhiletrue_dom) {
  22336. dowhiletrue_dom.find('.button_remove_command').on('click', function () {
  22337. if (_commands__WEBPACK_IMPORTED_MODULE_6__["removeCommand"](command, function_obj, dowhiletrue_dom)) {
  22338. dowhiletrue_dom.fadeOut(400, function () {
  22339. dowhiletrue_dom.remove();
  22340. });
  22341. }
  22342. });
  22343. }
  22344. /***/ }),
  22345. /***/ "./js/visualUI/commands/functioncall.js":
  22346. /*!**********************************************!*\
  22347. !*** ./js/visualUI/commands/functioncall.js ***!
  22348. \**********************************************/
  22349. /*! exports provided: createFloatingCommand, renderCommand */
  22350. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  22351. "use strict";
  22352. __webpack_require__.r(__webpack_exports__);
  22353. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  22354. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  22355. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  22356. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  22357. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  22358. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  22359. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  22360. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  22361. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  22362. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  22363. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  22364. function createFloatingCommand() {
  22365. return jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui functioncall created_element"> <i class="hand point right icon"></i> <span> funcao() </span></div>');
  22366. }
  22367. function renderCommand(command, function_obj) {
  22368. var el = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui functioncall command_container"> <i class="hand point right icon command_drag"></i> <i class="ui icon times red button_remove_command"></i> <div class="var_value_menu_div"></div> </div>');
  22369. el.data('command', command);
  22370. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, command.function_called, el.find('.var_value_menu_div'), function_obj);
  22371. addHandlers(command, function_obj, el);
  22372. return el;
  22373. }
  22374. function addHandlers(command, function_obj, functioncall_dom) {
  22375. functioncall_dom.find('.button_remove_command').on('click', function () {
  22376. if (_commands__WEBPACK_IMPORTED_MODULE_7__["removeCommand"](command, function_obj, functioncall_dom)) {
  22377. functioncall_dom.fadeOut(400, function () {
  22378. functioncall_dom.remove();
  22379. });
  22380. }
  22381. });
  22382. }
  22383. /***/ }),
  22384. /***/ "./js/visualUI/commands/iftrue.js":
  22385. /*!****************************************!*\
  22386. !*** ./js/visualUI/commands/iftrue.js ***!
  22387. \****************************************/
  22388. /*! exports provided: createFloatingCommand, renderCommand */
  22389. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  22390. "use strict";
  22391. __webpack_require__.r(__webpack_exports__);
  22392. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  22393. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  22394. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  22395. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  22396. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  22397. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  22398. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  22399. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  22400. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  22401. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  22402. /* harmony import */ var _conditional_expression__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  22403. function createFloatingCommand() {
  22404. return jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui iftrue created_element"> <i class="ui icon small random"></i> <span> if (x < 1) { } </span></div>');
  22405. }
  22406. function renderCommand(command, function_obj) {
  22407. var ret = '';
  22408. ret += '<div class="ui iftrue command_container"><div class="ui data_block_if" data-if="true"> <i class="ui icon small random command_drag"></i> <i class="ui icon times red button_remove_command"></i>';
  22409. ret += '<span class="span_command_spec"> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_if') + '</span>';
  22410. ret += ' <span class="span_command_spec"> ( </span> <div class="conditional_expression"></div> <span class="span_command_spec"> ) </span>';
  22411. ret += '<span> </span> ';
  22412. ret += '<div class="ui block_commands commands_if conditional_comands_block" data-if="true">';
  22413. ret += '</div></div>';
  22414. ret += '<div class="ui data_block_else" data-else="true"> <span class="span_command_spec"> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_else') + ' </span>';
  22415. ret += '<div class="ui block_commands commands_else conditional_comands_block" data-else="true">';
  22416. ret += '</div>';
  22417. ret += '<span></span></div>';
  22418. ret += '</div>';
  22419. var el = jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret);
  22420. el.data('command', command);
  22421. el.find('.block_commands').data('command', command);
  22422. el.find('.data_block_if').data('command', command);
  22423. el.find('.data_block_else').data('command', command);
  22424. el.find('.commands_if').data('command', command);
  22425. addHandlers(command, function_obj, el);
  22426. _conditional_expression__WEBPACK_IMPORTED_MODULE_7__["renderExpression"](command, command.expression, function_obj, el.find('.conditional_expression'));
  22427. if (command.commands_block) {
  22428. for (var j = 0; j < command.commands_block.length; j++) {
  22429. _commands__WEBPACK_IMPORTED_MODULE_6__["renderCommand"](command.commands_block[j], jquery__WEBPACK_IMPORTED_MODULE_0___default()(el.find('.commands_if')[0]), 3, function_obj);
  22430. }
  22431. }
  22432. if (command.commands_else) {
  22433. for (var j = 0; j < command.commands_else.length; j++) {
  22434. _commands__WEBPACK_IMPORTED_MODULE_6__["renderCommand"](command.commands_else[j], jquery__WEBPACK_IMPORTED_MODULE_0___default()(el.find('.commands_else')[0]), 3, function_obj);
  22435. }
  22436. }
  22437. return el;
  22438. }
  22439. function addHandlers(command, function_obj, iftrue_dom) {
  22440. iftrue_dom.find('.button_remove_command').on('click', function () {
  22441. if (_commands__WEBPACK_IMPORTED_MODULE_6__["removeCommand"](command, function_obj, iftrue_dom)) {
  22442. iftrue_dom.fadeOut(400, function () {
  22443. iftrue_dom.remove();
  22444. });
  22445. }
  22446. });
  22447. }
  22448. /***/ }),
  22449. /***/ "./js/visualUI/commands/reader.js":
  22450. /*!****************************************!*\
  22451. !*** ./js/visualUI/commands/reader.js ***!
  22452. \****************************************/
  22453. /*! exports provided: createFloatingCommand, renderCommand */
  22454. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  22455. "use strict";
  22456. __webpack_require__.r(__webpack_exports__);
  22457. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  22458. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  22459. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  22460. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  22461. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  22462. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  22463. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  22464. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  22465. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  22466. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  22467. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  22468. function createFloatingCommand() {
  22469. return jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui reader created_element"> <i class="ui icon small download"></i> <span> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_command_read') + ' var </span></div>');
  22470. }
  22471. function renderCommand(command, function_obj) {
  22472. var el = '<div class="ui reader command_container"> <i class="ui icon small download command_drag"></i> <i class="ui icon times red button_remove_command"></i> <span class="span_command_spec">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_command_read') + ' ( </span> <div class="var_value_menu_div"></div> <span class="close_parentheses span_command_spec">)</span> </div>';
  22473. el = jquery__WEBPACK_IMPORTED_MODULE_0___default()(el);
  22474. el.data('command', command);
  22475. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, command.variable_value_menu, el.find('.var_value_menu_div'), function_obj);
  22476. addHandlers(command, function_obj, el);
  22477. return el;
  22478. }
  22479. function addHandlers(command, function_obj, reader_dom) {
  22480. reader_dom.find('.button_remove_command').on('click', function () {
  22481. if (_commands__WEBPACK_IMPORTED_MODULE_7__["removeCommand"](command, function_obj, reader_dom)) {
  22482. reader_dom.fadeOut(400, function () {
  22483. reader_dom.remove();
  22484. });
  22485. }
  22486. });
  22487. }
  22488. /***/ }),
  22489. /***/ "./js/visualUI/commands/repeatNtimes.js":
  22490. /*!**********************************************!*\
  22491. !*** ./js/visualUI/commands/repeatNtimes.js ***!
  22492. \**********************************************/
  22493. /*! exports provided: createFloatingCommand, renderCommand, manageExpressionElements, manageClearExpressionElements */
  22494. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  22495. "use strict";
  22496. __webpack_require__.r(__webpack_exports__);
  22497. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  22498. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  22499. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "manageExpressionElements", function() { return manageExpressionElements; });
  22500. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "manageClearExpressionElements", function() { return manageClearExpressionElements; });
  22501. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  22502. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  22503. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  22504. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  22505. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  22506. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  22507. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  22508. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  22509. /* harmony import */ var _conditional_expression__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  22510. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  22511. /* harmony import */ var _contextualized_menu__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  22512. function createFloatingCommand() {
  22513. return jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui repeatNtimes created_element"> <i class="ui icon small sync"></i> <span> para (x = 0; x < 10; x ++) <br> </span></div>');
  22514. }
  22515. function renderCommand(command, function_obj) {
  22516. var ret = '<div class="ui repeatNtimes command_container"> <i class="ui icon small sync command_drag"></i> <i class="ui icon times red button_remove_command"></i> <div class="ui context_menu"></div> <span class="span_command_spec"> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_for') + ' ( </span> <div class="ui attribution_expression"><div class="ui variable_attribution"></div> <span class="text_receives span_command_spec"></span> <div class="ui var_value_expression div_expression_st"></div> </div> <span class="span_command_spec separator_character">;</span> <div class="conditional_expression"></div> <span class="span_command_spec separator_character">;</span> <div class="ui incrementation_field"><div class="ui incrementation_variable"></div> <span class="text_inc_receives span_command_spec"></span> <div class="ui first_operand"></div><div class="ui operator"></div><div class="ui second_operand"></div></div> <span class="span_command_spec"> ) </span>';
  22517. ret += '<div class="ui block_commands">';
  22518. ret += '</div>';
  22519. ret += '<span> </span>';
  22520. ret += '</div>';
  22521. var el = jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret);
  22522. el.data('command', command);
  22523. el.find('.block_commands').data('command', command);
  22524. addHandlers(command, function_obj, el);
  22525. _contextualized_menu__WEBPACK_IMPORTED_MODULE_9__["renderMenu"](command, el.find('.context_menu'), function_obj, el);
  22526. _variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["renderMenu"](command, command.var_attribution, el.find('.variable_attribution'), function_obj);
  22527. _conditional_expression__WEBPACK_IMPORTED_MODULE_7__["renderExpression"](command, command.expression2, function_obj, el.find('.conditional_expression'));
  22528. _variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["renderMenu"](command, command.var_incrementation, el.find('.incrementation_variable'), function_obj);
  22529. if (command.expression1) {
  22530. el.find('.text_receives').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_receives'));
  22531. _variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["renderMenu"](command, command.expression1, el.find('.var_value_expression'), function_obj);
  22532. }
  22533. if (command.expression3) {
  22534. el.find('.text_inc_receives').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_receives'));
  22535. _variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["renderMenu"](command, command.expression3.itens[0], el.find('.first_operand'), function_obj);
  22536. renderOperator(command, function_obj, el.find('.operator'), command.expression3, 1);
  22537. _variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["renderMenu"](command, command.expression3.itens[2], el.find('.second_operand'), function_obj);
  22538. }
  22539. if (command.commands_block) {
  22540. for (var j = 0; j < command.commands_block.length; j++) {
  22541. _commands__WEBPACK_IMPORTED_MODULE_6__["renderCommand"](command.commands_block[j], jquery__WEBPACK_IMPORTED_MODULE_0___default()(el.find('.block_commands')[0]), 3, function_obj);
  22542. }
  22543. }
  22544. return el;
  22545. }
  22546. function manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element) {
  22547. if (dom_object.hasClass('variable_attribution')) {
  22548. if (!command.expression3) {
  22549. var exp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ExpressionElement"](_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp, [command.var_attribution, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, "1", null, null, true)]);
  22550. command.expression3 = exp;
  22551. command.var_incrementation = command.var_attribution;
  22552. var cond_exp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ArithmeticExpression"](command.var_attribution, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true), _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].less_than);
  22553. command.expression2.expression = cond_exp;
  22554. }
  22555. dom_object.parent().find('.text_receives').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_receives'));
  22556. command.expression1 = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, "0", null, null, true);
  22557. dom_object.parent().find('.var_value_expression').empty();
  22558. _variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["renderMenu"](command, command.expression1, dom_object.parent().find('.var_value_expression'), function_obj);
  22559. renderAlgorithm();
  22560. }
  22561. if (dom_object.hasClass('incrementation_variable')) {
  22562. dom_object.parent().find('.text_inc_receives').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_receives'));
  22563. var exp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ExpressionElement"](_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true), _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)]);
  22564. command.expression3 = exp;
  22565. _variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["renderMenu"](command, command.expression3.itens[0], dom_object.parent().find('.first_operand'), function_obj);
  22566. renderOperator(command, function_obj, dom_object.parent().find('.operator'), command.expression3, 1);
  22567. _variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["renderMenu"](command, command.expression3.itens[2], dom_object.parent().find('.second_operand'), function_obj);
  22568. }
  22569. }
  22570. function manageClearExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element) {
  22571. if (dom_object.hasClass('variable_attribution')) {
  22572. jquery__WEBPACK_IMPORTED_MODULE_0___default()(dom_object).parent().find('.text_receives').text('');
  22573. command.expression1 = null;
  22574. jquery__WEBPACK_IMPORTED_MODULE_0___default()(dom_object).parent().find('.var_value_expression').empty();
  22575. }
  22576. if (dom_object.hasClass('incrementation_variable')) {
  22577. jquery__WEBPACK_IMPORTED_MODULE_0___default()(dom_object).parent().find('.text_inc_receives').text('');
  22578. command.expression3 = null;
  22579. jquery__WEBPACK_IMPORTED_MODULE_0___default()(dom_object).parent().find('.first_operand').empty();
  22580. jquery__WEBPACK_IMPORTED_MODULE_0___default()(dom_object).parent().find('.operator').empty();
  22581. jquery__WEBPACK_IMPORTED_MODULE_0___default()(dom_object).parent().find('.second_operand').empty();
  22582. }
  22583. }
  22584. function addHandlers(command, function_obj, repeatNtimes_dom) {
  22585. repeatNtimes_dom.find('.button_remove_command').on('click', function () {
  22586. if (_commands__WEBPACK_IMPORTED_MODULE_6__["removeCommand"](command, function_obj, repeatNtimes_dom)) {
  22587. repeatNtimes_dom.fadeOut(400, function () {
  22588. repeatNtimes_dom.remove();
  22589. });
  22590. }
  22591. });
  22592. }
  22593. function renderOperator(command, function_obj, temp_op, expression_element, index_op) {
  22594. var menu_operator = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui dropdown"><div class="text"></div></div>');
  22595. menu_operator.dropdown({
  22596. values: [{
  22597. name: '+',
  22598. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus,
  22599. selected: expression_element.itens[index_op] == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus
  22600. }, {
  22601. name: '-',
  22602. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].minus,
  22603. selected: expression_element.itens[index_op] == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].minus
  22604. }, {
  22605. name: '*',
  22606. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].multiplication,
  22607. selected: expression_element.itens[index_op] == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].multiplication
  22608. }, {
  22609. name: '/',
  22610. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].division,
  22611. selected: expression_element.itens[index_op] == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].division
  22612. }, {
  22613. name: '%',
  22614. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].module,
  22615. selected: expression_element.itens[index_op] == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].module
  22616. }],
  22617. onChange: function onChange(value, text, $selectedItem) {
  22618. expression_element.itens[index_op] = value;
  22619. }
  22620. });
  22621. temp_op.append(menu_operator);
  22622. }
  22623. /***/ }),
  22624. /***/ "./js/visualUI/commands/return.js":
  22625. /*!****************************************!*\
  22626. !*** ./js/visualUI/commands/return.js ***!
  22627. \****************************************/
  22628. /*! exports provided: createFloatingCommand, renderCommand */
  22629. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  22630. "use strict";
  22631. __webpack_require__.r(__webpack_exports__);
  22632. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  22633. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  22634. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  22635. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  22636. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  22637. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  22638. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  22639. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  22640. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  22641. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  22642. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  22643. function createFloatingCommand() {
  22644. return jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui return created_element"> <i class="ui icon small reply"></i> <span> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_return') + ' </span></div>');
  22645. }
  22646. function renderCommand(command, function_obj) {
  22647. var el = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui return command_container"> <i class="ui icon small reply command_drag"></i> <i class="ui icon times red button_remove_command"></i> <span class="span_command_spec"> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_return') + ' </span> <div class="var_value_menu_div"></div></div>');
  22648. el.data('command', command);
  22649. addHandlers(command, function_obj, el);
  22650. if (function_obj.return_type != _types__WEBPACK_IMPORTED_MODULE_1__["Types"].VOID) {
  22651. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, command.variable_value_menu, el.find('.var_value_menu_div'), function_obj);
  22652. } else {
  22653. el.find('.var_value_menu_div').remove();
  22654. command.variable_value_menu = null;
  22655. }
  22656. return el;
  22657. }
  22658. function addHandlers(command, function_obj, return_dom) {
  22659. return_dom.find('.button_remove_command').on('click', function () {
  22660. if (_commands__WEBPACK_IMPORTED_MODULE_7__["removeCommand"](command, function_obj, return_dom)) {
  22661. return_dom.fadeOut(400, function () {
  22662. return_dom.remove();
  22663. });
  22664. }
  22665. });
  22666. }
  22667. /***/ }),
  22668. /***/ "./js/visualUI/commands/switch.js":
  22669. /*!****************************************!*\
  22670. !*** ./js/visualUI/commands/switch.js ***!
  22671. \****************************************/
  22672. /*! exports provided: createFloatingCommand, renderCommand, renderCase */
  22673. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  22674. "use strict";
  22675. __webpack_require__.r(__webpack_exports__);
  22676. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  22677. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  22678. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCase", function() { return renderCase; });
  22679. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  22680. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  22681. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  22682. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  22683. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  22684. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  22685. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  22686. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  22687. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  22688. /* harmony import */ var _contextualized_menu__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  22689. function createFloatingCommand() {
  22690. return jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui switch created_element"> <i class="ui icon small random"></i> <span> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_code_switch') + ' ( x ) { <br> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_code_case') + ' 1: <br> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_code_case') + ' 2: <br> } </span></div>');
  22691. }
  22692. function renderCommand(command, function_obj) {
  22693. var ret = '';
  22694. ret += '<div class="ui switch command_container"> <i class="ui icon small random command_drag" ></i> <i class="ui icon times red button_remove_command"></i> <div class="ui context_menu"></div> <span> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_code_switch') + ' ( <div class="ui variable_to_switch"></div> ) <div class="ui all_cases_div"></div></span>';
  22695. ret += '</div>';
  22696. var el = jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret);
  22697. el.data('command', command);
  22698. addHandlers(command, function_obj, el);
  22699. _contextualized_menu__WEBPACK_IMPORTED_MODULE_8__["renderMenu"](command, el.find('.context_menu'), function_obj, el);
  22700. _variable_value_menu__WEBPACK_IMPORTED_MODULE_7__["renderMenu"](command, command.variable, el.find('.variable_to_switch'), function_obj);
  22701. if (command.cases) {
  22702. for (var i = 0; i < command.cases.length; i++) {
  22703. renderCase(command.cases[i], command, function_obj, el.find('.all_cases_div'));
  22704. }
  22705. }
  22706. return el;
  22707. }
  22708. function renderCase(switchcase, command, function_obj, el) {
  22709. var casediv = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui case_div"><i class="ui icon times red button_remove_command"></i><span>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_code_case') + '</span> <div class="ui variable_case"></div>: <div class="case_commands_block"></div></div>');
  22710. _variable_value_menu__WEBPACK_IMPORTED_MODULE_7__["renderMenu"](command, switchcase.variable_value_menu, casediv.find('.variable_case'), function_obj);
  22711. casediv.data('switchcase', switchcase);
  22712. casediv.find('.case_commands_block').data('switchcase', switchcase);
  22713. el.append(casediv);
  22714. if (switchcase.commands_block) {
  22715. for (var j = 0; j < switchcase.commands_block.length; j++) {
  22716. _commands__WEBPACK_IMPORTED_MODULE_6__["renderCommand"](switchcase.commands_block[j], jquery__WEBPACK_IMPORTED_MODULE_0___default()(casediv.find('.case_commands_block')[0]), 3, function_obj);
  22717. }
  22718. }
  22719. casediv.find('.button_remove_command').on('click', function () {
  22720. for (var i = 0; i < command.cases.length; i++) {
  22721. if (switchcase == command.cases[i]) {
  22722. delete command.cases[i];
  22723. command.cases.splice(i, 1);
  22724. casediv.remove();
  22725. break;
  22726. }
  22727. }
  22728. });
  22729. }
  22730. function addHandlers(command, function_obj, switch_dom) {
  22731. switch_dom.find('.button_remove_command').on('click', function () {
  22732. if (_commands__WEBPACK_IMPORTED_MODULE_6__["removeCommand"](command, function_obj, switch_dom)) {
  22733. switch_dom.fadeOut(400, function () {
  22734. switch_dom.remove();
  22735. });
  22736. }
  22737. });
  22738. }
  22739. /***/ }),
  22740. /***/ "./js/visualUI/commands/variable_value_menu.js":
  22741. /*!*****************************************************!*\
  22742. !*** ./js/visualUI/commands/variable_value_menu.js ***!
  22743. \*****************************************************/
  22744. /*! exports provided: VAR_OR_VALUE_TYPES, renderMenu */
  22745. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  22746. "use strict";
  22747. __webpack_require__.r(__webpack_exports__);
  22748. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VAR_OR_VALUE_TYPES", function() { return VAR_OR_VALUE_TYPES; });
  22749. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderMenu", function() { return renderMenu; });
  22750. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  22751. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  22752. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  22753. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  22754. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  22755. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  22756. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  22757. /* harmony import */ var _attribution__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./attribution */ "./js/visualUI/commands/attribution.js");
  22758. /* harmony import */ var _writer__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./writer */ "./js/visualUI/commands/writer.js");
  22759. /* harmony import */ var _repeatNtimes__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./repeatNtimes */ "./js/visualUI/commands/repeatNtimes.js");
  22760. var VAR_OR_VALUE_TYPES = Object.freeze({
  22761. only_variable: 1,
  22762. only_value: 2,
  22763. only_function: 3,
  22764. variable_and_function: 4,
  22765. variable_and_value_opt: 5,
  22766. value_and_function: 6,
  22767. all: 7
  22768. });
  22769. function renderMenu(command, ref_object, dom_object, function_obj) {
  22770. var size_field = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 2;
  22771. var expression_element = arguments.length > 5 ? arguments[5] : undefined;
  22772. // Verificar se o objeto atual trata-se de uma chamada de função e conferir se possui a quantidade correta de parâmetros
  22773. // Caso não possua, tem que adicionar as variáveis que servirão de parâmetros:
  22774. if (ref_object.function_called) {
  22775. if (ref_object.function_called.parameters_list) {
  22776. while (ref_object.function_called.parameters_list.length != ref_object.parameters_list.length) {
  22777. if (ref_object.parameters_list.length > ref_object.function_called.parameters_list.length) {
  22778. ref_object.parameters_list.pop();
  22779. } else {
  22780. ref_object.parameters_list.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](VAR_OR_VALUE_TYPES.all, null, null, null, true));
  22781. }
  22782. }
  22783. }
  22784. }
  22785. var menu_var_or_value = '<div class="ui dropdown menu_var_or_value_dom" data-varmenu="true"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  22786. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_variable) {
  22787. menu_var_or_value = '<div class="ui dropdown menu_var_or_value_dom" data-varmenu="true"><div class="text"></div><i class="dropdown icon"></i><div class="menu menu_only_vars">';
  22788. menu_var_or_value += '</div>';
  22789. }
  22790. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.variable_and_function || ref_object.variable_and_value == VAR_OR_VALUE_TYPES.variable_and_value_opt || ref_object.variable_and_value == VAR_OR_VALUE_TYPES.all) {
  22791. menu_var_or_value += '<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('variable');
  22792. menu_var_or_value += '<div class="menu menu_only_vars">';
  22793. menu_var_or_value += '</div></div>';
  22794. }
  22795. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_value) {
  22796. menu_var_or_value = '<input type="text" class="width-dynamic" size="' + size_field + '" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" />';
  22797. }
  22798. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.variable_and_value_opt || ref_object.variable_and_value == VAR_OR_VALUE_TYPES.value_and_function || ref_object.variable_and_value == VAR_OR_VALUE_TYPES.all) {
  22799. menu_var_or_value += '<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_value + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_value') + '</div>';
  22800. }
  22801. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_function) {
  22802. menu_var_or_value = '<div class="ui dropdown menu_var_or_value_dom" data-varmenu="true"><div class="text"></div><i class="dropdown icon"></i><div class="menu menu_only_functions">';
  22803. menu_var_or_value += '</div>';
  22804. }
  22805. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.variable_and_function || ref_object.variable_and_value == VAR_OR_VALUE_TYPES.value_and_function || ref_object.variable_and_value == VAR_OR_VALUE_TYPES.all) {
  22806. menu_var_or_value += '<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_function + '"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_function');
  22807. menu_var_or_value += '<div class="menu menu_only_functions">';
  22808. menu_var_or_value += '</div></div>';
  22809. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution) {
  22810. menu_var_or_value += '<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_change');
  22811. menu_var_or_value += '<div class="menu">';
  22812. menu_var_or_value += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp + '">EXP OP EXP</div>';
  22813. menu_var_or_value += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp + '">OP EXP</div>';
  22814. menu_var_or_value += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par + '">( EXP )</div>';
  22815. menu_var_or_value += '</div></div>';
  22816. }
  22817. }
  22818. menu_var_or_value += '</div></div>';
  22819. menu_var_or_value = jquery__WEBPACK_IMPORTED_MODULE_0___default()(menu_var_or_value);
  22820. dom_object.append(menu_var_or_value);
  22821. ref_object.dom_object = menu_var_or_value;
  22822. addHandlers(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  22823. addVariablesToMenu(function_obj, menu_var_or_value, ref_object, expression_element);
  22824. addFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element);
  22825. addIVProgFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element);
  22826. if (ref_object.content || ref_object.function_called) {
  22827. if (ref_object.content) {
  22828. // Verificar se a variável ainda existe:
  22829. var variable_fun = isVarInProgram(ref_object.content, function_obj);
  22830. if (variable_fun) {
  22831. ref_object.content = variable_fun;
  22832. renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element);
  22833. } else {
  22834. if (ref_object.content && ref_object.content.type) {
  22835. ref_object.content = null;
  22836. appendSelectText(ref_object, menu_var_or_value);
  22837. } else {
  22838. renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element);
  22839. }
  22840. }
  22841. } else if (ref_object.function_called) {
  22842. // Verificar se a função ainda existe:
  22843. var ret_function = isFunctionInProgram(ref_object.function_called);
  22844. if (ret_function) {
  22845. ref_object.function_called = ret_function;
  22846. renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element);
  22847. } else {
  22848. ref_object.content = null;
  22849. ref_object.row = null;
  22850. ref_object.column = null;
  22851. delete ref_object.function_called;
  22852. delete ref_object.parameters_list;
  22853. appendSelectText(ref_object, menu_var_or_value);
  22854. }
  22855. }
  22856. } else {
  22857. appendSelectText(ref_object, menu_var_or_value);
  22858. }
  22859. }
  22860. function appendSelectText(ref_object, menu_var_or_value) {
  22861. switch (ref_object.variable_and_value) {
  22862. case VAR_OR_VALUE_TYPES.only_variable:
  22863. menu_var_or_value.find('.text').append('<i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('var_menu_select_var') + '</i>');
  22864. break;
  22865. case VAR_OR_VALUE_TYPES.all:
  22866. menu_var_or_value.find('.text').append('<i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('var_menu_select_all') + '</i>');
  22867. break;
  22868. case VAR_OR_VALUE_TYPES.variable_and_function:
  22869. menu_var_or_value.find('.text').append('<i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('var_menu_select_all') + '</i>');
  22870. break;
  22871. case VAR_OR_VALUE_TYPES.only_function:
  22872. menu_var_or_value.find('.text').append('<i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('var_menu_select_function') + '</i>');
  22873. break;
  22874. }
  22875. }
  22876. function isFunctionInProgram(function_called_obj) {
  22877. if (function_called_obj.name) {
  22878. if (window.program_obj.functions) {
  22879. for (var i = 0; i < window.program_obj.functions.length; i++) {
  22880. if (window.program_obj.functions[i] == function_called_obj) {
  22881. return window.program_obj.functions[i];
  22882. }
  22883. }
  22884. for (var i = 0; i < window.program_obj.functions.length; i++) {
  22885. if (window.program_obj.functions[i].name == function_called_obj.name) {
  22886. return window.program_obj.functions[i];
  22887. }
  22888. }
  22889. }
  22890. } else if (function_called_obj.identifier) {
  22891. for (var i = 0; i < window.system_functions.length; i++) {
  22892. if (window.system_functions[i].identifier == function_called_obj.identifier) {
  22893. return window.system_functions[i];
  22894. }
  22895. }
  22896. }
  22897. return null;
  22898. }
  22899. function isVarInProgram(var_obj, function_obj) {
  22900. // Verify in locals:
  22901. if (function_obj.variables_list) {
  22902. for (var i = 0; i < function_obj.variables_list.length; i++) {
  22903. if (function_obj.variables_list[i] == var_obj) {
  22904. return function_obj.variables_list[i];
  22905. }
  22906. }
  22907. } // Verify in parameters:
  22908. if (function_obj.parameters_list) {
  22909. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  22910. if (function_obj.parameters_list[i] == var_obj) {
  22911. return function_obj.parameters_list[i];
  22912. }
  22913. }
  22914. } // Verify in globals:
  22915. if (window.program_obj.globals) {
  22916. for (var i = 0; i < window.program_obj.globals.length; i++) {
  22917. if (window.program_obj.globals[i] == var_obj) {
  22918. return window.program_obj.globals[i];
  22919. }
  22920. }
  22921. } // If not found, verify if the reference was lost
  22922. if (var_obj) {
  22923. if (function_obj.variables_list) {
  22924. for (var i = 0; i < function_obj.variables_list.length; i++) {
  22925. if (function_obj.variables_list[i].name == var_obj.name) {
  22926. return function_obj.variables_list[i];
  22927. }
  22928. }
  22929. }
  22930. if (function_obj.parameters_list) {
  22931. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  22932. if (function_obj.parameters_list[i].name == var_obj.name) {
  22933. return function_obj.parameters_list[i];
  22934. }
  22935. }
  22936. }
  22937. if (window.program_obj.globals) {
  22938. for (var i = 0; i < window.program_obj.globals.length; i++) {
  22939. if (window.program_obj.globals[i].name == var_obj.name) {
  22940. return window.program_obj.globals[i];
  22941. }
  22942. }
  22943. }
  22944. }
  22945. return null;
  22946. }
  22947. function renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element) {
  22948. if (ref_object.function_called) {
  22949. menu_var_or_value.remove();
  22950. variableValueMenuCode(command, ref_object, dom_object, function_obj, menu_var_or_value, expression_element);
  22951. } else if (ref_object.content.type) {
  22952. menu_var_or_value.remove();
  22953. variableValueMenuCode(command, ref_object, dom_object, function_obj, menu_var_or_value, expression_element);
  22954. } else {
  22955. menu_var_or_value.remove();
  22956. variableValueMenuCode(command, ref_object, dom_object, function_obj, menu_var_or_value, expression_element);
  22957. }
  22958. }
  22959. function variableValueMenuCode(command, variable_obj, dom_object, function_obj, menu_var_or_value, expression_element) {
  22960. if (variable_obj.content || variable_obj.function_called) {
  22961. // Verificar se a variável ainda existe:
  22962. var var_fun = isVarInProgram(variable_obj.content, function_obj);
  22963. if (var_fun) {
  22964. variable_obj.content = var_fun;
  22965. } else {
  22966. if (variable_obj.content && variable_obj.content.type) {
  22967. variable_obj.content = null;
  22968. appendSelectText(variable_obj, menu_var_or_value);
  22969. }
  22970. }
  22971. } else {
  22972. appendSelectText(variable_obj, menu_var_or_value);
  22973. }
  22974. if (variable_obj.content == null && variable_obj.function_called == null) {
  22975. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  22976. return;
  22977. }
  22978. var ret = '';
  22979. if (variable_obj.function_called) {
  22980. if (variable_obj.function_called.parameters_list == null || variable_obj.function_called.length == 0) {
  22981. menu_var_or_value.find('.text').text(' ');
  22982. dom_object.find('.menu_var_or_value_dom').remove();
  22983. var parameters_menu;
  22984. if (variable_obj.function_called.name) {
  22985. parameters_menu = '<div class="parameters_function_called"> ' + variable_obj.function_called.name + ' <span> ( </span>';
  22986. } else {
  22987. parameters_menu = '<div class="parameters_function_called"> <i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(variable_obj.function_called.category) + '.' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(variable_obj.function_called.identifier) + '</i> <span> ( </span>';
  22988. }
  22989. parameters_menu += '<span> ) </span></div>';
  22990. parameters_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(parameters_menu);
  22991. dom_object.append(parameters_menu);
  22992. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  22993. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_clear') + '</div>';
  22994. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution) {
  22995. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_change');
  22996. context_menu += '<div class="menu">';
  22997. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp + '">EXP OP EXP</div>';
  22998. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp + '">OP EXP</div>';
  22999. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par + '">( EXP )</div>';
  23000. context_menu += '</div></div>';
  23001. }
  23002. context_menu += '</div></div>';
  23003. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  23004. context_menu.insertAfter(dom_object.find('.parameters_function_called'));
  23005. context_menu.dropdown({
  23006. onChange: function onChange(value, text, $selectedItem) {
  23007. console.log('S1');
  23008. if ($selectedItem.data('clear')) {
  23009. console.log('PP1');
  23010. dom_object.text('');
  23011. variable_obj.content = null;
  23012. variable_obj.row = null;
  23013. variable_obj.column = null;
  23014. delete variable_obj.function_called;
  23015. delete variable_obj.parameters_list;
  23016. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  23017. }
  23018. if ($selectedItem.data('exp')) {
  23019. _attribution__WEBPACK_IMPORTED_MODULE_6__["manageExpressionElements"](command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  23020. }
  23021. },
  23022. selectOnKeydown: false
  23023. });
  23024. } else {
  23025. menu_var_or_value.find('.text').text(' ');
  23026. dom_object.find('.menu_var_or_value_dom').remove();
  23027. var parameters_menu;
  23028. if (variable_obj.function_called.name) {
  23029. parameters_menu = '<div class="parameters_function_called"> ' + variable_obj.function_called.name + ' <span> ( </span>';
  23030. } else {
  23031. parameters_menu = '<div class="parameters_function_called"> <i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(variable_obj.function_called.category) + '.' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(variable_obj.function_called.identifier) + '</i> <span> ( </span>';
  23032. }
  23033. for (var j = 0; j < variable_obj.function_called.parameters_list.length; j++) {
  23034. parameters_menu += '<div class="render_style_param parameter_' + j + '"></div>';
  23035. if (j + 1 != variable_obj.function_called.parameters_list.length) {
  23036. parameters_menu += ' , ';
  23037. }
  23038. }
  23039. parameters_menu += '<span> ) </span></div>';
  23040. parameters_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(parameters_menu);
  23041. dom_object.append(parameters_menu);
  23042. for (var j = 0; j < variable_obj.function_called.parameters_list.length; j++) {
  23043. renderMenu(command, variable_obj.parameters_list[j], parameters_menu.find('.parameter_' + j), function_obj, 2, expression_element);
  23044. }
  23045. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  23046. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_clear') + '</div>';
  23047. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution) {
  23048. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_change');
  23049. context_menu += '<div class="menu">';
  23050. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp + '">EXP OP EXP</div>';
  23051. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp + '">OP EXP</div>';
  23052. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par + '">( EXP )</div>';
  23053. context_menu += '</div></div>';
  23054. }
  23055. context_menu += '</div></div>';
  23056. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  23057. context_menu.insertAfter(parameters_menu);
  23058. context_menu.dropdown({
  23059. onChange: function onChange(value, text, $selectedItem) {
  23060. console.log('S2');
  23061. if ($selectedItem.data('clear')) {
  23062. console.log('PP2');
  23063. dom_object.text('');
  23064. variable_obj.content = null;
  23065. variable_obj.row = null;
  23066. variable_obj.column = null;
  23067. delete variable_obj.function_called;
  23068. delete variable_obj.parameters_list;
  23069. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  23070. }
  23071. if ($selectedItem.data('exp')) {
  23072. _attribution__WEBPACK_IMPORTED_MODULE_6__["manageExpressionElements"](command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  23073. }
  23074. },
  23075. selectOnKeydown: false
  23076. });
  23077. }
  23078. } else if (variable_obj.content.type) {
  23079. var variable_render = "";
  23080. if (variable_obj.content.dimensions == 1 && variable_obj.dimensions != 1) {
  23081. variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content.name + '</span>';
  23082. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ]</span>';
  23083. variable_render += '</div>';
  23084. variable_render = jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_render);
  23085. dom_object.append(variable_render);
  23086. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  23087. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_clear') + '</div>';
  23088. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution) {
  23089. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_change');
  23090. context_menu += '<div class="menu">';
  23091. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp + '">EXP OP EXP</div>';
  23092. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp + '">OP EXP</div>';
  23093. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par + '">( EXP )</div>';
  23094. context_menu += '</div></div>';
  23095. }
  23096. context_menu += '</div></div>';
  23097. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  23098. variable_render.append(context_menu);
  23099. context_menu.dropdown({
  23100. onChange: function onChange(value, text, $selectedItem) {
  23101. console.log('S3');
  23102. if ($selectedItem.data('clear')) {
  23103. console.log('PP3');
  23104. dom_object.text('');
  23105. variable_obj.content = null;
  23106. variable_obj.row = null;
  23107. variable_obj.column = null;
  23108. delete variable_obj.function_called;
  23109. delete variable_obj.parameters_list;
  23110. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  23111. }
  23112. if ($selectedItem.data('exp')) {
  23113. _attribution__WEBPACK_IMPORTED_MODULE_6__["manageExpressionElements"](command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  23114. }
  23115. },
  23116. selectOnKeydown: false
  23117. });
  23118. if (!variable_obj.column) {
  23119. variable_obj.column = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](VAR_OR_VALUE_TYPES.all, null, null, null, true);
  23120. }
  23121. variableValueMenuCode(command, variable_obj.column, jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_render.find('.column_container')), function_obj, menu_var_or_value, expression_element);
  23122. } else if (variable_obj.content.dimensions == 2 && variable_obj.dimensions != 2) {
  23123. variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content.name + '</span>';
  23124. variable_render += ' <span>[ </span> <div class="row_container"></div> <span> ]</span>';
  23125. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ] </span>';
  23126. variable_render += '</div>';
  23127. variable_render = jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_render);
  23128. dom_object.append(variable_render);
  23129. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  23130. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_clear') + '</div>';
  23131. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution) {
  23132. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_change');
  23133. context_menu += '<div class="menu">';
  23134. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp + '">EXP OP EXP</div>';
  23135. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp + '">OP EXP</div>';
  23136. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par + '">( EXP )</div>';
  23137. context_menu += '</div></div>';
  23138. }
  23139. context_menu += '</div></div>';
  23140. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  23141. variable_render.append(context_menu);
  23142. context_menu.dropdown({
  23143. onChange: function onChange(value, text, $selectedItem) {
  23144. console.log('S4');
  23145. if ($selectedItem.data('clear')) {
  23146. console.log('PP4');
  23147. dom_object.text('');
  23148. variable_obj.content = null;
  23149. variable_obj.row = null;
  23150. variable_obj.column = null;
  23151. delete variable_obj.function_called;
  23152. delete variable_obj.parameters_list;
  23153. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  23154. }
  23155. if ($selectedItem.data('exp')) {
  23156. _attribution__WEBPACK_IMPORTED_MODULE_6__["manageExpressionElements"](command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  23157. }
  23158. },
  23159. selectOnKeydown: false
  23160. });
  23161. if (!variable_obj.column) {
  23162. variable_obj.column = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](VAR_OR_VALUE_TYPES.all, null, null, null, true);
  23163. }
  23164. if (!variable_obj.row) {
  23165. variable_obj.row = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](VAR_OR_VALUE_TYPES.all, null, null, null, true);
  23166. }
  23167. variableValueMenuCode(command, variable_obj.row, jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_render.find('.row_container')), function_obj, menu_var_or_value, expression_element);
  23168. variableValueMenuCode(command, variable_obj.column, jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_render.find('.column_container')), function_obj, menu_var_or_value, expression_element);
  23169. } else {
  23170. variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content.name + '</span>';
  23171. variable_render += '</div>';
  23172. variable_render = jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_render);
  23173. dom_object.append(variable_render);
  23174. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  23175. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_clear') + '</div>';
  23176. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution && !dom_object.hasClass('var_attributed')) {
  23177. console.log('dom_object6');
  23178. console.log(dom_object);
  23179. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_change');
  23180. context_menu += '<div class="menu">';
  23181. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp + '">EXP OP EXP</div>';
  23182. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp + '">OP EXP</div>';
  23183. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par + '">( EXP )</div>';
  23184. context_menu += '</div></div>';
  23185. }
  23186. context_menu += '</div></div>';
  23187. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  23188. variable_render.append(context_menu);
  23189. context_menu.dropdown({
  23190. onChange: function onChange(value, text, $selectedItem) {
  23191. console.log('S5');
  23192. if ($selectedItem.data('clear')) {
  23193. console.log('PP5');
  23194. dom_object.text('');
  23195. variable_obj.content = null;
  23196. variable_obj.row = null;
  23197. variable_obj.column = null;
  23198. delete variable_obj.function_called;
  23199. delete variable_obj.parameters_list;
  23200. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  23201. }
  23202. if ($selectedItem.data('exp')) {
  23203. _attribution__WEBPACK_IMPORTED_MODULE_6__["manageExpressionElements"](command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  23204. }
  23205. },
  23206. selectOnKeydown: false
  23207. });
  23208. }
  23209. } else {
  23210. var variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content + '</span>';
  23211. variable_render += '</div>';
  23212. variable_render = jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_render);
  23213. dom_object.append(variable_render);
  23214. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  23215. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_clear') + '</div>';
  23216. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution) {
  23217. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_change');
  23218. context_menu += '<div class="menu">';
  23219. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp + '">EXP OP EXP</div>';
  23220. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp + '">OP EXP</div>';
  23221. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par + '">( EXP )</div>';
  23222. context_menu += '</div></div>';
  23223. }
  23224. context_menu += '</div></div>';
  23225. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  23226. if (variable_obj.variable_and_value != VAR_OR_VALUE_TYPES.only_value) {
  23227. context_menu.insertAfter(variable_render);
  23228. }
  23229. context_menu.dropdown({
  23230. onChange: function onChange(value, text, $selectedItem) {
  23231. console.log('S6');
  23232. if ($selectedItem.data('clear')) {
  23233. console.log('PP6');
  23234. dom_object.text('');
  23235. variable_obj.content = null;
  23236. variable_obj.row = null;
  23237. variable_obj.column = null;
  23238. delete variable_obj.function_called;
  23239. delete variable_obj.parameters_list;
  23240. dom_object.find('.value_rendered').remove();
  23241. dom_object.find('.context_menu_clear').remove();
  23242. dom_object.find('.width-dynamic-minus').remove();
  23243. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  23244. }
  23245. if ($selectedItem.data('exp')) {
  23246. _attribution__WEBPACK_IMPORTED_MODULE_6__["manageExpressionElements"](command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  23247. }
  23248. },
  23249. selectOnKeydown: false
  23250. });
  23251. variable_render.on('click', function (e) {
  23252. variable_render.remove();
  23253. variable_render.empty();
  23254. variable_render.remove();
  23255. dom_object.empty();
  23256. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  23257. openInputToValue(command, variable_obj, dom_object, menu_var_or_value, function_obj, expression_element);
  23258. });
  23259. }
  23260. }
  23261. function addIVProgFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element) {
  23262. var sub_menu = menu_var_or_value.find('.menu_only_functions');
  23263. sub_menu.append('<div class="divider"></div><div class="header">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_header_ivprog_functions') + '</div>');
  23264. sub_menu.append('<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_menu_functions_math') + '<div class="menu menu_math_functions"></div></div>');
  23265. sub_menu.append('<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_menu_functions_text') + '<div class="menu menu_text_functions"></div></div>');
  23266. sub_menu.append('<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_menu_functions_arrangement') + '<div class="menu menu_arrangement_functions"></div></div>');
  23267. sub_menu.append('<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_menu_functions_conversion') + '<div class="menu menu_conversion_functions"></div></div>'); // Insert Math functions:
  23268. for (var i = 0; i < window.system_functions.length; i++) {
  23269. var t = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="item"></div>');
  23270. t.data('function_reference', window.system_functions[i]);
  23271. t.data('option', VAR_OR_VALUE_TYPES.only_function);
  23272. t.text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(window.system_functions[i].identifier));
  23273. switch (window.system_functions[i].category) {
  23274. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].math:
  23275. sub_menu.find('.menu_math_functions').append(t);
  23276. break;
  23277. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].text:
  23278. sub_menu.find('.menu_text_functions').append(t);
  23279. break;
  23280. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].arrangement:
  23281. sub_menu.find('.menu_arrangement_functions').append(t);
  23282. break;
  23283. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].conversion:
  23284. sub_menu.find('.menu_conversion_functions').append(t);
  23285. break;
  23286. }
  23287. }
  23288. }
  23289. function addFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element) {
  23290. var sub_menu = menu_var_or_value.find('.menu_only_functions');
  23291. sub_menu.text('');
  23292. for (var i = 0; i < window.program_obj.functions.length; i++) {
  23293. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_function + '">' + window.program_obj.functions[i].name + ' </div>');
  23294. temp.data('function_reference', window.program_obj.functions[i]);
  23295. sub_menu.append(temp);
  23296. }
  23297. }
  23298. function addVariablesToMenu(function_obj, menu_var_or_value, ref_object, expression_element) {
  23299. var sub_menu = menu_var_or_value.find('.menu_only_vars');
  23300. sub_menu.text('');
  23301. var is_there = false;
  23302. if (window.program_obj.globals) {
  23303. if (ref_object.include_constant) {
  23304. for (var i = 0; i < window.program_obj.globals.length; i++) {
  23305. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + window.program_obj.globals[i].name + ' </div>');
  23306. temp.data('variable_reference', window.program_obj.globals[i]);
  23307. sub_menu.append(temp);
  23308. is_there = true;
  23309. }
  23310. } else {
  23311. for (var i = 0; i < window.program_obj.globals.length; i++) {
  23312. if (!window.program_obj.globals[i].is_constant) {
  23313. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + window.program_obj.globals[i].name + ' </div>');
  23314. temp.data('variable_reference', window.program_obj.globals[i]);
  23315. sub_menu.append(temp);
  23316. is_there = true;
  23317. }
  23318. }
  23319. }
  23320. }
  23321. if (function_obj.parameters_list) {
  23322. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  23323. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + function_obj.parameters_list[i].name + ' </div>');
  23324. temp.data('variable_reference', function_obj.parameters_list[i]);
  23325. sub_menu.append(temp);
  23326. is_there = true;
  23327. }
  23328. }
  23329. if (function_obj.variables_list) {
  23330. for (var i = 0; i < function_obj.variables_list.length; i++) {
  23331. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + function_obj.variables_list[i].name + ' </div>');
  23332. temp.data('variable_reference', function_obj.variables_list[i]);
  23333. sub_menu.append(temp);
  23334. is_there = true;
  23335. }
  23336. }
  23337. if (!is_there) {
  23338. sub_menu.append(jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="header">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_none_variable') + '</div>'));
  23339. sub_menu.append(jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="item disabled">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_none_variable_instruction') + '</div>'));
  23340. }
  23341. }
  23342. function addHandlers(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element) {
  23343. if (ref_object.variable_and_value != VAR_OR_VALUE_TYPES.only_value) {
  23344. menu_var_or_value.dropdown({
  23345. onChange: function onChange(value, text, $selectedItem) {
  23346. console.log('S7');
  23347. dom_object.find('.var_name').remove();
  23348. switch ($selectedItem.data('option')) {
  23349. case VAR_OR_VALUE_TYPES.only_function:
  23350. openInputToFunction(command, ref_object, dom_object, menu_var_or_value, function_obj, jquery__WEBPACK_IMPORTED_MODULE_0___default()($selectedItem).data('function_reference'), expression_element);
  23351. break;
  23352. case VAR_OR_VALUE_TYPES.only_value:
  23353. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  23354. break;
  23355. case VAR_OR_VALUE_TYPES.only_variable:
  23356. openInputToVariable(command, ref_object, dom_object, menu_var_or_value, function_obj, jquery__WEBPACK_IMPORTED_MODULE_0___default()($selectedItem).data('variable_reference'), expression_element);
  23357. break;
  23358. }
  23359. if ($selectedItem.data('exp')) {
  23360. _attribution__WEBPACK_IMPORTED_MODULE_6__["manageExpressionElements"](command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  23361. }
  23362. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes) {
  23363. _repeatNtimes__WEBPACK_IMPORTED_MODULE_8__["manageExpressionElements"](command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  23364. }
  23365. },
  23366. selectOnKeydown: false
  23367. });
  23368. }
  23369. dom_object.find('.width-dynamic').on('input', function () {
  23370. var inputWidth = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).textWidth() + 10;
  23371. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).focus();
  23372. var tmpStr = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).val();
  23373. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).val('');
  23374. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).val(tmpStr);
  23375. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).css({
  23376. width: inputWidth
  23377. });
  23378. }).trigger('input');
  23379. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].comment) {
  23380. dom_object.parent().on('click', function (e) {
  23381. dom_object.find('.value_rendered').remove();
  23382. dom_object.find('.value_rendered').empty();
  23383. dom_object.find('.value_rendered').remove();
  23384. dom_object.empty();
  23385. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  23386. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  23387. });
  23388. }
  23389. }
  23390. function openInputToFunction(command, ref_object, dom_object, menu_var_or_value, function_obj, function_selected, expression_element) {
  23391. ref_object.function_called = function_selected;
  23392. ref_object.parameters_list = [];
  23393. if (function_selected.parameters_list != null && function_selected.parameters_list.length > 0) {
  23394. menu_var_or_value.find('.text').text(' ');
  23395. dom_object.find('.menu_var_or_value_dom').remove();
  23396. var parameters_menu;
  23397. if (function_selected.name) {
  23398. parameters_menu = '<div class="parameters_function_called"> ' + function_selected.name + ' <span> ( </span>';
  23399. } else {
  23400. parameters_menu = '<div class="parameters_function_called"> <i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(function_selected.category) + '.' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(function_selected.identifier) + '</i> <span> ( </span>';
  23401. }
  23402. for (var j = 0; j < function_selected.parameters_list.length; j++) {
  23403. parameters_menu += '<div class="render_style_param parameter_' + j + '"></div>';
  23404. if (j + 1 != function_selected.parameters_list.length) {
  23405. parameters_menu += ' , ';
  23406. }
  23407. }
  23408. parameters_menu += '<span> ) </span></div>';
  23409. parameters_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(parameters_menu);
  23410. dom_object.append(parameters_menu);
  23411. for (var j = 0; j < function_selected.parameters_list.length; j++) {
  23412. var temp;
  23413. if (function_selected.parameters_list[j].dimensions > 0) {
  23414. temp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](VAR_OR_VALUE_TYPES.variable_and_function, null, null, null, true, function_selected.parameters_list[j].dimensions);
  23415. } else {
  23416. temp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](VAR_OR_VALUE_TYPES.all, null, null, null, true);
  23417. }
  23418. ref_object.parameters_list.push(temp);
  23419. renderMenu(command, temp, parameters_menu.find('.parameter_' + j), function_obj, 2, expression_element);
  23420. }
  23421. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  23422. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_clear') + '</div>';
  23423. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution) {
  23424. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_change');
  23425. context_menu += '<div class="menu">';
  23426. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp + '">EXP OP EXP</div>';
  23427. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp + '">OP EXP</div>';
  23428. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par + '">( EXP )</div>';
  23429. context_menu += '</div></div>';
  23430. }
  23431. context_menu += '</div></div>';
  23432. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  23433. context_menu.insertAfter(dom_object.find('.parameters_function_called'));
  23434. context_menu.dropdown({
  23435. onChange: function onChange(value, text, $selectedItem) {
  23436. console.log('S8');
  23437. if ($selectedItem.data('clear')) {
  23438. console.log('PP7');
  23439. dom_object.text('');
  23440. ref_object.content = null;
  23441. ref_object.row = null;
  23442. ref_object.column = null;
  23443. delete ref_object.function_called;
  23444. delete ref_object.parameters_list;
  23445. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  23446. }
  23447. if ($selectedItem.data('exp')) {
  23448. _attribution__WEBPACK_IMPORTED_MODULE_6__["manageExpressionElements"](command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  23449. }
  23450. },
  23451. selectOnKeydown: false
  23452. });
  23453. } else {
  23454. menu_var_or_value.find('.text').text(' ');
  23455. dom_object.find('.menu_var_or_value_dom').remove();
  23456. var parameters_menu;
  23457. if (function_selected.name) {
  23458. parameters_menu = '<div class="parameters_function_called"> ' + function_selected.name + ' <span> ( </span>';
  23459. } else {
  23460. parameters_menu = '<div class="parameters_function_called"> <i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(function_selected.category) + '.' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(function_selected.identifier) + '</i> <span> ( </span>';
  23461. }
  23462. parameters_menu += '<span> ) </span></div>';
  23463. parameters_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(parameters_menu);
  23464. dom_object.append(parameters_menu);
  23465. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  23466. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_clear') + '</div>';
  23467. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution) {
  23468. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_change');
  23469. context_menu += '<div class="menu">';
  23470. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp + '">EXP OP EXP</div>';
  23471. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp + '">OP EXP</div>';
  23472. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par + '">( EXP )</div>';
  23473. context_menu += '</div></div>';
  23474. }
  23475. context_menu += '</div></div>';
  23476. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  23477. context_menu.insertAfter(dom_object.find('.parameters_function_called'));
  23478. context_menu.dropdown({
  23479. onChange: function onChange(value, text, $selectedItem) {
  23480. console.log('S9');
  23481. if ($selectedItem.data('clear')) {
  23482. console.log('PP8');
  23483. dom_object.text('');
  23484. ref_object.content = null;
  23485. ref_object.row = null;
  23486. ref_object.column = null;
  23487. delete ref_object.function_called;
  23488. delete ref_object.parameters_list;
  23489. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  23490. }
  23491. if ($selectedItem.data('exp')) {
  23492. _attribution__WEBPACK_IMPORTED_MODULE_6__["manageExpressionElements"](command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  23493. }
  23494. },
  23495. selectOnKeydown: false
  23496. });
  23497. }
  23498. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution) {
  23499. _attribution__WEBPACK_IMPORTED_MODULE_6__["renderMenuOperations"](command, ref_object, dom_object, menu_var_or_value, function_obj);
  23500. }
  23501. }
  23502. function openInputToVariable(command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected, expression_element) {
  23503. ref_object.content = variable_selected;
  23504. menu_var_or_value.find('.text').text(' ');
  23505. dom_object.find('.menu_var_or_value_dom').remove();
  23506. var variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_selected.name + '</span>';
  23507. if (variable_selected.dimensions == 1 && ref_object.dimensions != 1) {
  23508. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ]</span>';
  23509. }
  23510. if (variable_selected.dimensions == 2 && ref_object.dimensions != 2) {
  23511. variable_render += ' <span>[ </span> <div class="row_container"></div> <span> ]</span> ';
  23512. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ]</span>';
  23513. }
  23514. variable_render += '</div>';
  23515. variable_render = jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_render);
  23516. dom_object.append(variable_render);
  23517. if (variable_selected.dimensions == 1 && ref_object.dimensions != 1) {
  23518. ref_object.column = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](VAR_OR_VALUE_TYPES.all, null, null, null, true);
  23519. renderMenu(command, ref_object.column, variable_render.find('.column_container'), function_obj, 2, expression_element);
  23520. }
  23521. if (variable_selected.dimensions == 2 && ref_object.dimensions != 2) {
  23522. ref_object.row = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](VAR_OR_VALUE_TYPES.all, null, null, null, true);
  23523. renderMenu(command, ref_object.row, variable_render.find('.row_container'), function_obj, 2, expression_element);
  23524. ref_object.column = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](VAR_OR_VALUE_TYPES.all, null, null, null, true);
  23525. renderMenu(command, ref_object.column, variable_render.find('.column_container'), function_obj, 2, expression_element);
  23526. }
  23527. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  23528. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_clear') + '</div>';
  23529. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution && !dom_object.hasClass('var_attributed')) {
  23530. console.log("dom_object 10: ");
  23531. console.log(dom_object);
  23532. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_change');
  23533. context_menu += '<div class="menu">';
  23534. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp + '">EXP OP EXP</div>';
  23535. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp + '">OP EXP</div>';
  23536. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par + '">( EXP )</div>';
  23537. context_menu += '</div></div>';
  23538. }
  23539. context_menu += '</div></div>';
  23540. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  23541. context_menu.insertAfter(dom_object.find('.variable_rendered'));
  23542. context_menu.dropdown({
  23543. onChange: function onChange(value, text, $selectedItem) {
  23544. console.log('S10');
  23545. if ($selectedItem.data('clear')) {
  23546. console.log('PP9');
  23547. dom_object.text('');
  23548. ref_object.content = null;
  23549. ref_object.row = null;
  23550. ref_object.column = null;
  23551. delete ref_object.function_called;
  23552. delete ref_object.parameters_list;
  23553. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  23554. }
  23555. if ($selectedItem.data('exp')) {
  23556. _attribution__WEBPACK_IMPORTED_MODULE_6__["manageExpressionElements"](command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  23557. }
  23558. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes) {
  23559. _repeatNtimes__WEBPACK_IMPORTED_MODULE_8__["manageClearExpressionElements"](command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  23560. }
  23561. },
  23562. selectOnKeydown: false
  23563. });
  23564. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution) {
  23565. _attribution__WEBPACK_IMPORTED_MODULE_6__["renderMenuOperations"](command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected);
  23566. }
  23567. }
  23568. function openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element) {
  23569. if (ref_object.content == null) {
  23570. ref_object.content = "";
  23571. }
  23572. menu_var_or_value.find('.text').text(' ');
  23573. var field = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<input type="text" size="2" class="width-dynamic-minus" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" />');
  23574. field.insertBefore(dom_object.find('.menu_var_or_value_dom'));
  23575. var rendered = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="value_rendered"></div>');
  23576. rendered.insertBefore(field);
  23577. field.focus();
  23578. field.val(ref_object.content);
  23579. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  23580. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_clear') + '</div>';
  23581. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution) {
  23582. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_change');
  23583. context_menu += '<div class="menu">';
  23584. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp + '">EXP OP EXP</div>';
  23585. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp + '">OP EXP</div>';
  23586. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par + '">( EXP )</div>';
  23587. context_menu += '</div></div>';
  23588. }
  23589. context_menu += '</div></div>';
  23590. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  23591. dom_object.find('.menu_var_or_value_dom').remove();
  23592. if (ref_object.variable_and_value != VAR_OR_VALUE_TYPES.only_value) {
  23593. context_menu.insertAfter(field);
  23594. }
  23595. context_menu.dropdown({
  23596. onChange: function onChange(value, text, $selectedItem) {
  23597. console.log('S11');
  23598. if ($selectedItem.data('clear')) {
  23599. console.log('PP10');
  23600. dom_object.text('');
  23601. dom_object.find('.value_rendered').remove();
  23602. dom_object.find('.context_menu_clear').remove();
  23603. dom_object.find('.width-dynamic-minus').remove();
  23604. ref_object.content = null;
  23605. ref_object.row = null;
  23606. ref_object.column = null;
  23607. delete ref_object.function_called;
  23608. delete ref_object.parameters_list;
  23609. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  23610. }
  23611. if ($selectedItem.data('exp')) {
  23612. _attribution__WEBPACK_IMPORTED_MODULE_6__["manageExpressionElements"](command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  23613. }
  23614. },
  23615. selectOnKeydown: false
  23616. });
  23617. dom_object.find('.width-dynamic-minus').focusout(function () {
  23618. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).val().trim()) {
  23619. ref_object.content = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).val().trim();
  23620. }
  23621. rendered.text(ref_object.content);
  23622. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).remove();
  23623. });
  23624. dom_object.find('.width-dynamic-minus').on('keydown', function (e) {
  23625. var code = e.keyCode || e.which;
  23626. if (code == 13) {
  23627. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).val().trim()) {
  23628. ref_object.content = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).val().trim();
  23629. }
  23630. rendered.text(ref_object.content);
  23631. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).remove();
  23632. }
  23633. if (code == 27) {
  23634. rendered.text(ref_object.content);
  23635. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).remove();
  23636. }
  23637. });
  23638. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].comment) {
  23639. /*rendered.parent().on('click', function(e) {
  23640. rendered.parent().off();
  23641. console.log("TTT14");
  23642. rendered.remove();
  23643. rendered.empty();
  23644. rendered.remove();
  23645. dom_object.empty();
  23646. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  23647. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element)
  23648. });*/
  23649. }
  23650. rendered.on('click', function (e) {
  23651. console.log("TTT2");
  23652. rendered.remove();
  23653. rendered.empty();
  23654. rendered.remove();
  23655. dom_object.empty();
  23656. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  23657. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  23658. });
  23659. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution) {
  23660. _attribution__WEBPACK_IMPORTED_MODULE_6__["renderMenuOperations"](command, ref_object, dom_object, menu_var_or_value, function_obj);
  23661. }
  23662. }
  23663. jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn.textWidth = function (text, font) {
  23664. if (!jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn.textWidth.fakeEl) jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn.textWidth.fakeEl = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<span>').hide().appendTo(document.body);
  23665. jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn.textWidth.fakeEl.text(text || this.val() || this.text() || this.attr('placeholder')).css('font', font || this.css('font'));
  23666. return jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn.textWidth.fakeEl.width();
  23667. };
  23668. /***/ }),
  23669. /***/ "./js/visualUI/commands/whiletrue.js":
  23670. /*!*******************************************!*\
  23671. !*** ./js/visualUI/commands/whiletrue.js ***!
  23672. \*******************************************/
  23673. /*! exports provided: createFloatingCommand, renderCommand */
  23674. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  23675. "use strict";
  23676. __webpack_require__.r(__webpack_exports__);
  23677. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  23678. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  23679. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  23680. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  23681. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  23682. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  23683. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  23684. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  23685. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  23686. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  23687. /* harmony import */ var _conditional_expression__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  23688. /* harmony import */ var _contextualized_menu__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  23689. function createFloatingCommand() {
  23690. return jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui whiletrue created_element"> <i class="ui icon small sync"></i> <span> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_code_while') + ' ( x < 10 ) <br> </span></div>');
  23691. }
  23692. function renderCommand(command, function_obj) {
  23693. var ret = '';
  23694. ret += '<div class="ui whiletrue command_container"> <i class="ui icon small sync command_drag"></i> <i class="ui icon times red button_remove_command"></i> <div class="ui context_menu"></div> <span class="span_command_spec"> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_code_while') + ' </span>';
  23695. ret += '<span class="span_command_spec"> ( </span> <div class="conditional_expression"></div> <span class="span_command_spec"> ) </span>';
  23696. ret += ' </span>';
  23697. ret += '<div class="ui block_commands">';
  23698. ret += '</div>';
  23699. ret += '<span> </span>';
  23700. ret += '</div>';
  23701. var el = jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret);
  23702. el.data('command', command);
  23703. el.find('.block_commands').data('command', command);
  23704. addHandlers(command, function_obj, el);
  23705. _contextualized_menu__WEBPACK_IMPORTED_MODULE_8__["renderMenu"](command, el.find('.context_menu'), function_obj, el);
  23706. _conditional_expression__WEBPACK_IMPORTED_MODULE_7__["renderExpression"](command, command.expression, function_obj, el.find('.conditional_expression'));
  23707. if (command.commands_block) {
  23708. for (var j = 0; j < command.commands_block.length; j++) {
  23709. _commands__WEBPACK_IMPORTED_MODULE_6__["renderCommand"](command.commands_block[j], jquery__WEBPACK_IMPORTED_MODULE_0___default()(el.find('.block_commands')[0]), 3, function_obj);
  23710. }
  23711. }
  23712. return el;
  23713. }
  23714. function addHandlers(command, function_obj, whiletrue_dom) {
  23715. whiletrue_dom.find('.button_remove_command').on('click', function () {
  23716. if (_commands__WEBPACK_IMPORTED_MODULE_6__["removeCommand"](command, function_obj, whiletrue_dom)) {
  23717. whiletrue_dom.fadeOut(400, function () {
  23718. whiletrue_dom.remove();
  23719. });
  23720. }
  23721. });
  23722. }
  23723. /***/ }),
  23724. /***/ "./js/visualUI/commands/writer.js":
  23725. /*!****************************************!*\
  23726. !*** ./js/visualUI/commands/writer.js ***!
  23727. \****************************************/
  23728. /*! exports provided: createFloatingCommand, renderCommand, addContent */
  23729. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  23730. "use strict";
  23731. __webpack_require__.r(__webpack_exports__);
  23732. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  23733. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  23734. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addContent", function() { return addContent; });
  23735. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  23736. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  23737. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  23738. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  23739. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  23740. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  23741. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  23742. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  23743. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  23744. /* harmony import */ var _Sortable_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../Sortable.js */ "./js/Sortable.js");
  23745. /* harmony import */ var _Sortable_js__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_Sortable_js__WEBPACK_IMPORTED_MODULE_8__);
  23746. function createFloatingCommand() {
  23747. return jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui writer created_element"> <i class="ui icon small upload"></i> <span> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_command_write') + ' var </span></div>');
  23748. }
  23749. function renderCommand(command, function_obj) {
  23750. var ret = '';
  23751. ret += '<div class="ui writer command_container"> <i class="ui icon small upload command_drag"></i> <i class="ui icon times red button_remove_command"></i> <span class="span_command_spec">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_command_write') + ' ( </span><div class="all_elements_write"></div> <span class="close_parentheses span_command_spec">)</span> </div>';
  23752. var el = jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret);
  23753. el.data('command', command);
  23754. for (var i = 0; i < command.content.length; i++) {
  23755. var new_div_item = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="var_value_menu_div"></div>');
  23756. var div_parent_with_handler = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="div_parent_handler"></div>');
  23757. div_parent_with_handler.append(jquery__WEBPACK_IMPORTED_MODULE_0___default()('<i class="ui icon ellipsis vertical inverted handler"></i>'));
  23758. div_parent_with_handler.append(new_div_item);
  23759. div_parent_with_handler.append(jquery__WEBPACK_IMPORTED_MODULE_0___default()('<i class="white inverted icon times handler"></i>'));
  23760. el.find('.all_elements_write').append(div_parent_with_handler);
  23761. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, command.content[i], new_div_item, function_obj);
  23762. addHandlerIconAdd(el.find('.all_elements_write'), command, function_obj);
  23763. addHandlersManager(command, function_obj, el, div_parent_with_handler, command.content[i]);
  23764. }
  23765. if (command.content.length == 0) {
  23766. addHandlerIconAdd(el.find('.all_elements_write'), command, function_obj);
  23767. }
  23768. addHandlers(command, function_obj, el);
  23769. return el;
  23770. }
  23771. function addHandlersManager(command, function_obj, writer_dom, item_div, content_element) {
  23772. item_div.find('.times').on('click', function () {
  23773. for (var i = 0; i < command.content.length; i++) {
  23774. if (command.content[i] == content_element) {
  23775. delete command.content[i];
  23776. command.content.splice(i, 1);
  23777. item_div.children().off();
  23778. item_div.off();
  23779. item_div.fadeOut();
  23780. if (command.content.length > 0) {
  23781. item_div.next('.icon_add_item_to_writer').fadeOut();
  23782. }
  23783. break;
  23784. }
  23785. }
  23786. });
  23787. }
  23788. function addHandlers(command, function_obj, writer_dom) {
  23789. writer_dom.find('.button_remove_command').on('click', function () {
  23790. if (_commands__WEBPACK_IMPORTED_MODULE_7__["removeCommand"](command, function_obj, writer_dom)) {
  23791. writer_dom.fadeOut(400, function () {
  23792. writer_dom.remove();
  23793. });
  23794. }
  23795. });
  23796. Sortable.create(writer_dom.find(".all_elements_write")[0], {
  23797. handle: '.ellipsis',
  23798. animation: 100,
  23799. ghostClass: 'ghost',
  23800. group: 'writer_' + Math.floor(Math.random() * 10000000),
  23801. draggable: '.div_parent_handler',
  23802. onEnd: function onEnd(evt) {
  23803. command.content.splice(evt.newIndex, 0, command.content.splice(evt.oldIndex, 1)[0]);
  23804. writer_dom.empty();
  23805. writer_dom.replaceWith(renderCommand(command, function_obj));
  23806. }
  23807. });
  23808. }
  23809. function addHandlerIconAdd(dom_object, command, function_obj) {
  23810. var insert_after = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  23811. var after_which = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
  23812. var icon_add_item = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<i class="ui icon plus square outline icon_add_item_to_writer"></i> ');
  23813. if (!insert_after) {
  23814. dom_object.append(icon_add_item);
  23815. } else {
  23816. icon_add_item.insertAfter(after_which);
  23817. }
  23818. icon_add_item.on('click', function (e) {
  23819. var div_parent_with_handler = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="div_parent_handler" style="display:none;"></div>');
  23820. var new_div_item = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="var_value_menu_div"></div>');
  23821. div_parent_with_handler.append(jquery__WEBPACK_IMPORTED_MODULE_0___default()('<i class="ui icon ellipsis vertical inverted handler"></i>'));
  23822. div_parent_with_handler.append(new_div_item);
  23823. div_parent_with_handler.append(jquery__WEBPACK_IMPORTED_MODULE_0___default()('<i class="white inverted icon times handler"></i>'));
  23824. div_parent_with_handler.insertAfter(icon_add_item);
  23825. var new_related_menu = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true);
  23826. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, new_related_menu, new_div_item, function_obj);
  23827. addHandlerIconAdd(dom_object, command, function_obj, true, div_parent_with_handler);
  23828. addHandlersManager(command, function_obj, dom_object, div_parent_with_handler, new_related_menu);
  23829. var pos = 1;
  23830. dom_object.find('.icon_add_item_to_writer').each(function () {
  23831. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).get(0) === icon_add_item.get(0)) {
  23832. command.content.splice(pos, 0, new_related_menu);
  23833. } else {
  23834. pos++;
  23835. }
  23836. });
  23837. if (command.content.length == 1) {
  23838. icon_add_item.remove();
  23839. }
  23840. div_parent_with_handler.fadeIn();
  23841. });
  23842. }
  23843. function addContent(command, ref_object, dom_object, menu_var_or_value, function_obj, ref_object_content) {
  23844. if (dom_object.hasClass('var_value_menu_div')) {
  23845. var icon_add_item = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<i class="ui icon plus square outline icon_add_item_to_writer"></i> ');
  23846. icon_add_item.insertAfter(dom_object);
  23847. icon_add_item.on('click', function (e) {
  23848. var div_parent_with_handler = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="div_parent_handler"></div>');
  23849. div_parent_with_handler.append(jquery__WEBPACK_IMPORTED_MODULE_0___default()('<i class="ui icon ellipsis vertical inverted handler"></i>'));
  23850. div_parent_with_handler.append(new_div_item);
  23851. div_parent_with_handler.append(jquery__WEBPACK_IMPORTED_MODULE_0___default()('<i class="white inverted icon times handler"></i>'));
  23852. div_parent_with_handler.insertAfter(icon_add_item);
  23853. var new_related_menu = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true);
  23854. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, new_related_menu, new_div_item, function_obj);
  23855. addHandlersManager(command, function_obj, dom_object, div_parent_with_handler, new_related_menu);
  23856. command.content.push(new_related_menu);
  23857. if (command.content.length == 1) {
  23858. icon_add_item.remove();
  23859. }
  23860. });
  23861. }
  23862. }
  23863. /***/ }),
  23864. /***/ "./js/visualUI/functions.js":
  23865. /*!**********************************!*\
  23866. !*** ./js/visualUI/functions.js ***!
  23867. \**********************************/
  23868. /*! exports provided: renderFunction, initVisualUI, addFunctionChangeListener, addGlobalChangeListener, removeGlobalListener, removeFunctionListener */
  23869. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  23870. "use strict";
  23871. __webpack_require__.r(__webpack_exports__);
  23872. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderFunction", function() { return renderFunction; });
  23873. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "initVisualUI", function() { return initVisualUI; });
  23874. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addFunctionChangeListener", function() { return addFunctionChangeListener; });
  23875. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addGlobalChangeListener", function() { return addGlobalChangeListener; });
  23876. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeGlobalListener", function() { return removeGlobalListener; });
  23877. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeFunctionListener", function() { return removeFunctionListener; });
  23878. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  23879. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  23880. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  23881. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  23882. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  23883. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  23884. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  23885. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./commands */ "./js/visualUI/commands.js");
  23886. /* harmony import */ var _code_generator__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./code_generator */ "./js/visualUI/code_generator.js");
  23887. /* harmony import */ var _commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  23888. /* harmony import */ var _io_domConsole__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./../io/domConsole */ "./js/io/domConsole.js");
  23889. /* harmony import */ var _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  23890. /* harmony import */ var _processor_ivprogProcessor__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./../processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  23891. /* harmony import */ var melanke_watchjs__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! melanke-watchjs */ "./node_modules/melanke-watchjs/src/watch.js");
  23892. /* harmony import */ var melanke_watchjs__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(melanke_watchjs__WEBPACK_IMPORTED_MODULE_12__);
  23893. /* harmony import */ var _processor_semantic_semanticAnalyser__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../processor/semantic/semanticAnalyser */ "./js/processor/semantic/semanticAnalyser.js");
  23894. /* harmony import */ var _assessment_ivprogAssessment__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../assessment/ivprogAssessment */ "./js/assessment/ivprogAssessment.js");
  23895. /* harmony import */ var _algorithm__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./algorithm */ "./js/visualUI/algorithm.js");
  23896. /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./utils */ "./js/visualUI/utils.js");
  23897. /* harmony import */ var _ima_version_json__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./../../.ima_version.json */ "./.ima_version.json");
  23898. var _ima_version_json__WEBPACK_IMPORTED_MODULE_17___namespace = /*#__PURE__*/__webpack_require__.t(/*! ./../../.ima_version.json */ "./.ima_version.json", 1);
  23899. /* harmony import */ var _Sortable_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../Sortable.js */ "./js/Sortable.js");
  23900. /* harmony import */ var _Sortable_js__WEBPACK_IMPORTED_MODULE_18___default = /*#__PURE__*/__webpack_require__.n(_Sortable_js__WEBPACK_IMPORTED_MODULE_18__);
  23901. var counter_new_functions = 0;
  23902. var counter_new_parameters = 0;
  23903. var ivprog_version = _ima_version_json__WEBPACK_IMPORTED_MODULE_17__.version;
  23904. var globalChangeListeners = [];
  23905. var functionsChangeListeners = [];
  23906. var domConsole = null;
  23907. window.studentGrade = null;
  23908. window.LocalizedStrings = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"];
  23909. var program = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Program"]();
  23910. window.system_functions = []; // Adding math functions:
  23911. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$sin', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].math));
  23912. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$cos', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].math));
  23913. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$tan', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].math));
  23914. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$sqrt', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].math));
  23915. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$pow', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true), new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].math));
  23916. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$log', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].math));
  23917. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$abs', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].math));
  23918. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$negate', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].math));
  23919. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$invert', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].math));
  23920. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$max', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].math));
  23921. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$min', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].math)); // Adding text functions:
  23922. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$substring', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true), new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true), new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].text));
  23923. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$length', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].text));
  23924. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$uppercase', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].text));
  23925. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$lowercase', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].text));
  23926. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$charAt', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true), new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].text)); // Adding arrangement functions:
  23927. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$numElements', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].variable_and_function, null, null, null, true, 1)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].arrangement));
  23928. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$matrixLines', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].variable_and_function, null, null, null, true, 2)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].arrangement));
  23929. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$matrixColumns', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].variable_and_function, null, null, null, true, 2)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].arrangement)); // Adding conversion functions:
  23930. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$isReal', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].conversion));
  23931. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$isInt', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].conversion));
  23932. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$isBool', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].conversion));
  23933. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$castReal', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].conversion));
  23934. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$castInt', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].conversion));
  23935. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$castBool', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].conversion));
  23936. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$castString', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].conversion));
  23937. console.log(' ___ ___ ________ \n / / / / / ____/ \n / / / / / / \n / / / / ______ ___ / /__ \n / / / / / \\ / / / ___/ \n / /______ / / / /\\ \\/ / / / \n / / / / / / \\ / / /____ \n/__________/ /___/ /___/ \\___/ /________/ \n\n Laboratório de Informática na Educação\n http://line.ime.usp.br');
  23938. var mainFunction = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Function"](_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("start"), _types__WEBPACK_IMPORTED_MODULE_1__["Types"].VOID, 0, [], true, false);
  23939. mainFunction.function_comment = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Comment"](_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_comment_main'));
  23940. program.addFunction(mainFunction);
  23941. window.program_obj = program;
  23942. window.generator = _code_generator__WEBPACK_IMPORTED_MODULE_7__["generate"];
  23943. window.runCodeAssessment = runCodeAssessment;
  23944. window.renderAlgorithm = _algorithm__WEBPACK_IMPORTED_MODULE_15__["renderAlgorithm"];
  23945. window.insertContext = false;
  23946. window.watchW = melanke_watchjs__WEBPACK_IMPORTED_MODULE_12___default.a;
  23947. melanke_watchjs__WEBPACK_IMPORTED_MODULE_12___default.a.watch(window.program_obj.globals, function () {
  23948. if (window.insertContext) {
  23949. setTimeout(function () {
  23950. _algorithm__WEBPACK_IMPORTED_MODULE_15__["renderAlgorithm"]();
  23951. globalChangeListeners.forEach(function (x) {
  23952. return x();
  23953. });
  23954. }, 300);
  23955. window.insertContext = false;
  23956. } else {
  23957. _algorithm__WEBPACK_IMPORTED_MODULE_15__["renderAlgorithm"]();
  23958. globalChangeListeners.forEach(function (x) {
  23959. return x();
  23960. });
  23961. }
  23962. }, 1);
  23963. melanke_watchjs__WEBPACK_IMPORTED_MODULE_12___default.a.watch(window.program_obj.functions, function () {
  23964. if (window.insertContext) {
  23965. setTimeout(function () {
  23966. _algorithm__WEBPACK_IMPORTED_MODULE_15__["renderAlgorithm"]();
  23967. functionsChangeListeners.forEach(function (x) {
  23968. return x();
  23969. });
  23970. }, 300);
  23971. window.insertContext = false;
  23972. } else {
  23973. _algorithm__WEBPACK_IMPORTED_MODULE_15__["renderAlgorithm"]();
  23974. functionsChangeListeners.forEach(function (x) {
  23975. return x();
  23976. });
  23977. }
  23978. }, 1);
  23979. function addFunctionHandler() {
  23980. var new_function = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Function"](_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("new_function") + "_" + counter_new_functions, _types__WEBPACK_IMPORTED_MODULE_1__["Types"].VOID, 0, [], false, false, [], new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Comment"](_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_comment_start')));
  23981. program.addFunction(new_function);
  23982. counter_new_functions++;
  23983. window.insertContext = true;
  23984. var newe = renderFunction(new_function);
  23985. /*newe.css('display', 'none');
  23986. newe.fadeIn();*/
  23987. }
  23988. function addParameter(function_obj, function_container) {
  23989. var is_from_click = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  23990. if (function_obj.parameters_list == null) {
  23991. function_obj.parameters_list = [];
  23992. }
  23993. var new_parameter = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Variable"](_types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER, _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("new_parameter") + "_" + counter_new_parameters);
  23994. function_obj.parameters_list.push(new_parameter);
  23995. counter_new_parameters++;
  23996. var newe = renderParameter(function_obj, new_parameter, function_container);
  23997. if (is_from_click) {
  23998. /*newe.css('display', 'none');
  23999. newe.fadeIn();*/
  24000. }
  24001. }
  24002. function updateReturnType(function_obj, new_type) {
  24003. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  24004. function_obj.return_type = new_type;
  24005. function_obj.return_dimensions = new_dimensions;
  24006. }
  24007. function removeFunction(function_obj) {
  24008. var index = program.functions.indexOf(function_obj);
  24009. if (index > -1) {
  24010. program.functions.splice(index, 1);
  24011. }
  24012. }
  24013. function minimizeFunction(function_obj) {
  24014. function_obj.is_hidden = !function_obj.is_hidden;
  24015. }
  24016. function addHandlers(function_obj, function_container) {
  24017. function_container.find('.ui.dropdown.function_return').dropdown({
  24018. onChange: function onChange(value, text, $selectedItem) {
  24019. if ($selectedItem.data('dimensions')) {
  24020. updateReturnType(function_obj, _types__WEBPACK_IMPORTED_MODULE_1__["Types"][$selectedItem.data('type')], $selectedItem.data('dimensions'));
  24021. } else {
  24022. updateReturnType(function_obj, _types__WEBPACK_IMPORTED_MODULE_1__["Types"][$selectedItem.data('type')]);
  24023. }
  24024. },
  24025. selectOnKeydown: false
  24026. });
  24027. function_container.find(".name_function_updated").on('click', function (e) {
  24028. enableNameFunctionUpdate(function_obj, function_container);
  24029. });
  24030. function_container.find(".add_parameter_button").on('click', function (e) {
  24031. window.insertContext = true;
  24032. addParameter(function_obj, function_container, true);
  24033. });
  24034. function_container.find('.menu_commands').dropdown({
  24035. on: 'hover'
  24036. });
  24037. function_container.find('.menu_commands a').on('click', function (evt) {
  24038. if (function_obj.commands == null || function_obj.commands.length == 0) {
  24039. function_obj.commands = [];
  24040. var new_cmd = _commands__WEBPACK_IMPORTED_MODULE_6__["genericCreateCommand"](jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('command'));
  24041. function_obj.commands.push(new_cmd);
  24042. _commands__WEBPACK_IMPORTED_MODULE_6__["renderCommand"](new_cmd, function_container.find('.commands_list_div'), 3, function_obj);
  24043. } else {
  24044. _commands__WEBPACK_IMPORTED_MODULE_6__["createFloatingCommand"](function_obj, function_container, jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('command'), evt);
  24045. }
  24046. });
  24047. function_container.find('.add_var_button_function').on('click', function (e) {
  24048. window.insertContext = true;
  24049. _variables__WEBPACK_IMPORTED_MODULE_5__["addVariable"](function_obj, function_container, true);
  24050. });
  24051. function_container.find('.remove_function_button').on('click', function (e) {
  24052. removeFunction(function_obj);
  24053. function_container.fadeOut();
  24054. });
  24055. function_container.find('.minimize_function_button').on('click', function (e) {
  24056. minimizeFunction(function_obj);
  24057. if (function_obj.is_hidden) {
  24058. function_container.find(".add_var_button_function").toggle();
  24059. function_container.find(".inline_add_command").toggle();
  24060. function_container.find(".function_area").slideToggle();
  24061. } else {
  24062. function_container.find(".function_area").slideToggle(function () {
  24063. function_container.find(".add_var_button_function").toggle();
  24064. function_container.find(".inline_add_command").toggle();
  24065. });
  24066. }
  24067. });
  24068. } // Essa função imprime o tipo de retorno da função e cria o menu do tipo 'select' para alteração
  24069. function renderFunctionReturn(function_obj, function_element) {
  24070. var ret = '<div class="ui dropdown function_return">';
  24071. if (function_obj.return_dimensions > 0) {
  24072. ret += '<div class="text">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("vector") + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(function_obj.return_type);
  24073. if (function_obj.return_dimensions == 1) {
  24074. ret += ' [ ] ';
  24075. } else {
  24076. ret += ' [ ] [ ] ';
  24077. }
  24078. ret += '</div>';
  24079. } else {
  24080. ret += '<div class="text">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(function_obj.return_type) + '</div>';
  24081. }
  24082. ret += '<div class="menu">';
  24083. for (var tm in _types__WEBPACK_IMPORTED_MODULE_1__["Types"]) {
  24084. ret += '<div class="item ' + (function_obj.return_type == tm.toLowerCase() && function_obj.return_dimensions < 1 ? ' selected ' : '') + '" data-type="' + tm + '" >' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + '</div>';
  24085. }
  24086. for (var tm in _types__WEBPACK_IMPORTED_MODULE_1__["Types"]) {
  24087. if (tm == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].VOID.toUpperCase()) {
  24088. continue;
  24089. }
  24090. ret += '<div class="item">' + '<i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + '<div class="menu">' + '<div class="item ' + (function_obj.return_type == tm.toLowerCase() && function_obj.return_dimensions > 0 ? ' selected ' : '') + '" data-text="' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + ' [ ] " data-type="' + tm + '" data-dimensions="1">[ ]</div>' + '<div class="item ' + (function_obj.return_type == tm.toLowerCase() && function_obj.return_dimensions > 0 ? ' selected ' : '') + '" data-text="' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + ' [ ] [ ] " data-type="' + tm + '" data-dimensions="2">[ ] [ ] </div>' + '</div>' + '</div>';
  24091. }
  24092. ret += '</div></div>';
  24093. ret = jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret);
  24094. function_element.find('.function_return').append(ret);
  24095. }
  24096. var cont = 0;
  24097. function renderFunction(function_obj) {
  24098. var appender = '<div class="ui secondary segment function_div list-group-item function_cont_' + cont + '">';
  24099. if (function_obj.function_comment) {//appender += renderComment(function_obj.function_comment, sequence, true, -1);
  24100. }
  24101. appender += '<span class="glyphicon glyphicon-move move_function" aria-hidden="true"><i class="icon sort alternate vertical"></i></span>';
  24102. appender += (function_obj.is_main ? '<div class="div_start_minimize_v"> </div>' : '<button class="ui icon button large remove_function_button"><i class="red icon times"></i></button>') + '<button class="ui icon button tiny minimize_function_button"><i class="icon window minimize"></i></button>';
  24103. appender += '<div class="function_signature_div">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("function") + ' ';
  24104. if (function_obj.is_main) {
  24105. appender += '<div class="function_name_div"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('void') + ' &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span class="span_name_function" >' + function_obj.name + '</span> </div> ' + ' <span class="parethesis_function">( </span> <div class="ui large labels parameters_list">';
  24106. } else {
  24107. appender += '<div class="ui function_return"></div>';
  24108. appender += '<div class="function_name_div function_name_div_updated"><span class="span_name_function name_function_updated">' + function_obj.name + '</span> </div> ' + ' <span class="parethesis_function"> ( </span> <i class="ui icon plus square outline add_parameter_button"></i> <div class="ui large labels parameters_list container_parameters_list">';
  24109. }
  24110. appender += '</div> <span class="parethesis_function"> ) </span> </div>' + (function_obj.is_hidden ? ' <div class="function_area" style="display: none;"> ' : ' <div class="function_area"> ');
  24111. appender += '<div class="ui add_var_context add_var_button_function" style="float: left;"><i class="icon plus circle purple"></i><i class="icon circle white back"></i><div class="ui icon button purple"><i class="icon superscript"></i></div></div>';
  24112. appender += '<div class="ui top attached segment variables_list_div"></div>';
  24113. appender += '<div class="ui bottom attached segment commands_list_div commands_cont_' + cont + '">' + '<div class="ui rail" style="width: 35px; margin-left: -36px;"><div class="ui sticky sticky_cont_' + cont + '" style="top: 50px !important;">';
  24114. appender += '<i class="icon plus circle purple"></i><i class="icon circle white back"></i><div class="ui icon button dropdown menu_commands orange" ><i class="icon code"></i> <div class="menu"> ';
  24115. appender += '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].reader + '"><i class="download icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_read_var') + '</a>' + '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].writer + '"><i class="upload icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_write_var') + '</a>' + '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].comment + '"><i class="quote left icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_comment') + '</a>' + '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution + '"><i class="arrow left icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_attribution') + '</a>' + '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].functioncall + '"><i class="hand point right icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_functioncall') + '</a>' + '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].iftrue + '" ><i class="random icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_iftrue') + '</a>' + '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes + '"><i class="sync icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_repeatNtimes') + '</a>' + '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].whiletrue + '"><i class="sync icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_whiletrue') + '</a>' + '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].dowhiletrue + '"><i class="sync icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_dowhiletrue') + '</a>' + '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].switch + '"><i class="list icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_switch') + '</a>' + '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].return + '"><i class="reply icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_btn_return') + '</a>' + '</div></div>';
  24116. appender += '</div></div>' + '</div>';
  24117. appender += '</div></div>';
  24118. appender = jquery__WEBPACK_IMPORTED_MODULE_0___default()(appender);
  24119. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.all_functions').append(appender);
  24120. appender.data('fun', function_obj);
  24121. appender.find('.commands_list_div').data('fun', function_obj);
  24122. renderFunctionReturn(function_obj, appender);
  24123. addHandlers(function_obj, appender); // Rendering parameters:
  24124. for (var j = 0; j < function_obj.parameters_list.length; j++) {
  24125. renderParameter(function_obj, function_obj.parameters_list[j], appender);
  24126. } // Rendering variables:
  24127. for (var j = 0; j < function_obj.variables_list.length; j++) {
  24128. _variables__WEBPACK_IMPORTED_MODULE_5__["renderVariable"](appender, function_obj.variables_list[j], function_obj);
  24129. } // Rendering commands:
  24130. for (var j = 0; j < function_obj.commands.length; j++) {
  24131. _commands__WEBPACK_IMPORTED_MODULE_6__["renderCommand"](function_obj.commands[j], jquery__WEBPACK_IMPORTED_MODULE_0___default()(appender.find('.commands_list_div')[0]), 3, function_obj);
  24132. }
  24133. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.minimize_function_button').popup({
  24134. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("tooltip_minimize"),
  24135. delay: {
  24136. show: 750,
  24137. hide: 0
  24138. }
  24139. });
  24140. var function_index = program.functions.indexOf(function_obj);
  24141. Sortable.create(appender.find(".variables_list_div")[0], {
  24142. handle: '.ellipsis',
  24143. animation: 100,
  24144. ghostClass: 'ghost',
  24145. group: 'local_vars_drag_' + function_index,
  24146. onEnd: function onEnd(evt) {
  24147. updateSequenceLocals(evt.oldIndex, evt.newIndex, function_obj);
  24148. }
  24149. });
  24150. addSortableHandler(appender.find(".commands_list_div")[0], function_index);
  24151. if (!function_obj.is_main) {
  24152. Sortable.create(appender.find(".container_parameters_list")[0], {
  24153. handle: '.ellipsis',
  24154. animation: 100,
  24155. ghostClass: 'ghost',
  24156. group: 'parameters_drag_' + program.functions.indexOf(function_obj),
  24157. onEnd: function onEnd(evt) {
  24158. updateSequenceParameters(evt.oldIndex, evt.newIndex, function_obj);
  24159. }
  24160. });
  24161. }
  24162. var teste = '.ui.sticky.sticky_cont_' + cont;
  24163. jquery__WEBPACK_IMPORTED_MODULE_0___default()(teste).sticky({
  24164. context: '.ui.bottom.attached.segment.commands_list_div.commands_cont_' + cont,
  24165. scrollContext: '.ivprog_visual_panel',
  24166. observeChanges: true,
  24167. offset: 40,
  24168. onStick: function onStick(evt) {
  24169. jquery__WEBPACK_IMPORTED_MODULE_0___default()(teste).css('top', '20px', 'important');
  24170. },
  24171. onBottom: function onBottom(evt) {
  24172. jquery__WEBPACK_IMPORTED_MODULE_0___default()(teste).css('top', '20px', 'important');
  24173. },
  24174. onUnstick: function onUnstick(evt) {
  24175. jquery__WEBPACK_IMPORTED_MODULE_0___default()(teste).css('top', '20px', 'important');
  24176. },
  24177. onReposition: function onReposition(evt) {
  24178. jquery__WEBPACK_IMPORTED_MODULE_0___default()(teste).css('top', '20px', 'important');
  24179. },
  24180. onScroll: function onScroll(evt) {
  24181. jquery__WEBPACK_IMPORTED_MODULE_0___default()(teste).css('top', '20px', 'important');
  24182. if (!isVisible(jquery__WEBPACK_IMPORTED_MODULE_0___default()(teste), jquery__WEBPACK_IMPORTED_MODULE_0___default()(teste).parent())) {
  24183. jquery__WEBPACK_IMPORTED_MODULE_0___default()(teste).removeClass('fixed');
  24184. }
  24185. },
  24186. onTop: function onTop(evt) {
  24187. jquery__WEBPACK_IMPORTED_MODULE_0___default()(teste).css('top', '20px', 'important');
  24188. }
  24189. });
  24190. cont++;
  24191. return appender;
  24192. }
  24193. function isVisible(element, container) {
  24194. var elementTop = jquery__WEBPACK_IMPORTED_MODULE_0___default()(element).offset().top,
  24195. elementHeight = jquery__WEBPACK_IMPORTED_MODULE_0___default()(element).height(),
  24196. containerTop = jquery__WEBPACK_IMPORTED_MODULE_0___default()(container).offset().top,
  24197. containerHeight = jquery__WEBPACK_IMPORTED_MODULE_0___default()(container).height() - 30;
  24198. return elementTop - containerTop + elementHeight > 0 && elementTop - containerTop < containerHeight;
  24199. }
  24200. window.evento_drag;
  24201. function updateProgramObjDrag() {
  24202. var nodes = Array.prototype.slice.call(jquery__WEBPACK_IMPORTED_MODULE_0___default()('.all_functions').children());
  24203. var function_index;
  24204. var start_index;
  24205. var function_obj;
  24206. jquery__WEBPACK_IMPORTED_MODULE_0___default()(evento_drag.item).parentsUntil(".all_functions").each(function (index) {
  24207. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).hasClass('function_div')) {
  24208. function_index = nodes.indexOf(this);
  24209. start_index = index;
  24210. function_obj = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this);
  24211. }
  24212. });
  24213. console.log(function_index);
  24214. var path_target = [];
  24215. jquery__WEBPACK_IMPORTED_MODULE_0___default()(evento_drag.item).parentsUntil(".all_functions").each(function (index) {
  24216. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).hasClass('command_container')) {
  24217. path_target.push(this);
  24218. }
  24219. });
  24220. if (path_target.length == 0) {//console.log('soltou na raiz, na posição: ' + evento_drag.newIndex + ' mas ainda não sei de onde saiu ');
  24221. } else {//console.log('soltou dentro de algum bloco, sequência vem logo abaixo (de baixo pra cima): ');
  24222. //console.log(path_target);
  24223. }
  24224. var index_each = [];
  24225. var path_relative = [];
  24226. for (var i = path_target.length - 1; i >= 0; i--) {
  24227. console.log('da vez', jquery__WEBPACK_IMPORTED_MODULE_0___default()(path_target[i + 1]));
  24228. if (i == path_target.length - 1) {
  24229. // está na raiz
  24230. var indice_na_raiz = function_obj.find('.command_container').index(path_target[i]);
  24231. console.log('índice na raiz: ', indice_na_raiz);
  24232. } else {
  24233. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(path_target[i + 1]).hasClass('iftrue')) {
  24234. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(path_target[i]).parent().hasClass('commands_if')) {
  24235. path_relative.push('if');
  24236. index_each.push(jquery__WEBPACK_IMPORTED_MODULE_0___default()(path_target[i]).parent().find('.command_container').index(path_target[i]));
  24237. } else {
  24238. path_relative.push('else');
  24239. index_each.push(jquery__WEBPACK_IMPORTED_MODULE_0___default()(path_target[i]).parent().find('.command_container').index(path_target[i]));
  24240. }
  24241. } else if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(path_target[i + 1]).hasClass('dowhiletrue')) {
  24242. path_relative.push('dowhiletrue');
  24243. index_each.push(jquery__WEBPACK_IMPORTED_MODULE_0___default()(path_target[i + 1]).find('.command_container').index(path_target[i]));
  24244. } else if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(path_target[i + 1]).hasClass('repeatNtimes')) {
  24245. path_relative.push('repeatNtimes');
  24246. index_each.push(jquery__WEBPACK_IMPORTED_MODULE_0___default()(path_target[i + 1]).find('.command_container').index(path_target[i]));
  24247. } else if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(path_target[i + 1]).hasClass('whiletrue')) {
  24248. path_relative.push('whiletrue');
  24249. index_each.push(jquery__WEBPACK_IMPORTED_MODULE_0___default()(path_target[i + 1]).find('.command_container').index(path_target[i]));
  24250. } else if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(path_target[i + 1]).hasClass('switch')) {
  24251. path_relative.push('switch'); //index_each.push($(path_target[i + 1]).find('.command_container').index(path_target[i]));
  24252. }
  24253. }
  24254. }
  24255. var index_in_block = -1;
  24256. var is_in_else = jquery__WEBPACK_IMPORTED_MODULE_0___default()(evento_drag.item).parent().hasClass('commands_else');
  24257. index_in_block = jquery__WEBPACK_IMPORTED_MODULE_0___default()(evento_drag.item).parent().find('.command_container').index(evento_drag.item);
  24258. var is_in_case_switch = jquery__WEBPACK_IMPORTED_MODULE_0___default()(evento_drag.item).parent().hasClass('case_commands_block');
  24259. var index_case_of_switch = -1;
  24260. if (is_in_case_switch) {
  24261. index_case_of_switch = jquery__WEBPACK_IMPORTED_MODULE_0___default()(evento_drag.item).parent().parent().parent().find('.case_div').index(jquery__WEBPACK_IMPORTED_MODULE_0___default()(evento_drag.item).parent().parent());
  24262. }
  24263. /*console.log('path_relative:');
  24264. console.log(path_relative);
  24265. console.log('index_each:');
  24266. console.log(index_each);
  24267. console.log('index_in_block:');
  24268. console.log(index_in_block);
  24269. console.log('ele está em algum bloco de senão? ');
  24270. console.log(is_in_else);
  24271. console.log('ele está dentro de um case de switch?');
  24272. console.log(is_in_case_switch);
  24273. console.log('qual é o índice do case: ');
  24274. console.log(index_case_of_switch);*/
  24275. // encontrar o elemento na árvore:
  24276. var command_start_point = window.program_obj.functions[function_index].commands[indice_na_raiz];
  24277. var block_to_insert = command_start_point;
  24278. for (var i = 0; i < index_each.length; i++) {
  24279. if (path_relative[i] == "else") {
  24280. block_to_insert = block_to_insert.commands_else[index_each[i]];
  24281. } else if (path_relative[i] == "switch") {} else {
  24282. block_to_insert = block_to_insert.commands_block[index_each[i]];
  24283. }
  24284. } //console.log('command_start_point', command_start_point);
  24285. //console.log('block_to_insert', block_to_insert);
  24286. // agora tem que alocar o comando na árvore, mas considerar as quatro situações:
  24287. // (1) se está em um else ou (2) se está em switch ou (3) será um caso padrão ou (4) se será na raiz.
  24288. if (path_target.length == 0) {
  24289. // soltou na raiz:
  24290. window.program_obj.functions[function_index].commands.splice(evento_drag.newIndex, 0, command_in_drag);
  24291. } else if (is_in_else) {
  24292. if (block_to_insert.commands_else) {
  24293. block_to_insert.commands_else.splice(evento_drag.newIndex, 0, command_in_drag);
  24294. } else {
  24295. block_to_insert.commands_else = [];
  24296. block_to_insert.commands_else.push(command_in_drag);
  24297. }
  24298. } else if (is_in_case_switch) {} else {
  24299. // verificar se tem alguma coisa no bloco:
  24300. if (block_to_insert.commands_block) {
  24301. block_to_insert.commands_block.splice(evento_drag.newIndex, 0, command_in_drag);
  24302. } else {
  24303. block_to_insert.commands_block = [];
  24304. block_to_insert.commands_block.push(command_in_drag);
  24305. }
  24306. }
  24307. window.draging = false;
  24308. renderAlgorithm();
  24309. }
  24310. function prepareDragHandler(evt) {
  24311. window.draging = true;
  24312. var nodes = Array.prototype.slice.call(jquery__WEBPACK_IMPORTED_MODULE_0___default()('.all_functions').children());
  24313. var function_index;
  24314. var function_obj;
  24315. jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.item).parentsUntil(".all_functions").each(function (index) {
  24316. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).hasClass('function_div')) {
  24317. function_index = nodes.indexOf(this);
  24318. function_obj = window.program_obj.functions[function_index];
  24319. }
  24320. });
  24321. command_in_drag = jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.item).data("command"); //console.log('$(evt.item).parent(): ');
  24322. //console.log($(evt.item).parent());
  24323. // descobrir qual das quatro situações:
  24324. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.item).parent().hasClass('commands_list_div')) {
  24325. // está na raiz:
  24326. if (function_obj.commands.indexOf(command_in_drag) > -1) {
  24327. function_obj.commands.splice(function_obj.commands.indexOf(command_in_drag), 1);
  24328. }
  24329. } else if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.item).parent().hasClass('commands_else')) {
  24330. // está no else:
  24331. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.item).parent().data('command').commands_else.indexOf(command_in_drag) > -1) {
  24332. jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.item).parent().data('command').commands_else.splice(jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.item).parent().data('command').commands_else.indexOf(command_in_drag), 1);
  24333. }
  24334. } else if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.item).parent().hasClass('case_commands_block')) {// está em um switch:
  24335. } else {
  24336. // caso padrão:
  24337. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.item).parent().data('command').commands_block.indexOf(command_in_drag) > -1) {
  24338. jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.item).parent().data('command').commands_block.splice(jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.item).parent().data('command').commands_block.indexOf(command_in_drag), 1);
  24339. }
  24340. }
  24341. }
  24342. var command_in_drag;
  24343. function addSortableHandler(element, id_function) {
  24344. var n_group = 'commands_drag_' + id_function;
  24345. Sortable.create(element, {
  24346. handle: '.command_drag',
  24347. ghostClass: 'ghost',
  24348. animation: 300,
  24349. group: {
  24350. name: n_group
  24351. },
  24352. onEnd: function onEnd(evt) {
  24353. //updateSequenceLocals(evt.oldIndex, evt.newIndex, function_obj);
  24354. var itemEl = evt.item; // dragged HTMLElement
  24355. evt.to; // target list
  24356. evt.from; // previous list
  24357. evt.oldIndex; // element's old index within old parent
  24358. evt.newIndex; // element's new index within new parent
  24359. //console.log('::EVT::');
  24360. //console.log(evt);
  24361. window.evento_drag = evt;
  24362. try {
  24363. updateProgramObjDrag();
  24364. } catch (e) {
  24365. window.draging = false;
  24366. }
  24367. },
  24368. onStart: function onStart(evt) {
  24369. //console.log("START::EVT::");
  24370. //console.log(evt);
  24371. //console.log("\n\ncommand_in_drag");
  24372. try {
  24373. prepareDragHandler(evt);
  24374. } catch (e) {
  24375. window.draging = false;
  24376. }
  24377. }
  24378. });
  24379. element = jquery__WEBPACK_IMPORTED_MODULE_0___default()(element);
  24380. element.find(".iftrue").each(function (index) {
  24381. addSortableHandler(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).find(".block_commands")[0], id_function);
  24382. addSortableHandler(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).find(".block_commands")[1], id_function);
  24383. });
  24384. element.find(".repeatNtimes").each(function (index) {
  24385. addSortableHandler(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).find(".block_commands")[0], id_function);
  24386. });
  24387. element.find(".dowhiletrue").each(function (index) {
  24388. addSortableHandler(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).find(".block_commands")[0], id_function);
  24389. });
  24390. element.find(".whiletrue").each(function (index) {
  24391. addSortableHandler(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).find(".block_commands")[0], id_function);
  24392. });
  24393. element.find(".switch").each(function (index) {
  24394. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).find(".case_div").each(function (index) {
  24395. addSortableHandler(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).find(".case_commands_block")[0], id_function);
  24396. });
  24397. });
  24398. }
  24399. function initVisualUI() {
  24400. // MUST USE CONST, LET, OR VAR !!!!!!
  24401. var mainDiv = jquery__WEBPACK_IMPORTED_MODULE_0___default()('#visual-main-div'); // fill mainDiv with functions and globals...
  24402. // renderAlgorithm()...
  24403. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.add_function_button').on('click', function () {
  24404. addFunctionHandler();
  24405. });
  24406. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.add_global_button').on('click', function () {
  24407. window.insertContext = true;
  24408. _globals__WEBPACK_IMPORTED_MODULE_4__["addGlobal"](program, true);
  24409. });
  24410. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.run_button').on('click', function () {
  24411. runCode();
  24412. });
  24413. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.visual_coding_button').on('click', function () {
  24414. toggleVisualCoding();
  24415. });
  24416. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.textual_coding_button').on('click', function () {
  24417. toggleTextualCoding();
  24418. });
  24419. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.assessment').on('click', function () {
  24420. runCodeAssessment();
  24421. is_iassign = true;
  24422. });
  24423. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.div_toggle_console').on('click', function () {
  24424. toggleConsole();
  24425. });
  24426. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.expand_button').on('click', function () {
  24427. full_screen();
  24428. });
  24429. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.help_button').on('click', function () {
  24430. window.open('https://www.usp.br/line/ivprog/', '_blank');
  24431. });
  24432. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.main_title h2').prop('title', _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_ivprog_description'));
  24433. }
  24434. var is_iassign = false;
  24435. jquery__WEBPACK_IMPORTED_MODULE_0___default()(document).ready(function () {
  24436. var time_show = 750;
  24437. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.visual_coding_button').popup({
  24438. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("tooltip_visual"),
  24439. delay: {
  24440. show: time_show,
  24441. hide: 0
  24442. }
  24443. });
  24444. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.textual_coding_button').popup({
  24445. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("tooltip_textual"),
  24446. delay: {
  24447. show: time_show,
  24448. hide: 0
  24449. }
  24450. });
  24451. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.upload_file_button').popup({
  24452. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("tooltip_upload"),
  24453. delay: {
  24454. show: time_show,
  24455. hide: 0
  24456. }
  24457. });
  24458. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.download_file_button').popup({
  24459. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("tooltip_download"),
  24460. delay: {
  24461. show: time_show,
  24462. hide: 0
  24463. }
  24464. });
  24465. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.undo_button').popup({
  24466. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("tooltip_undo"),
  24467. delay: {
  24468. show: time_show,
  24469. hide: 0
  24470. }
  24471. });
  24472. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.redo_button').popup({
  24473. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("tooltip_redo"),
  24474. delay: {
  24475. show: time_show,
  24476. hide: 0
  24477. }
  24478. });
  24479. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.run_button').popup({
  24480. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("tooltip_run"),
  24481. delay: {
  24482. show: time_show,
  24483. hide: 0
  24484. }
  24485. });
  24486. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.assessment_button').popup({
  24487. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("tooltip_evaluate"),
  24488. delay: {
  24489. show: time_show,
  24490. hide: 0
  24491. }
  24492. });
  24493. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.help_button').popup({
  24494. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("tooltip_help") + ' - ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("text_ivprog_version") + ' ' + ivprog_version,
  24495. delay: {
  24496. show: time_show,
  24497. hide: 0
  24498. }
  24499. });
  24500. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.add_global_button').popup({
  24501. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("tooltip_add_global"),
  24502. delay: {
  24503. show: time_show,
  24504. hide: 0
  24505. }
  24506. });
  24507. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.div_toggle_console').popup({
  24508. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("tooltip_console"),
  24509. delay: {
  24510. show: time_show,
  24511. hide: 0
  24512. }
  24513. });
  24514. Sortable.create(listWithHandle, {
  24515. handle: '.glyphicon-move',
  24516. animation: 100,
  24517. ghostClass: 'ghost',
  24518. group: 'functions_divs_drag',
  24519. onEnd: function onEnd(evt) {
  24520. updateSequenceFunction(evt.oldIndex, evt.newIndex);
  24521. }
  24522. });
  24523. var listGlobalsHandle = document.getElementById("listGlobalsHandle");
  24524. Sortable.create(listGlobalsHandle, {
  24525. handle: '.ellipsis',
  24526. animation: 100,
  24527. ghostClass: 'ghost',
  24528. group: 'globals_divs_drag',
  24529. onEnd: function onEnd(evt) {
  24530. updateSequenceGlobals(evt.oldIndex, evt.newIndex);
  24531. }
  24532. });
  24533. });
  24534. function updateSequenceParameters(oldIndex, newIndex, function_obj) {
  24535. function_obj.parameters_list.splice(newIndex, 0, function_obj.parameters_list.splice(oldIndex, 1)[0]);
  24536. }
  24537. function updateSequenceLocals(oldIndex, newIndex, function_obj) {
  24538. function_obj.variables_list.splice(newIndex, 0, function_obj.variables_list.splice(oldIndex, 1)[0]);
  24539. }
  24540. function updateSequenceGlobals(oldIndex, newIndex) {
  24541. program_obj.globals.splice(newIndex, 0, program_obj.globals.splice(oldIndex, 1)[0]);
  24542. }
  24543. function updateSequenceFunction(oldIndex, newIndex) {
  24544. program_obj.functions.splice(newIndex, 0, program_obj.functions.splice(oldIndex, 1)[0]);
  24545. }
  24546. function runCodeAssessment() {
  24547. window.studentGrade = null;
  24548. var strCode = _code_generator__WEBPACK_IMPORTED_MODULE_7__["generate"]();
  24549. if (strCode == null) {
  24550. return;
  24551. }
  24552. toggleConsole(true);
  24553. if (domConsole == null) domConsole = new _io_domConsole__WEBPACK_IMPORTED_MODULE_9__["DOMConsole"]("#ivprog-term");
  24554. jquery__WEBPACK_IMPORTED_MODULE_0___default()("#ivprog-term").slideDown(500);
  24555. var runner = new _assessment_ivprogAssessment__WEBPACK_IMPORTED_MODULE_14__["IVProgAssessment"](strCode, testCases, domConsole);
  24556. runner.runTest().then(function (grade) {
  24557. if (!is_iassign) {
  24558. parent.getEvaluationCallback(grade);
  24559. } else {
  24560. is_iassign = false;
  24561. }
  24562. }).catch(function (err) {
  24563. return console.log(err);
  24564. });
  24565. }
  24566. function runCode() {
  24567. var strCode = _code_generator__WEBPACK_IMPORTED_MODULE_7__["generate"]();
  24568. if (strCode == null) {
  24569. return;
  24570. }
  24571. toggleConsole(true);
  24572. if (domConsole == null) domConsole = new _io_domConsole__WEBPACK_IMPORTED_MODULE_9__["DOMConsole"]("#ivprog-term");
  24573. jquery__WEBPACK_IMPORTED_MODULE_0___default()("#ivprog-term").slideDown(500);
  24574. try {
  24575. var parser = _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_10__["IVProgParser"].createParser(strCode);
  24576. var analyser = new _processor_semantic_semanticAnalyser__WEBPACK_IMPORTED_MODULE_13__["SemanticAnalyser"](parser.parseTree());
  24577. var data = analyser.analyseTree();
  24578. var proc = new _processor_ivprogProcessor__WEBPACK_IMPORTED_MODULE_11__["IVProgProcessor"](data);
  24579. proc.registerInput(domConsole);
  24580. proc.registerOutput(domConsole);
  24581. jquery__WEBPACK_IMPORTED_MODULE_0___default()("#ivprog-term").addClass('ivprog-term-active');
  24582. proc.interpretAST().then(function (_) {
  24583. domConsole.info("Programa executado com sucesso!");
  24584. jquery__WEBPACK_IMPORTED_MODULE_0___default()("#ivprog-term").removeClass('ivprog-term-active');
  24585. }).catch(function (err) {
  24586. domConsole.err(err.message);
  24587. jquery__WEBPACK_IMPORTED_MODULE_0___default()("#ivprog-term").removeClass('ivprog-term-active');
  24588. });
  24589. } catch (error) {
  24590. domConsole.err(error.message);
  24591. console.log(error);
  24592. }
  24593. }
  24594. function toggleConsole(is_running) {
  24595. if (is_running) {
  24596. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ivprog-term-div').css('display', 'block');
  24597. jquery__WEBPACK_IMPORTED_MODULE_0___default()('#ivprog-term').css('min-height', '160px');
  24598. jquery__WEBPACK_IMPORTED_MODULE_0___default()('#ivprog-term').css('margin-top', '-170px');
  24599. return;
  24600. }
  24601. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()('#ivprog-term').css('min-height') == '160px') {
  24602. // esconder
  24603. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ivprog-term-div').css('display', 'none');
  24604. jquery__WEBPACK_IMPORTED_MODULE_0___default()('#ivprog-term').css('min-height', '0');
  24605. jquery__WEBPACK_IMPORTED_MODULE_0___default()('#ivprog-term').css('margin-top', '-30px');
  24606. jquery__WEBPACK_IMPORTED_MODULE_0___default()('#ivprog-term').css('padding', '5px');
  24607. } else {
  24608. // mostrar
  24609. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ivprog-term-div').css('display', 'block');
  24610. jquery__WEBPACK_IMPORTED_MODULE_0___default()('#ivprog-term').css('min-height', '160px');
  24611. jquery__WEBPACK_IMPORTED_MODULE_0___default()('#ivprog-term').css('margin-top', '-170px');
  24612. }
  24613. }
  24614. function waitToCloseConsole() {
  24615. domConsole.info("Aperte qualquer tecla para fechar...");
  24616. var p = new Promise(function (resolve, _) {
  24617. domConsole.requestInput(resolve, true);
  24618. });
  24619. p.then(function (_) {
  24620. domConsole.dispose();
  24621. domConsole = null;
  24622. jquery__WEBPACK_IMPORTED_MODULE_0___default()("#ivprog-term").hide();
  24623. });
  24624. }
  24625. function toggleTextualCoding() {
  24626. var code = _code_generator__WEBPACK_IMPORTED_MODULE_7__["generate"]();
  24627. if (code == null) {
  24628. return;
  24629. }
  24630. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ivprog_visual_panel').css('display', 'none');
  24631. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ivprog_textual_panel').css('display', 'block');
  24632. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ivprog_textual_panel').removeClass('loading');
  24633. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ivprog_textual_code').text(code);
  24634. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.visual_coding_button').removeClass('active');
  24635. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.textual_coding_button').addClass('active');
  24636. }
  24637. function toggleVisualCoding() {
  24638. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ivprog_textual_panel').addClass('loading');
  24639. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ivprog_textual_panel').css('display', 'none');
  24640. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ivprog_visual_panel').css('display', 'block');
  24641. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.textual_coding_button').removeClass('active');
  24642. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.visual_coding_button').addClass('active');
  24643. }
  24644. function removeParameter(function_obj, parameter_obj, parameter_container) {
  24645. var index = function_obj.parameters_list.indexOf(parameter_obj);
  24646. if (index > -1) {
  24647. window.insertContext = true;
  24648. function_obj.parameters_list.splice(index, 1);
  24649. }
  24650. jquery__WEBPACK_IMPORTED_MODULE_0___default()(parameter_container).fadeOut();
  24651. }
  24652. function updateParameterType(parameter_obj, new_type) {
  24653. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  24654. parameter_obj.type = new_type;
  24655. parameter_obj.dimensions = new_dimensions;
  24656. if (new_dimensions > 0) {
  24657. parameter_obj.rows = new_dimensions;
  24658. parameter_obj.columns = 2;
  24659. }
  24660. }
  24661. function renderParameter(function_obj, parameter_obj, function_container) {
  24662. var ret = "";
  24663. ret += '<div class="ui label function_name_parameter pink"><i class="ui icon ellipsis vertical inverted"></i>';
  24664. ret += '<div class="ui dropdown parameter_type">';
  24665. if (parameter_obj.dimensions > 0) {
  24666. ret += '<div class="text">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(parameter_obj.type);
  24667. if (parameter_obj.dimensions == 1) {
  24668. ret += ' [ ] ';
  24669. } else {
  24670. ret += ' [ ] [ ] ';
  24671. }
  24672. ret += '</div>';
  24673. } else {
  24674. ret += '<div class="text">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(parameter_obj.type) + '</div>';
  24675. }
  24676. ret += '<div class="menu">';
  24677. for (var tm in _types__WEBPACK_IMPORTED_MODULE_1__["Types"]) {
  24678. if (tm == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].VOID.toUpperCase()) {
  24679. continue;
  24680. }
  24681. ret += '<div class="item ' + (parameter_obj.type == tm.toLowerCase() ? ' selected ' : '') + '" data-type="' + tm + '" >' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + '</div>';
  24682. }
  24683. for (var tm in _types__WEBPACK_IMPORTED_MODULE_1__["Types"]) {
  24684. if (tm == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].VOID.toUpperCase()) {
  24685. continue;
  24686. }
  24687. ret += '<div class="item">' + '<i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + '<div class="menu">' + '<div class="item" data-text="' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + ' [ ] " data-type="' + tm + '" data-dimensions="1">[ ]</div>' + '<div class="item" data-text="' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + ' [ ] [ ] " data-type="' + tm + '" data-dimensions="2">[ ] [ ] </div>' + '</div>' + '</div>';
  24688. }
  24689. ret += '</div></div>';
  24690. ret += '<div class="parameter_div_edit"><span class="span_name_parameter label_enable_name_parameter">' + parameter_obj.name + '</span></div> ';
  24691. ret += ' <i class="yellow inverted icon times remove_parameter"></i></div>';
  24692. ret = jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret);
  24693. function_container.find('.container_parameters_list').append(ret);
  24694. ret.find('.remove_parameter').on('click', function (e) {
  24695. removeParameter(function_obj, parameter_obj, ret);
  24696. });
  24697. ret.find('.ui.dropdown.parameter_type').dropdown({
  24698. onChange: function onChange(value, text, $selectedItem) {
  24699. if ($selectedItem.data('dimensions')) {
  24700. updateParameterType(parameter_obj, _types__WEBPACK_IMPORTED_MODULE_1__["Types"][$selectedItem.data('type')], $selectedItem.data('dimensions'));
  24701. } else {
  24702. updateParameterType(parameter_obj, _types__WEBPACK_IMPORTED_MODULE_1__["Types"][$selectedItem.data('type')]);
  24703. }
  24704. },
  24705. selectOnKeydown: false
  24706. });
  24707. ret.find('.label_enable_name_parameter').on('click', function (e) {
  24708. enableNameParameterUpdate(parameter_obj, ret, function_obj);
  24709. });
  24710. return ret;
  24711. }
  24712. function updateParameterName(parameter_var, new_name, parameter_obj_dom, function_obj) {
  24713. if (parameter_var.name == new_name) {
  24714. return;
  24715. }
  24716. if (isValidIdentifier(new_name)) {
  24717. if (variableNameAlreadyExists(new_name, function_obj)) {
  24718. _utils__WEBPACK_IMPORTED_MODULE_16__["renderErrorMessage"](parameter_obj_dom.find('.parameter_div_edit'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('inform_valid_variable_duplicated'));
  24719. } else {
  24720. parameter_var.name = new_name;
  24721. }
  24722. } else {
  24723. _utils__WEBPACK_IMPORTED_MODULE_16__["renderErrorMessage"](parameter_obj_dom.find('.parameter_div_edit'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('inform_valid_name'));
  24724. }
  24725. }
  24726. function variableNameAlreadyExists(name_var, function_obj) {
  24727. if (function_obj.parameters_list) {
  24728. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  24729. if (function_obj.parameters_list[i].name == name_var) {
  24730. return true;
  24731. }
  24732. }
  24733. }
  24734. if (function_obj.variables_list) {
  24735. for (var i = 0; i < function_obj.variables_list.length; i++) {
  24736. if (function_obj.variables_list[i].name == name_var) {
  24737. return true;
  24738. }
  24739. }
  24740. }
  24741. return false;
  24742. }
  24743. function updateFunctionName(function_var, new_name, function_obj_dom) {
  24744. if (function_var.name == new_name) {
  24745. return;
  24746. }
  24747. if (isValidIdentifier(new_name)) {
  24748. if (functionNameAlreadyExists(new_name)) {
  24749. _utils__WEBPACK_IMPORTED_MODULE_16__["renderErrorMessage"](function_obj_dom.find('.function_name_div'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('inform_valid_name_duplicated'));
  24750. } else {
  24751. function_var.name = new_name;
  24752. }
  24753. } else {
  24754. _utils__WEBPACK_IMPORTED_MODULE_16__["renderErrorMessage"](function_obj_dom.find('.function_name_div'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('inform_valid_name'));
  24755. }
  24756. }
  24757. function functionNameAlreadyExists(function_name) {
  24758. for (var i = 0; i < window.program_obj.functions.length; i++) {
  24759. if (window.program_obj.functions[i].name == function_name) {
  24760. return true;
  24761. }
  24762. }
  24763. return false;
  24764. }
  24765. function isValidIdentifier(identifier_str) {
  24766. return /^[a-zA-Z_][a-zA-Z0-9_]*$/.test(identifier_str);
  24767. }
  24768. var opened_name_parameter = false;
  24769. var opened_input_parameter = null;
  24770. function enableNameParameterUpdate(parameter_obj, parent_node, function_obj) {
  24771. if (opened_name_parameter) {
  24772. opened_input_parameter.focus();
  24773. return;
  24774. }
  24775. opened_name_parameter = true;
  24776. parent_node = jquery__WEBPACK_IMPORTED_MODULE_0___default()(parent_node);
  24777. var input_field;
  24778. parent_node.find('.span_name_parameter').text('');
  24779. input_field = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + parameter_obj.name + "' />");
  24780. input_field.insertBefore(parent_node.find('.span_name_parameter'));
  24781. input_field.on('input', function () {
  24782. var inputWidth = input_field.textWidth() + 10;
  24783. opened_input_parameter = input_field;
  24784. input_field.focus();
  24785. var tmpStr = input_field.val();
  24786. input_field.val('');
  24787. input_field.val(tmpStr);
  24788. input_field.css({
  24789. width: inputWidth
  24790. });
  24791. }).trigger('input');
  24792. input_field.focusout(function () {
  24793. /// update array:
  24794. if (input_field.val().trim()) {
  24795. updateParameterName(parameter_obj, input_field.val().trim(), parent_node, function_obj);
  24796. parent_node.find('.span_name_parameter').text(parameter_obj.name);
  24797. }
  24798. input_field.off();
  24799. input_field.remove(); /// update elements:
  24800. opened_name_parameter = false;
  24801. opened_input_parameter = false;
  24802. });
  24803. input_field.on('keydown', function (e) {
  24804. var code = e.keyCode || e.which;
  24805. if (code == 13) {
  24806. if (input_field.val().trim()) {
  24807. updateParameterName(parameter_obj, input_field.val().trim(), parent_node, function_obj);
  24808. parent_node.find('.span_name_parameter').text(parameter_obj.name);
  24809. }
  24810. input_field.off();
  24811. input_field.remove(); /// update elements:
  24812. opened_name_parameter = false;
  24813. opened_input_parameter = false;
  24814. }
  24815. if (code == 27) {
  24816. parent_node.find('.span_name_parameter').text(parameter_obj.name);
  24817. input_field.off();
  24818. input_field.remove(); /// update elements:
  24819. opened_name_parameter = false;
  24820. opened_input_parameter = false;
  24821. }
  24822. });
  24823. input_field.select();
  24824. }
  24825. var opened_name_function = false;
  24826. var opened_input = null;
  24827. var previousPadding = null;
  24828. function enableNameFunctionUpdate(function_obj, parent_node) {
  24829. if (opened_name_function) {
  24830. opened_input.focus();
  24831. return;
  24832. }
  24833. parent_node = jquery__WEBPACK_IMPORTED_MODULE_0___default()(parent_node);
  24834. parent_node.find('.span_name_function').text('');
  24835. var input_field;
  24836. if (!previousPadding) {
  24837. previousPadding = parent_node.find('.span_name_function').css('padding-left');
  24838. }
  24839. parent_node.find('.span_name_function').css('padding-left', '0');
  24840. parent_node.find('.span_name_function').css('padding-right', '0');
  24841. input_field = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + function_obj.name + "' />");
  24842. input_field.insertBefore(parent_node.find('.span_name_function'));
  24843. input_field.on('input', function () {
  24844. var inputWidth = input_field.textWidth() + 10;
  24845. opened_input = input_field;
  24846. input_field.focus();
  24847. var tmpStr = input_field.val();
  24848. input_field.val('');
  24849. input_field.val(tmpStr);
  24850. input_field.css({
  24851. width: inputWidth
  24852. });
  24853. }).trigger('input');
  24854. input_field.focusout(function () {
  24855. /// update array:
  24856. if (input_field.val().trim()) {
  24857. updateFunctionName(function_obj, input_field.val().trim(), parent_node);
  24858. }
  24859. input_field.off();
  24860. input_field.remove();
  24861. parent_node.find('.span_name_function').css('padding-left', previousPadding);
  24862. parent_node.find('.span_name_function').css('padding-right', previousPadding);
  24863. parent_node.find('.span_name_function').text(function_obj.name); /// update elements:
  24864. opened_name_function = false;
  24865. opened_input = false;
  24866. });
  24867. input_field.on('keydown', function (e) {
  24868. var code = e.keyCode || e.which;
  24869. if (code == 13) {
  24870. if (input_field.val().trim()) {
  24871. updateFunctionName(function_obj, input_field.val().trim(), parent_node);
  24872. }
  24873. input_field.off();
  24874. input_field.remove();
  24875. parent_node.find('.span_name_function').css('padding-left', previousPadding);
  24876. parent_node.find('.span_name_function').css('padding-right', previousPadding);
  24877. parent_node.find('.span_name_function').text(function_obj.name); /// update elements:
  24878. opened_name_function = false;
  24879. opened_input = false;
  24880. }
  24881. if (code == 27) {
  24882. input_field.off();
  24883. input_field.remove();
  24884. parent_node.find('.span_name_function').css('padding-left', previousPadding);
  24885. parent_node.find('.span_name_function').css('padding-right', previousPadding);
  24886. parent_node.find('.span_name_function').text(function_obj.name); /// update elements:
  24887. opened_name_function = false;
  24888. opened_input = false;
  24889. }
  24890. });
  24891. input_field.select();
  24892. }
  24893. function addFunctionChangeListener(callback) {
  24894. functionsChangeListeners.push(callback);
  24895. return functionsChangeListeners.length - 1;
  24896. }
  24897. function addGlobalChangeListener(callback) {
  24898. globalChangeListeners.push(callback);
  24899. return globalChangeListeners.length - 1;
  24900. }
  24901. function removeGlobalListener(index) {
  24902. globalChangeListeners.splice(index, 1);
  24903. }
  24904. function removeFunctionListener(index) {
  24905. functionsChangeListeners.splice(index);
  24906. }
  24907. /***/ }),
  24908. /***/ "./js/visualUI/globals.js":
  24909. /*!********************************!*\
  24910. !*** ./js/visualUI/globals.js ***!
  24911. \********************************/
  24912. /*! exports provided: addGlobal, renderGlobal */
  24913. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  24914. "use strict";
  24915. __webpack_require__.r(__webpack_exports__);
  24916. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addGlobal", function() { return addGlobal; });
  24917. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderGlobal", function() { return renderGlobal; });
  24918. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  24919. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  24920. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  24921. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  24922. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  24923. /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./utils */ "./js/visualUI/utils.js");
  24924. /* harmony import */ var _semantic_semantic_min_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../semantic/semantic.min.js */ "./js/semantic/semantic.min.js");
  24925. /* harmony import */ var _semantic_semantic_min_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_semantic_semantic_min_js__WEBPACK_IMPORTED_MODULE_5__);
  24926. window.jQuery = jquery__WEBPACK_IMPORTED_MODULE_0___default.a;
  24927. var counter_new_globals = 0;
  24928. function addGlobal(program) {
  24929. var is_from_click = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  24930. var new_global = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Variable"](_types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER, _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('new_global') + '_' + counter_new_globals, 1);
  24931. counter_new_globals++;
  24932. program.addGlobal(new_global);
  24933. var newe = renderGlobal(new_global);
  24934. if (is_from_click) {
  24935. newe.css('display', 'none');
  24936. newe.fadeIn();
  24937. }
  24938. }
  24939. function toggleConstant(global_var) {
  24940. global_var.is_constant = !global_var.is_constant;
  24941. }
  24942. function updateName(global_var, new_name, global_obj_dom) {
  24943. if (global_var.name == new_name) {
  24944. return;
  24945. }
  24946. if (isValidIdentifier(new_name)) {
  24947. if (globalNameAlreadyExists(new_name)) {
  24948. _utils__WEBPACK_IMPORTED_MODULE_4__["renderErrorMessage"](global_obj_dom.find('.editing_name_var'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('inform_valid_global_duplicated'));
  24949. } else {
  24950. global_var.name = new_name;
  24951. }
  24952. } else {
  24953. _utils__WEBPACK_IMPORTED_MODULE_4__["renderErrorMessage"](global_obj_dom.find('.editing_name_var'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('inform_valid_name'));
  24954. }
  24955. }
  24956. function globalNameAlreadyExists(global_name) {
  24957. for (var i = 0; i < window.program_obj.globals.length; i++) {
  24958. if (window.program_obj.globals[i].name == global_name) {
  24959. return true;
  24960. }
  24961. }
  24962. return false;
  24963. }
  24964. function isValidIdentifier(identifier_str) {
  24965. return /^[a-zA-Z_][a-zA-Z0-9_]*$/.test(identifier_str);
  24966. }
  24967. function updateType(global_var, new_type) {
  24968. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  24969. global_var.type = new_type;
  24970. global_var.dimensions = new_dimensions;
  24971. if (new_dimensions > 0) {
  24972. global_var.rows = new_dimensions;
  24973. global_var.columns = 2;
  24974. }
  24975. updateInitialValues(global_var);
  24976. }
  24977. function removeGlobal(global_var, global_container) {
  24978. var index = window.program_obj.globals.indexOf(global_var);
  24979. if (index > -1) {
  24980. window.insertContext = true;
  24981. window.program_obj.globals.splice(index, 1);
  24982. }
  24983. global_container.children().off();
  24984. global_container.off();
  24985. global_container.fadeOut();
  24986. }
  24987. function updateInitialValues(global_var) {
  24988. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  24989. if (global_var.dimensions == 0) {
  24990. global_var.value = 1;
  24991. }
  24992. if (global_var.dimensions == 1) {
  24993. global_var.value = [1, 1];
  24994. }
  24995. if (global_var.dimensions == 2) {
  24996. global_var.value = [[1, 1], [1, 1]];
  24997. }
  24998. }
  24999. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25000. if (global_var.dimensions == 0) {
  25001. global_var.value = 1.0;
  25002. }
  25003. if (global_var.dimensions == 1) {
  25004. global_var.value = [1.0, 1.0];
  25005. }
  25006. if (global_var.dimensions == 2) {
  25007. global_var.value = [[1.0, 1.0], [1.0, 1.0]];
  25008. }
  25009. }
  25010. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  25011. if (global_var.dimensions == 0) {
  25012. global_var.value = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start');
  25013. }
  25014. if (global_var.dimensions == 1) {
  25015. global_var.value = [_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start')];
  25016. }
  25017. if (global_var.dimensions == 2) {
  25018. global_var.value = [[_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start')], [_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start')]];
  25019. }
  25020. }
  25021. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  25022. if (global_var.dimensions == 0) {
  25023. global_var.value = true;
  25024. }
  25025. if (global_var.dimensions == 1) {
  25026. global_var.value = [true, true];
  25027. }
  25028. if (global_var.dimensions == 2) {
  25029. global_var.value = [[true, true], [true, true]];
  25030. }
  25031. }
  25032. }
  25033. function alternateBooleanGlobalValue(global_var, value_container) {
  25034. global_var.value = !global_var.value;
  25035. jquery__WEBPACK_IMPORTED_MODULE_0___default()(value_container).find('.span_value_variable').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(global_var.value));
  25036. }
  25037. function alternateBooleanGlobalVectorValue(global_var, index, value_container) {
  25038. global_var.value[index] = !global_var.value[index];
  25039. jquery__WEBPACK_IMPORTED_MODULE_0___default()(value_container).find('.span_value_variable').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(global_var.value[index]));
  25040. }
  25041. function removeGlobalColumnVector(global_var) {
  25042. if (global_var.columns == 0) {
  25043. return;
  25044. }
  25045. global_var.columns--;
  25046. global_var.value.splice(global_var.value.length - 1, 1);
  25047. }
  25048. function addGlobalColumnVector(global_var) {
  25049. global_var.columns++;
  25050. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  25051. global_var.value.push(1);
  25052. }
  25053. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25054. global_var.value.push(1.0);
  25055. }
  25056. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  25057. global_var.value.push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start'));
  25058. }
  25059. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  25060. global_var.value.push(true);
  25061. }
  25062. }
  25063. function removeColumnGlobalMatrix(global_var) {
  25064. if (global_var.columns == 0) {
  25065. return;
  25066. }
  25067. global_var.columns--;
  25068. for (var i = 0; i < global_var.rows; i++) {
  25069. global_var.value[i].splice(global_var.value[i].length - 1, 1);
  25070. }
  25071. }
  25072. function addColumnGlobalMatrix(global_var) {
  25073. global_var.columns++;
  25074. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  25075. for (var i = 0; i < global_var.rows; i++) {
  25076. global_var.value[i].push(1);
  25077. }
  25078. }
  25079. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25080. for (var i = 0; i < global_var.rows; i++) {
  25081. global_var.value[i].push(1.0);
  25082. }
  25083. }
  25084. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  25085. for (var i = 0; i < global_var.rows; i++) {
  25086. global_var.value[i].push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start'));
  25087. }
  25088. }
  25089. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  25090. for (var i = 0; i < global_var.rows; i++) {
  25091. global_var.value[i].push(true);
  25092. }
  25093. }
  25094. }
  25095. function removeLineGlobalMatrix(global_var) {
  25096. if (global_var.rows == 0) {
  25097. return;
  25098. }
  25099. global_var.rows--;
  25100. global_var.value.splice(global_var.value.length - 1, 1);
  25101. }
  25102. function addLineGlobalMatrix(global_var) {
  25103. global_var.rows++;
  25104. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  25105. var n_l = [];
  25106. for (var i = 0; i < global_var.columns; i++) {
  25107. n_l.push(1);
  25108. }
  25109. global_var.value.push(n_l);
  25110. }
  25111. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25112. var n_l = [];
  25113. for (i = 0; i < global_var.columns; i++) {
  25114. n_l.push(1.0);
  25115. }
  25116. global_var.value.push(n_l);
  25117. }
  25118. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  25119. var n_l = [];
  25120. for (i = 0; i < global_var.columns; i++) {
  25121. n_l.push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start'));
  25122. }
  25123. global_var.value.push(n_l);
  25124. }
  25125. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  25126. var n_l = [];
  25127. for (i = 0; i < global_var.columns; i++) {
  25128. n_l.push(true);
  25129. }
  25130. global_var.value.push(n_l);
  25131. }
  25132. }
  25133. function alternateBooleanGlobalMatrixValue(global_var, row, index, value_container) {
  25134. global_var.value[row][index] = !global_var.value[row][index];
  25135. jquery__WEBPACK_IMPORTED_MODULE_0___default()(value_container).find('.span_value_variable').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(global_var.value[row][index]));
  25136. }
  25137. function renderValues(global_var, global_container) {
  25138. var ret = "";
  25139. var j = 0;
  25140. if (global_var.dimensions == 0) {
  25141. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25142. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + global_var.value.toFixed(1) + '</span> </div> ';
  25143. } else {
  25144. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  25145. ret += '<div class="created_div_valor_var"><span class="span_value_variable boolean_simple_type">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(global_var.value) + '</span> </div> ';
  25146. } else {
  25147. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + global_var.value + '</span> </div> ';
  25148. }
  25149. }
  25150. } else {
  25151. ret += '<table class="tabela_var">';
  25152. if (global_var.dimensions == 1) {
  25153. ret += '<tr>';
  25154. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25155. for (var k = 0; k < global_var.columns; k++) {
  25156. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + global_var.value[k].toFixed(1) + '</span></td>';
  25157. }
  25158. } else {
  25159. for (var k = 0; k < global_var.columns; k++) {
  25160. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  25161. ret += '<td><span class="span_value_variable boolean_vector_var" data-index="' + k + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(global_var.value[k]) + '</span></td>';
  25162. } else {
  25163. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + global_var.value[k] + '</span>' + '</td>';
  25164. }
  25165. }
  25166. }
  25167. ret += '</tr>';
  25168. ret += '</table>';
  25169. ret += '<div class="buttons_manage_columns"><i class="ui icon minus square outline remove_global_vector_column"></i>' + ' <i class="ui icon plus square outline add_global_vector_column"></i></div>';
  25170. }
  25171. if (global_var.dimensions == 2) {
  25172. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25173. for (var l = 0; l < global_var.rows; l++) {
  25174. ret += '<tr>';
  25175. for (var k = 0; k < global_var.columns; k++) {
  25176. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + global_var.value[l][k].toFixed(1) + '</span>' + '</td>';
  25177. }
  25178. ret += '</tr>';
  25179. }
  25180. } else {
  25181. for (var l = 0; l < global_var.rows; l++) {
  25182. ret += '<tr>';
  25183. for (var k = 0; k < global_var.columns; k++) {
  25184. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  25185. ret += '<td><span class="span_value_variable boolean_matrix_var" data-index="' + k + '" data-row="' + l + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(global_var.value[l][k]) + '</span></td>';
  25186. } else {
  25187. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + global_var.value[l][k] + '</span></td>';
  25188. }
  25189. }
  25190. ret += '</tr>';
  25191. }
  25192. }
  25193. if (global_var.rows == 0) {
  25194. ret += '<tr><td></td></tr>';
  25195. }
  25196. ret += '<tr><td colspan="' + global_var.columns + '" class="tr_manage_lines"><i class="ui icon minus square outline remove_global_matrix_line"></i>' + ' <i class="ui icon plus square outline add_global_matrix_line"></i></td></tr>';
  25197. ret += '</table>';
  25198. ret += '<div class="buttons_manage_columns"><i class="ui icon minus square outline remove_global_matrix_column"></i>' + ' <i class="ui icon plus square outline add_global_matrix_column"></i></div>';
  25199. }
  25200. }
  25201. global_container.find(".div_valor_var").html('');
  25202. ret = jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret);
  25203. ret.find('.span_value_variable').data('associatedOject', global_var);
  25204. ret.find(".boolean_simple_type").on('click', function (e) {
  25205. alternateBooleanGlobalValue(global_var, this.parentNode);
  25206. });
  25207. ret.find(".simple_var").on('click', function (e) {
  25208. enableGlobalValueUpdate(global_var, this.parentNode);
  25209. });
  25210. ret.find(".boolean_vector_var").on('click', function (e) {
  25211. alternateBooleanGlobalVectorValue(global_var, jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('index'), this.parentNode);
  25212. });
  25213. ret.find(".vector_var").on('click', function (e) {
  25214. enableGlobalVectorValueUpdate(global_var, jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('index'), this.parentNode);
  25215. });
  25216. ret.find(".remove_global_vector_column").on('click', function (e) {
  25217. removeGlobalColumnVector(global_var);
  25218. global_container.find(".div_valor_var").html('');
  25219. renderValues(global_var, global_container);
  25220. });
  25221. ret.find(".add_global_vector_column").on('click', function (e) {
  25222. addGlobalColumnVector(global_var);
  25223. global_container.find(".div_valor_var").html('');
  25224. renderValues(global_var, global_container);
  25225. });
  25226. ret.find(".remove_global_matrix_column").on('click', function (e) {
  25227. removeColumnGlobalMatrix(global_var);
  25228. global_container.find(".div_valor_var").html('');
  25229. renderValues(global_var, global_container);
  25230. });
  25231. ret.find(".add_global_matrix_column").on('click', function (e) {
  25232. addColumnGlobalMatrix(global_var);
  25233. global_container.find(".div_valor_var").html('');
  25234. renderValues(global_var, global_container);
  25235. });
  25236. ret.find(".remove_global_matrix_line").on('click', function (e) {
  25237. removeLineGlobalMatrix(global_var);
  25238. global_container.find(".div_valor_var").html('');
  25239. renderValues(global_var, global_container);
  25240. });
  25241. ret.find(".add_global_matrix_line").on('click', function (e) {
  25242. addLineGlobalMatrix(global_var);
  25243. global_container.find(".div_valor_var").html('');
  25244. renderValues(global_var, global_container);
  25245. });
  25246. ret.find(".boolean_matrix_var").on('click', function (e) {
  25247. alternateBooleanGlobalMatrixValue(global_var, jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('row'), jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('index'), this.parentNode);
  25248. });
  25249. ret.find(".matrix_var").on('click', function (e) {
  25250. enableGlobalMatrixValueUpdate(global_var, jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('row'), jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('index'), this.parentNode);
  25251. });
  25252. global_container.find(".div_valor_var").append(ret);
  25253. updateColumnsAndRowsText(global_container, global_var);
  25254. }
  25255. function addHandlers(global_container) {
  25256. var global_var = global_container.data('associatedOject'); // Manage constant option:
  25257. global_container.find(".alternate_constant").on('click', function (e) {
  25258. toggleConstant(global_var);
  25259. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).removeClass("on off");
  25260. if (global_var.is_constant) {
  25261. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).addClass("on");
  25262. } else {
  25263. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).addClass("off");
  25264. }
  25265. }); // Manage global name:
  25266. global_container.find(".enable_edit_name_parameter").on('click', function (e) {
  25267. enableNameUpdate(global_container);
  25268. }); // Menu to change type:
  25269. global_container.find('.ui.dropdown.global_type').dropdown({
  25270. onChange: function onChange(value, text, $selectedItem) {
  25271. if ($selectedItem.data('dimensions')) {
  25272. updateType(global_var, _types__WEBPACK_IMPORTED_MODULE_1__["Types"][$selectedItem.data('type')], $selectedItem.data('dimensions'));
  25273. } else {
  25274. updateType(global_var, _types__WEBPACK_IMPORTED_MODULE_1__["Types"][$selectedItem.data('type')]);
  25275. }
  25276. renderValues(global_var, global_container);
  25277. },
  25278. selectOnKeydown: false
  25279. }); // Remove global:
  25280. global_container.find(".remove_global").on('click', function (e) {
  25281. removeGlobal(global_var, global_container);
  25282. });
  25283. }
  25284. function updateColumnsAndRowsText(global_container, global_var) {
  25285. var prev = global_container.find('.text').text().split('[');
  25286. if (prev.length == 2) {
  25287. var ff = prev[0] + '[ ' + global_var.columns + ' ] ';
  25288. global_container.find('.text').empty();
  25289. global_container.find('.text').text(ff);
  25290. }
  25291. if (prev.length == 3) {
  25292. var ff = prev[0] + '[ ' + global_var.columns + ' ] [ ' + global_var.rows + ' ] ';
  25293. global_container.find('.text').empty();
  25294. global_container.find('.text').text(ff);
  25295. }
  25296. }
  25297. function renderGlobal(global_var) {
  25298. var element = '<div class="ui label global_container pink"><i class="ui icon ellipsis vertical inverted"></i><div class="global_const">const: ';
  25299. element += '<i class="ui icon toggle ' + (global_var.is_constant ? "on" : "off") + ' alternate_constant"></i></div>';
  25300. element += '<div class="ui dropdown global_type">';
  25301. if (global_var.dimensions > 0) {
  25302. element += '<div class="text">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(global_var.type);
  25303. for (var i = 0; i < global_var.dimensions; i++) {
  25304. element += ' [ <span class="dimensions_' + i + '"></span> ] ';
  25305. }
  25306. element += '</div>';
  25307. } else {
  25308. element += '<div class="text">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(global_var.type.toLowerCase()) + '</div>';
  25309. }
  25310. element += '<div class="menu">';
  25311. for (var tm in _types__WEBPACK_IMPORTED_MODULE_1__["Types"]) {
  25312. if (tm == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].VOID.toUpperCase()) {
  25313. continue;
  25314. }
  25315. element += '<div class="item ' + (global_var.type == tm.toLowerCase() ? ' selected ' : '') + '" data-type="' + tm + '" >' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + '</div>';
  25316. }
  25317. for (var tm in _types__WEBPACK_IMPORTED_MODULE_1__["Types"]) {
  25318. if (tm == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].VOID.toUpperCase()) {
  25319. continue;
  25320. }
  25321. element += '<div class="item">' + '<i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + '<div class="menu">' + '<div class="item" data-text="' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + ' [ ] " data-type="' + tm + '" data-dimensions="1">[ ]</div>' + '<div class="item" data-text="' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + ' [ ] [ ] " data-type="' + tm + '" data-dimensions="2">[ ] [ ] </div>' + '</div>' + '</div>';
  25322. }
  25323. element += '</div></div> <div class="editing_name_var"> <span class="span_name_variable enable_edit_name_parameter">' + global_var.name + '</span> </div> <span class="character_equals"> = </span> ';
  25324. element += '<div class="ui div_valor_var">' + global_var.value + '</div>';
  25325. element += ' <i class="yellow inverted icon times remove_global"></i></div>';
  25326. var complete_element = jquery__WEBPACK_IMPORTED_MODULE_0___default()(element);
  25327. complete_element.data('associatedOject', global_var);
  25328. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.list_globals').append(complete_element);
  25329. addHandlers(complete_element);
  25330. renderValues(global_var, complete_element);
  25331. if (global_var.dimensions == 1) {
  25332. complete_element.find('.dimensions_0').text(global_var.columns);
  25333. }
  25334. if (global_var.dimensions == 2) {
  25335. complete_element.find('.dimensions_0').text(global_var.columns);
  25336. complete_element.find('.dimensions_1').text(global_var.rows);
  25337. }
  25338. return complete_element;
  25339. }
  25340. var opened_name_value_matrix_global_v = false;
  25341. var opened_input_value_matrix_global_v = null;
  25342. function enableGlobalMatrixValueUpdate(global_var, row, index, parent_node) {
  25343. if (opened_name_value_matrix_global_v) {
  25344. opened_input_value_matrix_global_v.focus();
  25345. return;
  25346. }
  25347. parent_node = jquery__WEBPACK_IMPORTED_MODULE_0___default()(parent_node);
  25348. opened_name_value_matrix_global_v = true;
  25349. parent_node.find('.span_value_variable').text('');
  25350. var input_field;
  25351. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25352. input_field = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.value[row][index].toFixed(1) + "' />");
  25353. input_field.insertBefore(parent_node.find('.span_value_variable'));
  25354. } else {
  25355. input_field = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.value[row][index] + "' />");
  25356. input_field.insertBefore(parent_node.find('.span_value_variable'));
  25357. }
  25358. input_field.on('input', function () {
  25359. var inputWidth = input_field.textWidth() + 10;
  25360. opened_input_value_matrix_global_v = input_field;
  25361. input_field.focus();
  25362. var tmpStr = input_field.val();
  25363. input_field.val('');
  25364. input_field.val(tmpStr);
  25365. input_field.css({
  25366. width: inputWidth
  25367. });
  25368. }).trigger('input');
  25369. input_field.focusout(function () {
  25370. /// update array:
  25371. if (input_field.val().trim()) {
  25372. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25373. global_var.value[row][index] = parseFloat(input_field.val().trim());
  25374. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  25375. } else {
  25376. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  25377. global_var.value[row][index] = parseInt(input_field.val().trim());
  25378. } else {
  25379. global_var.value[row][index] = input_field.val().trim();
  25380. }
  25381. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  25382. }
  25383. } else {
  25384. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25385. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  25386. } else {
  25387. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  25388. }
  25389. }
  25390. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  25391. global_var.value[row][index] = input_field.val();
  25392. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  25393. }
  25394. input_field.off();
  25395. input_field.remove(); /// update elements:
  25396. opened_name_value_matrix_global_v = false;
  25397. opened_input_value_matrix_global_v = false;
  25398. });
  25399. input_field.on('keydown', function (e) {
  25400. var code = e.keyCode || e.which;
  25401. if (code == 13) {
  25402. if (input_field.val().trim()) {
  25403. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25404. global_var.value[row][index] = parseFloat(input_field.val().trim());
  25405. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  25406. } else {
  25407. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  25408. global_var.value[row][index] = parseInt(input_field.val().trim());
  25409. } else {
  25410. global_var.value[row][index] = input_field.val().trim();
  25411. }
  25412. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  25413. }
  25414. } else {
  25415. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25416. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  25417. } else {
  25418. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  25419. }
  25420. }
  25421. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  25422. global_var.value[row][index] = input_field.val();
  25423. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  25424. }
  25425. input_field.off();
  25426. input_field.remove(); /// update elements:
  25427. opened_name_value_matrix_global_v = false;
  25428. opened_input_value_matrix_global_v = false;
  25429. }
  25430. if (code == 27) {
  25431. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25432. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  25433. } else {
  25434. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  25435. }
  25436. input_field.off();
  25437. input_field.remove(); /// update elements:
  25438. opened_name_value_matrix_global_v = false;
  25439. opened_input_value_matrix_global_v = false;
  25440. }
  25441. });
  25442. input_field.select();
  25443. }
  25444. var opened_name_value_global_var = false;
  25445. var opened_input_value_global_ar = null;
  25446. function enableGlobalValueUpdate(global_var, parent_node) {
  25447. if (opened_name_value_global_var) {
  25448. opened_input_value_global_ar.focus();
  25449. return;
  25450. }
  25451. parent_node = jquery__WEBPACK_IMPORTED_MODULE_0___default()(parent_node);
  25452. opened_name_value_global_var = true;
  25453. parent_node.find('.span_value_variable').text('');
  25454. var input_field;
  25455. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25456. input_field = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.value.toFixed(1) + "' />");
  25457. input_field.insertBefore(parent_node.find('.span_value_variable'));
  25458. } else {
  25459. input_field = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.value + "' />");
  25460. input_field.insertBefore(parent_node.find('.span_value_variable'));
  25461. }
  25462. input_field.on('input', function () {
  25463. var inputWidth = input_field.textWidth() + 10;
  25464. opened_input_value_global_ar = input_field;
  25465. input_field.focus();
  25466. var tmpStr = input_field.val();
  25467. input_field.val('');
  25468. input_field.val(tmpStr);
  25469. input_field.css({
  25470. width: inputWidth
  25471. });
  25472. }).trigger('input');
  25473. input_field.focusout(function () {
  25474. /// update array:
  25475. if (input_field.val().trim()) {
  25476. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25477. global_var.value = parseFloat(input_field.val().trim());
  25478. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  25479. } else {
  25480. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  25481. global_var.value = parseInt(input_field.val().trim());
  25482. } else {
  25483. global_var.value = input_field.val().trim();
  25484. }
  25485. parent_node.find('.span_value_variable').text(global_var.value);
  25486. }
  25487. } else {
  25488. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25489. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  25490. } else {
  25491. parent_node.find('.span_value_variable').text(global_var.value);
  25492. }
  25493. }
  25494. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  25495. global_var.value = input_field.val();
  25496. parent_node.find('.span_value_variable').text(global_var.value);
  25497. }
  25498. input_field.off();
  25499. input_field.remove(); /// update elements:
  25500. opened_name_value_global_var = false;
  25501. opened_input_value_global_ar = false;
  25502. });
  25503. input_field.on('keydown', function (e) {
  25504. var code = e.keyCode || e.which;
  25505. if (code == 13) {
  25506. if (input_field.val().trim()) {
  25507. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25508. global_var.value = parseFloat(input_field.val().trim());
  25509. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  25510. } else {
  25511. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  25512. global_var.value = parseInt(input_field.val().trim());
  25513. } else {
  25514. global_var.value = input_field.val().trim();
  25515. }
  25516. parent_node.find('.span_value_variable').text(global_var.value);
  25517. }
  25518. } else {
  25519. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25520. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  25521. } else {
  25522. parent_node.find('.span_value_variable').text(global_var.value);
  25523. }
  25524. }
  25525. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  25526. global_var.value = input_field.val();
  25527. parent_node.find('.span_value_variable').text(global_var.value);
  25528. }
  25529. input_field.off();
  25530. input_field.remove(); /// update elements:
  25531. opened_name_value_global_var = false;
  25532. opened_input_value_global_ar = false;
  25533. }
  25534. if (code == 27) {
  25535. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25536. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  25537. } else {
  25538. parent_node.find('.span_value_variable').text(global_var.value);
  25539. }
  25540. input_field.off();
  25541. input_field.remove(); /// update elements:
  25542. opened_name_value_global_var = false;
  25543. opened_input_value_global_ar = false;
  25544. }
  25545. });
  25546. input_field.select();
  25547. }
  25548. var opened_name_global = false;
  25549. var opened_input_global = null;
  25550. function enableNameUpdate(global_container) {
  25551. var global_var = global_container.data('associatedOject');
  25552. if (opened_name_global) {
  25553. opened_input_global.focus();
  25554. return;
  25555. }
  25556. opened_name_global = true;
  25557. global_container.find('.span_name_variable').text('');
  25558. var input_name = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.name + "' />");
  25559. input_name.insertBefore(global_container.find('.span_name_variable'));
  25560. input_name.on('input', function () {
  25561. var inputWidth = input_name.textWidth() + 10;
  25562. opened_input_global = input_name;
  25563. opened_input_global.focus();
  25564. opened_input_global.css({
  25565. width: inputWidth
  25566. });
  25567. }).trigger('input');
  25568. input_name.focusout(function () {
  25569. /// update array:
  25570. if (input_name.val().trim().length > 0) {
  25571. updateName(global_var, input_name.val().trim(), global_container);
  25572. global_container.find('.span_name_variable').text(global_var.name);
  25573. } else {
  25574. global_container.find('.span_name_variable').text(global_var.name);
  25575. }
  25576. input_name.off();
  25577. input_name.remove(); /// update elements:
  25578. opened_name_global = false;
  25579. opened_input_global = false;
  25580. });
  25581. input_name.on('keydown', function (e) {
  25582. var code = e.keyCode || e.which;
  25583. if (code == 13) {
  25584. if (input_name.val().trim()) {
  25585. updateName(global_var, input_name.val().trim(), global_container);
  25586. global_container.find('.span_name_variable').text(global_var.name);
  25587. } else {
  25588. global_container.find('.span_name_variable').text(global_var.name);
  25589. }
  25590. input_name.off();
  25591. input_name.remove(); /// update elements:
  25592. opened_name_global = false;
  25593. opened_input_global = false;
  25594. }
  25595. if (code == 27) {
  25596. global_container.find('.span_name_variable').text(global_var.name);
  25597. input_name.off();
  25598. input_name.remove(); /// update elements:
  25599. opened_name_global = false;
  25600. opened_input_global = false;
  25601. }
  25602. });
  25603. input_name.select();
  25604. }
  25605. var opened_name_value_vector_global_ = false;
  25606. var opened_input_value_vector_global_ = null;
  25607. function enableGlobalVectorValueUpdate(global_var, index, parent_node) {
  25608. if (opened_name_value_vector_global_) {
  25609. opened_input_value_vector_global_.focus();
  25610. return;
  25611. }
  25612. parent_node = jquery__WEBPACK_IMPORTED_MODULE_0___default()(parent_node);
  25613. opened_name_value_vector_global_ = true;
  25614. parent_node.find('.span_value_variable').text('');
  25615. var input_field;
  25616. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25617. input_field = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.value[index].toFixed(1) + "' />");
  25618. input_field.insertBefore(parent_node.find('.span_value_variable'));
  25619. } else {
  25620. input_field = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.value[index] + "' />");
  25621. input_field.insertBefore(parent_node.find('.span_value_variable'));
  25622. }
  25623. input_field.on('input', function () {
  25624. var inputWidth = input_field.textWidth() + 10;
  25625. opened_input_value_vector_global_ = input_field;
  25626. input_field.focus();
  25627. var tmpStr = input_field.val();
  25628. input_field.val('');
  25629. input_field.val(tmpStr);
  25630. input_field.css({
  25631. width: inputWidth
  25632. });
  25633. }).trigger('input');
  25634. input_field.focusout(function () {
  25635. /// update array:
  25636. if (input_field.val().trim()) {
  25637. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25638. global_var.value[index] = parseFloat(input_field.val().trim());
  25639. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  25640. } else {
  25641. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  25642. global_var.value[index] = parseInt(input_field.val().trim());
  25643. } else {
  25644. global_var.value[index] = input_field.val().trim();
  25645. }
  25646. parent_node.find('.span_value_variable').text(global_var.value[index]);
  25647. }
  25648. } else {
  25649. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25650. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  25651. } else {
  25652. parent_node.find('.span_value_variable').text(global_var.value[index]);
  25653. }
  25654. }
  25655. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  25656. global_var.value[index] = input_field.val();
  25657. parent_node.find('.span_value_variable').text(global_var.value[index]);
  25658. }
  25659. input_field.off();
  25660. input_field.remove(); /// update elements:
  25661. opened_name_value_vector_global_ = false;
  25662. opened_input_value_vector_global_ = false;
  25663. });
  25664. input_field.on('keydown', function (e) {
  25665. var code = e.keyCode || e.which;
  25666. if (code == 13) {
  25667. if (input_field.val().trim()) {
  25668. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25669. global_var.value[index] = parseFloat(input_field.val().trim());
  25670. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  25671. } else {
  25672. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  25673. global_var.value[index] = parseInt(input_field.val().trim());
  25674. } else {
  25675. global_var.value[index] = input_field.val().trim();
  25676. }
  25677. parent_node.find('.span_value_variable').text(global_var.value[index]);
  25678. }
  25679. } else {
  25680. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25681. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  25682. } else {
  25683. parent_node.find('.span_value_variable').text(global_var.value[index]);
  25684. }
  25685. }
  25686. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  25687. global_var.value[index] = input_field.val();
  25688. parent_node.find('.span_value_variable').text(global_var.value[index]);
  25689. }
  25690. input_field.off();
  25691. input_field.remove(); /// update elements:
  25692. opened_name_value_vector_global_ = false;
  25693. opened_input_value_vector_global_ = false;
  25694. }
  25695. if (code == 27) {
  25696. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25697. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  25698. } else {
  25699. parent_node.find('.span_value_variable').text(global_var.value[index]);
  25700. }
  25701. input_field.off();
  25702. input_field.remove(); /// update elements:
  25703. opened_name_value_vector_global_ = false;
  25704. opened_input_value_vector_global_ = false;
  25705. }
  25706. });
  25707. input_field.select();
  25708. }
  25709. jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn.textWidth = function (text, font) {
  25710. if (!jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn.textWidth.fakeEl) jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn.textWidth.fakeEl = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<span>').hide().appendTo(document.body);
  25711. jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn.textWidth.fakeEl.text(text || this.val() || this.text() || this.attr('placeholder')).css('font', font || this.css('font'));
  25712. return jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn.textWidth.fakeEl.width();
  25713. };
  25714. /***/ }),
  25715. /***/ "./js/visualUI/ivprog_elements.js":
  25716. /*!****************************************!*\
  25717. !*** ./js/visualUI/ivprog_elements.js ***!
  25718. \****************************************/
  25719. /*! exports provided: COMMAND_TYPES, ARITHMETIC_TYPES, EXPRESSION_ELEMENTS, EXPRESSION_TYPES, ARITHMETIC_COMPARISON, LOGIC_COMPARISON, SYSTEM_FUNCTIONS_CATEGORIES, Variable, Function, SystemFunction, Comment, Break, Reader, Writer, Attribution, ExpressionElement, ConditionalExpression, LogicExpression, ArithmeticExpression, IfTrue, RepeatNTimes, WhileTrue, DoWhileTrue, Switch, Return, SwitchCase, FunctionCall, VariableValueMenu, FunctionCallMenu, Program */
  25720. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  25721. "use strict";
  25722. __webpack_require__.r(__webpack_exports__);
  25723. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "COMMAND_TYPES", function() { return COMMAND_TYPES; });
  25724. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ARITHMETIC_TYPES", function() { return ARITHMETIC_TYPES; });
  25725. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EXPRESSION_ELEMENTS", function() { return EXPRESSION_ELEMENTS; });
  25726. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EXPRESSION_TYPES", function() { return EXPRESSION_TYPES; });
  25727. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ARITHMETIC_COMPARISON", function() { return ARITHMETIC_COMPARISON; });
  25728. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LOGIC_COMPARISON", function() { return LOGIC_COMPARISON; });
  25729. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SYSTEM_FUNCTIONS_CATEGORIES", function() { return SYSTEM_FUNCTIONS_CATEGORIES; });
  25730. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Variable", function() { return Variable; });
  25731. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Function", function() { return Function; });
  25732. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SystemFunction", function() { return SystemFunction; });
  25733. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Comment", function() { return Comment; });
  25734. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Break", function() { return Break; });
  25735. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Reader", function() { return Reader; });
  25736. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Writer", function() { return Writer; });
  25737. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Attribution", function() { return Attribution; });
  25738. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ExpressionElement", function() { return ExpressionElement; });
  25739. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ConditionalExpression", function() { return ConditionalExpression; });
  25740. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LogicExpression", function() { return LogicExpression; });
  25741. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ArithmeticExpression", function() { return ArithmeticExpression; });
  25742. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IfTrue", function() { return IfTrue; });
  25743. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RepeatNTimes", function() { return RepeatNTimes; });
  25744. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WhileTrue", function() { return WhileTrue; });
  25745. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DoWhileTrue", function() { return DoWhileTrue; });
  25746. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Switch", function() { return Switch; });
  25747. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Return", function() { return Return; });
  25748. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SwitchCase", function() { return SwitchCase; });
  25749. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FunctionCall", function() { return FunctionCall; });
  25750. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VariableValueMenu", function() { return VariableValueMenu; });
  25751. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FunctionCallMenu", function() { return FunctionCallMenu; });
  25752. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Program", function() { return Program; });
  25753. /* harmony import */ var _commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  25754. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  25755. /* harmony import */ var melanke_watchjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! melanke-watchjs */ "./node_modules/melanke-watchjs/src/watch.js");
  25756. /* harmony import */ var melanke_watchjs__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(melanke_watchjs__WEBPACK_IMPORTED_MODULE_2__);
  25757. /* harmony import */ var _algorithm__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./algorithm */ "./js/visualUI/algorithm.js");
  25758. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  25759. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  25760. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  25761. var COMMAND_TYPES = Object.freeze({
  25762. function: "function",
  25763. comment: "comment",
  25764. reader: "reader",
  25765. writer: "writer",
  25766. attribution: "attribution",
  25767. iftrue: "iftrue",
  25768. repeatNtimes: "repeatNtimes",
  25769. whiletrue: "whiletrue",
  25770. dowhiletrue: "dowhiletrue",
  25771. switch: "switch",
  25772. switchcase: "switchcase",
  25773. functioncall: "functioncall",
  25774. break: "break",
  25775. return: "return"
  25776. });
  25777. var ARITHMETIC_TYPES = Object.freeze({
  25778. plus: "plus",
  25779. minus: "minus",
  25780. multiplication: "multiplication",
  25781. division: "division",
  25782. module: "module",
  25783. none: "none"
  25784. });
  25785. var EXPRESSION_ELEMENTS = Object.freeze({
  25786. exp_op_exp: "exp_op_exp",
  25787. op_exp: "op_exp",
  25788. par_exp_par: "par_exp_par",
  25789. start_point: "start_point"
  25790. });
  25791. var EXPRESSION_TYPES = Object.freeze({
  25792. exp_conditional: "exp_conditional",
  25793. exp_logic: "exp_logic",
  25794. exp_arithmetic: "exp_arithmetic"
  25795. });
  25796. var ARITHMETIC_COMPARISON = Object.freeze({
  25797. greater_than: "greater_than",
  25798. less_than: "less_than",
  25799. equals_to: "equals_to",
  25800. not_equals_to: "not_equals_to",
  25801. greater_than_or_equals_to: "greater_than_or_equals_to",
  25802. less_than_or_equals_to: "less_than_or_equals_to"
  25803. });
  25804. var LOGIC_COMPARISON = Object.freeze({
  25805. equals_to: "equals_to",
  25806. not_equals_to: "not_equals_to",
  25807. and: "and",
  25808. or: "or"
  25809. });
  25810. var SYSTEM_FUNCTIONS_CATEGORIES = Object.freeze({
  25811. math: "math",
  25812. text: "text_t",
  25813. arrangement: "arrangement",
  25814. conversion: "conversion"
  25815. });
  25816. var Variable = function Variable(type, name, value) {
  25817. var dimensions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
  25818. var is_constant = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  25819. var rows = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  25820. var columns = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 0;
  25821. _classCallCheck(this, Variable);
  25822. this.type = type;
  25823. this.name = name;
  25824. this.value = value;
  25825. this.dimensions = dimensions;
  25826. this.is_constant = is_constant;
  25827. this.rows = rows;
  25828. this.columns = columns;
  25829. };
  25830. var Function = function Function(name) {
  25831. var return_type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _types__WEBPACK_IMPORTED_MODULE_1__["Types"].VOID;
  25832. var return_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  25833. var parameters_list = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
  25834. var is_main = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  25835. var is_hidden = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
  25836. var variables_list = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : [];
  25837. var function_comment = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
  25838. var commands = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : [];
  25839. _classCallCheck(this, Function);
  25840. this.type = COMMAND_TYPES.function;
  25841. this.name = name;
  25842. this.return_type = return_type;
  25843. this.return_dimensions = return_dimensions;
  25844. this.parameters_list = parameters_list;
  25845. this.is_main = is_main;
  25846. this.is_hidden = is_hidden;
  25847. this.variables_list = variables_list;
  25848. this.function_comment = function_comment;
  25849. this.commands = commands;
  25850. };
  25851. var SystemFunction = function SystemFunction(identifier, return_type, return_dimensions, parameters_list) {
  25852. var function_comment = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
  25853. var category = arguments.length > 5 ? arguments[5] : undefined;
  25854. _classCallCheck(this, SystemFunction);
  25855. this.type = COMMAND_TYPES.function;
  25856. this.identifier = identifier;
  25857. this.return_type = return_type;
  25858. this.return_dimensions = return_dimensions;
  25859. this.parameters_list = parameters_list;
  25860. this.function_comment = function_comment;
  25861. this.category = category;
  25862. };
  25863. var Comment = function Comment(comment_text) {
  25864. _classCallCheck(this, Comment);
  25865. this.type = COMMAND_TYPES.comment;
  25866. this.comment_text = comment_text;
  25867. };
  25868. var Break = function Break() {
  25869. _classCallCheck(this, Break);
  25870. this.type = COMMAND_TYPES.break;
  25871. };
  25872. var Reader = function Reader() {
  25873. var variable_value_menu = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new VariableValueMenu();
  25874. _classCallCheck(this, Reader);
  25875. this.type = COMMAND_TYPES.reader;
  25876. this.variable_value_menu = variable_value_menu;
  25877. };
  25878. var Writer = function Writer(content) {
  25879. _classCallCheck(this, Writer);
  25880. this.type = COMMAND_TYPES.writer;
  25881. this.content = content;
  25882. };
  25883. var Attribution = function Attribution(variable) {
  25884. var expression = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  25885. _classCallCheck(this, Attribution);
  25886. this.type = COMMAND_TYPES.attribution;
  25887. this.variable = variable;
  25888. this.expression = expression;
  25889. };
  25890. var ExpressionElement = function ExpressionElement(type_exp) {
  25891. var itens = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  25892. _classCallCheck(this, ExpressionElement);
  25893. this.type_exp = type_exp;
  25894. this.itens = itens;
  25895. };
  25896. var ConditionalExpression = function ConditionalExpression(expression) {
  25897. _classCallCheck(this, ConditionalExpression);
  25898. this.type = EXPRESSION_TYPES.exp_conditional;
  25899. this.expression = expression;
  25900. };
  25901. var LogicExpression = function LogicExpression(has_neg, first_operand, second_operand, operator) {
  25902. _classCallCheck(this, LogicExpression);
  25903. this.type = EXPRESSION_TYPES.exp_logic;
  25904. this.has_neg = has_neg;
  25905. this.first_operand = first_operand;
  25906. this.second_operand = second_operand;
  25907. this.operator = operator;
  25908. };
  25909. var ArithmeticExpression = function ArithmeticExpression(first_operand, second_operand, operator) {
  25910. _classCallCheck(this, ArithmeticExpression);
  25911. this.type = EXPRESSION_TYPES.exp_arithmetic;
  25912. this.first_operand = first_operand;
  25913. this.second_operand = second_operand;
  25914. this.operator = operator;
  25915. };
  25916. var IfTrue = function IfTrue(expression, commands_block, commands_else) {
  25917. _classCallCheck(this, IfTrue);
  25918. this.type = COMMAND_TYPES.iftrue;
  25919. this.expression = expression;
  25920. this.commands_block = commands_block;
  25921. this.commands_else = commands_else;
  25922. };
  25923. var RepeatNTimes = function RepeatNTimes(var_attribution, var_incrementation, expression1, expression2, expression3, commands_block) {
  25924. _classCallCheck(this, RepeatNTimes);
  25925. this.type = COMMAND_TYPES.repeatNtimes;
  25926. this.var_attribution = var_attribution;
  25927. this.var_incrementation = var_incrementation;
  25928. this.expression1 = expression1;
  25929. this.expression2 = expression2;
  25930. this.expression3 = expression3;
  25931. this.commands_block = commands_block;
  25932. };
  25933. var WhileTrue = function WhileTrue(expression, commands_block) {
  25934. _classCallCheck(this, WhileTrue);
  25935. this.type = COMMAND_TYPES.whiletrue;
  25936. this.expression = expression;
  25937. this.commands_block = commands_block;
  25938. };
  25939. var DoWhileTrue = function DoWhileTrue(expression, commands_block) {
  25940. _classCallCheck(this, DoWhileTrue);
  25941. this.type = COMMAND_TYPES.dowhiletrue;
  25942. this.expression = expression;
  25943. this.commands_block = commands_block;
  25944. };
  25945. var Switch = function Switch(variable) {
  25946. var cases = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  25947. _classCallCheck(this, Switch);
  25948. this.type = COMMAND_TYPES.switch;
  25949. this.variable = variable;
  25950. this.cases = cases;
  25951. };
  25952. var Return = function Return(variable_value_menu) {
  25953. _classCallCheck(this, Return);
  25954. this.type = COMMAND_TYPES.return;
  25955. this.variable_value_menu = variable_value_menu;
  25956. };
  25957. var SwitchCase = function SwitchCase(variable_value_menu) {
  25958. var commands_block = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  25959. _classCallCheck(this, SwitchCase);
  25960. this.type = COMMAND_TYPES.switchcase;
  25961. this.variable_value_menu = variable_value_menu;
  25962. this.commands_block = commands_block;
  25963. };
  25964. var FunctionCall = function FunctionCall(function_called, parameters_list) {
  25965. _classCallCheck(this, FunctionCall);
  25966. this.type = COMMAND_TYPES.functioncall;
  25967. this.function_called = function_called;
  25968. this.parameters_list = parameters_list;
  25969. };
  25970. var VariableValueMenu = function VariableValueMenu() {
  25971. var variable_and_value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 7;
  25972. var content = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  25973. var row = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  25974. var column = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  25975. var include_constant = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
  25976. var dimensions = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  25977. _classCallCheck(this, VariableValueMenu);
  25978. this.type = "var_value";
  25979. this.variable_and_value = variable_and_value;
  25980. this.content = content;
  25981. this.row = row;
  25982. this.column = column;
  25983. this.include_constant = include_constant;
  25984. this.dimensions = dimensions;
  25985. };
  25986. var FunctionCallMenu = function FunctionCallMenu() {
  25987. var function_called = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  25988. var parameters_list = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  25989. _classCallCheck(this, FunctionCallMenu);
  25990. this.type = "function_call";
  25991. this.function_called = function_called;
  25992. this.parameters_list = parameters_list;
  25993. };
  25994. var Program =
  25995. /*#__PURE__*/
  25996. function () {
  25997. function Program() {
  25998. _classCallCheck(this, Program);
  25999. this.functions = [];
  26000. this.globals = [];
  26001. }
  26002. _createClass(Program, [{
  26003. key: "addFunction",
  26004. value: function addFunction(function_to_add) {
  26005. melanke_watchjs__WEBPACK_IMPORTED_MODULE_2___default.a.watch(function_to_add.parameters_list, function () {
  26006. if (window.insertContext) {
  26007. setTimeout(function () {
  26008. _algorithm__WEBPACK_IMPORTED_MODULE_3__["renderAlgorithm"]();
  26009. }, 300);
  26010. window.insertContext = false;
  26011. } else {
  26012. _algorithm__WEBPACK_IMPORTED_MODULE_3__["renderAlgorithm"]();
  26013. }
  26014. }, 1);
  26015. melanke_watchjs__WEBPACK_IMPORTED_MODULE_2___default.a.watch(function_to_add.variables_list, function () {
  26016. if (window.insertContext) {
  26017. setTimeout(function () {
  26018. _algorithm__WEBPACK_IMPORTED_MODULE_3__["renderAlgorithm"]();
  26019. }, 300);
  26020. window.insertContext = false;
  26021. } else {
  26022. _algorithm__WEBPACK_IMPORTED_MODULE_3__["renderAlgorithm"]();
  26023. }
  26024. }, 1);
  26025. this.functions.push(function_to_add);
  26026. }
  26027. }, {
  26028. key: "addVariable",
  26029. value: function addVariable(function_to_receive, variable) {
  26030. if (this.functions[function_to_receive].variable === null) {
  26031. this.functions[function_to_receive].variables_list = [];
  26032. }
  26033. this.functions[function_to_receive].variables_list.push(variable);
  26034. }
  26035. }, {
  26036. key: "addGlobal",
  26037. value: function addGlobal(variable) {
  26038. this.globals.push(variable);
  26039. }
  26040. }]);
  26041. return Program;
  26042. }();
  26043. /***/ }),
  26044. /***/ "./js/visualUI/types.js":
  26045. /*!******************************!*\
  26046. !*** ./js/visualUI/types.js ***!
  26047. \******************************/
  26048. /*! exports provided: Types */
  26049. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  26050. "use strict";
  26051. __webpack_require__.r(__webpack_exports__);
  26052. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Types", function() { return Types; });
  26053. var Types = Object.freeze({
  26054. INTEGER: "integer",
  26055. REAL: "real",
  26056. TEXT: "text",
  26057. BOOLEAN: "boolean",
  26058. VOID: "void"
  26059. });
  26060. /***/ }),
  26061. /***/ "./js/visualUI/utils.js":
  26062. /*!******************************!*\
  26063. !*** ./js/visualUI/utils.js ***!
  26064. \******************************/
  26065. /*! exports provided: renderErrorMessage */
  26066. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  26067. "use strict";
  26068. __webpack_require__.r(__webpack_exports__);
  26069. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderErrorMessage", function() { return renderErrorMessage; });
  26070. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  26071. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  26072. function renderErrorMessage(dom_obj_target, message_text) {
  26073. dom_obj_target.popup({
  26074. html: '<i class="ui icon inverted exclamation triangle yellow"></i>' + message_text,
  26075. transition: "fade up",
  26076. on: 'click',
  26077. closable: true,
  26078. movePopup: true,
  26079. boundary: window,
  26080. preserve: false,
  26081. target: false,
  26082. className: {
  26083. popup: 'ui popup invalid-identifier'
  26084. },
  26085. onHidden: function onHidden($module) {
  26086. dom_obj_target.popup('destroy');
  26087. }
  26088. }).popup('toggle');
  26089. }
  26090. /***/ }),
  26091. /***/ "./js/visualUI/variables.js":
  26092. /*!**********************************!*\
  26093. !*** ./js/visualUI/variables.js ***!
  26094. \**********************************/
  26095. /*! exports provided: addVariable, renderVariable */
  26096. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  26097. "use strict";
  26098. __webpack_require__.r(__webpack_exports__);
  26099. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addVariable", function() { return addVariable; });
  26100. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderVariable", function() { return renderVariable; });
  26101. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  26102. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  26103. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  26104. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  26105. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  26106. /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./utils */ "./js/visualUI/utils.js");
  26107. /* harmony import */ var _semantic_semantic_min_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../semantic/semantic.min.js */ "./js/semantic/semantic.min.js");
  26108. /* harmony import */ var _semantic_semantic_min_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_semantic_semantic_min_js__WEBPACK_IMPORTED_MODULE_5__);
  26109. window.jQuery = jquery__WEBPACK_IMPORTED_MODULE_0___default.a;
  26110. var counter_new_variables = 0;
  26111. function addVariable(function_obj, function_container) {
  26112. var is_in_click = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  26113. var new_var = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Variable"](_types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER, _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('new_variable') + '_' + counter_new_variables, 1);
  26114. if (function_obj.variables_list == null) {
  26115. function_obj.variables_list = [];
  26116. }
  26117. function_obj.variables_list.push(new_var);
  26118. counter_new_variables++;
  26119. var newe = renderVariable(function_container, new_var, function_obj);
  26120. if (is_in_click) {
  26121. newe.css('display', 'none');
  26122. newe.fadeIn();
  26123. }
  26124. }
  26125. function updateName(variable_obj, new_name, variable_obj_dom, function_obj) {
  26126. if (variable_obj.name == new_name) {
  26127. return;
  26128. }
  26129. if (isValidIdentifier(new_name)) {
  26130. if (variableNameAlreadyExists(new_name, function_obj)) {
  26131. _utils__WEBPACK_IMPORTED_MODULE_4__["renderErrorMessage"](variable_obj_dom.find('.editing_name_var'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('inform_valid_variable_duplicated'));
  26132. } else {
  26133. variable_obj.name = new_name;
  26134. }
  26135. } else {
  26136. _utils__WEBPACK_IMPORTED_MODULE_4__["renderErrorMessage"](variable_obj_dom.find('.editing_name_var'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('inform_valid_name'));
  26137. }
  26138. }
  26139. function variableNameAlreadyExists(name_var, function_obj) {
  26140. if (function_obj.parameters_list) {
  26141. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  26142. if (function_obj.parameters_list[i].name == name_var) {
  26143. return true;
  26144. }
  26145. }
  26146. }
  26147. if (function_obj.variables_list) {
  26148. for (var i = 0; i < function_obj.variables_list.length; i++) {
  26149. if (function_obj.variables_list[i].name == name_var) {
  26150. return true;
  26151. }
  26152. }
  26153. }
  26154. return false;
  26155. }
  26156. function isValidIdentifier(identifier_str) {
  26157. return /^[a-zA-Z_][a-zA-Z0-9_]*$/.test(identifier_str);
  26158. }
  26159. function removeVariable(variable_obj, variable_container) {
  26160. var function_associated = variable_container.data('associatedFunction');
  26161. var index = function_associated.variables_list.indexOf(variable_obj);
  26162. if (index > -1) {
  26163. window.insertContext = true;
  26164. delete function_associated.variables_list[index];
  26165. function_associated.variables_list.splice(index, 1);
  26166. }
  26167. variable_container.children().off();
  26168. variable_container.off();
  26169. variable_container.fadeOut();
  26170. }
  26171. function updateType(variable_obj, new_type) {
  26172. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  26173. variable_obj.type = new_type;
  26174. variable_obj.dimensions = new_dimensions;
  26175. if (new_dimensions > 0) {
  26176. variable_obj.rows = new_dimensions;
  26177. variable_obj.columns = 2;
  26178. }
  26179. updateInitialValues(variable_obj);
  26180. }
  26181. function addHandlers(variable_obj, variable_container, function_obj) {
  26182. // Manage variable name:
  26183. variable_container.find(".enable_edit_name_variable").on('click', function (e) {
  26184. enableNameUpdate(variable_obj, variable_container, function_obj);
  26185. }); // Menu to change type:
  26186. variable_container.find('.ui.dropdown.variable_type').dropdown({
  26187. onChange: function onChange(value, text, $selectedItem) {
  26188. if ($selectedItem.data('dimensions')) {
  26189. updateType(variable_obj, _types__WEBPACK_IMPORTED_MODULE_1__["Types"][$selectedItem.data('type')], $selectedItem.data('dimensions'));
  26190. } else {
  26191. updateType(variable_obj, _types__WEBPACK_IMPORTED_MODULE_1__["Types"][$selectedItem.data('type')]);
  26192. }
  26193. renderValues(variable_obj, variable_container);
  26194. },
  26195. selectOnKeydown: false
  26196. }); // Remove variable:
  26197. variable_container.find(".remove_variable").on('click', function (e) {
  26198. removeVariable(variable_obj, variable_container);
  26199. });
  26200. }
  26201. function renderVariable(function_container, new_var, function_obj) {
  26202. var element = '<div class="ui label variable_container pink"><i class="ui icon ellipsis vertical inverted"></i>';
  26203. element += '<div class="ui dropdown variable_type">';
  26204. if (new_var.dimensions > 0) {
  26205. element += '<div class="text">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(new_var.type.toLowerCase());
  26206. for (var i = 0; i < new_var.dimensions; i++) {
  26207. element += ' [ ] ';
  26208. }
  26209. element += '</div>';
  26210. } else {
  26211. element += '<div class="text">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(new_var.type.toLowerCase()) + '</div>';
  26212. }
  26213. element += '<div class="menu">';
  26214. for (var tm in _types__WEBPACK_IMPORTED_MODULE_1__["Types"]) {
  26215. if (tm == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].VOID.toUpperCase()) {
  26216. continue;
  26217. }
  26218. element += '<div class="item ' + (new_var.type == tm.toLowerCase() ? ' selected ' : '') + '" data-type="' + tm + '" >' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + '</div>';
  26219. }
  26220. for (var tm in _types__WEBPACK_IMPORTED_MODULE_1__["Types"]) {
  26221. if (tm == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].VOID.toUpperCase()) {
  26222. continue;
  26223. }
  26224. element += '<div class="item">' + '<i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + '<div class="menu">' + '<div class="item" data-text="' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + ' [ ] " data-type="' + tm + '" data-dimensions="1">[ ]</div>' + '<div class="item" data-text="' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + ' [ ] [ ] " data-type="' + tm + '" data-dimensions="2">[ ] [ ] </div>' + '</div>' + '</div>';
  26225. }
  26226. element += '</div></div> ';
  26227. element += '<div class="editing_name_var"><span class="span_name_variable enable_edit_name_variable">' + new_var.name + '</span> </div>';
  26228. element += ' <span class="character_equals"> = </span> <div class="ui div_valor_var">' + new_var.value + '</div>';
  26229. element += ' <i class="yellow inverted icon times remove_variable"></i></div>';
  26230. element = jquery__WEBPACK_IMPORTED_MODULE_0___default()(element);
  26231. element.data('associatedFunction', function_obj);
  26232. function_container.find('.variables_list_div').append(element);
  26233. addHandlers(new_var, element, function_obj);
  26234. renderValues(new_var, element);
  26235. return element;
  26236. }
  26237. function updateColumnsAndRowsText(variable_container, variable_var) {
  26238. var prev = variable_container.find('.text').text().split('[');
  26239. if (prev.length == 2) {
  26240. var ff = prev[0] + '[ ' + variable_var.columns + ' ] ';
  26241. variable_container.find('.text').empty();
  26242. variable_container.find('.text').text(ff);
  26243. }
  26244. if (prev.length == 3) {
  26245. var ff = prev[0] + '[ ' + variable_var.columns + ' ] [ ' + variable_var.rows + ' ] ';
  26246. variable_container.find('.text').empty();
  26247. variable_container.find('.text').text(ff);
  26248. }
  26249. }
  26250. function renderValues(new_var, variable_container) {
  26251. var ret = "";
  26252. var j = 0;
  26253. if (new_var.dimensions == 0) {
  26254. if (new_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26255. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + new_var.value.toFixed(1) + '</span> </div> ';
  26256. } else {
  26257. if (new_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  26258. ret += '<div class="created_div_valor_var"><span class="span_value_variable boolean_simple_type">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(new_var.value) + '</span> </div> ';
  26259. } else {
  26260. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + new_var.value + '</span> </div> ';
  26261. }
  26262. }
  26263. } else {
  26264. ret += '<table class="tabela_var">';
  26265. if (new_var.dimensions == 1) {
  26266. ret += '<tr>';
  26267. if (new_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26268. for (var k = 0; k < new_var.columns; k++) {
  26269. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + new_var.value[k].toFixed(1) + '</span></td>';
  26270. }
  26271. } else {
  26272. for (var k = 0; k < new_var.columns; k++) {
  26273. if (new_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  26274. ret += '<td><span class="span_value_variable boolean_vector_var" data-index="' + k + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(new_var.value[k]) + '</span></td>';
  26275. } else {
  26276. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + new_var.value[k] + '</span>' + '</td>';
  26277. }
  26278. }
  26279. }
  26280. ret += '</tr>';
  26281. ret += '</table>';
  26282. ret += '<div class="buttons_manage_columns"><i class="ui icon minus square outline remove_global_vector_column"></i>' + ' <i class="ui icon plus square outline add_global_vector_column"></i></div>';
  26283. }
  26284. if (new_var.dimensions == 2) {
  26285. if (new_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26286. for (var l = 0; l < new_var.rows; l++) {
  26287. ret += '<tr>';
  26288. for (var k = 0; k < new_var.columns; k++) {
  26289. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + new_var.value[l][k].toFixed(1) + '</span>' + '</td>';
  26290. }
  26291. ret += '</tr>';
  26292. }
  26293. } else {
  26294. for (var l = 0; l < new_var.rows; l++) {
  26295. ret += '<tr>';
  26296. for (var k = 0; k < new_var.columns; k++) {
  26297. if (new_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  26298. ret += '<td><span class="span_value_variable boolean_matrix_var" data-index="' + k + '" data-row="' + l + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(new_var.value[l][k]) + '</span></td>';
  26299. } else {
  26300. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + new_var.value[l][k] + '</span></td>';
  26301. }
  26302. }
  26303. ret += '</tr>';
  26304. }
  26305. }
  26306. if (new_var.rows == 0) {
  26307. ret += '<tr><td></td></tr>';
  26308. }
  26309. ret += '<tr><td colspan="' + new_var.columns + '" class="tr_manage_lines"><i class="ui icon minus square outline remove_global_matrix_line"></i>' + ' <i class="ui icon plus square outline add_global_matrix_line"></i></td></tr>';
  26310. ret += '</table>';
  26311. ret += '<div class="buttons_manage_columns"><i class="ui icon minus square outline remove_global_matrix_column"></i>' + ' <i class="ui icon plus square outline add_global_matrix_column"></i></div>';
  26312. }
  26313. }
  26314. jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_container).find(".div_valor_var").html('');
  26315. ret = jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret);
  26316. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find('.span_value_variable').data('associatedOject', new_var);
  26317. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find(".boolean_simple_type").on('click', function (e) {
  26318. alternateBooleanValue(new_var, this.parentNode);
  26319. });
  26320. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find(".simple_var").on('click', function (e) {
  26321. enableValueUpdate(new_var, this.parentNode);
  26322. });
  26323. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find(".boolean_vector_var").on('click', function (e) {
  26324. alternateBooleanVectorValue(new_var, jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('index'), this.parentNode);
  26325. });
  26326. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find(".vector_var").on('click', function (e) {
  26327. enableVectorValueUpdate(new_var, jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('index'), this.parentNode);
  26328. });
  26329. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find(".remove_global_vector_column").on('click', function (e) {
  26330. removeColumnVector(new_var);
  26331. jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_container).find(".div_valor_var").html('');
  26332. renderValues(new_var, variable_container);
  26333. });
  26334. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find(".add_global_vector_column").on('click', function (e) {
  26335. addColumnVector(new_var);
  26336. jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_container).find(".div_valor_var").html('');
  26337. renderValues(new_var, variable_container);
  26338. });
  26339. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find(".remove_global_matrix_column").on('click', function (e) {
  26340. removeColumnMatrix(new_var);
  26341. jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_container).find(".div_valor_var").html('');
  26342. renderValues(new_var, variable_container);
  26343. });
  26344. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find(".add_global_matrix_column").on('click', function (e) {
  26345. addColumnMatrix(new_var);
  26346. jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_container).find(".div_valor_var").html('');
  26347. renderValues(new_var, variable_container);
  26348. });
  26349. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find(".remove_global_matrix_line").on('click', function (e) {
  26350. removeLineMatrix(new_var);
  26351. jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_container).find(".div_valor_var").html('');
  26352. renderValues(new_var, variable_container);
  26353. });
  26354. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find(".add_global_matrix_line").on('click', function (e) {
  26355. addLineMatrix(new_var);
  26356. jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_container).find(".div_valor_var").html('');
  26357. renderValues(new_var, variable_container);
  26358. });
  26359. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find(".boolean_matrix_var").on('click', function (e) {
  26360. alternateBooleanMatrixValue(new_var, jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('row'), jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('index'), this.parentNode);
  26361. });
  26362. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find(".matrix_var").on('click', function (e) {
  26363. enableMatrixValueUpdate(new_var, jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('row'), jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('index'), this.parentNode);
  26364. });
  26365. jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_container).find(".div_valor_var").append(ret);
  26366. updateColumnsAndRowsText(variable_container, new_var);
  26367. }
  26368. function alternateBooleanMatrixValue(var_obj, row, index, value_container) {
  26369. var_obj.value[row][index] = !var_obj.value[row][index];
  26370. jquery__WEBPACK_IMPORTED_MODULE_0___default()(value_container).find('.span_value_variable').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(var_obj.value[row][index]));
  26371. }
  26372. function addLineMatrix(var_obj) {
  26373. var_obj.rows++;
  26374. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  26375. var n_l = [];
  26376. for (var i = 0; i < var_obj.columns; i++) {
  26377. n_l.push(1);
  26378. }
  26379. var_obj.value.push(n_l);
  26380. }
  26381. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26382. var n_l = [];
  26383. for (i = 0; i < var_obj.columns; i++) {
  26384. n_l.push(1.0);
  26385. }
  26386. var_obj.value.push(n_l);
  26387. }
  26388. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  26389. var n_l = [];
  26390. for (i = 0; i < var_obj.columns; i++) {
  26391. n_l.push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start'));
  26392. }
  26393. var_obj.value.push(n_l);
  26394. }
  26395. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  26396. var n_l = [];
  26397. for (i = 0; i < var_obj.columns; i++) {
  26398. n_l.push(true);
  26399. }
  26400. var_obj.value.push(n_l);
  26401. }
  26402. }
  26403. function removeLineMatrix(var_obj) {
  26404. if (var_obj.rows == 0) {
  26405. return;
  26406. }
  26407. var_obj.rows--;
  26408. var_obj.value.splice(var_obj.value.length - 1, 1);
  26409. }
  26410. function addColumnMatrix(var_obj) {
  26411. var_obj.columns++;
  26412. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  26413. for (var i = 0; i < var_obj.rows; i++) {
  26414. var_obj.value[i].push(1);
  26415. }
  26416. }
  26417. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26418. for (var i = 0; i < var_obj.rows; i++) {
  26419. var_obj.value[i].push(1.0);
  26420. }
  26421. }
  26422. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  26423. for (var i = 0; i < var_obj.rows; i++) {
  26424. var_obj.value[i].push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start'));
  26425. }
  26426. }
  26427. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  26428. for (var i = 0; i < var_obj.rows; i++) {
  26429. var_obj.value[i].push(true);
  26430. }
  26431. }
  26432. }
  26433. function removeColumnMatrix(var_obj) {
  26434. if (var_obj.columns == 0) {
  26435. return;
  26436. }
  26437. var_obj.columns--;
  26438. for (var i = 0; i < var_obj.rows; i++) {
  26439. var_obj.value[i].splice(var_obj.value[i].length - 1, 1);
  26440. }
  26441. }
  26442. function addColumnVector(var_obj) {
  26443. var_obj.columns++;
  26444. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  26445. var_obj.value.push(1);
  26446. }
  26447. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26448. var_obj.value.push(1.0);
  26449. }
  26450. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  26451. var_obj.value.push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start'));
  26452. }
  26453. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  26454. var_obj.value.push(true);
  26455. }
  26456. }
  26457. function removeColumnVector(var_obj) {
  26458. if (var_obj.columns == 0) {
  26459. return;
  26460. }
  26461. var_obj.columns--;
  26462. var_obj.value.splice(var_obj.value.length - 1, 1);
  26463. }
  26464. function alternateBooleanValue(var_obj, value_container) {
  26465. var_obj.value = !var_obj.value;
  26466. jquery__WEBPACK_IMPORTED_MODULE_0___default()(value_container).find('.span_value_variable').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(var_obj.value));
  26467. }
  26468. function alternateBooleanVectorValue(var_obj, index, value_container) {
  26469. var_obj.value[index] = !var_obj.value[index];
  26470. jquery__WEBPACK_IMPORTED_MODULE_0___default()(value_container).find('.span_value_variable').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(var_obj.value[index]));
  26471. }
  26472. function updateInitialValues(variable_obj) {
  26473. if (variable_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  26474. if (variable_obj.dimensions == 0) {
  26475. variable_obj.value = 1;
  26476. }
  26477. if (variable_obj.dimensions == 1) {
  26478. variable_obj.value = [1, 1];
  26479. }
  26480. if (variable_obj.dimensions == 2) {
  26481. variable_obj.value = [[1, 1], [1, 1]];
  26482. }
  26483. }
  26484. if (variable_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26485. if (variable_obj.dimensions == 0) {
  26486. variable_obj.value = 1.0;
  26487. }
  26488. if (variable_obj.dimensions == 1) {
  26489. variable_obj.value = [1.0, 1.0];
  26490. }
  26491. if (variable_obj.dimensions == 2) {
  26492. variable_obj.value = [[1.0, 1.0], [1.0, 1.0]];
  26493. }
  26494. }
  26495. if (variable_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  26496. if (variable_obj.dimensions == 0) {
  26497. variable_obj.value = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start');
  26498. }
  26499. if (variable_obj.dimensions == 1) {
  26500. variable_obj.value = [_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start')];
  26501. }
  26502. if (variable_obj.dimensions == 2) {
  26503. variable_obj.value = [[_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start')], [_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start')]];
  26504. }
  26505. }
  26506. if (variable_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  26507. if (variable_obj.dimensions == 0) {
  26508. variable_obj.value = true;
  26509. }
  26510. if (variable_obj.dimensions == 1) {
  26511. variable_obj.value = [true, true];
  26512. }
  26513. if (variable_obj.dimensions == 2) {
  26514. variable_obj.value = [[true, true], [true, true]];
  26515. }
  26516. }
  26517. }
  26518. var opened_name_value_vector_global_ = false;
  26519. var opened_input_value_vector_global_ = null;
  26520. function enableVectorValueUpdate(var_obj, index, parent_node) {
  26521. if (opened_name_value_vector_global_) {
  26522. opened_input_value_vector_global_.focus();
  26523. return;
  26524. }
  26525. parent_node = jquery__WEBPACK_IMPORTED_MODULE_0___default()(parent_node);
  26526. opened_name_value_vector_global_ = true;
  26527. parent_node.find('.span_value_variable').text('');
  26528. var input_field;
  26529. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26530. input_field = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + var_obj.value[index].toFixed(1) + "' />");
  26531. input_field.insertBefore(parent_node.find('.span_value_variable'));
  26532. } else {
  26533. input_field = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + var_obj.value[index] + "' />");
  26534. input_field.insertBefore(parent_node.find('.span_value_variable'));
  26535. }
  26536. input_field.on('input', function () {
  26537. var inputWidth = input_field.textWidth() + 10;
  26538. opened_input_value_vector_global_ = input_field;
  26539. input_field.focus();
  26540. var tmpStr = input_field.val();
  26541. input_field.val('');
  26542. input_field.val(tmpStr);
  26543. input_field.css({
  26544. width: inputWidth
  26545. });
  26546. }).trigger('input');
  26547. input_field.focusout(function () {
  26548. /// update array:
  26549. if (input_field.val().trim()) {
  26550. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26551. var_obj.value[index] = parseFloat(input_field.val().trim());
  26552. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  26553. } else {
  26554. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  26555. var_obj.value[index] = parseInt(input_field.val().trim());
  26556. } else {
  26557. var_obj.value[index] = input_field.val().trim();
  26558. }
  26559. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  26560. }
  26561. } else {
  26562. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26563. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  26564. } else {
  26565. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  26566. }
  26567. }
  26568. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  26569. var_obj.value[index] = input_field.val();
  26570. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  26571. }
  26572. input_field.off();
  26573. input_field.remove(); /// update elements:
  26574. opened_name_value_vector_global_ = false;
  26575. opened_input_value_vector_global_ = false;
  26576. });
  26577. input_field.on('keydown', function (e) {
  26578. var code = e.keyCode || e.which;
  26579. if (code == 13) {
  26580. if (input_field.val().trim()) {
  26581. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26582. var_obj.value[index] = parseFloat(input_field.val().trim());
  26583. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  26584. } else {
  26585. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  26586. var_obj.value[index] = parseInt(input_field.val().trim());
  26587. } else {
  26588. var_obj.value[index] = input_field.val().trim();
  26589. }
  26590. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  26591. }
  26592. } else {
  26593. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26594. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  26595. } else {
  26596. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  26597. }
  26598. }
  26599. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  26600. var_obj.value[index] = input_field.val();
  26601. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  26602. }
  26603. input_field.off();
  26604. input_field.remove(); /// update elements:
  26605. opened_name_value_vector_global_ = false;
  26606. opened_input_value_vector_global_ = false;
  26607. }
  26608. if (code == 27) {
  26609. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26610. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  26611. } else {
  26612. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  26613. }
  26614. input_field.off();
  26615. input_field.remove(); /// update elements:
  26616. opened_name_value_vector_global_ = false;
  26617. opened_input_value_vector_global_ = false;
  26618. }
  26619. });
  26620. input_field.select();
  26621. }
  26622. var opened_name_value_global_var = false;
  26623. var opened_input_value_global_ar = null;
  26624. function enableValueUpdate(var_obj, parent_node) {
  26625. if (opened_name_value_global_var) {
  26626. opened_input_value_global_ar.focus();
  26627. return;
  26628. }
  26629. parent_node = jquery__WEBPACK_IMPORTED_MODULE_0___default()(parent_node);
  26630. opened_name_value_global_var = true;
  26631. var input_field;
  26632. parent_node.find('.span_value_variable').text('');
  26633. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26634. input_field = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + var_obj.value.toFixed(1) + "' />");
  26635. input_field.insertBefore(parent_node.find('.span_value_variable'));
  26636. } else {
  26637. input_field = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + var_obj.value + "' />");
  26638. input_field.insertBefore(parent_node.find('.span_value_variable'));
  26639. }
  26640. input_field.on('input', function () {
  26641. var inputWidth = input_field.textWidth() + 10;
  26642. opened_input_value_global_ar = input_field;
  26643. input_field.focus();
  26644. var tmpStr = input_field.val();
  26645. input_field.val('');
  26646. input_field.val(tmpStr);
  26647. input_field.css({
  26648. width: inputWidth
  26649. });
  26650. }).trigger('input');
  26651. input_field.focusout(function () {
  26652. /// update array:
  26653. if (input_field.val().trim()) {
  26654. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26655. var_obj.value = parseFloat(input_field.val().trim());
  26656. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  26657. } else {
  26658. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  26659. var_obj.value = parseInt(input_field.val().trim());
  26660. } else {
  26661. var_obj.value = input_field.val().trim();
  26662. }
  26663. parent_node.find('.span_value_variable').text(var_obj.value);
  26664. }
  26665. } else {
  26666. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26667. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  26668. } else {
  26669. parent_node.find('.span_value_variable').text(var_obj.value);
  26670. }
  26671. }
  26672. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  26673. var_obj.value = input_field.val();
  26674. parent_node.find('.span_value_variable').text(var_obj.value);
  26675. }
  26676. input_field.off();
  26677. input_field.remove(); /// update elements:
  26678. opened_name_value_global_var = false;
  26679. opened_input_value_global_ar = false;
  26680. });
  26681. input_field.on('keydown', function (e) {
  26682. var code = e.keyCode || e.which;
  26683. if (code == 13) {
  26684. if (input_field.val().trim()) {
  26685. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26686. var_obj.value = parseFloat(input_field.val().trim());
  26687. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  26688. } else {
  26689. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  26690. var_obj.value = parseInt(input_field.val().trim());
  26691. } else {
  26692. var_obj.value = input_field.val().trim();
  26693. }
  26694. parent_node.find('.span_value_variable').text(var_obj.value);
  26695. }
  26696. } else {
  26697. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26698. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  26699. } else {
  26700. parent_node.find('.span_value_variable').text(var_obj.value);
  26701. }
  26702. }
  26703. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  26704. var_obj.value = input_field.val();
  26705. parent_node.find('.span_value_variable').text(var_obj.value);
  26706. }
  26707. input_field.off();
  26708. input_field.remove(); /// update elements:
  26709. opened_name_value_global_var = false;
  26710. opened_input_value_global_ar = false;
  26711. }
  26712. if (code == 27) {
  26713. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26714. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  26715. } else {
  26716. parent_node.find('.span_value_variable').text(var_obj.value);
  26717. }
  26718. input_field.off();
  26719. input_field.remove(); /// update elements:
  26720. opened_name_value_global_var = false;
  26721. opened_input_value_global_ar = false;
  26722. }
  26723. });
  26724. input_field.select();
  26725. }
  26726. var opened_name_global = false;
  26727. var opened_input_global = null;
  26728. function enableNameUpdate(variable_obj, variable_container, function_obj) {
  26729. if (opened_name_global) {
  26730. opened_input_global.focus();
  26731. return;
  26732. }
  26733. opened_name_global = true;
  26734. variable_container.find('.span_name_variable').text('');
  26735. var input_name;
  26736. input_name = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + variable_obj.name + "' />");
  26737. input_name.insertBefore(variable_container.find('.span_name_variable'));
  26738. input_name.on('input', function () {
  26739. var inputWidth = input_name.textWidth() + 10;
  26740. opened_input_global = input_name;
  26741. input_name.focus();
  26742. var tmpStr = input_name.val();
  26743. input_name.val('');
  26744. input_name.val(tmpStr);
  26745. input_name.css({
  26746. width: inputWidth
  26747. });
  26748. }).trigger('input');
  26749. input_name.focusout(function () {
  26750. /// update array:
  26751. if (input_name.val().trim().length > 0) {
  26752. updateName(variable_obj, input_name.val().trim(), variable_container, function_obj);
  26753. variable_container.find('.span_name_variable').text(variable_obj.name);
  26754. } else {
  26755. variable_container.find('.span_name_variable').text(variable_obj.name);
  26756. }
  26757. input_name.off();
  26758. input_name.remove(); /// update elements:
  26759. opened_name_global = false;
  26760. opened_input_global = false;
  26761. });
  26762. input_name.on('keydown', function (e) {
  26763. var code = e.keyCode || e.which;
  26764. if (code == 13) {
  26765. if (input_name.val().trim().length > 0) {
  26766. updateName(variable_obj, input_name.val().trim(), variable_container, function_obj);
  26767. variable_container.find('.span_name_variable').text(variable_obj.name);
  26768. } else {
  26769. variable_container.find('.span_name_variable').text(variable_obj.name);
  26770. }
  26771. input_name.off();
  26772. input_name.remove(); /// update elements:
  26773. opened_name_global = false;
  26774. opened_input_global = false;
  26775. }
  26776. if (code == 27) {
  26777. variable_container.find('.span_name_variable').text(variable_obj.name);
  26778. input_name.off();
  26779. input_name.remove(); /// update elements:
  26780. opened_name_global = false;
  26781. opened_input_global = false;
  26782. }
  26783. });
  26784. input_name.select();
  26785. }
  26786. var opened_name_value_matrix_global_v = false;
  26787. var opened_input_value_matrix_global_v = null;
  26788. function enableMatrixValueUpdate(var_obj, row, index, parent_node) {
  26789. if (opened_name_value_matrix_global_v) {
  26790. opened_input_value_matrix_global_v.focus();
  26791. return;
  26792. }
  26793. parent_node = jquery__WEBPACK_IMPORTED_MODULE_0___default()(parent_node);
  26794. opened_name_value_matrix_global_v = true;
  26795. parent_node.find('.span_value_variable').text('');
  26796. var input_field;
  26797. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26798. input_field = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + var_obj.value[row][index].toFixed(1) + "' />");
  26799. input_field.insertBefore(parent_node.find('.span_value_variable'));
  26800. } else {
  26801. input_field = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + var_obj.value[row][index] + "' />");
  26802. input_field.insertBefore(parent_node.find('.span_value_variable'));
  26803. }
  26804. input_field.on('input', function () {
  26805. var inputWidth = input_field.textWidth() + 10;
  26806. opened_input_value_matrix_global_v = input_field;
  26807. input_field.focus();
  26808. var tmpStr = input_field.val();
  26809. input_field.val('');
  26810. input_field.val(tmpStr);
  26811. input_field.css({
  26812. width: inputWidth
  26813. });
  26814. }).trigger('input');
  26815. input_field.focusout(function () {
  26816. /// update array:
  26817. if (input_field.val().trim()) {
  26818. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26819. var_obj.value[row][index] = parseFloat(input_field.val().trim());
  26820. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  26821. } else {
  26822. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  26823. var_obj.value[row][index] = parseInt(input_field.val().trim());
  26824. } else {
  26825. var_obj.value[row][index] = input_field.val().trim();
  26826. }
  26827. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  26828. }
  26829. } else {
  26830. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26831. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  26832. } else {
  26833. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  26834. }
  26835. }
  26836. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  26837. var_obj.value[row][index] = input_field.val();
  26838. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  26839. }
  26840. input_field.off();
  26841. input_field.remove(); /// update elements:
  26842. opened_name_value_matrix_global_v = false;
  26843. opened_input_value_matrix_global_v = false;
  26844. });
  26845. input_field.on('keydown', function (e) {
  26846. var code = e.keyCode || e.which;
  26847. if (code == 13) {
  26848. if (input_field.val().trim()) {
  26849. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26850. var_obj.value[row][index] = parseFloat(input_field.val().trim());
  26851. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  26852. } else {
  26853. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  26854. var_obj.value[row][index] = parseInt(input_field.val().trim());
  26855. } else {
  26856. var_obj.value[row][index] = input_field.val().trim();
  26857. }
  26858. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  26859. }
  26860. } else {
  26861. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26862. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  26863. } else {
  26864. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  26865. }
  26866. }
  26867. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  26868. var_obj.value[row][index] = input_field.val();
  26869. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  26870. }
  26871. input_field.off();
  26872. input_field.remove(); /// update elements:
  26873. opened_name_value_matrix_global_v = false;
  26874. opened_input_value_matrix_global_v = false;
  26875. }
  26876. if (code == 27) {
  26877. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26878. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  26879. } else {
  26880. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  26881. }
  26882. input_field.off();
  26883. input_field.remove(); /// update elements:
  26884. opened_name_value_matrix_global_v = false;
  26885. opened_input_value_matrix_global_v = false;
  26886. }
  26887. });
  26888. input_field.select();
  26889. }
  26890. /***/ }),
  26891. /***/ "./node_modules/antlr4/BufferedTokenStream.js":
  26892. /*!****************************************************!*\
  26893. !*** ./node_modules/antlr4/BufferedTokenStream.js ***!
  26894. \****************************************************/
  26895. /*! no static exports found */
  26896. /***/ (function(module, exports, __webpack_require__) {
  26897. //
  26898. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  26899. * Use of this file is governed by the BSD 3-clause license that
  26900. * can be found in the LICENSE.txt file in the project root.
  26901. */
  26902. // This implementation of {@link TokenStream} loads tokens from a
  26903. // {@link TokenSource} on-demand, and places the tokens in a buffer to provide
  26904. // access to any previous token by index.
  26905. //
  26906. // <p>
  26907. // This token stream ignores the value of {@link Token//getChannel}. If your
  26908. // parser requires the token stream filter tokens to only those on a particular
  26909. // channel, such as {@link Token//DEFAULT_CHANNEL} or
  26910. // {@link Token//HIDDEN_CHANNEL}, use a filtering token stream such a
  26911. // {@link CommonTokenStream}.</p>
  26912. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  26913. var Lexer = __webpack_require__(/*! ./Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  26914. var Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  26915. // this is just to keep meaningful parameter types to Parser
  26916. function TokenStream() {
  26917. return this;
  26918. }
  26919. function BufferedTokenStream(tokenSource) {
  26920. TokenStream.call(this);
  26921. // The {@link TokenSource} from which tokens for this stream are fetched.
  26922. this.tokenSource = tokenSource;
  26923. // A collection of all tokens fetched from the token source. The list is
  26924. // considered a complete view of the input once {@link //fetchedEOF} is set
  26925. // to {@code true}.
  26926. this.tokens = [];
  26927. // The index into {@link //tokens} of the current token (next token to
  26928. // {@link //consume}). {@link //tokens}{@code [}{@link //p}{@code ]} should
  26929. // be
  26930. // {@link //LT LT(1)}.
  26931. //
  26932. // <p>This field is set to -1 when the stream is first constructed or when
  26933. // {@link //setTokenSource} is called, indicating that the first token has
  26934. // not yet been fetched from the token source. For additional information,
  26935. // see the documentation of {@link IntStream} for a description of
  26936. // Initializing Methods.</p>
  26937. this.index = -1;
  26938. // Indicates whether the {@link Token//EOF} token has been fetched from
  26939. // {@link //tokenSource} and added to {@link //tokens}. This field improves
  26940. // performance for the following cases:
  26941. //
  26942. // <ul>
  26943. // <li>{@link //consume}: The lookahead check in {@link //consume} to
  26944. // prevent
  26945. // consuming the EOF symbol is optimized by checking the values of
  26946. // {@link //fetchedEOF} and {@link //p} instead of calling {@link
  26947. // //LA}.</li>
  26948. // <li>{@link //fetch}: The check to prevent adding multiple EOF symbols
  26949. // into
  26950. // {@link //tokens} is trivial with this field.</li>
  26951. // <ul>
  26952. this.fetchedEOF = false;
  26953. return this;
  26954. }
  26955. BufferedTokenStream.prototype = Object.create(TokenStream.prototype);
  26956. BufferedTokenStream.prototype.constructor = BufferedTokenStream;
  26957. BufferedTokenStream.prototype.mark = function() {
  26958. return 0;
  26959. };
  26960. BufferedTokenStream.prototype.release = function(marker) {
  26961. // no resources to release
  26962. };
  26963. BufferedTokenStream.prototype.reset = function() {
  26964. this.seek(0);
  26965. };
  26966. BufferedTokenStream.prototype.seek = function(index) {
  26967. this.lazyInit();
  26968. this.index = this.adjustSeekIndex(index);
  26969. };
  26970. BufferedTokenStream.prototype.get = function(index) {
  26971. this.lazyInit();
  26972. return this.tokens[index];
  26973. };
  26974. BufferedTokenStream.prototype.consume = function() {
  26975. var skipEofCheck = false;
  26976. if (this.index >= 0) {
  26977. if (this.fetchedEOF) {
  26978. // the last token in tokens is EOF. skip check if p indexes any
  26979. // fetched token except the last.
  26980. skipEofCheck = this.index < this.tokens.length - 1;
  26981. } else {
  26982. // no EOF token in tokens. skip check if p indexes a fetched token.
  26983. skipEofCheck = this.index < this.tokens.length;
  26984. }
  26985. } else {
  26986. // not yet initialized
  26987. skipEofCheck = false;
  26988. }
  26989. if (!skipEofCheck && this.LA(1) === Token.EOF) {
  26990. throw "cannot consume EOF";
  26991. }
  26992. if (this.sync(this.index + 1)) {
  26993. this.index = this.adjustSeekIndex(this.index + 1);
  26994. }
  26995. };
  26996. // Make sure index {@code i} in tokens has a token.
  26997. //
  26998. // @return {@code true} if a token is located at index {@code i}, otherwise
  26999. // {@code false}.
  27000. // @see //get(int i)
  27001. // /
  27002. BufferedTokenStream.prototype.sync = function(i) {
  27003. var n = i - this.tokens.length + 1; // how many more elements we need?
  27004. if (n > 0) {
  27005. var fetched = this.fetch(n);
  27006. return fetched >= n;
  27007. }
  27008. return true;
  27009. };
  27010. // Add {@code n} elements to buffer.
  27011. //
  27012. // @return The actual number of elements added to the buffer.
  27013. // /
  27014. BufferedTokenStream.prototype.fetch = function(n) {
  27015. if (this.fetchedEOF) {
  27016. return 0;
  27017. }
  27018. for (var i = 0; i < n; i++) {
  27019. var t = this.tokenSource.nextToken();
  27020. t.tokenIndex = this.tokens.length;
  27021. this.tokens.push(t);
  27022. if (t.type === Token.EOF) {
  27023. this.fetchedEOF = true;
  27024. return i + 1;
  27025. }
  27026. }
  27027. return n;
  27028. };
  27029. // Get all tokens from start..stop inclusively///
  27030. BufferedTokenStream.prototype.getTokens = function(start, stop, types) {
  27031. if (types === undefined) {
  27032. types = null;
  27033. }
  27034. if (start < 0 || stop < 0) {
  27035. return null;
  27036. }
  27037. this.lazyInit();
  27038. var subset = [];
  27039. if (stop >= this.tokens.length) {
  27040. stop = this.tokens.length - 1;
  27041. }
  27042. for (var i = start; i < stop; i++) {
  27043. var t = this.tokens[i];
  27044. if (t.type === Token.EOF) {
  27045. break;
  27046. }
  27047. if (types === null || types.contains(t.type)) {
  27048. subset.push(t);
  27049. }
  27050. }
  27051. return subset;
  27052. };
  27053. BufferedTokenStream.prototype.LA = function(i) {
  27054. return this.LT(i).type;
  27055. };
  27056. BufferedTokenStream.prototype.LB = function(k) {
  27057. if (this.index - k < 0) {
  27058. return null;
  27059. }
  27060. return this.tokens[this.index - k];
  27061. };
  27062. BufferedTokenStream.prototype.LT = function(k) {
  27063. this.lazyInit();
  27064. if (k === 0) {
  27065. return null;
  27066. }
  27067. if (k < 0) {
  27068. return this.LB(-k);
  27069. }
  27070. var i = this.index + k - 1;
  27071. this.sync(i);
  27072. if (i >= this.tokens.length) { // return EOF token
  27073. // EOF must be last token
  27074. return this.tokens[this.tokens.length - 1];
  27075. }
  27076. return this.tokens[i];
  27077. };
  27078. // Allowed derived classes to modify the behavior of operations which change
  27079. // the current stream position by adjusting the target token index of a seek
  27080. // operation. The default implementation simply returns {@code i}. If an
  27081. // exception is thrown in this method, the current stream index should not be
  27082. // changed.
  27083. //
  27084. // <p>For example, {@link CommonTokenStream} overrides this method to ensure
  27085. // that
  27086. // the seek target is always an on-channel token.</p>
  27087. //
  27088. // @param i The target token index.
  27089. // @return The adjusted target token index.
  27090. BufferedTokenStream.prototype.adjustSeekIndex = function(i) {
  27091. return i;
  27092. };
  27093. BufferedTokenStream.prototype.lazyInit = function() {
  27094. if (this.index === -1) {
  27095. this.setup();
  27096. }
  27097. };
  27098. BufferedTokenStream.prototype.setup = function() {
  27099. this.sync(0);
  27100. this.index = this.adjustSeekIndex(0);
  27101. };
  27102. // Reset this token stream by setting its token source.///
  27103. BufferedTokenStream.prototype.setTokenSource = function(tokenSource) {
  27104. this.tokenSource = tokenSource;
  27105. this.tokens = [];
  27106. this.index = -1;
  27107. this.fetchedEOF = false;
  27108. };
  27109. // Given a starting index, return the index of the next token on channel.
  27110. // Return i if tokens[i] is on channel. Return -1 if there are no tokens
  27111. // on channel between i and EOF.
  27112. // /
  27113. BufferedTokenStream.prototype.nextTokenOnChannel = function(i, channel) {
  27114. this.sync(i);
  27115. if (i >= this.tokens.length) {
  27116. return -1;
  27117. }
  27118. var token = this.tokens[i];
  27119. while (token.channel !== this.channel) {
  27120. if (token.type === Token.EOF) {
  27121. return -1;
  27122. }
  27123. i += 1;
  27124. this.sync(i);
  27125. token = this.tokens[i];
  27126. }
  27127. return i;
  27128. };
  27129. // Given a starting index, return the index of the previous token on channel.
  27130. // Return i if tokens[i] is on channel. Return -1 if there are no tokens
  27131. // on channel between i and 0.
  27132. BufferedTokenStream.prototype.previousTokenOnChannel = function(i, channel) {
  27133. while (i >= 0 && this.tokens[i].channel !== channel) {
  27134. i -= 1;
  27135. }
  27136. return i;
  27137. };
  27138. // Collect all tokens on specified channel to the right of
  27139. // the current token up until we see a token on DEFAULT_TOKEN_CHANNEL or
  27140. // EOF. If channel is -1, find any non default channel token.
  27141. BufferedTokenStream.prototype.getHiddenTokensToRight = function(tokenIndex,
  27142. channel) {
  27143. if (channel === undefined) {
  27144. channel = -1;
  27145. }
  27146. this.lazyInit();
  27147. if (tokenIndex < 0 || tokenIndex >= this.tokens.length) {
  27148. throw "" + tokenIndex + " not in 0.." + this.tokens.length - 1;
  27149. }
  27150. var nextOnChannel = this.nextTokenOnChannel(tokenIndex + 1, Lexer.DEFAULT_TOKEN_CHANNEL);
  27151. var from_ = tokenIndex + 1;
  27152. // if none onchannel to right, nextOnChannel=-1 so set to = last token
  27153. var to = nextOnChannel === -1 ? this.tokens.length - 1 : nextOnChannel;
  27154. return this.filterForChannel(from_, to, channel);
  27155. };
  27156. // Collect all tokens on specified channel to the left of
  27157. // the current token up until we see a token on DEFAULT_TOKEN_CHANNEL.
  27158. // If channel is -1, find any non default channel token.
  27159. BufferedTokenStream.prototype.getHiddenTokensToLeft = function(tokenIndex,
  27160. channel) {
  27161. if (channel === undefined) {
  27162. channel = -1;
  27163. }
  27164. this.lazyInit();
  27165. if (tokenIndex < 0 || tokenIndex >= this.tokens.length) {
  27166. throw "" + tokenIndex + " not in 0.." + this.tokens.length - 1;
  27167. }
  27168. var prevOnChannel = this.previousTokenOnChannel(tokenIndex - 1, Lexer.DEFAULT_TOKEN_CHANNEL);
  27169. if (prevOnChannel === tokenIndex - 1) {
  27170. return null;
  27171. }
  27172. // if none on channel to left, prevOnChannel=-1 then from=0
  27173. var from_ = prevOnChannel + 1;
  27174. var to = tokenIndex - 1;
  27175. return this.filterForChannel(from_, to, channel);
  27176. };
  27177. BufferedTokenStream.prototype.filterForChannel = function(left, right, channel) {
  27178. var hidden = [];
  27179. for (var i = left; i < right + 1; i++) {
  27180. var t = this.tokens[i];
  27181. if (channel === -1) {
  27182. if (t.channel !== Lexer.DEFAULT_TOKEN_CHANNEL) {
  27183. hidden.push(t);
  27184. }
  27185. } else if (t.channel === channel) {
  27186. hidden.push(t);
  27187. }
  27188. }
  27189. if (hidden.length === 0) {
  27190. return null;
  27191. }
  27192. return hidden;
  27193. };
  27194. BufferedTokenStream.prototype.getSourceName = function() {
  27195. return this.tokenSource.getSourceName();
  27196. };
  27197. // Get the text of all tokens in this buffer.///
  27198. BufferedTokenStream.prototype.getText = function(interval) {
  27199. this.lazyInit();
  27200. this.fill();
  27201. if (interval === undefined || interval === null) {
  27202. interval = new Interval(0, this.tokens.length - 1);
  27203. }
  27204. var start = interval.start;
  27205. if (start instanceof Token) {
  27206. start = start.tokenIndex;
  27207. }
  27208. var stop = interval.stop;
  27209. if (stop instanceof Token) {
  27210. stop = stop.tokenIndex;
  27211. }
  27212. if (start === null || stop === null || start < 0 || stop < 0) {
  27213. return "";
  27214. }
  27215. if (stop >= this.tokens.length) {
  27216. stop = this.tokens.length - 1;
  27217. }
  27218. var s = "";
  27219. for (var i = start; i < stop + 1; i++) {
  27220. var t = this.tokens[i];
  27221. if (t.type === Token.EOF) {
  27222. break;
  27223. }
  27224. s = s + t.text;
  27225. }
  27226. return s;
  27227. };
  27228. // Get all tokens from lexer until EOF///
  27229. BufferedTokenStream.prototype.fill = function() {
  27230. this.lazyInit();
  27231. while (this.fetch(1000) === 1000) {
  27232. continue;
  27233. }
  27234. };
  27235. exports.BufferedTokenStream = BufferedTokenStream;
  27236. /***/ }),
  27237. /***/ "./node_modules/antlr4/CharStreams.js":
  27238. /*!********************************************!*\
  27239. !*** ./node_modules/antlr4/CharStreams.js ***!
  27240. \********************************************/
  27241. /*! no static exports found */
  27242. /***/ (function(module, exports, __webpack_require__) {
  27243. //
  27244. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27245. * Use of this file is governed by the BSD 3-clause license that
  27246. * can be found in the LICENSE.txt file in the project root.
  27247. */
  27248. //
  27249. var InputStream = __webpack_require__(/*! ./InputStream */ "./node_modules/antlr4/InputStream.js").InputStream;
  27250. var isNodeJs = typeof window === 'undefined' && typeof importScripts === 'undefined';
  27251. var fs = isNodeJs ? __webpack_require__(/*! fs */ "./node_modules/node-libs-browser/mock/empty.js") : null;
  27252. // Utility functions to create InputStreams from various sources.
  27253. //
  27254. // All returned InputStreams support the full range of Unicode
  27255. // up to U+10FFFF (the default behavior of InputStream only supports
  27256. // code points up to U+FFFF).
  27257. var CharStreams = {
  27258. // Creates an InputStream from a string.
  27259. fromString: function(str) {
  27260. return new InputStream(str, true);
  27261. },
  27262. // Asynchronously creates an InputStream from a blob given the
  27263. // encoding of the bytes in that blob (defaults to 'utf8' if
  27264. // encoding is null).
  27265. //
  27266. // Invokes onLoad(result) on success, onError(error) on
  27267. // failure.
  27268. fromBlob: function(blob, encoding, onLoad, onError) {
  27269. var reader = FileReader();
  27270. reader.onload = function(e) {
  27271. var is = new InputStream(e.target.result, true);
  27272. onLoad(is);
  27273. };
  27274. reader.onerror = onError;
  27275. reader.readAsText(blob, encoding);
  27276. },
  27277. // Creates an InputStream from a Buffer given the
  27278. // encoding of the bytes in that buffer (defaults to 'utf8' if
  27279. // encoding is null).
  27280. fromBuffer: function(buffer, encoding) {
  27281. return new InputStream(buffer.toString(encoding), true);
  27282. },
  27283. // Asynchronously creates an InputStream from a file on disk given
  27284. // the encoding of the bytes in that file (defaults to 'utf8' if
  27285. // encoding is null).
  27286. //
  27287. // Invokes callback(error, result) on completion.
  27288. fromPath: function(path, encoding, callback) {
  27289. fs.readFile(path, encoding, function(err, data) {
  27290. var is = null;
  27291. if (data !== null) {
  27292. is = new InputStream(data, true);
  27293. }
  27294. callback(err, is);
  27295. });
  27296. },
  27297. // Synchronously creates an InputStream given a path to a file
  27298. // on disk and the encoding of the bytes in that file (defaults to
  27299. // 'utf8' if encoding is null).
  27300. fromPathSync: function(path, encoding) {
  27301. var data = fs.readFileSync(path, encoding);
  27302. return new InputStream(data, true);
  27303. }
  27304. };
  27305. exports.CharStreams = CharStreams;
  27306. /***/ }),
  27307. /***/ "./node_modules/antlr4/CommonTokenFactory.js":
  27308. /*!***************************************************!*\
  27309. !*** ./node_modules/antlr4/CommonTokenFactory.js ***!
  27310. \***************************************************/
  27311. /*! no static exports found */
  27312. /***/ (function(module, exports, __webpack_require__) {
  27313. //
  27314. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27315. * Use of this file is governed by the BSD 3-clause license that
  27316. * can be found in the LICENSE.txt file in the project root.
  27317. */
  27318. //
  27319. //
  27320. // This default implementation of {@link TokenFactory} creates
  27321. // {@link CommonToken} objects.
  27322. //
  27323. var CommonToken = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").CommonToken;
  27324. function TokenFactory() {
  27325. return this;
  27326. }
  27327. function CommonTokenFactory(copyText) {
  27328. TokenFactory.call(this);
  27329. // Indicates whether {@link CommonToken//setText} should be called after
  27330. // constructing tokens to explicitly set the text. This is useful for cases
  27331. // where the input stream might not be able to provide arbitrary substrings
  27332. // of text from the input after the lexer creates a token (e.g. the
  27333. // implementation of {@link CharStream//getText} in
  27334. // {@link UnbufferedCharStream} throws an
  27335. // {@link UnsupportedOperationException}). Explicitly setting the token text
  27336. // allows {@link Token//getText} to be called at any time regardless of the
  27337. // input stream implementation.
  27338. //
  27339. // <p>
  27340. // The default value is {@code false} to avoid the performance and memory
  27341. // overhead of copying text for every token unless explicitly requested.</p>
  27342. //
  27343. this.copyText = copyText===undefined ? false : copyText;
  27344. return this;
  27345. }
  27346. CommonTokenFactory.prototype = Object.create(TokenFactory.prototype);
  27347. CommonTokenFactory.prototype.constructor = CommonTokenFactory;
  27348. //
  27349. // The default {@link CommonTokenFactory} instance.
  27350. //
  27351. // <p>
  27352. // This token factory does not explicitly copy token text when constructing
  27353. // tokens.</p>
  27354. //
  27355. CommonTokenFactory.DEFAULT = new CommonTokenFactory();
  27356. CommonTokenFactory.prototype.create = function(source, type, text, channel, start, stop, line, column) {
  27357. var t = new CommonToken(source, type, channel, start, stop);
  27358. t.line = line;
  27359. t.column = column;
  27360. if (text !==null) {
  27361. t.text = text;
  27362. } else if (this.copyText && source[1] !==null) {
  27363. t.text = source[1].getText(start,stop);
  27364. }
  27365. return t;
  27366. };
  27367. CommonTokenFactory.prototype.createThin = function(type, text) {
  27368. var t = new CommonToken(null, type);
  27369. t.text = text;
  27370. return t;
  27371. };
  27372. exports.CommonTokenFactory = CommonTokenFactory;
  27373. /***/ }),
  27374. /***/ "./node_modules/antlr4/CommonTokenStream.js":
  27375. /*!**************************************************!*\
  27376. !*** ./node_modules/antlr4/CommonTokenStream.js ***!
  27377. \**************************************************/
  27378. /*! no static exports found */
  27379. /***/ (function(module, exports, __webpack_require__) {
  27380. //
  27381. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27382. * Use of this file is governed by the BSD 3-clause license that
  27383. * can be found in the LICENSE.txt file in the project root.
  27384. */
  27385. ///
  27386. //
  27387. // This class extends {@link BufferedTokenStream} with functionality to filter
  27388. // token streams to tokens on a particular channel (tokens where
  27389. // {@link Token//getChannel} returns a particular value).
  27390. //
  27391. // <p>
  27392. // This token stream provides access to all tokens by index or when calling
  27393. // methods like {@link //getText}. The channel filtering is only used for code
  27394. // accessing tokens via the lookahead methods {@link //LA}, {@link //LT}, and
  27395. // {@link //LB}.</p>
  27396. //
  27397. // <p>
  27398. // By default, tokens are placed on the default channel
  27399. // ({@link Token//DEFAULT_CHANNEL}), but may be reassigned by using the
  27400. // {@code ->channel(HIDDEN)} lexer command, or by using an embedded action to
  27401. // call {@link Lexer//setChannel}.
  27402. // </p>
  27403. //
  27404. // <p>
  27405. // Note: lexer rules which use the {@code ->skip} lexer command or call
  27406. // {@link Lexer//skip} do not produce tokens at all, so input text matched by
  27407. // such a rule will not be available as part of the token stream, regardless of
  27408. // channel.</p>
  27409. ///
  27410. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  27411. var BufferedTokenStream = __webpack_require__(/*! ./BufferedTokenStream */ "./node_modules/antlr4/BufferedTokenStream.js").BufferedTokenStream;
  27412. function CommonTokenStream(lexer, channel) {
  27413. BufferedTokenStream.call(this, lexer);
  27414. this.channel = channel===undefined ? Token.DEFAULT_CHANNEL : channel;
  27415. return this;
  27416. }
  27417. CommonTokenStream.prototype = Object.create(BufferedTokenStream.prototype);
  27418. CommonTokenStream.prototype.constructor = CommonTokenStream;
  27419. CommonTokenStream.prototype.adjustSeekIndex = function(i) {
  27420. return this.nextTokenOnChannel(i, this.channel);
  27421. };
  27422. CommonTokenStream.prototype.LB = function(k) {
  27423. if (k===0 || this.index-k<0) {
  27424. return null;
  27425. }
  27426. var i = this.index;
  27427. var n = 1;
  27428. // find k good tokens looking backwards
  27429. while (n <= k) {
  27430. // skip off-channel tokens
  27431. i = this.previousTokenOnChannel(i - 1, this.channel);
  27432. n += 1;
  27433. }
  27434. if (i < 0) {
  27435. return null;
  27436. }
  27437. return this.tokens[i];
  27438. };
  27439. CommonTokenStream.prototype.LT = function(k) {
  27440. this.lazyInit();
  27441. if (k === 0) {
  27442. return null;
  27443. }
  27444. if (k < 0) {
  27445. return this.LB(-k);
  27446. }
  27447. var i = this.index;
  27448. var n = 1; // we know tokens[pos] is a good one
  27449. // find k good tokens
  27450. while (n < k) {
  27451. // skip off-channel tokens, but make sure to not look past EOF
  27452. if (this.sync(i + 1)) {
  27453. i = this.nextTokenOnChannel(i + 1, this.channel);
  27454. }
  27455. n += 1;
  27456. }
  27457. return this.tokens[i];
  27458. };
  27459. // Count EOF just once.///
  27460. CommonTokenStream.prototype.getNumberOfOnChannelTokens = function() {
  27461. var n = 0;
  27462. this.fill();
  27463. for (var i =0; i< this.tokens.length;i++) {
  27464. var t = this.tokens[i];
  27465. if( t.channel===this.channel) {
  27466. n += 1;
  27467. }
  27468. if( t.type===Token.EOF) {
  27469. break;
  27470. }
  27471. }
  27472. return n;
  27473. };
  27474. exports.CommonTokenStream = CommonTokenStream;
  27475. /***/ }),
  27476. /***/ "./node_modules/antlr4/FileStream.js":
  27477. /*!*******************************************!*\
  27478. !*** ./node_modules/antlr4/FileStream.js ***!
  27479. \*******************************************/
  27480. /*! no static exports found */
  27481. /***/ (function(module, exports, __webpack_require__) {
  27482. //
  27483. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27484. * Use of this file is governed by the BSD 3-clause license that
  27485. * can be found in the LICENSE.txt file in the project root.
  27486. */
  27487. //
  27488. //
  27489. // This is an InputStream that is loaded from a file all at once
  27490. // when you construct the object.
  27491. //
  27492. var InputStream = __webpack_require__(/*! ./InputStream */ "./node_modules/antlr4/InputStream.js").InputStream;
  27493. var isNodeJs = typeof window === 'undefined' && typeof importScripts === 'undefined';
  27494. var fs = isNodeJs ? __webpack_require__(/*! fs */ "./node_modules/node-libs-browser/mock/empty.js") : null;
  27495. function FileStream(fileName, decodeToUnicodeCodePoints) {
  27496. var data = fs.readFileSync(fileName, "utf8");
  27497. InputStream.call(this, data, decodeToUnicodeCodePoints);
  27498. this.fileName = fileName;
  27499. return this;
  27500. }
  27501. FileStream.prototype = Object.create(InputStream.prototype);
  27502. FileStream.prototype.constructor = FileStream;
  27503. exports.FileStream = FileStream;
  27504. /***/ }),
  27505. /***/ "./node_modules/antlr4/InputStream.js":
  27506. /*!********************************************!*\
  27507. !*** ./node_modules/antlr4/InputStream.js ***!
  27508. \********************************************/
  27509. /*! no static exports found */
  27510. /***/ (function(module, exports, __webpack_require__) {
  27511. //
  27512. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27513. * Use of this file is governed by the BSD 3-clause license that
  27514. * can be found in the LICENSE.txt file in the project root.
  27515. */
  27516. //
  27517. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  27518. __webpack_require__(/*! ./polyfills/codepointat */ "./node_modules/antlr4/polyfills/codepointat.js");
  27519. __webpack_require__(/*! ./polyfills/fromcodepoint */ "./node_modules/antlr4/polyfills/fromcodepoint.js");
  27520. // Vacuum all input from a string and then treat it like a buffer.
  27521. function _loadString(stream, decodeToUnicodeCodePoints) {
  27522. stream._index = 0;
  27523. stream.data = [];
  27524. if (stream.decodeToUnicodeCodePoints) {
  27525. for (var i = 0; i < stream.strdata.length; ) {
  27526. var codePoint = stream.strdata.codePointAt(i);
  27527. stream.data.push(codePoint);
  27528. i += codePoint <= 0xFFFF ? 1 : 2;
  27529. }
  27530. } else {
  27531. for (var i = 0; i < stream.strdata.length; i++) {
  27532. var codeUnit = stream.strdata.charCodeAt(i);
  27533. stream.data.push(codeUnit);
  27534. }
  27535. }
  27536. stream._size = stream.data.length;
  27537. }
  27538. // If decodeToUnicodeCodePoints is true, the input is treated
  27539. // as a series of Unicode code points.
  27540. //
  27541. // Otherwise, the input is treated as a series of 16-bit UTF-16 code
  27542. // units.
  27543. function InputStream(data, decodeToUnicodeCodePoints) {
  27544. this.name = "<empty>";
  27545. this.strdata = data;
  27546. this.decodeToUnicodeCodePoints = decodeToUnicodeCodePoints || false;
  27547. _loadString(this);
  27548. return this;
  27549. }
  27550. Object.defineProperty(InputStream.prototype, "index", {
  27551. get : function() {
  27552. return this._index;
  27553. }
  27554. });
  27555. Object.defineProperty(InputStream.prototype, "size", {
  27556. get : function() {
  27557. return this._size;
  27558. }
  27559. });
  27560. // Reset the stream so that it's in the same state it was
  27561. // when the object was created *except* the data array is not
  27562. // touched.
  27563. //
  27564. InputStream.prototype.reset = function() {
  27565. this._index = 0;
  27566. };
  27567. InputStream.prototype.consume = function() {
  27568. if (this._index >= this._size) {
  27569. // assert this.LA(1) == Token.EOF
  27570. throw ("cannot consume EOF");
  27571. }
  27572. this._index += 1;
  27573. };
  27574. InputStream.prototype.LA = function(offset) {
  27575. if (offset === 0) {
  27576. return 0; // undefined
  27577. }
  27578. if (offset < 0) {
  27579. offset += 1; // e.g., translate LA(-1) to use offset=0
  27580. }
  27581. var pos = this._index + offset - 1;
  27582. if (pos < 0 || pos >= this._size) { // invalid
  27583. return Token.EOF;
  27584. }
  27585. return this.data[pos];
  27586. };
  27587. InputStream.prototype.LT = function(offset) {
  27588. return this.LA(offset);
  27589. };
  27590. // mark/release do nothing; we have entire buffer
  27591. InputStream.prototype.mark = function() {
  27592. return -1;
  27593. };
  27594. InputStream.prototype.release = function(marker) {
  27595. };
  27596. // consume() ahead until p==_index; can't just set p=_index as we must
  27597. // update line and column. If we seek backwards, just set p
  27598. //
  27599. InputStream.prototype.seek = function(_index) {
  27600. if (_index <= this._index) {
  27601. this._index = _index; // just jump; don't update stream state (line,
  27602. // ...)
  27603. return;
  27604. }
  27605. // seek forward
  27606. this._index = Math.min(_index, this._size);
  27607. };
  27608. InputStream.prototype.getText = function(start, stop) {
  27609. if (stop >= this._size) {
  27610. stop = this._size - 1;
  27611. }
  27612. if (start >= this._size) {
  27613. return "";
  27614. } else {
  27615. if (this.decodeToUnicodeCodePoints) {
  27616. var result = "";
  27617. for (var i = start; i <= stop; i++) {
  27618. result += String.fromCodePoint(this.data[i]);
  27619. }
  27620. return result;
  27621. } else {
  27622. return this.strdata.slice(start, stop + 1);
  27623. }
  27624. }
  27625. };
  27626. InputStream.prototype.toString = function() {
  27627. return this.strdata;
  27628. };
  27629. exports.InputStream = InputStream;
  27630. /***/ }),
  27631. /***/ "./node_modules/antlr4/IntervalSet.js":
  27632. /*!********************************************!*\
  27633. !*** ./node_modules/antlr4/IntervalSet.js ***!
  27634. \********************************************/
  27635. /*! no static exports found */
  27636. /***/ (function(module, exports, __webpack_require__) {
  27637. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27638. * Use of this file is governed by the BSD 3-clause license that
  27639. * can be found in the LICENSE.txt file in the project root.
  27640. */
  27641. /*jslint smarttabs:true */
  27642. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  27643. /* stop is not included! */
  27644. function Interval(start, stop) {
  27645. this.start = start;
  27646. this.stop = stop;
  27647. return this;
  27648. }
  27649. Interval.prototype.contains = function(item) {
  27650. return item >= this.start && item < this.stop;
  27651. };
  27652. Interval.prototype.toString = function() {
  27653. if(this.start===this.stop-1) {
  27654. return this.start.toString();
  27655. } else {
  27656. return this.start.toString() + ".." + (this.stop-1).toString();
  27657. }
  27658. };
  27659. Object.defineProperty(Interval.prototype, "length", {
  27660. get : function() {
  27661. return this.stop - this.start;
  27662. }
  27663. });
  27664. function IntervalSet() {
  27665. this.intervals = null;
  27666. this.readOnly = false;
  27667. }
  27668. IntervalSet.prototype.first = function(v) {
  27669. if (this.intervals === null || this.intervals.length===0) {
  27670. return Token.INVALID_TYPE;
  27671. } else {
  27672. return this.intervals[0].start;
  27673. }
  27674. };
  27675. IntervalSet.prototype.addOne = function(v) {
  27676. this.addInterval(new Interval(v, v + 1));
  27677. };
  27678. IntervalSet.prototype.addRange = function(l, h) {
  27679. this.addInterval(new Interval(l, h + 1));
  27680. };
  27681. IntervalSet.prototype.addInterval = function(v) {
  27682. if (this.intervals === null) {
  27683. this.intervals = [];
  27684. this.intervals.push(v);
  27685. } else {
  27686. // find insert pos
  27687. for (var k = 0; k < this.intervals.length; k++) {
  27688. var i = this.intervals[k];
  27689. // distinct range -> insert
  27690. if (v.stop < i.start) {
  27691. this.intervals.splice(k, 0, v);
  27692. return;
  27693. }
  27694. // contiguous range -> adjust
  27695. else if (v.stop === i.start) {
  27696. this.intervals[k].start = v.start;
  27697. return;
  27698. }
  27699. // overlapping range -> adjust and reduce
  27700. else if (v.start <= i.stop) {
  27701. this.intervals[k] = new Interval(Math.min(i.start, v.start), Math.max(i.stop, v.stop));
  27702. this.reduce(k);
  27703. return;
  27704. }
  27705. }
  27706. // greater than any existing
  27707. this.intervals.push(v);
  27708. }
  27709. };
  27710. IntervalSet.prototype.addSet = function(other) {
  27711. if (other.intervals !== null) {
  27712. for (var k = 0; k < other.intervals.length; k++) {
  27713. var i = other.intervals[k];
  27714. this.addInterval(new Interval(i.start, i.stop));
  27715. }
  27716. }
  27717. return this;
  27718. };
  27719. IntervalSet.prototype.reduce = function(k) {
  27720. // only need to reduce if k is not the last
  27721. if (k < this.intervalslength - 1) {
  27722. var l = this.intervals[k];
  27723. var r = this.intervals[k + 1];
  27724. // if r contained in l
  27725. if (l.stop >= r.stop) {
  27726. this.intervals.pop(k + 1);
  27727. this.reduce(k);
  27728. } else if (l.stop >= r.start) {
  27729. this.intervals[k] = new Interval(l.start, r.stop);
  27730. this.intervals.pop(k + 1);
  27731. }
  27732. }
  27733. };
  27734. IntervalSet.prototype.complement = function(start, stop) {
  27735. var result = new IntervalSet();
  27736. result.addInterval(new Interval(start,stop+1));
  27737. for(var i=0; i<this.intervals.length; i++) {
  27738. result.removeRange(this.intervals[i]);
  27739. }
  27740. return result;
  27741. };
  27742. IntervalSet.prototype.contains = function(item) {
  27743. if (this.intervals === null) {
  27744. return false;
  27745. } else {
  27746. for (var k = 0; k < this.intervals.length; k++) {
  27747. if(this.intervals[k].contains(item)) {
  27748. return true;
  27749. }
  27750. }
  27751. return false;
  27752. }
  27753. };
  27754. Object.defineProperty(IntervalSet.prototype, "length", {
  27755. get : function() {
  27756. var len = 0;
  27757. this.intervals.map(function(i) {len += i.length;});
  27758. return len;
  27759. }
  27760. });
  27761. IntervalSet.prototype.removeRange = function(v) {
  27762. if(v.start===v.stop-1) {
  27763. this.removeOne(v.start);
  27764. } else if (this.intervals!==null) {
  27765. var k = 0;
  27766. for(var n=0; n<this.intervals.length; n++) {
  27767. var i = this.intervals[k];
  27768. // intervals are ordered
  27769. if (v.stop<=i.start) {
  27770. return;
  27771. }
  27772. // check for including range, split it
  27773. else if(v.start>i.start && v.stop<i.stop) {
  27774. this.intervals[k] = new Interval(i.start, v.start);
  27775. var x = new Interval(v.stop, i.stop);
  27776. this.intervals.splice(k, 0, x);
  27777. return;
  27778. }
  27779. // check for included range, remove it
  27780. else if(v.start<=i.start && v.stop>=i.stop) {
  27781. this.intervals.splice(k, 1);
  27782. k = k - 1; // need another pass
  27783. }
  27784. // check for lower boundary
  27785. else if(v.start<i.stop) {
  27786. this.intervals[k] = new Interval(i.start, v.start);
  27787. }
  27788. // check for upper boundary
  27789. else if(v.stop<i.stop) {
  27790. this.intervals[k] = new Interval(v.stop, i.stop);
  27791. }
  27792. k += 1;
  27793. }
  27794. }
  27795. };
  27796. IntervalSet.prototype.removeOne = function(v) {
  27797. if (this.intervals !== null) {
  27798. for (var k = 0; k < this.intervals.length; k++) {
  27799. var i = this.intervals[k];
  27800. // intervals is ordered
  27801. if (v < i.start) {
  27802. return;
  27803. }
  27804. // check for single value range
  27805. else if (v === i.start && v === i.stop - 1) {
  27806. this.intervals.splice(k, 1);
  27807. return;
  27808. }
  27809. // check for lower boundary
  27810. else if (v === i.start) {
  27811. this.intervals[k] = new Interval(i.start + 1, i.stop);
  27812. return;
  27813. }
  27814. // check for upper boundary
  27815. else if (v === i.stop - 1) {
  27816. this.intervals[k] = new Interval(i.start, i.stop - 1);
  27817. return;
  27818. }
  27819. // split existing range
  27820. else if (v < i.stop - 1) {
  27821. var x = new Interval(i.start, v);
  27822. i.start = v + 1;
  27823. this.intervals.splice(k, 0, x);
  27824. return;
  27825. }
  27826. }
  27827. }
  27828. };
  27829. IntervalSet.prototype.toString = function(literalNames, symbolicNames, elemsAreChar) {
  27830. literalNames = literalNames || null;
  27831. symbolicNames = symbolicNames || null;
  27832. elemsAreChar = elemsAreChar || false;
  27833. if (this.intervals === null) {
  27834. return "{}";
  27835. } else if(literalNames!==null || symbolicNames!==null) {
  27836. return this.toTokenString(literalNames, symbolicNames);
  27837. } else if(elemsAreChar) {
  27838. return this.toCharString();
  27839. } else {
  27840. return this.toIndexString();
  27841. }
  27842. };
  27843. IntervalSet.prototype.toCharString = function() {
  27844. var names = [];
  27845. for (var i = 0; i < this.intervals.length; i++) {
  27846. var v = this.intervals[i];
  27847. if(v.stop===v.start+1) {
  27848. if ( v.start===Token.EOF ) {
  27849. names.push("<EOF>");
  27850. } else {
  27851. names.push("'" + String.fromCharCode(v.start) + "'");
  27852. }
  27853. } else {
  27854. names.push("'" + String.fromCharCode(v.start) + "'..'" + String.fromCharCode(v.stop-1) + "'");
  27855. }
  27856. }
  27857. if (names.length > 1) {
  27858. return "{" + names.join(", ") + "}";
  27859. } else {
  27860. return names[0];
  27861. }
  27862. };
  27863. IntervalSet.prototype.toIndexString = function() {
  27864. var names = [];
  27865. for (var i = 0; i < this.intervals.length; i++) {
  27866. var v = this.intervals[i];
  27867. if(v.stop===v.start+1) {
  27868. if ( v.start===Token.EOF ) {
  27869. names.push("<EOF>");
  27870. } else {
  27871. names.push(v.start.toString());
  27872. }
  27873. } else {
  27874. names.push(v.start.toString() + ".." + (v.stop-1).toString());
  27875. }
  27876. }
  27877. if (names.length > 1) {
  27878. return "{" + names.join(", ") + "}";
  27879. } else {
  27880. return names[0];
  27881. }
  27882. };
  27883. IntervalSet.prototype.toTokenString = function(literalNames, symbolicNames) {
  27884. var names = [];
  27885. for (var i = 0; i < this.intervals.length; i++) {
  27886. var v = this.intervals[i];
  27887. for (var j = v.start; j < v.stop; j++) {
  27888. names.push(this.elementName(literalNames, symbolicNames, j));
  27889. }
  27890. }
  27891. if (names.length > 1) {
  27892. return "{" + names.join(", ") + "}";
  27893. } else {
  27894. return names[0];
  27895. }
  27896. };
  27897. IntervalSet.prototype.elementName = function(literalNames, symbolicNames, a) {
  27898. if (a === Token.EOF) {
  27899. return "<EOF>";
  27900. } else if (a === Token.EPSILON) {
  27901. return "<EPSILON>";
  27902. } else {
  27903. return literalNames[a] || symbolicNames[a];
  27904. }
  27905. };
  27906. exports.Interval = Interval;
  27907. exports.IntervalSet = IntervalSet;
  27908. /***/ }),
  27909. /***/ "./node_modules/antlr4/LL1Analyzer.js":
  27910. /*!********************************************!*\
  27911. !*** ./node_modules/antlr4/LL1Analyzer.js ***!
  27912. \********************************************/
  27913. /*! no static exports found */
  27914. /***/ (function(module, exports, __webpack_require__) {
  27915. //
  27916. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27917. * Use of this file is governed by the BSD 3-clause license that
  27918. * can be found in the LICENSE.txt file in the project root.
  27919. */
  27920. ///
  27921. var Set = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js").Set;
  27922. var BitSet = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js").BitSet;
  27923. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  27924. var ATNConfig = __webpack_require__(/*! ./atn/ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").ATNConfig;
  27925. var Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  27926. var IntervalSet = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  27927. var RuleStopState = __webpack_require__(/*! ./atn/ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  27928. var RuleTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").RuleTransition;
  27929. var NotSetTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").NotSetTransition;
  27930. var WildcardTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").WildcardTransition;
  27931. var AbstractPredicateTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").AbstractPredicateTransition;
  27932. var pc = __webpack_require__(/*! ./PredictionContext */ "./node_modules/antlr4/PredictionContext.js");
  27933. var predictionContextFromRuleContext = pc.predictionContextFromRuleContext;
  27934. var PredictionContext = pc.PredictionContext;
  27935. var SingletonPredictionContext = pc.SingletonPredictionContext;
  27936. function LL1Analyzer (atn) {
  27937. this.atn = atn;
  27938. }
  27939. //* Special value added to the lookahead sets to indicate that we hit
  27940. // a predicate during analysis if {@code seeThruPreds==false}.
  27941. ///
  27942. LL1Analyzer.HIT_PRED = Token.INVALID_TYPE;
  27943. //*
  27944. // Calculates the SLL(1) expected lookahead set for each outgoing transition
  27945. // of an {@link ATNState}. The returned array has one element for each
  27946. // outgoing transition in {@code s}. If the closure from transition
  27947. // <em>i</em> leads to a semantic predicate before matching a symbol, the
  27948. // element at index <em>i</em> of the result will be {@code null}.
  27949. //
  27950. // @param s the ATN state
  27951. // @return the expected symbols for each outgoing transition of {@code s}.
  27952. ///
  27953. LL1Analyzer.prototype.getDecisionLookahead = function(s) {
  27954. if (s === null) {
  27955. return null;
  27956. }
  27957. var count = s.transitions.length;
  27958. var look = [];
  27959. for(var alt=0; alt< count; alt++) {
  27960. look[alt] = new IntervalSet();
  27961. var lookBusy = new Set();
  27962. var seeThruPreds = false; // fail to get lookahead upon pred
  27963. this._LOOK(s.transition(alt).target, null, PredictionContext.EMPTY,
  27964. look[alt], lookBusy, new BitSet(), seeThruPreds, false);
  27965. // Wipe out lookahead for this alternative if we found nothing
  27966. // or we had a predicate when we !seeThruPreds
  27967. if (look[alt].length===0 || look[alt].contains(LL1Analyzer.HIT_PRED)) {
  27968. look[alt] = null;
  27969. }
  27970. }
  27971. return look;
  27972. };
  27973. //*
  27974. // Compute set of tokens that can follow {@code s} in the ATN in the
  27975. // specified {@code ctx}.
  27976. //
  27977. // <p>If {@code ctx} is {@code null} and the end of the rule containing
  27978. // {@code s} is reached, {@link Token//EPSILON} is added to the result set.
  27979. // If {@code ctx} is not {@code null} and the end of the outermost rule is
  27980. // reached, {@link Token//EOF} is added to the result set.</p>
  27981. //
  27982. // @param s the ATN state
  27983. // @param stopState the ATN state to stop at. This can be a
  27984. // {@link BlockEndState} to detect epsilon paths through a closure.
  27985. // @param ctx the complete parser context, or {@code null} if the context
  27986. // should be ignored
  27987. //
  27988. // @return The set of tokens that can follow {@code s} in the ATN in the
  27989. // specified {@code ctx}.
  27990. ///
  27991. LL1Analyzer.prototype.LOOK = function(s, stopState, ctx) {
  27992. var r = new IntervalSet();
  27993. var seeThruPreds = true; // ignore preds; get all lookahead
  27994. ctx = ctx || null;
  27995. var lookContext = ctx!==null ? predictionContextFromRuleContext(s.atn, ctx) : null;
  27996. this._LOOK(s, stopState, lookContext, r, new Set(), new BitSet(), seeThruPreds, true);
  27997. return r;
  27998. };
  27999. //*
  28000. // Compute set of tokens that can follow {@code s} in the ATN in the
  28001. // specified {@code ctx}.
  28002. //
  28003. // <p>If {@code ctx} is {@code null} and {@code stopState} or the end of the
  28004. // rule containing {@code s} is reached, {@link Token//EPSILON} is added to
  28005. // the result set. If {@code ctx} is not {@code null} and {@code addEOF} is
  28006. // {@code true} and {@code stopState} or the end of the outermost rule is
  28007. // reached, {@link Token//EOF} is added to the result set.</p>
  28008. //
  28009. // @param s the ATN state.
  28010. // @param stopState the ATN state to stop at. This can be a
  28011. // {@link BlockEndState} to detect epsilon paths through a closure.
  28012. // @param ctx The outer context, or {@code null} if the outer context should
  28013. // not be used.
  28014. // @param look The result lookahead set.
  28015. // @param lookBusy A set used for preventing epsilon closures in the ATN
  28016. // from causing a stack overflow. Outside code should pass
  28017. // {@code new Set<ATNConfig>} for this argument.
  28018. // @param calledRuleStack A set used for preventing left recursion in the
  28019. // ATN from causing a stack overflow. Outside code should pass
  28020. // {@code new BitSet()} for this argument.
  28021. // @param seeThruPreds {@code true} to true semantic predicates as
  28022. // implicitly {@code true} and "see through them", otherwise {@code false}
  28023. // to treat semantic predicates as opaque and add {@link //HIT_PRED} to the
  28024. // result if one is encountered.
  28025. // @param addEOF Add {@link Token//EOF} to the result if the end of the
  28026. // outermost context is reached. This parameter has no effect if {@code ctx}
  28027. // is {@code null}.
  28028. ///
  28029. LL1Analyzer.prototype._LOOK = function(s, stopState , ctx, look, lookBusy, calledRuleStack, seeThruPreds, addEOF) {
  28030. var c = new ATNConfig({state:s, alt:0, context: ctx}, null);
  28031. if (lookBusy.contains(c)) {
  28032. return;
  28033. }
  28034. lookBusy.add(c);
  28035. if (s === stopState) {
  28036. if (ctx ===null) {
  28037. look.addOne(Token.EPSILON);
  28038. return;
  28039. } else if (ctx.isEmpty() && addEOF) {
  28040. look.addOne(Token.EOF);
  28041. return;
  28042. }
  28043. }
  28044. if (s instanceof RuleStopState ) {
  28045. if (ctx ===null) {
  28046. look.addOne(Token.EPSILON);
  28047. return;
  28048. } else if (ctx.isEmpty() && addEOF) {
  28049. look.addOne(Token.EOF);
  28050. return;
  28051. }
  28052. if (ctx !== PredictionContext.EMPTY) {
  28053. // run thru all possible stack tops in ctx
  28054. for(var i=0; i<ctx.length; i++) {
  28055. var returnState = this.atn.states[ctx.getReturnState(i)];
  28056. var removed = calledRuleStack.contains(returnState.ruleIndex);
  28057. try {
  28058. calledRuleStack.remove(returnState.ruleIndex);
  28059. this._LOOK(returnState, stopState, ctx.getParent(i), look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  28060. } finally {
  28061. if (removed) {
  28062. calledRuleStack.add(returnState.ruleIndex);
  28063. }
  28064. }
  28065. }
  28066. return;
  28067. }
  28068. }
  28069. for(var j=0; j<s.transitions.length; j++) {
  28070. var t = s.transitions[j];
  28071. if (t.constructor === RuleTransition) {
  28072. if (calledRuleStack.contains(t.target.ruleIndex)) {
  28073. continue;
  28074. }
  28075. var newContext = SingletonPredictionContext.create(ctx, t.followState.stateNumber);
  28076. try {
  28077. calledRuleStack.add(t.target.ruleIndex);
  28078. this._LOOK(t.target, stopState, newContext, look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  28079. } finally {
  28080. calledRuleStack.remove(t.target.ruleIndex);
  28081. }
  28082. } else if (t instanceof AbstractPredicateTransition ) {
  28083. if (seeThruPreds) {
  28084. this._LOOK(t.target, stopState, ctx, look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  28085. } else {
  28086. look.addOne(LL1Analyzer.HIT_PRED);
  28087. }
  28088. } else if( t.isEpsilon) {
  28089. this._LOOK(t.target, stopState, ctx, look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  28090. } else if (t.constructor === WildcardTransition) {
  28091. look.addRange( Token.MIN_USER_TOKEN_TYPE, this.atn.maxTokenType );
  28092. } else {
  28093. var set = t.label;
  28094. if (set !== null) {
  28095. if (t instanceof NotSetTransition) {
  28096. set = set.complement(Token.MIN_USER_TOKEN_TYPE, this.atn.maxTokenType);
  28097. }
  28098. look.addSet(set);
  28099. }
  28100. }
  28101. }
  28102. };
  28103. exports.LL1Analyzer = LL1Analyzer;
  28104. /***/ }),
  28105. /***/ "./node_modules/antlr4/Lexer.js":
  28106. /*!**************************************!*\
  28107. !*** ./node_modules/antlr4/Lexer.js ***!
  28108. \**************************************/
  28109. /*! no static exports found */
  28110. /***/ (function(module, exports, __webpack_require__) {
  28111. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  28112. * Use of this file is governed by the BSD 3-clause license that
  28113. * can be found in the LICENSE.txt file in the project root.
  28114. */
  28115. ///
  28116. // A lexer is recognizer that draws input symbols from a character stream.
  28117. // lexer grammars result in a subclass of this object. A Lexer object
  28118. // uses simplified match() and error recovery mechanisms in the interest of speed.
  28119. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  28120. var Recognizer = __webpack_require__(/*! ./Recognizer */ "./node_modules/antlr4/Recognizer.js").Recognizer;
  28121. var CommonTokenFactory = __webpack_require__(/*! ./CommonTokenFactory */ "./node_modules/antlr4/CommonTokenFactory.js").CommonTokenFactory;
  28122. var RecognitionException = __webpack_require__(/*! ./error/Errors */ "./node_modules/antlr4/error/Errors.js").RecognitionException;
  28123. var LexerNoViableAltException = __webpack_require__(/*! ./error/Errors */ "./node_modules/antlr4/error/Errors.js").LexerNoViableAltException;
  28124. function TokenSource() {
  28125. return this;
  28126. }
  28127. function Lexer(input) {
  28128. Recognizer.call(this);
  28129. this._input = input;
  28130. this._factory = CommonTokenFactory.DEFAULT;
  28131. this._tokenFactorySourcePair = [ this, input ];
  28132. this._interp = null; // child classes must populate this
  28133. // The goal of all lexer rules/methods is to create a token object.
  28134. // this is an instance variable as multiple rules may collaborate to
  28135. // create a single token. nextToken will return this object after
  28136. // matching lexer rule(s). If you subclass to allow multiple token
  28137. // emissions, then set this to the last token to be matched or
  28138. // something nonnull so that the auto token emit mechanism will not
  28139. // emit another token.
  28140. this._token = null;
  28141. // What character index in the stream did the current token start at?
  28142. // Needed, for example, to get the text for current token. Set at
  28143. // the start of nextToken.
  28144. this._tokenStartCharIndex = -1;
  28145. // The line on which the first character of the token resides///
  28146. this._tokenStartLine = -1;
  28147. // The character position of first character within the line///
  28148. this._tokenStartColumn = -1;
  28149. // Once we see EOF on char stream, next token will be EOF.
  28150. // If you have DONE : EOF ; then you see DONE EOF.
  28151. this._hitEOF = false;
  28152. // The channel number for the current token///
  28153. this._channel = Token.DEFAULT_CHANNEL;
  28154. // The token type for the current token///
  28155. this._type = Token.INVALID_TYPE;
  28156. this._modeStack = [];
  28157. this._mode = Lexer.DEFAULT_MODE;
  28158. // You can set the text for the current token to override what is in
  28159. // the input char buffer. Use setText() or can set this instance var.
  28160. // /
  28161. this._text = null;
  28162. return this;
  28163. }
  28164. Lexer.prototype = Object.create(Recognizer.prototype);
  28165. Lexer.prototype.constructor = Lexer;
  28166. Lexer.DEFAULT_MODE = 0;
  28167. Lexer.MORE = -2;
  28168. Lexer.SKIP = -3;
  28169. Lexer.DEFAULT_TOKEN_CHANNEL = Token.DEFAULT_CHANNEL;
  28170. Lexer.HIDDEN = Token.HIDDEN_CHANNEL;
  28171. Lexer.MIN_CHAR_VALUE = 0x0000;
  28172. Lexer.MAX_CHAR_VALUE = 0x10FFFF;
  28173. Lexer.prototype.reset = function() {
  28174. // wack Lexer state variables
  28175. if (this._input !== null) {
  28176. this._input.seek(0); // rewind the input
  28177. }
  28178. this._token = null;
  28179. this._type = Token.INVALID_TYPE;
  28180. this._channel = Token.DEFAULT_CHANNEL;
  28181. this._tokenStartCharIndex = -1;
  28182. this._tokenStartColumn = -1;
  28183. this._tokenStartLine = -1;
  28184. this._text = null;
  28185. this._hitEOF = false;
  28186. this._mode = Lexer.DEFAULT_MODE;
  28187. this._modeStack = [];
  28188. this._interp.reset();
  28189. };
  28190. // Return a token from this source; i.e., match a token on the char stream.
  28191. Lexer.prototype.nextToken = function() {
  28192. if (this._input === null) {
  28193. throw "nextToken requires a non-null input stream.";
  28194. }
  28195. // Mark start location in char stream so unbuffered streams are
  28196. // guaranteed at least have text of current token
  28197. var tokenStartMarker = this._input.mark();
  28198. try {
  28199. while (true) {
  28200. if (this._hitEOF) {
  28201. this.emitEOF();
  28202. return this._token;
  28203. }
  28204. this._token = null;
  28205. this._channel = Token.DEFAULT_CHANNEL;
  28206. this._tokenStartCharIndex = this._input.index;
  28207. this._tokenStartColumn = this._interp.column;
  28208. this._tokenStartLine = this._interp.line;
  28209. this._text = null;
  28210. var continueOuter = false;
  28211. while (true) {
  28212. this._type = Token.INVALID_TYPE;
  28213. var ttype = Lexer.SKIP;
  28214. try {
  28215. ttype = this._interp.match(this._input, this._mode);
  28216. } catch (e) {
  28217. if(e instanceof RecognitionException) {
  28218. this.notifyListeners(e); // report error
  28219. this.recover(e);
  28220. } else {
  28221. console.log(e.stack);
  28222. throw e;
  28223. }
  28224. }
  28225. if (this._input.LA(1) === Token.EOF) {
  28226. this._hitEOF = true;
  28227. }
  28228. if (this._type === Token.INVALID_TYPE) {
  28229. this._type = ttype;
  28230. }
  28231. if (this._type === Lexer.SKIP) {
  28232. continueOuter = true;
  28233. break;
  28234. }
  28235. if (this._type !== Lexer.MORE) {
  28236. break;
  28237. }
  28238. }
  28239. if (continueOuter) {
  28240. continue;
  28241. }
  28242. if (this._token === null) {
  28243. this.emit();
  28244. }
  28245. return this._token;
  28246. }
  28247. } finally {
  28248. // make sure we release marker after match or
  28249. // unbuffered char stream will keep buffering
  28250. this._input.release(tokenStartMarker);
  28251. }
  28252. };
  28253. // Instruct the lexer to skip creating a token for current lexer rule
  28254. // and look for another token. nextToken() knows to keep looking when
  28255. // a lexer rule finishes with token set to SKIP_TOKEN. Recall that
  28256. // if token==null at end of any token rule, it creates one for you
  28257. // and emits it.
  28258. // /
  28259. Lexer.prototype.skip = function() {
  28260. this._type = Lexer.SKIP;
  28261. };
  28262. Lexer.prototype.more = function() {
  28263. this._type = Lexer.MORE;
  28264. };
  28265. Lexer.prototype.mode = function(m) {
  28266. this._mode = m;
  28267. };
  28268. Lexer.prototype.pushMode = function(m) {
  28269. if (this._interp.debug) {
  28270. console.log("pushMode " + m);
  28271. }
  28272. this._modeStack.push(this._mode);
  28273. this.mode(m);
  28274. };
  28275. Lexer.prototype.popMode = function() {
  28276. if (this._modeStack.length === 0) {
  28277. throw "Empty Stack";
  28278. }
  28279. if (this._interp.debug) {
  28280. console.log("popMode back to " + this._modeStack.slice(0, -1));
  28281. }
  28282. this.mode(this._modeStack.pop());
  28283. return this._mode;
  28284. };
  28285. // Set the char stream and reset the lexer
  28286. Object.defineProperty(Lexer.prototype, "inputStream", {
  28287. get : function() {
  28288. return this._input;
  28289. },
  28290. set : function(input) {
  28291. this._input = null;
  28292. this._tokenFactorySourcePair = [ this, this._input ];
  28293. this.reset();
  28294. this._input = input;
  28295. this._tokenFactorySourcePair = [ this, this._input ];
  28296. }
  28297. });
  28298. Object.defineProperty(Lexer.prototype, "sourceName", {
  28299. get : function sourceName() {
  28300. return this._input.sourceName;
  28301. }
  28302. });
  28303. // By default does not support multiple emits per nextToken invocation
  28304. // for efficiency reasons. Subclass and override this method, nextToken,
  28305. // and getToken (to push tokens into a list and pull from that list
  28306. // rather than a single variable as this implementation does).
  28307. // /
  28308. Lexer.prototype.emitToken = function(token) {
  28309. this._token = token;
  28310. };
  28311. // The standard method called to automatically emit a token at the
  28312. // outermost lexical rule. The token object should point into the
  28313. // char buffer start..stop. If there is a text override in 'text',
  28314. // use that to set the token's text. Override this method to emit
  28315. // custom Token objects or provide a new factory.
  28316. // /
  28317. Lexer.prototype.emit = function() {
  28318. var t = this._factory.create(this._tokenFactorySourcePair, this._type,
  28319. this._text, this._channel, this._tokenStartCharIndex, this
  28320. .getCharIndex() - 1, this._tokenStartLine,
  28321. this._tokenStartColumn);
  28322. this.emitToken(t);
  28323. return t;
  28324. };
  28325. Lexer.prototype.emitEOF = function() {
  28326. var cpos = this.column;
  28327. var lpos = this.line;
  28328. var eof = this._factory.create(this._tokenFactorySourcePair, Token.EOF,
  28329. null, Token.DEFAULT_CHANNEL, this._input.index,
  28330. this._input.index - 1, lpos, cpos);
  28331. this.emitToken(eof);
  28332. return eof;
  28333. };
  28334. Object.defineProperty(Lexer.prototype, "type", {
  28335. get : function() {
  28336. return this.type;
  28337. },
  28338. set : function(type) {
  28339. this._type = type;
  28340. }
  28341. });
  28342. Object.defineProperty(Lexer.prototype, "line", {
  28343. get : function() {
  28344. return this._interp.line;
  28345. },
  28346. set : function(line) {
  28347. this._interp.line = line;
  28348. }
  28349. });
  28350. Object.defineProperty(Lexer.prototype, "column", {
  28351. get : function() {
  28352. return this._interp.column;
  28353. },
  28354. set : function(column) {
  28355. this._interp.column = column;
  28356. }
  28357. });
  28358. // What is the index of the current character of lookahead?///
  28359. Lexer.prototype.getCharIndex = function() {
  28360. return this._input.index;
  28361. };
  28362. // Return the text matched so far for the current token or any text override.
  28363. //Set the complete text of this token; it wipes any previous changes to the text.
  28364. Object.defineProperty(Lexer.prototype, "text", {
  28365. get : function() {
  28366. if (this._text !== null) {
  28367. return this._text;
  28368. } else {
  28369. return this._interp.getText(this._input);
  28370. }
  28371. },
  28372. set : function(text) {
  28373. this._text = text;
  28374. }
  28375. });
  28376. // Return a list of all Token objects in input char stream.
  28377. // Forces load of all tokens. Does not include EOF token.
  28378. // /
  28379. Lexer.prototype.getAllTokens = function() {
  28380. var tokens = [];
  28381. var t = this.nextToken();
  28382. while (t.type !== Token.EOF) {
  28383. tokens.push(t);
  28384. t = this.nextToken();
  28385. }
  28386. return tokens;
  28387. };
  28388. Lexer.prototype.notifyListeners = function(e) {
  28389. var start = this._tokenStartCharIndex;
  28390. var stop = this._input.index;
  28391. var text = this._input.getText(start, stop);
  28392. var msg = "token recognition error at: '" + this.getErrorDisplay(text) + "'";
  28393. var listener = this.getErrorListenerDispatch();
  28394. listener.syntaxError(this, null, this._tokenStartLine,
  28395. this._tokenStartColumn, msg, e);
  28396. };
  28397. Lexer.prototype.getErrorDisplay = function(s) {
  28398. var d = [];
  28399. for (var i = 0; i < s.length; i++) {
  28400. d.push(s[i]);
  28401. }
  28402. return d.join('');
  28403. };
  28404. Lexer.prototype.getErrorDisplayForChar = function(c) {
  28405. if (c.charCodeAt(0) === Token.EOF) {
  28406. return "<EOF>";
  28407. } else if (c === '\n') {
  28408. return "\\n";
  28409. } else if (c === '\t') {
  28410. return "\\t";
  28411. } else if (c === '\r') {
  28412. return "\\r";
  28413. } else {
  28414. return c;
  28415. }
  28416. };
  28417. Lexer.prototype.getCharErrorDisplay = function(c) {
  28418. return "'" + this.getErrorDisplayForChar(c) + "'";
  28419. };
  28420. // Lexers can normally match any char in it's vocabulary after matching
  28421. // a token, so do the easy thing and just kill a character and hope
  28422. // it all works out. You can instead use the rule invocation stack
  28423. // to do sophisticated error recovery if you are in a fragment rule.
  28424. // /
  28425. Lexer.prototype.recover = function(re) {
  28426. if (this._input.LA(1) !== Token.EOF) {
  28427. if (re instanceof LexerNoViableAltException) {
  28428. // skip a char and try again
  28429. this._interp.consume(this._input);
  28430. } else {
  28431. // TODO: Do we lose character or line position information?
  28432. this._input.consume();
  28433. }
  28434. }
  28435. };
  28436. exports.Lexer = Lexer;
  28437. /***/ }),
  28438. /***/ "./node_modules/antlr4/Parser.js":
  28439. /*!***************************************!*\
  28440. !*** ./node_modules/antlr4/Parser.js ***!
  28441. \***************************************/
  28442. /*! no static exports found */
  28443. /***/ (function(module, exports, __webpack_require__) {
  28444. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  28445. * Use of this file is governed by the BSD 3-clause license that
  28446. * can be found in the LICENSE.txt file in the project root.
  28447. */
  28448. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  28449. var ParseTreeListener = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").ParseTreeListener;
  28450. var Recognizer = __webpack_require__(/*! ./Recognizer */ "./node_modules/antlr4/Recognizer.js").Recognizer;
  28451. var DefaultErrorStrategy = __webpack_require__(/*! ./error/ErrorStrategy */ "./node_modules/antlr4/error/ErrorStrategy.js").DefaultErrorStrategy;
  28452. var ATNDeserializer = __webpack_require__(/*! ./atn/ATNDeserializer */ "./node_modules/antlr4/atn/ATNDeserializer.js").ATNDeserializer;
  28453. var ATNDeserializationOptions = __webpack_require__(/*! ./atn/ATNDeserializationOptions */ "./node_modules/antlr4/atn/ATNDeserializationOptions.js").ATNDeserializationOptions;
  28454. var TerminalNode = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").TerminalNode;
  28455. var ErrorNode = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").ErrorNode;
  28456. function TraceListener(parser) {
  28457. ParseTreeListener.call(this);
  28458. this.parser = parser;
  28459. return this;
  28460. }
  28461. TraceListener.prototype = Object.create(ParseTreeListener.prototype);
  28462. TraceListener.prototype.constructor = TraceListener;
  28463. TraceListener.prototype.enterEveryRule = function(ctx) {
  28464. console.log("enter " + this.parser.ruleNames[ctx.ruleIndex] + ", LT(1)=" + this.parser._input.LT(1).text);
  28465. };
  28466. TraceListener.prototype.visitTerminal = function( node) {
  28467. console.log("consume " + node.symbol + " rule " + this.parser.ruleNames[this.parser._ctx.ruleIndex]);
  28468. };
  28469. TraceListener.prototype.exitEveryRule = function(ctx) {
  28470. console.log("exit " + this.parser.ruleNames[ctx.ruleIndex] + ", LT(1)=" + this.parser._input.LT(1).text);
  28471. };
  28472. // this is all the parsing support code essentially; most of it is error
  28473. // recovery stuff.//
  28474. function Parser(input) {
  28475. Recognizer.call(this);
  28476. // The input stream.
  28477. this._input = null;
  28478. // The error handling strategy for the parser. The default value is a new
  28479. // instance of {@link DefaultErrorStrategy}.
  28480. this._errHandler = new DefaultErrorStrategy();
  28481. this._precedenceStack = [];
  28482. this._precedenceStack.push(0);
  28483. // The {@link ParserRuleContext} object for the currently executing rule.
  28484. // this is always non-null during the parsing process.
  28485. this._ctx = null;
  28486. // Specifies whether or not the parser should construct a parse tree during
  28487. // the parsing process. The default value is {@code true}.
  28488. this.buildParseTrees = true;
  28489. // When {@link //setTrace}{@code (true)} is called, a reference to the
  28490. // {@link TraceListener} is stored here so it can be easily removed in a
  28491. // later call to {@link //setTrace}{@code (false)}. The listener itself is
  28492. // implemented as a parser listener so this field is not directly used by
  28493. // other parser methods.
  28494. this._tracer = null;
  28495. // The list of {@link ParseTreeListener} listeners registered to receive
  28496. // events during the parse.
  28497. this._parseListeners = null;
  28498. // The number of syntax errors reported during parsing. this value is
  28499. // incremented each time {@link //notifyErrorListeners} is called.
  28500. this._syntaxErrors = 0;
  28501. this.setInputStream(input);
  28502. return this;
  28503. }
  28504. Parser.prototype = Object.create(Recognizer.prototype);
  28505. Parser.prototype.contructor = Parser;
  28506. // this field maps from the serialized ATN string to the deserialized {@link
  28507. // ATN} with
  28508. // bypass alternatives.
  28509. //
  28510. // @see ATNDeserializationOptions//isGenerateRuleBypassTransitions()
  28511. //
  28512. Parser.bypassAltsAtnCache = {};
  28513. // reset the parser's state//
  28514. Parser.prototype.reset = function() {
  28515. if (this._input !== null) {
  28516. this._input.seek(0);
  28517. }
  28518. this._errHandler.reset(this);
  28519. this._ctx = null;
  28520. this._syntaxErrors = 0;
  28521. this.setTrace(false);
  28522. this._precedenceStack = [];
  28523. this._precedenceStack.push(0);
  28524. if (this._interp !== null) {
  28525. this._interp.reset();
  28526. }
  28527. };
  28528. // Match current input symbol against {@code ttype}. If the symbol type
  28529. // matches, {@link ANTLRErrorStrategy//reportMatch} and {@link //consume} are
  28530. // called to complete the match process.
  28531. //
  28532. // <p>If the symbol type does not match,
  28533. // {@link ANTLRErrorStrategy//recoverInline} is called on the current error
  28534. // strategy to attempt recovery. If {@link //getBuildParseTree} is
  28535. // {@code true} and the token index of the symbol returned by
  28536. // {@link ANTLRErrorStrategy//recoverInline} is -1, the symbol is added to
  28537. // the parse tree by calling {@link ParserRuleContext//addErrorNode}.</p>
  28538. //
  28539. // @param ttype the token type to match
  28540. // @return the matched symbol
  28541. // @throws RecognitionException if the current input symbol did not match
  28542. // {@code ttype} and the error strategy could not recover from the
  28543. // mismatched symbol
  28544. Parser.prototype.match = function(ttype) {
  28545. var t = this.getCurrentToken();
  28546. if (t.type === ttype) {
  28547. this._errHandler.reportMatch(this);
  28548. this.consume();
  28549. } else {
  28550. t = this._errHandler.recoverInline(this);
  28551. if (this.buildParseTrees && t.tokenIndex === -1) {
  28552. // we must have conjured up a new token during single token
  28553. // insertion
  28554. // if it's not the current symbol
  28555. this._ctx.addErrorNode(t);
  28556. }
  28557. }
  28558. return t;
  28559. };
  28560. // Match current input symbol as a wildcard. If the symbol type matches
  28561. // (i.e. has a value greater than 0), {@link ANTLRErrorStrategy//reportMatch}
  28562. // and {@link //consume} are called to complete the match process.
  28563. //
  28564. // <p>If the symbol type does not match,
  28565. // {@link ANTLRErrorStrategy//recoverInline} is called on the current error
  28566. // strategy to attempt recovery. If {@link //getBuildParseTree} is
  28567. // {@code true} and the token index of the symbol returned by
  28568. // {@link ANTLRErrorStrategy//recoverInline} is -1, the symbol is added to
  28569. // the parse tree by calling {@link ParserRuleContext//addErrorNode}.</p>
  28570. //
  28571. // @return the matched symbol
  28572. // @throws RecognitionException if the current input symbol did not match
  28573. // a wildcard and the error strategy could not recover from the mismatched
  28574. // symbol
  28575. Parser.prototype.matchWildcard = function() {
  28576. var t = this.getCurrentToken();
  28577. if (t.type > 0) {
  28578. this._errHandler.reportMatch(this);
  28579. this.consume();
  28580. } else {
  28581. t = this._errHandler.recoverInline(this);
  28582. if (this._buildParseTrees && t.tokenIndex === -1) {
  28583. // we must have conjured up a new token during single token
  28584. // insertion
  28585. // if it's not the current symbol
  28586. this._ctx.addErrorNode(t);
  28587. }
  28588. }
  28589. return t;
  28590. };
  28591. Parser.prototype.getParseListeners = function() {
  28592. return this._parseListeners || [];
  28593. };
  28594. // Registers {@code listener} to receive events during the parsing process.
  28595. //
  28596. // <p>To support output-preserving grammar transformations (including but not
  28597. // limited to left-recursion removal, automated left-factoring, and
  28598. // optimized code generation), calls to listener methods during the parse
  28599. // may differ substantially from calls made by
  28600. // {@link ParseTreeWalker//DEFAULT} used after the parse is complete. In
  28601. // particular, rule entry and exit events may occur in a different order
  28602. // during the parse than after the parser. In addition, calls to certain
  28603. // rule entry methods may be omitted.</p>
  28604. //
  28605. // <p>With the following specific exceptions, calls to listener events are
  28606. // <em>deterministic</em>, i.e. for identical input the calls to listener
  28607. // methods will be the same.</p>
  28608. //
  28609. // <ul>
  28610. // <li>Alterations to the grammar used to generate code may change the
  28611. // behavior of the listener calls.</li>
  28612. // <li>Alterations to the command line options passed to ANTLR 4 when
  28613. // generating the parser may change the behavior of the listener calls.</li>
  28614. // <li>Changing the version of the ANTLR Tool used to generate the parser
  28615. // may change the behavior of the listener calls.</li>
  28616. // </ul>
  28617. //
  28618. // @param listener the listener to add
  28619. //
  28620. // @throws NullPointerException if {@code} listener is {@code null}
  28621. //
  28622. Parser.prototype.addParseListener = function(listener) {
  28623. if (listener === null) {
  28624. throw "listener";
  28625. }
  28626. if (this._parseListeners === null) {
  28627. this._parseListeners = [];
  28628. }
  28629. this._parseListeners.push(listener);
  28630. };
  28631. //
  28632. // Remove {@code listener} from the list of parse listeners.
  28633. //
  28634. // <p>If {@code listener} is {@code null} or has not been added as a parse
  28635. // listener, this method does nothing.</p>
  28636. // @param listener the listener to remove
  28637. //
  28638. Parser.prototype.removeParseListener = function(listener) {
  28639. if (this._parseListeners !== null) {
  28640. var idx = this._parseListeners.indexOf(listener);
  28641. if (idx >= 0) {
  28642. this._parseListeners.splice(idx, 1);
  28643. }
  28644. if (this._parseListeners.length === 0) {
  28645. this._parseListeners = null;
  28646. }
  28647. }
  28648. };
  28649. // Remove all parse listeners.
  28650. Parser.prototype.removeParseListeners = function() {
  28651. this._parseListeners = null;
  28652. };
  28653. // Notify any parse listeners of an enter rule event.
  28654. Parser.prototype.triggerEnterRuleEvent = function() {
  28655. if (this._parseListeners !== null) {
  28656. var ctx = this._ctx;
  28657. this._parseListeners.map(function(listener) {
  28658. listener.enterEveryRule(ctx);
  28659. ctx.enterRule(listener);
  28660. });
  28661. }
  28662. };
  28663. //
  28664. // Notify any parse listeners of an exit rule event.
  28665. //
  28666. // @see //addParseListener
  28667. //
  28668. Parser.prototype.triggerExitRuleEvent = function() {
  28669. if (this._parseListeners !== null) {
  28670. // reverse order walk of listeners
  28671. var ctx = this._ctx;
  28672. this._parseListeners.slice(0).reverse().map(function(listener) {
  28673. ctx.exitRule(listener);
  28674. listener.exitEveryRule(ctx);
  28675. });
  28676. }
  28677. };
  28678. Parser.prototype.getTokenFactory = function() {
  28679. return this._input.tokenSource._factory;
  28680. };
  28681. // Tell our token source and error strategy about a new way to create tokens.//
  28682. Parser.prototype.setTokenFactory = function(factory) {
  28683. this._input.tokenSource._factory = factory;
  28684. };
  28685. // The ATN with bypass alternatives is expensive to create so we create it
  28686. // lazily.
  28687. //
  28688. // @throws UnsupportedOperationException if the current parser does not
  28689. // implement the {@link //getSerializedATN()} method.
  28690. //
  28691. Parser.prototype.getATNWithBypassAlts = function() {
  28692. var serializedAtn = this.getSerializedATN();
  28693. if (serializedAtn === null) {
  28694. throw "The current parser does not support an ATN with bypass alternatives.";
  28695. }
  28696. var result = this.bypassAltsAtnCache[serializedAtn];
  28697. if (result === null) {
  28698. var deserializationOptions = new ATNDeserializationOptions();
  28699. deserializationOptions.generateRuleBypassTransitions = true;
  28700. result = new ATNDeserializer(deserializationOptions)
  28701. .deserialize(serializedAtn);
  28702. this.bypassAltsAtnCache[serializedAtn] = result;
  28703. }
  28704. return result;
  28705. };
  28706. // The preferred method of getting a tree pattern. For example, here's a
  28707. // sample use:
  28708. //
  28709. // <pre>
  28710. // ParseTree t = parser.expr();
  28711. // ParseTreePattern p = parser.compileParseTreePattern("&lt;ID&gt;+0",
  28712. // MyParser.RULE_expr);
  28713. // ParseTreeMatch m = p.match(t);
  28714. // String id = m.get("ID");
  28715. // </pre>
  28716. var Lexer = __webpack_require__(/*! ./Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  28717. Parser.prototype.compileParseTreePattern = function(pattern, patternRuleIndex, lexer) {
  28718. lexer = lexer || null;
  28719. if (lexer === null) {
  28720. if (this.getTokenStream() !== null) {
  28721. var tokenSource = this.getTokenStream().tokenSource;
  28722. if (tokenSource instanceof Lexer) {
  28723. lexer = tokenSource;
  28724. }
  28725. }
  28726. }
  28727. if (lexer === null) {
  28728. throw "Parser can't discover a lexer to use";
  28729. }
  28730. var m = new ParseTreePatternMatcher(lexer, this);
  28731. return m.compile(pattern, patternRuleIndex);
  28732. };
  28733. Parser.prototype.getInputStream = function() {
  28734. return this.getTokenStream();
  28735. };
  28736. Parser.prototype.setInputStream = function(input) {
  28737. this.setTokenStream(input);
  28738. };
  28739. Parser.prototype.getTokenStream = function() {
  28740. return this._input;
  28741. };
  28742. // Set the token stream and reset the parser.//
  28743. Parser.prototype.setTokenStream = function(input) {
  28744. this._input = null;
  28745. this.reset();
  28746. this._input = input;
  28747. };
  28748. // Match needs to return the current input symbol, which gets put
  28749. // into the label for the associated token ref; e.g., x=ID.
  28750. //
  28751. Parser.prototype.getCurrentToken = function() {
  28752. return this._input.LT(1);
  28753. };
  28754. Parser.prototype.notifyErrorListeners = function(msg, offendingToken, err) {
  28755. offendingToken = offendingToken || null;
  28756. err = err || null;
  28757. if (offendingToken === null) {
  28758. offendingToken = this.getCurrentToken();
  28759. }
  28760. this._syntaxErrors += 1;
  28761. var line = offendingToken.line;
  28762. var column = offendingToken.column;
  28763. var listener = this.getErrorListenerDispatch();
  28764. listener.syntaxError(this, offendingToken, line, column, msg, err);
  28765. };
  28766. //
  28767. // Consume and return the {@linkplain //getCurrentToken current symbol}.
  28768. //
  28769. // <p>E.g., given the following input with {@code A} being the current
  28770. // lookahead symbol, this function moves the cursor to {@code B} and returns
  28771. // {@code A}.</p>
  28772. //
  28773. // <pre>
  28774. // A B
  28775. // ^
  28776. // </pre>
  28777. //
  28778. // If the parser is not in error recovery mode, the consumed symbol is added
  28779. // to the parse tree using {@link ParserRuleContext//addChild(Token)}, and
  28780. // {@link ParseTreeListener//visitTerminal} is called on any parse listeners.
  28781. // If the parser <em>is</em> in error recovery mode, the consumed symbol is
  28782. // added to the parse tree using
  28783. // {@link ParserRuleContext//addErrorNode(Token)}, and
  28784. // {@link ParseTreeListener//visitErrorNode} is called on any parse
  28785. // listeners.
  28786. //
  28787. Parser.prototype.consume = function() {
  28788. var o = this.getCurrentToken();
  28789. if (o.type !== Token.EOF) {
  28790. this.getInputStream().consume();
  28791. }
  28792. var hasListener = this._parseListeners !== null && this._parseListeners.length > 0;
  28793. if (this.buildParseTrees || hasListener) {
  28794. var node;
  28795. if (this._errHandler.inErrorRecoveryMode(this)) {
  28796. node = this._ctx.addErrorNode(o);
  28797. } else {
  28798. node = this._ctx.addTokenNode(o);
  28799. }
  28800. node.invokingState = this.state;
  28801. if (hasListener) {
  28802. this._parseListeners.map(function(listener) {
  28803. if (node instanceof ErrorNode || (node.isErrorNode !== undefined && node.isErrorNode())) {
  28804. listener.visitErrorNode(node);
  28805. } else if (node instanceof TerminalNode) {
  28806. listener.visitTerminal(node);
  28807. }
  28808. });
  28809. }
  28810. }
  28811. return o;
  28812. };
  28813. Parser.prototype.addContextToParseTree = function() {
  28814. // add current context to parent if we have a parent
  28815. if (this._ctx.parentCtx !== null) {
  28816. this._ctx.parentCtx.addChild(this._ctx);
  28817. }
  28818. };
  28819. // Always called by generated parsers upon entry to a rule. Access field
  28820. // {@link //_ctx} get the current context.
  28821. Parser.prototype.enterRule = function(localctx, state, ruleIndex) {
  28822. this.state = state;
  28823. this._ctx = localctx;
  28824. this._ctx.start = this._input.LT(1);
  28825. if (this.buildParseTrees) {
  28826. this.addContextToParseTree();
  28827. }
  28828. if (this._parseListeners !== null) {
  28829. this.triggerEnterRuleEvent();
  28830. }
  28831. };
  28832. Parser.prototype.exitRule = function() {
  28833. this._ctx.stop = this._input.LT(-1);
  28834. // trigger event on _ctx, before it reverts to parent
  28835. if (this._parseListeners !== null) {
  28836. this.triggerExitRuleEvent();
  28837. }
  28838. this.state = this._ctx.invokingState;
  28839. this._ctx = this._ctx.parentCtx;
  28840. };
  28841. Parser.prototype.enterOuterAlt = function(localctx, altNum) {
  28842. localctx.setAltNumber(altNum);
  28843. // if we have new localctx, make sure we replace existing ctx
  28844. // that is previous child of parse tree
  28845. if (this.buildParseTrees && this._ctx !== localctx) {
  28846. if (this._ctx.parentCtx !== null) {
  28847. this._ctx.parentCtx.removeLastChild();
  28848. this._ctx.parentCtx.addChild(localctx);
  28849. }
  28850. }
  28851. this._ctx = localctx;
  28852. };
  28853. // Get the precedence level for the top-most precedence rule.
  28854. //
  28855. // @return The precedence level for the top-most precedence rule, or -1 if
  28856. // the parser context is not nested within a precedence rule.
  28857. Parser.prototype.getPrecedence = function() {
  28858. if (this._precedenceStack.length === 0) {
  28859. return -1;
  28860. } else {
  28861. return this._precedenceStack[this._precedenceStack.length-1];
  28862. }
  28863. };
  28864. Parser.prototype.enterRecursionRule = function(localctx, state, ruleIndex,
  28865. precedence) {
  28866. this.state = state;
  28867. this._precedenceStack.push(precedence);
  28868. this._ctx = localctx;
  28869. this._ctx.start = this._input.LT(1);
  28870. if (this._parseListeners !== null) {
  28871. this.triggerEnterRuleEvent(); // simulates rule entry for
  28872. // left-recursive rules
  28873. }
  28874. };
  28875. //
  28876. // Like {@link //enterRule} but for recursive rules.
  28877. Parser.prototype.pushNewRecursionContext = function(localctx, state, ruleIndex) {
  28878. var previous = this._ctx;
  28879. previous.parentCtx = localctx;
  28880. previous.invokingState = state;
  28881. previous.stop = this._input.LT(-1);
  28882. this._ctx = localctx;
  28883. this._ctx.start = previous.start;
  28884. if (this.buildParseTrees) {
  28885. this._ctx.addChild(previous);
  28886. }
  28887. if (this._parseListeners !== null) {
  28888. this.triggerEnterRuleEvent(); // simulates rule entry for
  28889. // left-recursive rules
  28890. }
  28891. };
  28892. Parser.prototype.unrollRecursionContexts = function(parentCtx) {
  28893. this._precedenceStack.pop();
  28894. this._ctx.stop = this._input.LT(-1);
  28895. var retCtx = this._ctx; // save current ctx (return value)
  28896. // unroll so _ctx is as it was before call to recursive method
  28897. if (this._parseListeners !== null) {
  28898. while (this._ctx !== parentCtx) {
  28899. this.triggerExitRuleEvent();
  28900. this._ctx = this._ctx.parentCtx;
  28901. }
  28902. } else {
  28903. this._ctx = parentCtx;
  28904. }
  28905. // hook into tree
  28906. retCtx.parentCtx = parentCtx;
  28907. if (this.buildParseTrees && parentCtx !== null) {
  28908. // add return ctx into invoking rule's tree
  28909. parentCtx.addChild(retCtx);
  28910. }
  28911. };
  28912. Parser.prototype.getInvokingContext = function(ruleIndex) {
  28913. var ctx = this._ctx;
  28914. while (ctx !== null) {
  28915. if (ctx.ruleIndex === ruleIndex) {
  28916. return ctx;
  28917. }
  28918. ctx = ctx.parentCtx;
  28919. }
  28920. return null;
  28921. };
  28922. Parser.prototype.precpred = function(localctx, precedence) {
  28923. return precedence >= this._precedenceStack[this._precedenceStack.length-1];
  28924. };
  28925. Parser.prototype.inContext = function(context) {
  28926. // TODO: useful in parser?
  28927. return false;
  28928. };
  28929. //
  28930. // Checks whether or not {@code symbol} can follow the current state in the
  28931. // ATN. The behavior of this method is equivalent to the following, but is
  28932. // implemented such that the complete context-sensitive follow set does not
  28933. // need to be explicitly constructed.
  28934. //
  28935. // <pre>
  28936. // return getExpectedTokens().contains(symbol);
  28937. // </pre>
  28938. //
  28939. // @param symbol the symbol type to check
  28940. // @return {@code true} if {@code symbol} can follow the current state in
  28941. // the ATN, otherwise {@code false}.
  28942. Parser.prototype.isExpectedToken = function(symbol) {
  28943. var atn = this._interp.atn;
  28944. var ctx = this._ctx;
  28945. var s = atn.states[this.state];
  28946. var following = atn.nextTokens(s);
  28947. if (following.contains(symbol)) {
  28948. return true;
  28949. }
  28950. if (!following.contains(Token.EPSILON)) {
  28951. return false;
  28952. }
  28953. while (ctx !== null && ctx.invokingState >= 0 && following.contains(Token.EPSILON)) {
  28954. var invokingState = atn.states[ctx.invokingState];
  28955. var rt = invokingState.transitions[0];
  28956. following = atn.nextTokens(rt.followState);
  28957. if (following.contains(symbol)) {
  28958. return true;
  28959. }
  28960. ctx = ctx.parentCtx;
  28961. }
  28962. if (following.contains(Token.EPSILON) && symbol === Token.EOF) {
  28963. return true;
  28964. } else {
  28965. return false;
  28966. }
  28967. };
  28968. // Computes the set of input symbols which could follow the current parser
  28969. // state and context, as given by {@link //getState} and {@link //getContext},
  28970. // respectively.
  28971. //
  28972. // @see ATN//getExpectedTokens(int, RuleContext)
  28973. //
  28974. Parser.prototype.getExpectedTokens = function() {
  28975. return this._interp.atn.getExpectedTokens(this.state, this._ctx);
  28976. };
  28977. Parser.prototype.getExpectedTokensWithinCurrentRule = function() {
  28978. var atn = this._interp.atn;
  28979. var s = atn.states[this.state];
  28980. return atn.nextTokens(s);
  28981. };
  28982. // Get a rule's index (i.e., {@code RULE_ruleName} field) or -1 if not found.//
  28983. Parser.prototype.getRuleIndex = function(ruleName) {
  28984. var ruleIndex = this.getRuleIndexMap()[ruleName];
  28985. if (ruleIndex !== null) {
  28986. return ruleIndex;
  28987. } else {
  28988. return -1;
  28989. }
  28990. };
  28991. // Return List&lt;String&gt; of the rule names in your parser instance
  28992. // leading up to a call to the current rule. You could override if
  28993. // you want more details such as the file/line info of where
  28994. // in the ATN a rule is invoked.
  28995. //
  28996. // this is very useful for error messages.
  28997. //
  28998. Parser.prototype.getRuleInvocationStack = function(p) {
  28999. p = p || null;
  29000. if (p === null) {
  29001. p = this._ctx;
  29002. }
  29003. var stack = [];
  29004. while (p !== null) {
  29005. // compute what follows who invoked us
  29006. var ruleIndex = p.ruleIndex;
  29007. if (ruleIndex < 0) {
  29008. stack.push("n/a");
  29009. } else {
  29010. stack.push(this.ruleNames[ruleIndex]);
  29011. }
  29012. p = p.parentCtx;
  29013. }
  29014. return stack;
  29015. };
  29016. // For debugging and other purposes.//
  29017. Parser.prototype.getDFAStrings = function() {
  29018. return this._interp.decisionToDFA.toString();
  29019. };
  29020. // For debugging and other purposes.//
  29021. Parser.prototype.dumpDFA = function() {
  29022. var seenOne = false;
  29023. for (var i = 0; i < this._interp.decisionToDFA.length; i++) {
  29024. var dfa = this._interp.decisionToDFA[i];
  29025. if (dfa.states.length > 0) {
  29026. if (seenOne) {
  29027. console.log();
  29028. }
  29029. this.printer.println("Decision " + dfa.decision + ":");
  29030. this.printer.print(dfa.toString(this.literalNames, this.symbolicNames));
  29031. seenOne = true;
  29032. }
  29033. }
  29034. };
  29035. /*
  29036. " printer = function() {\r\n" +
  29037. " this.println = function(s) { document.getElementById('output') += s + '\\n'; }\r\n" +
  29038. " this.print = function(s) { document.getElementById('output') += s; }\r\n" +
  29039. " };\r\n" +
  29040. */
  29041. Parser.prototype.getSourceName = function() {
  29042. return this._input.sourceName;
  29043. };
  29044. // During a parse is sometimes useful to listen in on the rule entry and exit
  29045. // events as well as token matches. this is for quick and dirty debugging.
  29046. //
  29047. Parser.prototype.setTrace = function(trace) {
  29048. if (!trace) {
  29049. this.removeParseListener(this._tracer);
  29050. this._tracer = null;
  29051. } else {
  29052. if (this._tracer !== null) {
  29053. this.removeParseListener(this._tracer);
  29054. }
  29055. this._tracer = new TraceListener(this);
  29056. this.addParseListener(this._tracer);
  29057. }
  29058. };
  29059. exports.Parser = Parser;
  29060. /***/ }),
  29061. /***/ "./node_modules/antlr4/ParserRuleContext.js":
  29062. /*!**************************************************!*\
  29063. !*** ./node_modules/antlr4/ParserRuleContext.js ***!
  29064. \**************************************************/
  29065. /*! no static exports found */
  29066. /***/ (function(module, exports, __webpack_require__) {
  29067. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  29068. * Use of this file is governed by the BSD 3-clause license that
  29069. * can be found in the LICENSE.txt file in the project root.
  29070. */
  29071. //* A rule invocation record for parsing.
  29072. //
  29073. // Contains all of the information about the current rule not stored in the
  29074. // RuleContext. It handles parse tree children list, Any ATN state
  29075. // tracing, and the default values available for rule indications:
  29076. // start, stop, rule index, current alt number, current
  29077. // ATN state.
  29078. //
  29079. // Subclasses made for each rule and grammar track the parameters,
  29080. // return values, locals, and labels specific to that rule. These
  29081. // are the objects that are returned from rules.
  29082. //
  29083. // Note text is not an actual field of a rule return value; it is computed
  29084. // from start and stop using the input stream's toString() method. I
  29085. // could add a ctor to this so that we can pass in and store the input
  29086. // stream, but I'm not sure we want to do that. It would seem to be undefined
  29087. // to get the .text property anyway if the rule matches tokens from multiple
  29088. // input streams.
  29089. //
  29090. // I do not use getters for fields of objects that are used simply to
  29091. // group values such as this aggregate. The getters/setters are there to
  29092. // satisfy the superclass interface.
  29093. var RuleContext = __webpack_require__(/*! ./RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  29094. var Tree = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js");
  29095. var INVALID_INTERVAL = Tree.INVALID_INTERVAL;
  29096. var TerminalNode = Tree.TerminalNode;
  29097. var TerminalNodeImpl = Tree.TerminalNodeImpl;
  29098. var ErrorNodeImpl = Tree.ErrorNodeImpl;
  29099. var Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  29100. function ParserRuleContext(parent, invokingStateNumber) {
  29101. parent = parent || null;
  29102. invokingStateNumber = invokingStateNumber || null;
  29103. RuleContext.call(this, parent, invokingStateNumber);
  29104. this.ruleIndex = -1;
  29105. // * If we are debugging or building a parse tree for a visitor,
  29106. // we need to track all of the tokens and rule invocations associated
  29107. // with this rule's context. This is empty for parsing w/o tree constr.
  29108. // operation because we don't the need to track the details about
  29109. // how we parse this rule.
  29110. // /
  29111. this.children = null;
  29112. this.start = null;
  29113. this.stop = null;
  29114. // The exception that forced this rule to return. If the rule successfully
  29115. // completed, this is {@code null}.
  29116. this.exception = null;
  29117. }
  29118. ParserRuleContext.prototype = Object.create(RuleContext.prototype);
  29119. ParserRuleContext.prototype.constructor = ParserRuleContext;
  29120. // * COPY a ctx (I'm deliberately not using copy constructor)///
  29121. ParserRuleContext.prototype.copyFrom = function(ctx) {
  29122. // from RuleContext
  29123. this.parentCtx = ctx.parentCtx;
  29124. this.invokingState = ctx.invokingState;
  29125. this.children = null;
  29126. this.start = ctx.start;
  29127. this.stop = ctx.stop;
  29128. // copy any error nodes to alt label node
  29129. if(ctx.children) {
  29130. this.children = [];
  29131. // reset parent pointer for any error nodes
  29132. ctx.children.map(function(child) {
  29133. if (child instanceof ErrorNodeImpl) {
  29134. this.children.push(child);
  29135. child.parentCtx = this;
  29136. }
  29137. }, this);
  29138. }
  29139. };
  29140. // Double dispatch methods for listeners
  29141. ParserRuleContext.prototype.enterRule = function(listener) {
  29142. };
  29143. ParserRuleContext.prototype.exitRule = function(listener) {
  29144. };
  29145. // * Does not set parent link; other add methods do that///
  29146. ParserRuleContext.prototype.addChild = function(child) {
  29147. if (this.children === null) {
  29148. this.children = [];
  29149. }
  29150. this.children.push(child);
  29151. return child;
  29152. };
  29153. // * Used by enterOuterAlt to toss out a RuleContext previously added as
  29154. // we entered a rule. If we have // label, we will need to remove
  29155. // generic ruleContext object.
  29156. // /
  29157. ParserRuleContext.prototype.removeLastChild = function() {
  29158. if (this.children !== null) {
  29159. this.children.pop();
  29160. }
  29161. };
  29162. ParserRuleContext.prototype.addTokenNode = function(token) {
  29163. var node = new TerminalNodeImpl(token);
  29164. this.addChild(node);
  29165. node.parentCtx = this;
  29166. return node;
  29167. };
  29168. ParserRuleContext.prototype.addErrorNode = function(badToken) {
  29169. var node = new ErrorNodeImpl(badToken);
  29170. this.addChild(node);
  29171. node.parentCtx = this;
  29172. return node;
  29173. };
  29174. ParserRuleContext.prototype.getChild = function(i, type) {
  29175. type = type || null;
  29176. if (this.children === null || i < 0 || i >= this.children.length) {
  29177. return null;
  29178. }
  29179. if (type === null) {
  29180. return this.children[i];
  29181. } else {
  29182. for(var j=0; j<this.children.length; j++) {
  29183. var child = this.children[j];
  29184. if(child instanceof type) {
  29185. if(i===0) {
  29186. return child;
  29187. } else {
  29188. i -= 1;
  29189. }
  29190. }
  29191. }
  29192. return null;
  29193. }
  29194. };
  29195. ParserRuleContext.prototype.getToken = function(ttype, i) {
  29196. if (this.children === null || i < 0 || i >= this.children.length) {
  29197. return null;
  29198. }
  29199. for(var j=0; j<this.children.length; j++) {
  29200. var child = this.children[j];
  29201. if (child instanceof TerminalNode) {
  29202. if (child.symbol.type === ttype) {
  29203. if(i===0) {
  29204. return child;
  29205. } else {
  29206. i -= 1;
  29207. }
  29208. }
  29209. }
  29210. }
  29211. return null;
  29212. };
  29213. ParserRuleContext.prototype.getTokens = function(ttype ) {
  29214. if (this.children=== null) {
  29215. return [];
  29216. } else {
  29217. var tokens = [];
  29218. for(var j=0; j<this.children.length; j++) {
  29219. var child = this.children[j];
  29220. if (child instanceof TerminalNode) {
  29221. if (child.symbol.type === ttype) {
  29222. tokens.push(child);
  29223. }
  29224. }
  29225. }
  29226. return tokens;
  29227. }
  29228. };
  29229. ParserRuleContext.prototype.getTypedRuleContext = function(ctxType, i) {
  29230. return this.getChild(i, ctxType);
  29231. };
  29232. ParserRuleContext.prototype.getTypedRuleContexts = function(ctxType) {
  29233. if (this.children=== null) {
  29234. return [];
  29235. } else {
  29236. var contexts = [];
  29237. for(var j=0; j<this.children.length; j++) {
  29238. var child = this.children[j];
  29239. if (child instanceof ctxType) {
  29240. contexts.push(child);
  29241. }
  29242. }
  29243. return contexts;
  29244. }
  29245. };
  29246. ParserRuleContext.prototype.getChildCount = function() {
  29247. if (this.children=== null) {
  29248. return 0;
  29249. } else {
  29250. return this.children.length;
  29251. }
  29252. };
  29253. ParserRuleContext.prototype.getSourceInterval = function() {
  29254. if( this.start === null || this.stop === null) {
  29255. return INVALID_INTERVAL;
  29256. } else {
  29257. return new Interval(this.start.tokenIndex, this.stop.tokenIndex);
  29258. }
  29259. };
  29260. RuleContext.EMPTY = new ParserRuleContext();
  29261. function InterpreterRuleContext(parent, invokingStateNumber, ruleIndex) {
  29262. ParserRuleContext.call(parent, invokingStateNumber);
  29263. this.ruleIndex = ruleIndex;
  29264. return this;
  29265. }
  29266. InterpreterRuleContext.prototype = Object.create(ParserRuleContext.prototype);
  29267. InterpreterRuleContext.prototype.constructor = InterpreterRuleContext;
  29268. exports.ParserRuleContext = ParserRuleContext;
  29269. /***/ }),
  29270. /***/ "./node_modules/antlr4/PredictionContext.js":
  29271. /*!**************************************************!*\
  29272. !*** ./node_modules/antlr4/PredictionContext.js ***!
  29273. \**************************************************/
  29274. /*! no static exports found */
  29275. /***/ (function(module, exports, __webpack_require__) {
  29276. //
  29277. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  29278. * Use of this file is governed by the BSD 3-clause license that
  29279. * can be found in the LICENSE.txt file in the project root.
  29280. */
  29281. ///
  29282. var RuleContext = __webpack_require__(/*! ./RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  29283. var Hash = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js").Hash;
  29284. function PredictionContext(cachedHashCode) {
  29285. this.cachedHashCode = cachedHashCode;
  29286. }
  29287. // Represents {@code $} in local context prediction, which means wildcard.
  29288. // {@code//+x =//}.
  29289. // /
  29290. PredictionContext.EMPTY = null;
  29291. // Represents {@code $} in an array in full context mode, when {@code $}
  29292. // doesn't mean wildcard: {@code $ + x = [$,x]}. Here,
  29293. // {@code $} = {@link //EMPTY_RETURN_STATE}.
  29294. // /
  29295. PredictionContext.EMPTY_RETURN_STATE = 0x7FFFFFFF;
  29296. PredictionContext.globalNodeCount = 1;
  29297. PredictionContext.id = PredictionContext.globalNodeCount;
  29298. // Stores the computed hash code of this {@link PredictionContext}. The hash
  29299. // code is computed in parts to match the following reference algorithm.
  29300. //
  29301. // <pre>
  29302. // private int referenceHashCode() {
  29303. // int hash = {@link MurmurHash//initialize MurmurHash.initialize}({@link
  29304. // //INITIAL_HASH});
  29305. //
  29306. // for (int i = 0; i &lt; {@link //size()}; i++) {
  29307. // hash = {@link MurmurHash//update MurmurHash.update}(hash, {@link //getParent
  29308. // getParent}(i));
  29309. // }
  29310. //
  29311. // for (int i = 0; i &lt; {@link //size()}; i++) {
  29312. // hash = {@link MurmurHash//update MurmurHash.update}(hash, {@link
  29313. // //getReturnState getReturnState}(i));
  29314. // }
  29315. //
  29316. // hash = {@link MurmurHash//finish MurmurHash.finish}(hash, 2// {@link
  29317. // //size()});
  29318. // return hash;
  29319. // }
  29320. // </pre>
  29321. // /
  29322. // This means only the {@link //EMPTY} context is in set.
  29323. PredictionContext.prototype.isEmpty = function() {
  29324. return this === PredictionContext.EMPTY;
  29325. };
  29326. PredictionContext.prototype.hasEmptyPath = function() {
  29327. return this.getReturnState(this.length - 1) === PredictionContext.EMPTY_RETURN_STATE;
  29328. };
  29329. PredictionContext.prototype.hashCode = function() {
  29330. return this.cachedHashCode;
  29331. };
  29332. PredictionContext.prototype.updateHashCode = function(hash) {
  29333. hash.update(this.cachedHashCode);
  29334. };
  29335. /*
  29336. function calculateHashString(parent, returnState) {
  29337. return "" + parent + returnState;
  29338. }
  29339. */
  29340. // Used to cache {@link PredictionContext} objects. Its used for the shared
  29341. // context cash associated with contexts in DFA states. This cache
  29342. // can be used for both lexers and parsers.
  29343. function PredictionContextCache() {
  29344. this.cache = {};
  29345. return this;
  29346. }
  29347. // Add a context to the cache and return it. If the context already exists,
  29348. // return that one instead and do not add a new context to the cache.
  29349. // Protect shared cache from unsafe thread access.
  29350. //
  29351. PredictionContextCache.prototype.add = function(ctx) {
  29352. if (ctx === PredictionContext.EMPTY) {
  29353. return PredictionContext.EMPTY;
  29354. }
  29355. var existing = this.cache[ctx] || null;
  29356. if (existing !== null) {
  29357. return existing;
  29358. }
  29359. this.cache[ctx] = ctx;
  29360. return ctx;
  29361. };
  29362. PredictionContextCache.prototype.get = function(ctx) {
  29363. return this.cache[ctx] || null;
  29364. };
  29365. Object.defineProperty(PredictionContextCache.prototype, "length", {
  29366. get : function() {
  29367. return this.cache.length;
  29368. }
  29369. });
  29370. function SingletonPredictionContext(parent, returnState) {
  29371. var hashCode = 0;
  29372. if(parent !== null) {
  29373. var hash = new Hash();
  29374. hash.update(parent, returnState);
  29375. hashCode = hash.finish();
  29376. }
  29377. PredictionContext.call(this, hashCode);
  29378. this.parentCtx = parent;
  29379. this.returnState = returnState;
  29380. }
  29381. SingletonPredictionContext.prototype = Object.create(PredictionContext.prototype);
  29382. SingletonPredictionContext.prototype.contructor = SingletonPredictionContext;
  29383. SingletonPredictionContext.create = function(parent, returnState) {
  29384. if (returnState === PredictionContext.EMPTY_RETURN_STATE && parent === null) {
  29385. // someone can pass in the bits of an array ctx that mean $
  29386. return PredictionContext.EMPTY;
  29387. } else {
  29388. return new SingletonPredictionContext(parent, returnState);
  29389. }
  29390. };
  29391. Object.defineProperty(SingletonPredictionContext.prototype, "length", {
  29392. get : function() {
  29393. return 1;
  29394. }
  29395. });
  29396. SingletonPredictionContext.prototype.getParent = function(index) {
  29397. return this.parentCtx;
  29398. };
  29399. SingletonPredictionContext.prototype.getReturnState = function(index) {
  29400. return this.returnState;
  29401. };
  29402. SingletonPredictionContext.prototype.equals = function(other) {
  29403. if (this === other) {
  29404. return true;
  29405. } else if (!(other instanceof SingletonPredictionContext)) {
  29406. return false;
  29407. } else if (this.hashCode() !== other.hashCode()) {
  29408. return false; // can't be same if hash is different
  29409. } else {
  29410. if(this.returnState !== other.returnState)
  29411. return false;
  29412. else if(this.parentCtx==null)
  29413. return other.parentCtx==null
  29414. else
  29415. return this.parentCtx.equals(other.parentCtx);
  29416. }
  29417. };
  29418. SingletonPredictionContext.prototype.toString = function() {
  29419. var up = this.parentCtx === null ? "" : this.parentCtx.toString();
  29420. if (up.length === 0) {
  29421. if (this.returnState === PredictionContext.EMPTY_RETURN_STATE) {
  29422. return "$";
  29423. } else {
  29424. return "" + this.returnState;
  29425. }
  29426. } else {
  29427. return "" + this.returnState + " " + up;
  29428. }
  29429. };
  29430. function EmptyPredictionContext() {
  29431. SingletonPredictionContext.call(this, null, PredictionContext.EMPTY_RETURN_STATE);
  29432. return this;
  29433. }
  29434. EmptyPredictionContext.prototype = Object.create(SingletonPredictionContext.prototype);
  29435. EmptyPredictionContext.prototype.constructor = EmptyPredictionContext;
  29436. EmptyPredictionContext.prototype.isEmpty = function() {
  29437. return true;
  29438. };
  29439. EmptyPredictionContext.prototype.getParent = function(index) {
  29440. return null;
  29441. };
  29442. EmptyPredictionContext.prototype.getReturnState = function(index) {
  29443. return this.returnState;
  29444. };
  29445. EmptyPredictionContext.prototype.equals = function(other) {
  29446. return this === other;
  29447. };
  29448. EmptyPredictionContext.prototype.toString = function() {
  29449. return "$";
  29450. };
  29451. PredictionContext.EMPTY = new EmptyPredictionContext();
  29452. function ArrayPredictionContext(parents, returnStates) {
  29453. // Parent can be null only if full ctx mode and we make an array
  29454. // from {@link //EMPTY} and non-empty. We merge {@link //EMPTY} by using
  29455. // null parent and
  29456. // returnState == {@link //EMPTY_RETURN_STATE}.
  29457. var h = new Hash();
  29458. h.update(parents, returnStates);
  29459. var hashCode = h.finish();
  29460. PredictionContext.call(this, hashCode);
  29461. this.parents = parents;
  29462. this.returnStates = returnStates;
  29463. return this;
  29464. }
  29465. ArrayPredictionContext.prototype = Object.create(PredictionContext.prototype);
  29466. ArrayPredictionContext.prototype.constructor = ArrayPredictionContext;
  29467. ArrayPredictionContext.prototype.isEmpty = function() {
  29468. // since EMPTY_RETURN_STATE can only appear in the last position, we
  29469. // don't need to verify that size==1
  29470. return this.returnStates[0] === PredictionContext.EMPTY_RETURN_STATE;
  29471. };
  29472. Object.defineProperty(ArrayPredictionContext.prototype, "length", {
  29473. get : function() {
  29474. return this.returnStates.length;
  29475. }
  29476. });
  29477. ArrayPredictionContext.prototype.getParent = function(index) {
  29478. return this.parents[index];
  29479. };
  29480. ArrayPredictionContext.prototype.getReturnState = function(index) {
  29481. return this.returnStates[index];
  29482. };
  29483. ArrayPredictionContext.prototype.equals = function(other) {
  29484. if (this === other) {
  29485. return true;
  29486. } else if (!(other instanceof ArrayPredictionContext)) {
  29487. return false;
  29488. } else if (this.hashCode() !== other.hashCode()) {
  29489. return false; // can't be same if hash is different
  29490. } else {
  29491. return this.returnStates === other.returnStates &&
  29492. this.parents === other.parents;
  29493. }
  29494. };
  29495. ArrayPredictionContext.prototype.toString = function() {
  29496. if (this.isEmpty()) {
  29497. return "[]";
  29498. } else {
  29499. var s = "[";
  29500. for (var i = 0; i < this.returnStates.length; i++) {
  29501. if (i > 0) {
  29502. s = s + ", ";
  29503. }
  29504. if (this.returnStates[i] === PredictionContext.EMPTY_RETURN_STATE) {
  29505. s = s + "$";
  29506. continue;
  29507. }
  29508. s = s + this.returnStates[i];
  29509. if (this.parents[i] !== null) {
  29510. s = s + " " + this.parents[i];
  29511. } else {
  29512. s = s + "null";
  29513. }
  29514. }
  29515. return s + "]";
  29516. }
  29517. };
  29518. // Convert a {@link RuleContext} tree to a {@link PredictionContext} graph.
  29519. // Return {@link //EMPTY} if {@code outerContext} is empty or null.
  29520. // /
  29521. function predictionContextFromRuleContext(atn, outerContext) {
  29522. if (outerContext === undefined || outerContext === null) {
  29523. outerContext = RuleContext.EMPTY;
  29524. }
  29525. // if we are in RuleContext of start rule, s, then PredictionContext
  29526. // is EMPTY. Nobody called us. (if we are empty, return empty)
  29527. if (outerContext.parentCtx === null || outerContext === RuleContext.EMPTY) {
  29528. return PredictionContext.EMPTY;
  29529. }
  29530. // If we have a parent, convert it to a PredictionContext graph
  29531. var parent = predictionContextFromRuleContext(atn, outerContext.parentCtx);
  29532. var state = atn.states[outerContext.invokingState];
  29533. var transition = state.transitions[0];
  29534. return SingletonPredictionContext.create(parent, transition.followState.stateNumber);
  29535. }
  29536. /*
  29537. function calculateListsHashString(parents, returnStates) {
  29538. var s = "";
  29539. parents.map(function(p) {
  29540. s = s + p;
  29541. });
  29542. returnStates.map(function(r) {
  29543. s = s + r;
  29544. });
  29545. return s;
  29546. }
  29547. */
  29548. function merge(a, b, rootIsWildcard, mergeCache) {
  29549. // share same graph if both same
  29550. if (a === b) {
  29551. return a;
  29552. }
  29553. if (a instanceof SingletonPredictionContext && b instanceof SingletonPredictionContext) {
  29554. return mergeSingletons(a, b, rootIsWildcard, mergeCache);
  29555. }
  29556. // At least one of a or b is array
  29557. // If one is $ and rootIsWildcard, return $ as// wildcard
  29558. if (rootIsWildcard) {
  29559. if (a instanceof EmptyPredictionContext) {
  29560. return a;
  29561. }
  29562. if (b instanceof EmptyPredictionContext) {
  29563. return b;
  29564. }
  29565. }
  29566. // convert singleton so both are arrays to normalize
  29567. if (a instanceof SingletonPredictionContext) {
  29568. a = new ArrayPredictionContext([a.getParent()], [a.returnState]);
  29569. }
  29570. if (b instanceof SingletonPredictionContext) {
  29571. b = new ArrayPredictionContext([b.getParent()], [b.returnState]);
  29572. }
  29573. return mergeArrays(a, b, rootIsWildcard, mergeCache);
  29574. }
  29575. //
  29576. // Merge two {@link SingletonPredictionContext} instances.
  29577. //
  29578. // <p>Stack tops equal, parents merge is same; return left graph.<br>
  29579. // <embed src="images/SingletonMerge_SameRootSamePar.svg"
  29580. // type="image/svg+xml"/></p>
  29581. //
  29582. // <p>Same stack top, parents differ; merge parents giving array node, then
  29583. // remainders of those graphs. A new root node is created to point to the
  29584. // merged parents.<br>
  29585. // <embed src="images/SingletonMerge_SameRootDiffPar.svg"
  29586. // type="image/svg+xml"/></p>
  29587. //
  29588. // <p>Different stack tops pointing to same parent. Make array node for the
  29589. // root where both element in the root point to the same (original)
  29590. // parent.<br>
  29591. // <embed src="images/SingletonMerge_DiffRootSamePar.svg"
  29592. // type="image/svg+xml"/></p>
  29593. //
  29594. // <p>Different stack tops pointing to different parents. Make array node for
  29595. // the root where each element points to the corresponding original
  29596. // parent.<br>
  29597. // <embed src="images/SingletonMerge_DiffRootDiffPar.svg"
  29598. // type="image/svg+xml"/></p>
  29599. //
  29600. // @param a the first {@link SingletonPredictionContext}
  29601. // @param b the second {@link SingletonPredictionContext}
  29602. // @param rootIsWildcard {@code true} if this is a local-context merge,
  29603. // otherwise false to indicate a full-context merge
  29604. // @param mergeCache
  29605. // /
  29606. function mergeSingletons(a, b, rootIsWildcard, mergeCache) {
  29607. if (mergeCache !== null) {
  29608. var previous = mergeCache.get(a, b);
  29609. if (previous !== null) {
  29610. return previous;
  29611. }
  29612. previous = mergeCache.get(b, a);
  29613. if (previous !== null) {
  29614. return previous;
  29615. }
  29616. }
  29617. var rootMerge = mergeRoot(a, b, rootIsWildcard);
  29618. if (rootMerge !== null) {
  29619. if (mergeCache !== null) {
  29620. mergeCache.set(a, b, rootMerge);
  29621. }
  29622. return rootMerge;
  29623. }
  29624. if (a.returnState === b.returnState) {
  29625. var parent = merge(a.parentCtx, b.parentCtx, rootIsWildcard, mergeCache);
  29626. // if parent is same as existing a or b parent or reduced to a parent,
  29627. // return it
  29628. if (parent === a.parentCtx) {
  29629. return a; // ax + bx = ax, if a=b
  29630. }
  29631. if (parent === b.parentCtx) {
  29632. return b; // ax + bx = bx, if a=b
  29633. }
  29634. // else: ax + ay = a'[x,y]
  29635. // merge parents x and y, giving array node with x,y then remainders
  29636. // of those graphs. dup a, a' points at merged array
  29637. // new joined parent so create new singleton pointing to it, a'
  29638. var spc = SingletonPredictionContext.create(parent, a.returnState);
  29639. if (mergeCache !== null) {
  29640. mergeCache.set(a, b, spc);
  29641. }
  29642. return spc;
  29643. } else { // a != b payloads differ
  29644. // see if we can collapse parents due to $+x parents if local ctx
  29645. var singleParent = null;
  29646. if (a === b || (a.parentCtx !== null && a.parentCtx === b.parentCtx)) { // ax +
  29647. // bx =
  29648. // [a,b]x
  29649. singleParent = a.parentCtx;
  29650. }
  29651. if (singleParent !== null) { // parents are same
  29652. // sort payloads and use same parent
  29653. var payloads = [ a.returnState, b.returnState ];
  29654. if (a.returnState > b.returnState) {
  29655. payloads[0] = b.returnState;
  29656. payloads[1] = a.returnState;
  29657. }
  29658. var parents = [ singleParent, singleParent ];
  29659. var apc = new ArrayPredictionContext(parents, payloads);
  29660. if (mergeCache !== null) {
  29661. mergeCache.set(a, b, apc);
  29662. }
  29663. return apc;
  29664. }
  29665. // parents differ and can't merge them. Just pack together
  29666. // into array; can't merge.
  29667. // ax + by = [ax,by]
  29668. var payloads = [ a.returnState, b.returnState ];
  29669. var parents = [ a.parentCtx, b.parentCtx ];
  29670. if (a.returnState > b.returnState) { // sort by payload
  29671. payloads[0] = b.returnState;
  29672. payloads[1] = a.returnState;
  29673. parents = [ b.parentCtx, a.parentCtx ];
  29674. }
  29675. var a_ = new ArrayPredictionContext(parents, payloads);
  29676. if (mergeCache !== null) {
  29677. mergeCache.set(a, b, a_);
  29678. }
  29679. return a_;
  29680. }
  29681. }
  29682. //
  29683. // Handle case where at least one of {@code a} or {@code b} is
  29684. // {@link //EMPTY}. In the following diagrams, the symbol {@code $} is used
  29685. // to represent {@link //EMPTY}.
  29686. //
  29687. // <h2>Local-Context Merges</h2>
  29688. //
  29689. // <p>These local-context merge operations are used when {@code rootIsWildcard}
  29690. // is true.</p>
  29691. //
  29692. // <p>{@link //EMPTY} is superset of any graph; return {@link //EMPTY}.<br>
  29693. // <embed src="images/LocalMerge_EmptyRoot.svg" type="image/svg+xml"/></p>
  29694. //
  29695. // <p>{@link //EMPTY} and anything is {@code //EMPTY}, so merged parent is
  29696. // {@code //EMPTY}; return left graph.<br>
  29697. // <embed src="images/LocalMerge_EmptyParent.svg" type="image/svg+xml"/></p>
  29698. //
  29699. // <p>Special case of last merge if local context.<br>
  29700. // <embed src="images/LocalMerge_DiffRoots.svg" type="image/svg+xml"/></p>
  29701. //
  29702. // <h2>Full-Context Merges</h2>
  29703. //
  29704. // <p>These full-context merge operations are used when {@code rootIsWildcard}
  29705. // is false.</p>
  29706. //
  29707. // <p><embed src="images/FullMerge_EmptyRoots.svg" type="image/svg+xml"/></p>
  29708. //
  29709. // <p>Must keep all contexts; {@link //EMPTY} in array is a special value (and
  29710. // null parent).<br>
  29711. // <embed src="images/FullMerge_EmptyRoot.svg" type="image/svg+xml"/></p>
  29712. //
  29713. // <p><embed src="images/FullMerge_SameRoot.svg" type="image/svg+xml"/></p>
  29714. //
  29715. // @param a the first {@link SingletonPredictionContext}
  29716. // @param b the second {@link SingletonPredictionContext}
  29717. // @param rootIsWildcard {@code true} if this is a local-context merge,
  29718. // otherwise false to indicate a full-context merge
  29719. // /
  29720. function mergeRoot(a, b, rootIsWildcard) {
  29721. if (rootIsWildcard) {
  29722. if (a === PredictionContext.EMPTY) {
  29723. return PredictionContext.EMPTY; // // + b =//
  29724. }
  29725. if (b === PredictionContext.EMPTY) {
  29726. return PredictionContext.EMPTY; // a +// =//
  29727. }
  29728. } else {
  29729. if (a === PredictionContext.EMPTY && b === PredictionContext.EMPTY) {
  29730. return PredictionContext.EMPTY; // $ + $ = $
  29731. } else if (a === PredictionContext.EMPTY) { // $ + x = [$,x]
  29732. var payloads = [ b.returnState,
  29733. PredictionContext.EMPTY_RETURN_STATE ];
  29734. var parents = [ b.parentCtx, null ];
  29735. return new ArrayPredictionContext(parents, payloads);
  29736. } else if (b === PredictionContext.EMPTY) { // x + $ = [$,x] ($ is always first if present)
  29737. var payloads = [ a.returnState, PredictionContext.EMPTY_RETURN_STATE ];
  29738. var parents = [ a.parentCtx, null ];
  29739. return new ArrayPredictionContext(parents, payloads);
  29740. }
  29741. }
  29742. return null;
  29743. }
  29744. //
  29745. // Merge two {@link ArrayPredictionContext} instances.
  29746. //
  29747. // <p>Different tops, different parents.<br>
  29748. // <embed src="images/ArrayMerge_DiffTopDiffPar.svg" type="image/svg+xml"/></p>
  29749. //
  29750. // <p>Shared top, same parents.<br>
  29751. // <embed src="images/ArrayMerge_ShareTopSamePar.svg" type="image/svg+xml"/></p>
  29752. //
  29753. // <p>Shared top, different parents.<br>
  29754. // <embed src="images/ArrayMerge_ShareTopDiffPar.svg" type="image/svg+xml"/></p>
  29755. //
  29756. // <p>Shared top, all shared parents.<br>
  29757. // <embed src="images/ArrayMerge_ShareTopSharePar.svg"
  29758. // type="image/svg+xml"/></p>
  29759. //
  29760. // <p>Equal tops, merge parents and reduce top to
  29761. // {@link SingletonPredictionContext}.<br>
  29762. // <embed src="images/ArrayMerge_EqualTop.svg" type="image/svg+xml"/></p>
  29763. // /
  29764. function mergeArrays(a, b, rootIsWildcard, mergeCache) {
  29765. if (mergeCache !== null) {
  29766. var previous = mergeCache.get(a, b);
  29767. if (previous !== null) {
  29768. return previous;
  29769. }
  29770. previous = mergeCache.get(b, a);
  29771. if (previous !== null) {
  29772. return previous;
  29773. }
  29774. }
  29775. // merge sorted payloads a + b => M
  29776. var i = 0; // walks a
  29777. var j = 0; // walks b
  29778. var k = 0; // walks target M array
  29779. var mergedReturnStates = [];
  29780. var mergedParents = [];
  29781. // walk and merge to yield mergedParents, mergedReturnStates
  29782. while (i < a.returnStates.length && j < b.returnStates.length) {
  29783. var a_parent = a.parents[i];
  29784. var b_parent = b.parents[j];
  29785. if (a.returnStates[i] === b.returnStates[j]) {
  29786. // same payload (stack tops are equal), must yield merged singleton
  29787. var payload = a.returnStates[i];
  29788. // $+$ = $
  29789. var bothDollars = payload === PredictionContext.EMPTY_RETURN_STATE &&
  29790. a_parent === null && b_parent === null;
  29791. var ax_ax = (a_parent !== null && b_parent !== null && a_parent === b_parent); // ax+ax
  29792. // ->
  29793. // ax
  29794. if (bothDollars || ax_ax) {
  29795. mergedParents[k] = a_parent; // choose left
  29796. mergedReturnStates[k] = payload;
  29797. } else { // ax+ay -> a'[x,y]
  29798. var mergedParent = merge(a_parent, b_parent, rootIsWildcard, mergeCache);
  29799. mergedParents[k] = mergedParent;
  29800. mergedReturnStates[k] = payload;
  29801. }
  29802. i += 1; // hop over left one as usual
  29803. j += 1; // but also skip one in right side since we merge
  29804. } else if (a.returnStates[i] < b.returnStates[j]) { // copy a[i] to M
  29805. mergedParents[k] = a_parent;
  29806. mergedReturnStates[k] = a.returnStates[i];
  29807. i += 1;
  29808. } else { // b > a, copy b[j] to M
  29809. mergedParents[k] = b_parent;
  29810. mergedReturnStates[k] = b.returnStates[j];
  29811. j += 1;
  29812. }
  29813. k += 1;
  29814. }
  29815. // copy over any payloads remaining in either array
  29816. if (i < a.returnStates.length) {
  29817. for (var p = i; p < a.returnStates.length; p++) {
  29818. mergedParents[k] = a.parents[p];
  29819. mergedReturnStates[k] = a.returnStates[p];
  29820. k += 1;
  29821. }
  29822. } else {
  29823. for (var p = j; p < b.returnStates.length; p++) {
  29824. mergedParents[k] = b.parents[p];
  29825. mergedReturnStates[k] = b.returnStates[p];
  29826. k += 1;
  29827. }
  29828. }
  29829. // trim merged if we combined a few that had same stack tops
  29830. if (k < mergedParents.length) { // write index < last position; trim
  29831. if (k === 1) { // for just one merged element, return singleton top
  29832. var a_ = SingletonPredictionContext.create(mergedParents[0],
  29833. mergedReturnStates[0]);
  29834. if (mergeCache !== null) {
  29835. mergeCache.set(a, b, a_);
  29836. }
  29837. return a_;
  29838. }
  29839. mergedParents = mergedParents.slice(0, k);
  29840. mergedReturnStates = mergedReturnStates.slice(0, k);
  29841. }
  29842. var M = new ArrayPredictionContext(mergedParents, mergedReturnStates);
  29843. // if we created same array as a or b, return that instead
  29844. // TODO: track whether this is possible above during merge sort for speed
  29845. if (M === a) {
  29846. if (mergeCache !== null) {
  29847. mergeCache.set(a, b, a);
  29848. }
  29849. return a;
  29850. }
  29851. if (M === b) {
  29852. if (mergeCache !== null) {
  29853. mergeCache.set(a, b, b);
  29854. }
  29855. return b;
  29856. }
  29857. combineCommonParents(mergedParents);
  29858. if (mergeCache !== null) {
  29859. mergeCache.set(a, b, M);
  29860. }
  29861. return M;
  29862. }
  29863. //
  29864. // Make pass over all <em>M</em> {@code parents}; merge any {@code equals()}
  29865. // ones.
  29866. // /
  29867. function combineCommonParents(parents) {
  29868. var uniqueParents = {};
  29869. for (var p = 0; p < parents.length; p++) {
  29870. var parent = parents[p];
  29871. if (!(parent in uniqueParents)) {
  29872. uniqueParents[parent] = parent;
  29873. }
  29874. }
  29875. for (var q = 0; q < parents.length; q++) {
  29876. parents[q] = uniqueParents[parents[q]];
  29877. }
  29878. }
  29879. function getCachedPredictionContext(context, contextCache, visited) {
  29880. if (context.isEmpty()) {
  29881. return context;
  29882. }
  29883. var existing = visited[context] || null;
  29884. if (existing !== null) {
  29885. return existing;
  29886. }
  29887. existing = contextCache.get(context);
  29888. if (existing !== null) {
  29889. visited[context] = existing;
  29890. return existing;
  29891. }
  29892. var changed = false;
  29893. var parents = [];
  29894. for (var i = 0; i < parents.length; i++) {
  29895. var parent = getCachedPredictionContext(context.getParent(i), contextCache, visited);
  29896. if (changed || parent !== context.getParent(i)) {
  29897. if (!changed) {
  29898. parents = [];
  29899. for (var j = 0; j < context.length; j++) {
  29900. parents[j] = context.getParent(j);
  29901. }
  29902. changed = true;
  29903. }
  29904. parents[i] = parent;
  29905. }
  29906. }
  29907. if (!changed) {
  29908. contextCache.add(context);
  29909. visited[context] = context;
  29910. return context;
  29911. }
  29912. var updated = null;
  29913. if (parents.length === 0) {
  29914. updated = PredictionContext.EMPTY;
  29915. } else if (parents.length === 1) {
  29916. updated = SingletonPredictionContext.create(parents[0], context
  29917. .getReturnState(0));
  29918. } else {
  29919. updated = new ArrayPredictionContext(parents, context.returnStates);
  29920. }
  29921. contextCache.add(updated);
  29922. visited[updated] = updated;
  29923. visited[context] = updated;
  29924. return updated;
  29925. }
  29926. // ter's recursive version of Sam's getAllNodes()
  29927. function getAllContextNodes(context, nodes, visited) {
  29928. if (nodes === null) {
  29929. nodes = [];
  29930. return getAllContextNodes(context, nodes, visited);
  29931. } else if (visited === null) {
  29932. visited = {};
  29933. return getAllContextNodes(context, nodes, visited);
  29934. } else {
  29935. if (context === null || visited[context] !== null) {
  29936. return nodes;
  29937. }
  29938. visited[context] = context;
  29939. nodes.push(context);
  29940. for (var i = 0; i < context.length; i++) {
  29941. getAllContextNodes(context.getParent(i), nodes, visited);
  29942. }
  29943. return nodes;
  29944. }
  29945. }
  29946. exports.merge = merge;
  29947. exports.PredictionContext = PredictionContext;
  29948. exports.PredictionContextCache = PredictionContextCache;
  29949. exports.SingletonPredictionContext = SingletonPredictionContext;
  29950. exports.predictionContextFromRuleContext = predictionContextFromRuleContext;
  29951. exports.getCachedPredictionContext = getCachedPredictionContext;
  29952. /***/ }),
  29953. /***/ "./node_modules/antlr4/Recognizer.js":
  29954. /*!*******************************************!*\
  29955. !*** ./node_modules/antlr4/Recognizer.js ***!
  29956. \*******************************************/
  29957. /*! no static exports found */
  29958. /***/ (function(module, exports, __webpack_require__) {
  29959. //
  29960. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  29961. * Use of this file is governed by the BSD 3-clause license that
  29962. * can be found in the LICENSE.txt file in the project root.
  29963. */
  29964. //
  29965. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  29966. var ConsoleErrorListener = __webpack_require__(/*! ./error/ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ConsoleErrorListener;
  29967. var ProxyErrorListener = __webpack_require__(/*! ./error/ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ProxyErrorListener;
  29968. function Recognizer() {
  29969. this._listeners = [ ConsoleErrorListener.INSTANCE ];
  29970. this._interp = null;
  29971. this._stateNumber = -1;
  29972. return this;
  29973. }
  29974. Recognizer.tokenTypeMapCache = {};
  29975. Recognizer.ruleIndexMapCache = {};
  29976. Recognizer.prototype.checkVersion = function(toolVersion) {
  29977. var runtimeVersion = "4.7.1";
  29978. if (runtimeVersion!==toolVersion) {
  29979. console.log("ANTLR runtime and generated code versions disagree: "+runtimeVersion+"!="+toolVersion);
  29980. }
  29981. };
  29982. Recognizer.prototype.addErrorListener = function(listener) {
  29983. this._listeners.push(listener);
  29984. };
  29985. Recognizer.prototype.removeErrorListeners = function() {
  29986. this._listeners = [];
  29987. };
  29988. Recognizer.prototype.getTokenTypeMap = function() {
  29989. var tokenNames = this.getTokenNames();
  29990. if (tokenNames===null) {
  29991. throw("The current recognizer does not provide a list of token names.");
  29992. }
  29993. var result = this.tokenTypeMapCache[tokenNames];
  29994. if(result===undefined) {
  29995. result = tokenNames.reduce(function(o, k, i) { o[k] = i; });
  29996. result.EOF = Token.EOF;
  29997. this.tokenTypeMapCache[tokenNames] = result;
  29998. }
  29999. return result;
  30000. };
  30001. // Get a map from rule names to rule indexes.
  30002. //
  30003. // <p>Used for XPath and tree pattern compilation.</p>
  30004. //
  30005. Recognizer.prototype.getRuleIndexMap = function() {
  30006. var ruleNames = this.ruleNames;
  30007. if (ruleNames===null) {
  30008. throw("The current recognizer does not provide a list of rule names.");
  30009. }
  30010. var result = this.ruleIndexMapCache[ruleNames];
  30011. if(result===undefined) {
  30012. result = ruleNames.reduce(function(o, k, i) { o[k] = i; });
  30013. this.ruleIndexMapCache[ruleNames] = result;
  30014. }
  30015. return result;
  30016. };
  30017. Recognizer.prototype.getTokenType = function(tokenName) {
  30018. var ttype = this.getTokenTypeMap()[tokenName];
  30019. if (ttype !==undefined) {
  30020. return ttype;
  30021. } else {
  30022. return Token.INVALID_TYPE;
  30023. }
  30024. };
  30025. // What is the error header, normally line/character position information?//
  30026. Recognizer.prototype.getErrorHeader = function(e) {
  30027. var line = e.getOffendingToken().line;
  30028. var column = e.getOffendingToken().column;
  30029. return "line " + line + ":" + column;
  30030. };
  30031. // How should a token be displayed in an error message? The default
  30032. // is to display just the text, but during development you might
  30033. // want to have a lot of information spit out. Override in that case
  30034. // to use t.toString() (which, for CommonToken, dumps everything about
  30035. // the token). This is better than forcing you to override a method in
  30036. // your token objects because you don't have to go modify your lexer
  30037. // so that it creates a new Java type.
  30038. //
  30039. // @deprecated This method is not called by the ANTLR 4 Runtime. Specific
  30040. // implementations of {@link ANTLRErrorStrategy} may provide a similar
  30041. // feature when necessary. For example, see
  30042. // {@link DefaultErrorStrategy//getTokenErrorDisplay}.
  30043. //
  30044. Recognizer.prototype.getTokenErrorDisplay = function(t) {
  30045. if (t===null) {
  30046. return "<no token>";
  30047. }
  30048. var s = t.text;
  30049. if (s===null) {
  30050. if (t.type===Token.EOF) {
  30051. s = "<EOF>";
  30052. } else {
  30053. s = "<" + t.type + ">";
  30054. }
  30055. }
  30056. s = s.replace("\n","\\n").replace("\r","\\r").replace("\t","\\t");
  30057. return "'" + s + "'";
  30058. };
  30059. Recognizer.prototype.getErrorListenerDispatch = function() {
  30060. return new ProxyErrorListener(this._listeners);
  30061. };
  30062. // subclass needs to override these if there are sempreds or actions
  30063. // that the ATN interp needs to execute
  30064. Recognizer.prototype.sempred = function(localctx, ruleIndex, actionIndex) {
  30065. return true;
  30066. };
  30067. Recognizer.prototype.precpred = function(localctx , precedence) {
  30068. return true;
  30069. };
  30070. //Indicate that the recognizer has changed internal state that is
  30071. //consistent with the ATN state passed in. This way we always know
  30072. //where we are in the ATN as the parser goes along. The rule
  30073. //context objects form a stack that lets us see the stack of
  30074. //invoking rules. Combine this and we have complete ATN
  30075. //configuration information.
  30076. Object.defineProperty(Recognizer.prototype, "state", {
  30077. get : function() {
  30078. return this._stateNumber;
  30079. },
  30080. set : function(state) {
  30081. this._stateNumber = state;
  30082. }
  30083. });
  30084. exports.Recognizer = Recognizer;
  30085. /***/ }),
  30086. /***/ "./node_modules/antlr4/RuleContext.js":
  30087. /*!********************************************!*\
  30088. !*** ./node_modules/antlr4/RuleContext.js ***!
  30089. \********************************************/
  30090. /*! no static exports found */
  30091. /***/ (function(module, exports, __webpack_require__) {
  30092. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30093. * Use of this file is governed by the BSD 3-clause license that
  30094. * can be found in the LICENSE.txt file in the project root.
  30095. */
  30096. ///
  30097. // A rule context is a record of a single rule invocation. It knows
  30098. // which context invoked it, if any. If there is no parent context, then
  30099. // naturally the invoking state is not valid. The parent link
  30100. // provides a chain upwards from the current rule invocation to the root
  30101. // of the invocation tree, forming a stack. We actually carry no
  30102. // information about the rule associated with this context (except
  30103. // when parsing). We keep only the state number of the invoking state from
  30104. // the ATN submachine that invoked this. Contrast this with the s
  30105. // pointer inside ParserRuleContext that tracks the current state
  30106. // being "executed" for the current rule.
  30107. //
  30108. // The parent contexts are useful for computing lookahead sets and
  30109. // getting error information.
  30110. //
  30111. // These objects are used during parsing and prediction.
  30112. // For the special case of parsers, we use the subclass
  30113. // ParserRuleContext.
  30114. //
  30115. // @see ParserRuleContext
  30116. ///
  30117. var RuleNode = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").RuleNode;
  30118. var INVALID_INTERVAL = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").INVALID_INTERVAL;
  30119. var INVALID_ALT_NUMBER = __webpack_require__(/*! ./atn/ATN */ "./node_modules/antlr4/atn/ATN.js").INVALID_ALT_NUMBER;
  30120. function RuleContext(parent, invokingState) {
  30121. RuleNode.call(this);
  30122. // What context invoked this rule?
  30123. this.parentCtx = parent || null;
  30124. // What state invoked the rule associated with this context?
  30125. // The "return address" is the followState of invokingState
  30126. // If parent is null, this should be -1.
  30127. this.invokingState = invokingState || -1;
  30128. return this;
  30129. }
  30130. RuleContext.prototype = Object.create(RuleNode.prototype);
  30131. RuleContext.prototype.constructor = RuleContext;
  30132. RuleContext.prototype.depth = function() {
  30133. var n = 0;
  30134. var p = this;
  30135. while (p !== null) {
  30136. p = p.parentCtx;
  30137. n += 1;
  30138. }
  30139. return n;
  30140. };
  30141. // A context is empty if there is no invoking state; meaning nobody call
  30142. // current context.
  30143. RuleContext.prototype.isEmpty = function() {
  30144. return this.invokingState === -1;
  30145. };
  30146. // satisfy the ParseTree / SyntaxTree interface
  30147. RuleContext.prototype.getSourceInterval = function() {
  30148. return INVALID_INTERVAL;
  30149. };
  30150. RuleContext.prototype.getRuleContext = function() {
  30151. return this;
  30152. };
  30153. RuleContext.prototype.getPayload = function() {
  30154. return this;
  30155. };
  30156. // Return the combined text of all child nodes. This method only considers
  30157. // tokens which have been added to the parse tree.
  30158. // <p>
  30159. // Since tokens on hidden channels (e.g. whitespace or comments) are not
  30160. // added to the parse trees, they will not appear in the output of this
  30161. // method.
  30162. // /
  30163. RuleContext.prototype.getText = function() {
  30164. if (this.getChildCount() === 0) {
  30165. return "";
  30166. } else {
  30167. return this.children.map(function(child) {
  30168. return child.getText();
  30169. }).join("");
  30170. }
  30171. };
  30172. // For rule associated with this parse tree internal node, return
  30173. // the outer alternative number used to match the input. Default
  30174. // implementation does not compute nor store this alt num. Create
  30175. // a subclass of ParserRuleContext with backing field and set
  30176. // option contextSuperClass.
  30177. // to set it.
  30178. RuleContext.prototype.getAltNumber = function() { return INVALID_ALT_NUMBER; }
  30179. // Set the outer alternative number for this context node. Default
  30180. // implementation does nothing to avoid backing field overhead for
  30181. // trees that don't need it. Create
  30182. // a subclass of ParserRuleContext with backing field and set
  30183. // option contextSuperClass.
  30184. RuleContext.prototype.setAltNumber = function(altNumber) { }
  30185. RuleContext.prototype.getChild = function(i) {
  30186. return null;
  30187. };
  30188. RuleContext.prototype.getChildCount = function() {
  30189. return 0;
  30190. };
  30191. RuleContext.prototype.accept = function(visitor) {
  30192. return visitor.visitChildren(this);
  30193. };
  30194. //need to manage circular dependencies, so export now
  30195. exports.RuleContext = RuleContext;
  30196. var Trees = __webpack_require__(/*! ./tree/Trees */ "./node_modules/antlr4/tree/Trees.js").Trees;
  30197. // Print out a whole tree, not just a node, in LISP format
  30198. // (root child1 .. childN). Print just a node if this is a leaf.
  30199. //
  30200. RuleContext.prototype.toStringTree = function(ruleNames, recog) {
  30201. return Trees.toStringTree(this, ruleNames, recog);
  30202. };
  30203. RuleContext.prototype.toString = function(ruleNames, stop) {
  30204. ruleNames = ruleNames || null;
  30205. stop = stop || null;
  30206. var p = this;
  30207. var s = "[";
  30208. while (p !== null && p !== stop) {
  30209. if (ruleNames === null) {
  30210. if (!p.isEmpty()) {
  30211. s += p.invokingState;
  30212. }
  30213. } else {
  30214. var ri = p.ruleIndex;
  30215. var ruleName = (ri >= 0 && ri < ruleNames.length) ? ruleNames[ri]
  30216. : "" + ri;
  30217. s += ruleName;
  30218. }
  30219. if (p.parentCtx !== null && (ruleNames !== null || !p.parentCtx.isEmpty())) {
  30220. s += " ";
  30221. }
  30222. p = p.parentCtx;
  30223. }
  30224. s += "]";
  30225. return s;
  30226. };
  30227. /***/ }),
  30228. /***/ "./node_modules/antlr4/Token.js":
  30229. /*!**************************************!*\
  30230. !*** ./node_modules/antlr4/Token.js ***!
  30231. \**************************************/
  30232. /*! no static exports found */
  30233. /***/ (function(module, exports) {
  30234. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30235. * Use of this file is governed by the BSD 3-clause license that
  30236. * can be found in the LICENSE.txt file in the project root.
  30237. */
  30238. //
  30239. // A token has properties: text, type, line, character position in the line
  30240. // (so we can ignore tabs), token channel, index, and source from which
  30241. // we obtained this token.
  30242. function Token() {
  30243. this.source = null;
  30244. this.type = null; // token type of the token
  30245. this.channel = null; // The parser ignores everything not on DEFAULT_CHANNEL
  30246. this.start = null; // optional; return -1 if not implemented.
  30247. this.stop = null; // optional; return -1 if not implemented.
  30248. this.tokenIndex = null; // from 0..n-1 of the token object in the input stream
  30249. this.line = null; // line=1..n of the 1st character
  30250. this.column = null; // beginning of the line at which it occurs, 0..n-1
  30251. this._text = null; // text of the token.
  30252. return this;
  30253. }
  30254. Token.INVALID_TYPE = 0;
  30255. // During lookahead operations, this "token" signifies we hit rule end ATN state
  30256. // and did not follow it despite needing to.
  30257. Token.EPSILON = -2;
  30258. Token.MIN_USER_TOKEN_TYPE = 1;
  30259. Token.EOF = -1;
  30260. // All tokens go to the parser (unless skip() is called in that rule)
  30261. // on a particular "channel". The parser tunes to a particular channel
  30262. // so that whitespace etc... can go to the parser on a "hidden" channel.
  30263. Token.DEFAULT_CHANNEL = 0;
  30264. // Anything on different channel than DEFAULT_CHANNEL is not parsed
  30265. // by parser.
  30266. Token.HIDDEN_CHANNEL = 1;
  30267. // Explicitly set the text for this token. If {code text} is not
  30268. // {@code null}, then {@link //getText} will return this value rather than
  30269. // extracting the text from the input.
  30270. //
  30271. // @param text The explicit text of the token, or {@code null} if the text
  30272. // should be obtained from the input along with the start and stop indexes
  30273. // of the token.
  30274. Object.defineProperty(Token.prototype, "text", {
  30275. get : function() {
  30276. return this._text;
  30277. },
  30278. set : function(text) {
  30279. this._text = text;
  30280. }
  30281. });
  30282. Token.prototype.getTokenSource = function() {
  30283. return this.source[0];
  30284. };
  30285. Token.prototype.getInputStream = function() {
  30286. return this.source[1];
  30287. };
  30288. function CommonToken(source, type, channel, start, stop) {
  30289. Token.call(this);
  30290. this.source = source !== undefined ? source : CommonToken.EMPTY_SOURCE;
  30291. this.type = type !== undefined ? type : null;
  30292. this.channel = channel !== undefined ? channel : Token.DEFAULT_CHANNEL;
  30293. this.start = start !== undefined ? start : -1;
  30294. this.stop = stop !== undefined ? stop : -1;
  30295. this.tokenIndex = -1;
  30296. if (this.source[0] !== null) {
  30297. this.line = source[0].line;
  30298. this.column = source[0].column;
  30299. } else {
  30300. this.column = -1;
  30301. }
  30302. return this;
  30303. }
  30304. CommonToken.prototype = Object.create(Token.prototype);
  30305. CommonToken.prototype.constructor = CommonToken;
  30306. // An empty {@link Pair} which is used as the default value of
  30307. // {@link //source} for tokens that do not have a source.
  30308. CommonToken.EMPTY_SOURCE = [ null, null ];
  30309. // Constructs a new {@link CommonToken} as a copy of another {@link Token}.
  30310. //
  30311. // <p>
  30312. // If {@code oldToken} is also a {@link CommonToken} instance, the newly
  30313. // constructed token will share a reference to the {@link //text} field and
  30314. // the {@link Pair} stored in {@link //source}. Otherwise, {@link //text} will
  30315. // be assigned the result of calling {@link //getText}, and {@link //source}
  30316. // will be constructed from the result of {@link Token//getTokenSource} and
  30317. // {@link Token//getInputStream}.</p>
  30318. //
  30319. // @param oldToken The token to copy.
  30320. //
  30321. CommonToken.prototype.clone = function() {
  30322. var t = new CommonToken(this.source, this.type, this.channel, this.start,
  30323. this.stop);
  30324. t.tokenIndex = this.tokenIndex;
  30325. t.line = this.line;
  30326. t.column = this.column;
  30327. t.text = this.text;
  30328. return t;
  30329. };
  30330. Object.defineProperty(CommonToken.prototype, "text", {
  30331. get : function() {
  30332. if (this._text !== null) {
  30333. return this._text;
  30334. }
  30335. var input = this.getInputStream();
  30336. if (input === null) {
  30337. return null;
  30338. }
  30339. var n = input.size;
  30340. if (this.start < n && this.stop < n) {
  30341. return input.getText(this.start, this.stop);
  30342. } else {
  30343. return "<EOF>";
  30344. }
  30345. },
  30346. set : function(text) {
  30347. this._text = text;
  30348. }
  30349. });
  30350. CommonToken.prototype.toString = function() {
  30351. var txt = this.text;
  30352. if (txt !== null) {
  30353. txt = txt.replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\t/g, "\\t");
  30354. } else {
  30355. txt = "<no text>";
  30356. }
  30357. return "[@" + this.tokenIndex + "," + this.start + ":" + this.stop + "='" +
  30358. txt + "',<" + this.type + ">" +
  30359. (this.channel > 0 ? ",channel=" + this.channel : "") + "," +
  30360. this.line + ":" + this.column + "]";
  30361. };
  30362. exports.Token = Token;
  30363. exports.CommonToken = CommonToken;
  30364. /***/ }),
  30365. /***/ "./node_modules/antlr4/Utils.js":
  30366. /*!**************************************!*\
  30367. !*** ./node_modules/antlr4/Utils.js ***!
  30368. \**************************************/
  30369. /*! no static exports found */
  30370. /***/ (function(module, exports) {
  30371. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30372. * Use of this file is governed by the BSD 3-clause license that
  30373. * can be found in the LICENSE.txt file in the project root.
  30374. */
  30375. function arrayToString(a) {
  30376. return "[" + a.join(", ") + "]";
  30377. }
  30378. String.prototype.seed = String.prototype.seed || Math.round(Math.random() * Math.pow(2, 32));
  30379. String.prototype.hashCode = function () {
  30380. var remainder, bytes, h1, h1b, c1, c1b, c2, c2b, k1, i,
  30381. key = this.toString();
  30382. remainder = key.length & 3; // key.length % 4
  30383. bytes = key.length - remainder;
  30384. h1 = String.prototype.seed;
  30385. c1 = 0xcc9e2d51;
  30386. c2 = 0x1b873593;
  30387. i = 0;
  30388. while (i < bytes) {
  30389. k1 =
  30390. ((key.charCodeAt(i) & 0xff)) |
  30391. ((key.charCodeAt(++i) & 0xff) << 8) |
  30392. ((key.charCodeAt(++i) & 0xff) << 16) |
  30393. ((key.charCodeAt(++i) & 0xff) << 24);
  30394. ++i;
  30395. k1 = ((((k1 & 0xffff) * c1) + ((((k1 >>> 16) * c1) & 0xffff) << 16))) & 0xffffffff;
  30396. k1 = (k1 << 15) | (k1 >>> 17);
  30397. k1 = ((((k1 & 0xffff) * c2) + ((((k1 >>> 16) * c2) & 0xffff) << 16))) & 0xffffffff;
  30398. h1 ^= k1;
  30399. h1 = (h1 << 13) | (h1 >>> 19);
  30400. h1b = ((((h1 & 0xffff) * 5) + ((((h1 >>> 16) * 5) & 0xffff) << 16))) & 0xffffffff;
  30401. h1 = (((h1b & 0xffff) + 0x6b64) + ((((h1b >>> 16) + 0xe654) & 0xffff) << 16));
  30402. }
  30403. k1 = 0;
  30404. switch (remainder) {
  30405. case 3:
  30406. k1 ^= (key.charCodeAt(i + 2) & 0xff) << 16;
  30407. case 2:
  30408. k1 ^= (key.charCodeAt(i + 1) & 0xff) << 8;
  30409. case 1:
  30410. k1 ^= (key.charCodeAt(i) & 0xff);
  30411. k1 = (((k1 & 0xffff) * c1) + ((((k1 >>> 16) * c1) & 0xffff) << 16)) & 0xffffffff;
  30412. k1 = (k1 << 15) | (k1 >>> 17);
  30413. k1 = (((k1 & 0xffff) * c2) + ((((k1 >>> 16) * c2) & 0xffff) << 16)) & 0xffffffff;
  30414. h1 ^= k1;
  30415. }
  30416. h1 ^= key.length;
  30417. h1 ^= h1 >>> 16;
  30418. h1 = (((h1 & 0xffff) * 0x85ebca6b) + ((((h1 >>> 16) * 0x85ebca6b) & 0xffff) << 16)) & 0xffffffff;
  30419. h1 ^= h1 >>> 13;
  30420. h1 = ((((h1 & 0xffff) * 0xc2b2ae35) + ((((h1 >>> 16) * 0xc2b2ae35) & 0xffff) << 16))) & 0xffffffff;
  30421. h1 ^= h1 >>> 16;
  30422. return h1 >>> 0;
  30423. };
  30424. function standardEqualsFunction(a, b) {
  30425. return a.equals(b);
  30426. }
  30427. function standardHashCodeFunction(a) {
  30428. return a.hashCode();
  30429. }
  30430. function Set(hashFunction, equalsFunction) {
  30431. this.data = {};
  30432. this.hashFunction = hashFunction || standardHashCodeFunction;
  30433. this.equalsFunction = equalsFunction || standardEqualsFunction;
  30434. return this;
  30435. }
  30436. Object.defineProperty(Set.prototype, "length", {
  30437. get: function () {
  30438. var l = 0;
  30439. for (var key in this.data) {
  30440. if (key.indexOf("hash_") === 0) {
  30441. l = l + this.data[key].length;
  30442. }
  30443. }
  30444. return l;
  30445. }
  30446. });
  30447. Set.prototype.add = function (value) {
  30448. var hash = this.hashFunction(value);
  30449. var key = "hash_" + hash;
  30450. if (key in this.data) {
  30451. var values = this.data[key];
  30452. for (var i = 0; i < values.length; i++) {
  30453. if (this.equalsFunction(value, values[i])) {
  30454. return values[i];
  30455. }
  30456. }
  30457. values.push(value);
  30458. return value;
  30459. } else {
  30460. this.data[key] = [value];
  30461. return value;
  30462. }
  30463. };
  30464. Set.prototype.contains = function (value) {
  30465. return this.get(value) != null;
  30466. };
  30467. Set.prototype.get = function (value) {
  30468. var hash = this.hashFunction(value);
  30469. var key = "hash_" + hash;
  30470. if (key in this.data) {
  30471. var values = this.data[key];
  30472. for (var i = 0; i < values.length; i++) {
  30473. if (this.equalsFunction(value, values[i])) {
  30474. return values[i];
  30475. }
  30476. }
  30477. }
  30478. return null;
  30479. };
  30480. Set.prototype.values = function () {
  30481. var l = [];
  30482. for (var key in this.data) {
  30483. if (key.indexOf("hash_") === 0) {
  30484. l = l.concat(this.data[key]);
  30485. }
  30486. }
  30487. return l;
  30488. };
  30489. Set.prototype.toString = function () {
  30490. return arrayToString(this.values());
  30491. };
  30492. function BitSet() {
  30493. this.data = [];
  30494. return this;
  30495. }
  30496. BitSet.prototype.add = function (value) {
  30497. this.data[value] = true;
  30498. };
  30499. BitSet.prototype.or = function (set) {
  30500. var bits = this;
  30501. Object.keys(set.data).map(function (alt) {
  30502. bits.add(alt);
  30503. });
  30504. };
  30505. BitSet.prototype.remove = function (value) {
  30506. delete this.data[value];
  30507. };
  30508. BitSet.prototype.contains = function (value) {
  30509. return this.data[value] === true;
  30510. };
  30511. BitSet.prototype.values = function () {
  30512. return Object.keys(this.data);
  30513. };
  30514. BitSet.prototype.minValue = function () {
  30515. return Math.min.apply(null, this.values());
  30516. };
  30517. BitSet.prototype.hashCode = function () {
  30518. var hash = new Hash();
  30519. hash.update(this.values());
  30520. return hash.finish();
  30521. };
  30522. BitSet.prototype.equals = function (other) {
  30523. if (!(other instanceof BitSet)) {
  30524. return false;
  30525. }
  30526. return this.hashCode() === other.hashCode();
  30527. };
  30528. Object.defineProperty(BitSet.prototype, "length", {
  30529. get: function () {
  30530. return this.values().length;
  30531. }
  30532. });
  30533. BitSet.prototype.toString = function () {
  30534. return "{" + this.values().join(", ") + "}";
  30535. };
  30536. function Map(hashFunction, equalsFunction) {
  30537. this.data = {};
  30538. this.hashFunction = hashFunction || standardHashCodeFunction;
  30539. this.equalsFunction = equalsFunction || standardEqualsFunction;
  30540. return this;
  30541. }
  30542. Object.defineProperty(Map.prototype, "length", {
  30543. get: function () {
  30544. var l = 0;
  30545. for (var hashKey in this.data) {
  30546. if (hashKey.indexOf("hash_") === 0) {
  30547. l = l + this.data[hashKey].length;
  30548. }
  30549. }
  30550. return l;
  30551. }
  30552. });
  30553. Map.prototype.put = function (key, value) {
  30554. var hashKey = "hash_" + this.hashFunction(key);
  30555. if (hashKey in this.data) {
  30556. var entries = this.data[hashKey];
  30557. for (var i = 0; i < entries.length; i++) {
  30558. var entry = entries[i];
  30559. if (this.equalsFunction(key, entry.key)) {
  30560. var oldValue = entry.value;
  30561. entry.value = value;
  30562. return oldValue;
  30563. }
  30564. }
  30565. entries.push({key:key, value:value});
  30566. return value;
  30567. } else {
  30568. this.data[hashKey] = [{key:key, value:value}];
  30569. return value;
  30570. }
  30571. };
  30572. Map.prototype.containsKey = function (key) {
  30573. var hashKey = "hash_" + this.hashFunction(key);
  30574. if(hashKey in this.data) {
  30575. var entries = this.data[hashKey];
  30576. for (var i = 0; i < entries.length; i++) {
  30577. var entry = entries[i];
  30578. if (this.equalsFunction(key, entry.key))
  30579. return true;
  30580. }
  30581. }
  30582. return false;
  30583. };
  30584. Map.prototype.get = function (key) {
  30585. var hashKey = "hash_" + this.hashFunction(key);
  30586. if(hashKey in this.data) {
  30587. var entries = this.data[hashKey];
  30588. for (var i = 0; i < entries.length; i++) {
  30589. var entry = entries[i];
  30590. if (this.equalsFunction(key, entry.key))
  30591. return entry.value;
  30592. }
  30593. }
  30594. return null;
  30595. };
  30596. Map.prototype.entries = function () {
  30597. var l = [];
  30598. for (var key in this.data) {
  30599. if (key.indexOf("hash_") === 0) {
  30600. l = l.concat(this.data[key]);
  30601. }
  30602. }
  30603. return l;
  30604. };
  30605. Map.prototype.getKeys = function () {
  30606. return this.entries().map(function(e) {
  30607. return e.key;
  30608. });
  30609. };
  30610. Map.prototype.getValues = function () {
  30611. return this.entries().map(function(e) {
  30612. return e.value;
  30613. });
  30614. };
  30615. Map.prototype.toString = function () {
  30616. var ss = this.entries().map(function(entry) {
  30617. return '{' + entry.key + ':' + entry.value + '}';
  30618. });
  30619. return '[' + ss.join(", ") + ']';
  30620. };
  30621. function AltDict() {
  30622. this.data = {};
  30623. return this;
  30624. }
  30625. AltDict.prototype.get = function (key) {
  30626. key = "k-" + key;
  30627. if (key in this.data) {
  30628. return this.data[key];
  30629. } else {
  30630. return null;
  30631. }
  30632. };
  30633. AltDict.prototype.put = function (key, value) {
  30634. key = "k-" + key;
  30635. this.data[key] = value;
  30636. };
  30637. AltDict.prototype.values = function () {
  30638. var data = this.data;
  30639. var keys = Object.keys(this.data);
  30640. return keys.map(function (key) {
  30641. return data[key];
  30642. });
  30643. };
  30644. function DoubleDict() {
  30645. return this;
  30646. }
  30647. function Hash() {
  30648. this.count = 0;
  30649. this.hash = 0;
  30650. return this;
  30651. }
  30652. Hash.prototype.update = function () {
  30653. for(var i=0;i<arguments.length;i++) {
  30654. var value = arguments[i];
  30655. if (value == null)
  30656. continue;
  30657. if(Array.isArray(value))
  30658. this.update.apply(value);
  30659. else {
  30660. var k = 0;
  30661. switch (typeof(value)) {
  30662. case 'undefined':
  30663. case 'function':
  30664. continue;
  30665. case 'number':
  30666. case 'boolean':
  30667. k = value;
  30668. break;
  30669. case 'string':
  30670. k = value.hashCode();
  30671. break;
  30672. default:
  30673. value.updateHashCode(this);
  30674. continue;
  30675. }
  30676. k = k * 0xCC9E2D51;
  30677. k = (k << 15) | (k >>> (32 - 15));
  30678. k = k * 0x1B873593;
  30679. this.count = this.count + 1;
  30680. var hash = this.hash ^ k;
  30681. hash = (hash << 13) | (hash >>> (32 - 13));
  30682. hash = hash * 5 + 0xE6546B64;
  30683. this.hash = hash;
  30684. }
  30685. }
  30686. }
  30687. Hash.prototype.finish = function () {
  30688. var hash = this.hash ^ (this.count * 4);
  30689. hash = hash ^ (hash >>> 16);
  30690. hash = hash * 0x85EBCA6B;
  30691. hash = hash ^ (hash >>> 13);
  30692. hash = hash * 0xC2B2AE35;
  30693. hash = hash ^ (hash >>> 16);
  30694. return hash;
  30695. }
  30696. function hashStuff() {
  30697. var hash = new Hash();
  30698. hash.update.apply(arguments);
  30699. return hash.finish();
  30700. }
  30701. DoubleDict.prototype.get = function (a, b) {
  30702. var d = this[a] || null;
  30703. return d === null ? null : (d[b] || null);
  30704. };
  30705. DoubleDict.prototype.set = function (a, b, o) {
  30706. var d = this[a] || null;
  30707. if (d === null) {
  30708. d = {};
  30709. this[a] = d;
  30710. }
  30711. d[b] = o;
  30712. };
  30713. function escapeWhitespace(s, escapeSpaces) {
  30714. s = s.replace(/\t/g, "\\t")
  30715. .replace(/\n/g, "\\n")
  30716. .replace(/\r/g, "\\r");
  30717. if (escapeSpaces) {
  30718. s = s.replace(/ /g, "\u00B7");
  30719. }
  30720. return s;
  30721. }
  30722. function titleCase(str) {
  30723. return str.replace(/\w\S*/g, function (txt) {
  30724. return txt.charAt(0).toUpperCase() + txt.substr(1);
  30725. });
  30726. };
  30727. function equalArrays(a, b)
  30728. {
  30729. if (!Array.isArray(a) || !Array.isArray(b))
  30730. return false;
  30731. if (a == b)
  30732. return true;
  30733. if (a.length != b.length)
  30734. return false;
  30735. for (var i = 0; i < a.length; i++) {
  30736. if (a[i] == b[i])
  30737. continue;
  30738. if (!a[i].equals(b[i]))
  30739. return false;
  30740. }
  30741. return true;
  30742. };
  30743. exports.Hash = Hash;
  30744. exports.Set = Set;
  30745. exports.Map = Map;
  30746. exports.BitSet = BitSet;
  30747. exports.AltDict = AltDict;
  30748. exports.DoubleDict = DoubleDict;
  30749. exports.hashStuff = hashStuff;
  30750. exports.escapeWhitespace = escapeWhitespace;
  30751. exports.arrayToString = arrayToString;
  30752. exports.titleCase = titleCase;
  30753. exports.equalArrays = equalArrays;
  30754. /***/ }),
  30755. /***/ "./node_modules/antlr4/atn/ATN.js":
  30756. /*!****************************************!*\
  30757. !*** ./node_modules/antlr4/atn/ATN.js ***!
  30758. \****************************************/
  30759. /*! no static exports found */
  30760. /***/ (function(module, exports, __webpack_require__) {
  30761. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30762. * Use of this file is governed by the BSD 3-clause license that
  30763. * can be found in the LICENSE.txt file in the project root.
  30764. */
  30765. var LL1Analyzer = __webpack_require__(/*! ./../LL1Analyzer */ "./node_modules/antlr4/LL1Analyzer.js").LL1Analyzer;
  30766. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  30767. function ATN(grammarType , maxTokenType) {
  30768. // Used for runtime deserialization of ATNs from strings///
  30769. // The type of the ATN.
  30770. this.grammarType = grammarType;
  30771. // The maximum value for any symbol recognized by a transition in the ATN.
  30772. this.maxTokenType = maxTokenType;
  30773. this.states = [];
  30774. // Each subrule/rule is a decision point and we must track them so we
  30775. // can go back later and build DFA predictors for them. This includes
  30776. // all the rules, subrules, optional blocks, ()+, ()* etc...
  30777. this.decisionToState = [];
  30778. // Maps from rule index to starting state number.
  30779. this.ruleToStartState = [];
  30780. // Maps from rule index to stop state number.
  30781. this.ruleToStopState = null;
  30782. this.modeNameToStartState = {};
  30783. // For lexer ATNs, this maps the rule index to the resulting token type.
  30784. // For parser ATNs, this maps the rule index to the generated bypass token
  30785. // type if the
  30786. // {@link ATNDeserializationOptions//isGenerateRuleBypassTransitions}
  30787. // deserialization option was specified; otherwise, this is {@code null}.
  30788. this.ruleToTokenType = null;
  30789. // For lexer ATNs, this is an array of {@link LexerAction} objects which may
  30790. // be referenced by action transitions in the ATN.
  30791. this.lexerActions = null;
  30792. this.modeToStartState = [];
  30793. return this;
  30794. }
  30795. // Compute the set of valid tokens that can occur starting in state {@code s}.
  30796. // If {@code ctx} is null, the set of tokens will not include what can follow
  30797. // the rule surrounding {@code s}. In other words, the set will be
  30798. // restricted to tokens reachable staying within {@code s}'s rule.
  30799. ATN.prototype.nextTokensInContext = function(s, ctx) {
  30800. var anal = new LL1Analyzer(this);
  30801. return anal.LOOK(s, null, ctx);
  30802. };
  30803. // Compute the set of valid tokens that can occur starting in {@code s} and
  30804. // staying in same rule. {@link Token//EPSILON} is in set if we reach end of
  30805. // rule.
  30806. ATN.prototype.nextTokensNoContext = function(s) {
  30807. if (s.nextTokenWithinRule !== null ) {
  30808. return s.nextTokenWithinRule;
  30809. }
  30810. s.nextTokenWithinRule = this.nextTokensInContext(s, null);
  30811. s.nextTokenWithinRule.readOnly = true;
  30812. return s.nextTokenWithinRule;
  30813. };
  30814. ATN.prototype.nextTokens = function(s, ctx) {
  30815. if ( ctx===undefined ) {
  30816. return this.nextTokensNoContext(s);
  30817. } else {
  30818. return this.nextTokensInContext(s, ctx);
  30819. }
  30820. };
  30821. ATN.prototype.addState = function( state) {
  30822. if ( state !== null ) {
  30823. state.atn = this;
  30824. state.stateNumber = this.states.length;
  30825. }
  30826. this.states.push(state);
  30827. };
  30828. ATN.prototype.removeState = function( state) {
  30829. this.states[state.stateNumber] = null; // just free mem, don't shift states in list
  30830. };
  30831. ATN.prototype.defineDecisionState = function( s) {
  30832. this.decisionToState.push(s);
  30833. s.decision = this.decisionToState.length-1;
  30834. return s.decision;
  30835. };
  30836. ATN.prototype.getDecisionState = function( decision) {
  30837. if (this.decisionToState.length===0) {
  30838. return null;
  30839. } else {
  30840. return this.decisionToState[decision];
  30841. }
  30842. };
  30843. // Computes the set of input symbols which could follow ATN state number
  30844. // {@code stateNumber} in the specified full {@code context}. This method
  30845. // considers the complete parser context, but does not evaluate semantic
  30846. // predicates (i.e. all predicates encountered during the calculation are
  30847. // assumed true). If a path in the ATN exists from the starting state to the
  30848. // {@link RuleStopState} of the outermost context without matching any
  30849. // symbols, {@link Token//EOF} is added to the returned set.
  30850. //
  30851. // <p>If {@code context} is {@code null}, it is treated as
  30852. // {@link ParserRuleContext//EMPTY}.</p>
  30853. //
  30854. // @param stateNumber the ATN state number
  30855. // @param context the full parse context
  30856. // @return The set of potentially valid input symbols which could follow the
  30857. // specified state in the specified context.
  30858. // @throws IllegalArgumentException if the ATN does not contain a state with
  30859. // number {@code stateNumber}
  30860. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  30861. ATN.prototype.getExpectedTokens = function( stateNumber, ctx ) {
  30862. if ( stateNumber < 0 || stateNumber >= this.states.length ) {
  30863. throw("Invalid state number.");
  30864. }
  30865. var s = this.states[stateNumber];
  30866. var following = this.nextTokens(s);
  30867. if (!following.contains(Token.EPSILON)) {
  30868. return following;
  30869. }
  30870. var expected = new IntervalSet();
  30871. expected.addSet(following);
  30872. expected.removeOne(Token.EPSILON);
  30873. while (ctx !== null && ctx.invokingState >= 0 && following.contains(Token.EPSILON)) {
  30874. var invokingState = this.states[ctx.invokingState];
  30875. var rt = invokingState.transitions[0];
  30876. following = this.nextTokens(rt.followState);
  30877. expected.addSet(following);
  30878. expected.removeOne(Token.EPSILON);
  30879. ctx = ctx.parentCtx;
  30880. }
  30881. if (following.contains(Token.EPSILON)) {
  30882. expected.addOne(Token.EOF);
  30883. }
  30884. return expected;
  30885. };
  30886. ATN.INVALID_ALT_NUMBER = 0;
  30887. exports.ATN = ATN;
  30888. /***/ }),
  30889. /***/ "./node_modules/antlr4/atn/ATNConfig.js":
  30890. /*!**********************************************!*\
  30891. !*** ./node_modules/antlr4/atn/ATNConfig.js ***!
  30892. \**********************************************/
  30893. /*! no static exports found */
  30894. /***/ (function(module, exports, __webpack_require__) {
  30895. //
  30896. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30897. * Use of this file is governed by the BSD 3-clause license that
  30898. * can be found in the LICENSE.txt file in the project root.
  30899. */
  30900. ///
  30901. // A tuple: (ATN state, predicted alt, syntactic, semantic context).
  30902. // The syntactic context is a graph-structured stack node whose
  30903. // path(s) to the root is the rule invocation(s)
  30904. // chain used to arrive at the state. The semantic context is
  30905. // the tree of semantic predicates encountered before reaching
  30906. // an ATN state.
  30907. ///
  30908. var DecisionState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").DecisionState;
  30909. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  30910. var Hash = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").Hash;
  30911. function checkParams(params, isCfg) {
  30912. if(params===null) {
  30913. var result = { state:null, alt:null, context:null, semanticContext:null };
  30914. if(isCfg) {
  30915. result.reachesIntoOuterContext = 0;
  30916. }
  30917. return result;
  30918. } else {
  30919. var props = {};
  30920. props.state = params.state || null;
  30921. props.alt = (params.alt === undefined) ? null : params.alt;
  30922. props.context = params.context || null;
  30923. props.semanticContext = params.semanticContext || null;
  30924. if(isCfg) {
  30925. props.reachesIntoOuterContext = params.reachesIntoOuterContext || 0;
  30926. props.precedenceFilterSuppressed = params.precedenceFilterSuppressed || false;
  30927. }
  30928. return props;
  30929. }
  30930. }
  30931. function ATNConfig(params, config) {
  30932. this.checkContext(params, config);
  30933. params = checkParams(params);
  30934. config = checkParams(config, true);
  30935. // The ATN state associated with this configuration///
  30936. this.state = params.state!==null ? params.state : config.state;
  30937. // What alt (or lexer rule) is predicted by this configuration///
  30938. this.alt = params.alt!==null ? params.alt : config.alt;
  30939. // The stack of invoking states leading to the rule/states associated
  30940. // with this config. We track only those contexts pushed during
  30941. // execution of the ATN simulator.
  30942. this.context = params.context!==null ? params.context : config.context;
  30943. this.semanticContext = params.semanticContext!==null ? params.semanticContext :
  30944. (config.semanticContext!==null ? config.semanticContext : SemanticContext.NONE);
  30945. // We cannot execute predicates dependent upon local context unless
  30946. // we know for sure we are in the correct context. Because there is
  30947. // no way to do this efficiently, we simply cannot evaluate
  30948. // dependent predicates unless we are in the rule that initially
  30949. // invokes the ATN simulator.
  30950. //
  30951. // closure() tracks the depth of how far we dip into the
  30952. // outer context: depth &gt; 0. Note that it may not be totally
  30953. // accurate depth since I don't ever decrement. TODO: make it a boolean then
  30954. this.reachesIntoOuterContext = config.reachesIntoOuterContext;
  30955. this.precedenceFilterSuppressed = config.precedenceFilterSuppressed;
  30956. return this;
  30957. }
  30958. ATNConfig.prototype.checkContext = function(params, config) {
  30959. if((params.context===null || params.context===undefined) &&
  30960. (config===null || config.context===null || config.context===undefined)) {
  30961. this.context = null;
  30962. }
  30963. };
  30964. ATNConfig.prototype.hashCode = function() {
  30965. var hash = new Hash();
  30966. this.updateHashCode(hash);
  30967. return hash.finish();
  30968. };
  30969. ATNConfig.prototype.updateHashCode = function(hash) {
  30970. hash.update(this.state.stateNumber, this.alt, this.context, this.semanticContext);
  30971. };
  30972. // An ATN configuration is equal to another if both have
  30973. // the same state, they predict the same alternative, and
  30974. // syntactic/semantic contexts are the same.
  30975. ATNConfig.prototype.equals = function(other) {
  30976. if (this === other) {
  30977. return true;
  30978. } else if (! (other instanceof ATNConfig)) {
  30979. return false;
  30980. } else {
  30981. return this.state.stateNumber===other.state.stateNumber &&
  30982. this.alt===other.alt &&
  30983. (this.context===null ? other.context===null : this.context.equals(other.context)) &&
  30984. this.semanticContext.equals(other.semanticContext) &&
  30985. this.precedenceFilterSuppressed===other.precedenceFilterSuppressed;
  30986. }
  30987. };
  30988. ATNConfig.prototype.hashCodeForConfigSet = function() {
  30989. var hash = new Hash();
  30990. hash.update(this.state.stateNumber, this.alt, this.semanticContext);
  30991. return hash.finish();
  30992. };
  30993. ATNConfig.prototype.equalsForConfigSet = function(other) {
  30994. if (this === other) {
  30995. return true;
  30996. } else if (! (other instanceof ATNConfig)) {
  30997. return false;
  30998. } else {
  30999. return this.state.stateNumber===other.state.stateNumber &&
  31000. this.alt===other.alt &&
  31001. this.semanticContext.equals(other.semanticContext);
  31002. }
  31003. };
  31004. ATNConfig.prototype.toString = function() {
  31005. return "(" + this.state + "," + this.alt +
  31006. (this.context!==null ? ",[" + this.context.toString() + "]" : "") +
  31007. (this.semanticContext !== SemanticContext.NONE ?
  31008. ("," + this.semanticContext.toString())
  31009. : "") +
  31010. (this.reachesIntoOuterContext>0 ?
  31011. (",up=" + this.reachesIntoOuterContext)
  31012. : "") + ")";
  31013. };
  31014. function LexerATNConfig(params, config) {
  31015. ATNConfig.call(this, params, config);
  31016. // This is the backing field for {@link //getLexerActionExecutor}.
  31017. var lexerActionExecutor = params.lexerActionExecutor || null;
  31018. this.lexerActionExecutor = lexerActionExecutor || (config!==null ? config.lexerActionExecutor : null);
  31019. this.passedThroughNonGreedyDecision = config!==null ? this.checkNonGreedyDecision(config, this.state) : false;
  31020. return this;
  31021. }
  31022. LexerATNConfig.prototype = Object.create(ATNConfig.prototype);
  31023. LexerATNConfig.prototype.constructor = LexerATNConfig;
  31024. LexerATNConfig.prototype.updateHashCode = function(hash) {
  31025. hash.update(this.state.stateNumber, this.alt, this.context, this.semanticContext, this.passedThroughNonGreedyDecision, this.lexerActionExecutor);
  31026. };
  31027. LexerATNConfig.prototype.equals = function(other) {
  31028. return this === other ||
  31029. (other instanceof LexerATNConfig &&
  31030. this.passedThroughNonGreedyDecision == other.passedThroughNonGreedyDecision &&
  31031. (this.lexerActionExecutor ? this.lexerActionExecutor.equals(other.lexerActionExecutor) : !other.lexerActionExecutor) &&
  31032. ATNConfig.prototype.equals.call(this, other));
  31033. };
  31034. LexerATNConfig.prototype.hashCodeForConfigSet = LexerATNConfig.prototype.hashCode;
  31035. LexerATNConfig.prototype.equalsForConfigSet = LexerATNConfig.prototype.equals;
  31036. LexerATNConfig.prototype.checkNonGreedyDecision = function(source, target) {
  31037. return source.passedThroughNonGreedyDecision ||
  31038. (target instanceof DecisionState) && target.nonGreedy;
  31039. };
  31040. exports.ATNConfig = ATNConfig;
  31041. exports.LexerATNConfig = LexerATNConfig;
  31042. /***/ }),
  31043. /***/ "./node_modules/antlr4/atn/ATNConfigSet.js":
  31044. /*!*************************************************!*\
  31045. !*** ./node_modules/antlr4/atn/ATNConfigSet.js ***!
  31046. \*************************************************/
  31047. /*! no static exports found */
  31048. /***/ (function(module, exports, __webpack_require__) {
  31049. //
  31050. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31051. * Use of this file is governed by the BSD 3-clause license that
  31052. * can be found in the LICENSE.txt file in the project root.
  31053. */
  31054. //
  31055. // Specialized {@link Set}{@code <}{@link ATNConfig}{@code >} that can track
  31056. // info about the set, with support for combining similar configurations using a
  31057. // graph-structured stack.
  31058. ///
  31059. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  31060. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  31061. var Hash = Utils.Hash;
  31062. var Set = Utils.Set;
  31063. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  31064. var merge = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").merge;
  31065. function hashATNConfig(c) {
  31066. return c.hashCodeForConfigSet();
  31067. }
  31068. function equalATNConfigs(a, b) {
  31069. if ( a===b ) {
  31070. return true;
  31071. } else if ( a===null || b===null ) {
  31072. return false;
  31073. } else
  31074. return a.equalsForConfigSet(b);
  31075. }
  31076. function ATNConfigSet(fullCtx) {
  31077. //
  31078. // The reason that we need this is because we don't want the hash map to use
  31079. // the standard hash code and equals. We need all configurations with the
  31080. // same
  31081. // {@code (s,i,_,semctx)} to be equal. Unfortunately, this key effectively
  31082. // doubles
  31083. // the number of objects associated with ATNConfigs. The other solution is
  31084. // to
  31085. // use a hash table that lets us specify the equals/hashcode operation.
  31086. // All configs but hashed by (s, i, _, pi) not including context. Wiped out
  31087. // when we go readonly as this set becomes a DFA state.
  31088. this.configLookup = new Set(hashATNConfig, equalATNConfigs);
  31089. // Indicates that this configuration set is part of a full context
  31090. // LL prediction. It will be used to determine how to merge $. With SLL
  31091. // it's a wildcard whereas it is not for LL context merge.
  31092. this.fullCtx = fullCtx === undefined ? true : fullCtx;
  31093. // Indicates that the set of configurations is read-only. Do not
  31094. // allow any code to manipulate the set; DFA states will point at
  31095. // the sets and they must not change. This does not protect the other
  31096. // fields; in particular, conflictingAlts is set after
  31097. // we've made this readonly.
  31098. this.readOnly = false;
  31099. // Track the elements as they are added to the set; supports get(i)///
  31100. this.configs = [];
  31101. // TODO: these fields make me pretty uncomfortable but nice to pack up info
  31102. // together, saves recomputation
  31103. // TODO: can we track conflicts as they are added to save scanning configs
  31104. // later?
  31105. this.uniqueAlt = 0;
  31106. this.conflictingAlts = null;
  31107. // Used in parser and lexer. In lexer, it indicates we hit a pred
  31108. // while computing a closure operation. Don't make a DFA state from this.
  31109. this.hasSemanticContext = false;
  31110. this.dipsIntoOuterContext = false;
  31111. this.cachedHashCode = -1;
  31112. return this;
  31113. }
  31114. // Adding a new config means merging contexts with existing configs for
  31115. // {@code (s, i, pi, _)}, where {@code s} is the
  31116. // {@link ATNConfig//state}, {@code i} is the {@link ATNConfig//alt}, and
  31117. // {@code pi} is the {@link ATNConfig//semanticContext}. We use
  31118. // {@code (s,i,pi)} as key.
  31119. //
  31120. // <p>This method updates {@link //dipsIntoOuterContext} and
  31121. // {@link //hasSemanticContext} when necessary.</p>
  31122. // /
  31123. ATNConfigSet.prototype.add = function(config, mergeCache) {
  31124. if (mergeCache === undefined) {
  31125. mergeCache = null;
  31126. }
  31127. if (this.readOnly) {
  31128. throw "This set is readonly";
  31129. }
  31130. if (config.semanticContext !== SemanticContext.NONE) {
  31131. this.hasSemanticContext = true;
  31132. }
  31133. if (config.reachesIntoOuterContext > 0) {
  31134. this.dipsIntoOuterContext = true;
  31135. }
  31136. var existing = this.configLookup.add(config);
  31137. if (existing === config) {
  31138. this.cachedHashCode = -1;
  31139. this.configs.push(config); // track order here
  31140. return true;
  31141. }
  31142. // a previous (s,i,pi,_), merge with it and save result
  31143. var rootIsWildcard = !this.fullCtx;
  31144. var merged = merge(existing.context, config.context, rootIsWildcard, mergeCache);
  31145. // no need to check for existing.context, config.context in cache
  31146. // since only way to create new graphs is "call rule" and here. We
  31147. // cache at both places.
  31148. existing.reachesIntoOuterContext = Math.max( existing.reachesIntoOuterContext, config.reachesIntoOuterContext);
  31149. // make sure to preserve the precedence filter suppression during the merge
  31150. if (config.precedenceFilterSuppressed) {
  31151. existing.precedenceFilterSuppressed = true;
  31152. }
  31153. existing.context = merged; // replace context; no need to alt mapping
  31154. return true;
  31155. };
  31156. ATNConfigSet.prototype.getStates = function() {
  31157. var states = new Set();
  31158. for (var i = 0; i < this.configs.length; i++) {
  31159. states.add(this.configs[i].state);
  31160. }
  31161. return states;
  31162. };
  31163. ATNConfigSet.prototype.getPredicates = function() {
  31164. var preds = [];
  31165. for (var i = 0; i < this.configs.length; i++) {
  31166. var c = this.configs[i].semanticContext;
  31167. if (c !== SemanticContext.NONE) {
  31168. preds.push(c.semanticContext);
  31169. }
  31170. }
  31171. return preds;
  31172. };
  31173. Object.defineProperty(ATNConfigSet.prototype, "items", {
  31174. get : function() {
  31175. return this.configs;
  31176. }
  31177. });
  31178. ATNConfigSet.prototype.optimizeConfigs = function(interpreter) {
  31179. if (this.readOnly) {
  31180. throw "This set is readonly";
  31181. }
  31182. if (this.configLookup.length === 0) {
  31183. return;
  31184. }
  31185. for (var i = 0; i < this.configs.length; i++) {
  31186. var config = this.configs[i];
  31187. config.context = interpreter.getCachedContext(config.context);
  31188. }
  31189. };
  31190. ATNConfigSet.prototype.addAll = function(coll) {
  31191. for (var i = 0; i < coll.length; i++) {
  31192. this.add(coll[i]);
  31193. }
  31194. return false;
  31195. };
  31196. ATNConfigSet.prototype.equals = function(other) {
  31197. return this === other ||
  31198. (other instanceof ATNConfigSet &&
  31199. Utils.equalArrays(this.configs, other.configs) &&
  31200. this.fullCtx === other.fullCtx &&
  31201. this.uniqueAlt === other.uniqueAlt &&
  31202. this.conflictingAlts === other.conflictingAlts &&
  31203. this.hasSemanticContext === other.hasSemanticContext &&
  31204. this.dipsIntoOuterContext === other.dipsIntoOuterContext);
  31205. };
  31206. ATNConfigSet.prototype.hashCode = function() {
  31207. var hash = new Hash();
  31208. this.updateHashCode(hash);
  31209. return hash.finish();
  31210. };
  31211. ATNConfigSet.prototype.updateHashCode = function(hash) {
  31212. if (this.readOnly) {
  31213. if (this.cachedHashCode === -1) {
  31214. var hash = new Hash();
  31215. hash.update(this.configs);
  31216. this.cachedHashCode = hash.finish();
  31217. }
  31218. hash.update(this.cachedHashCode);
  31219. } else {
  31220. hash.update(this.configs);
  31221. }
  31222. };
  31223. Object.defineProperty(ATNConfigSet.prototype, "length", {
  31224. get : function() {
  31225. return this.configs.length;
  31226. }
  31227. });
  31228. ATNConfigSet.prototype.isEmpty = function() {
  31229. return this.configs.length === 0;
  31230. };
  31231. ATNConfigSet.prototype.contains = function(item) {
  31232. if (this.configLookup === null) {
  31233. throw "This method is not implemented for readonly sets.";
  31234. }
  31235. return this.configLookup.contains(item);
  31236. };
  31237. ATNConfigSet.prototype.containsFast = function(item) {
  31238. if (this.configLookup === null) {
  31239. throw "This method is not implemented for readonly sets.";
  31240. }
  31241. return this.configLookup.containsFast(item);
  31242. };
  31243. ATNConfigSet.prototype.clear = function() {
  31244. if (this.readOnly) {
  31245. throw "This set is readonly";
  31246. }
  31247. this.configs = [];
  31248. this.cachedHashCode = -1;
  31249. this.configLookup = new Set();
  31250. };
  31251. ATNConfigSet.prototype.setReadonly = function(readOnly) {
  31252. this.readOnly = readOnly;
  31253. if (readOnly) {
  31254. this.configLookup = null; // can't mod, no need for lookup cache
  31255. }
  31256. };
  31257. ATNConfigSet.prototype.toString = function() {
  31258. return Utils.arrayToString(this.configs) +
  31259. (this.hasSemanticContext ? ",hasSemanticContext=" + this.hasSemanticContext : "") +
  31260. (this.uniqueAlt !== ATN.INVALID_ALT_NUMBER ? ",uniqueAlt=" + this.uniqueAlt : "") +
  31261. (this.conflictingAlts !== null ? ",conflictingAlts=" + this.conflictingAlts : "") +
  31262. (this.dipsIntoOuterContext ? ",dipsIntoOuterContext" : "");
  31263. };
  31264. function OrderedATNConfigSet() {
  31265. ATNConfigSet.call(this);
  31266. this.configLookup = new Set();
  31267. return this;
  31268. }
  31269. OrderedATNConfigSet.prototype = Object.create(ATNConfigSet.prototype);
  31270. OrderedATNConfigSet.prototype.constructor = OrderedATNConfigSet;
  31271. exports.ATNConfigSet = ATNConfigSet;
  31272. exports.OrderedATNConfigSet = OrderedATNConfigSet;
  31273. /***/ }),
  31274. /***/ "./node_modules/antlr4/atn/ATNDeserializationOptions.js":
  31275. /*!**************************************************************!*\
  31276. !*** ./node_modules/antlr4/atn/ATNDeserializationOptions.js ***!
  31277. \**************************************************************/
  31278. /*! no static exports found */
  31279. /***/ (function(module, exports) {
  31280. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31281. * Use of this file is governed by the BSD 3-clause license that
  31282. * can be found in the LICENSE.txt file in the project root.
  31283. */
  31284. function ATNDeserializationOptions(copyFrom) {
  31285. if(copyFrom===undefined) {
  31286. copyFrom = null;
  31287. }
  31288. this.readOnly = false;
  31289. this.verifyATN = copyFrom===null ? true : copyFrom.verifyATN;
  31290. this.generateRuleBypassTransitions = copyFrom===null ? false : copyFrom.generateRuleBypassTransitions;
  31291. return this;
  31292. }
  31293. ATNDeserializationOptions.defaultOptions = new ATNDeserializationOptions();
  31294. ATNDeserializationOptions.defaultOptions.readOnly = true;
  31295. // def __setattr__(self, key, value):
  31296. // if key!="readOnly" and self.readOnly:
  31297. // raise Exception("The object is read only.")
  31298. // super(type(self), self).__setattr__(key,value)
  31299. exports.ATNDeserializationOptions = ATNDeserializationOptions;
  31300. /***/ }),
  31301. /***/ "./node_modules/antlr4/atn/ATNDeserializer.js":
  31302. /*!****************************************************!*\
  31303. !*** ./node_modules/antlr4/atn/ATNDeserializer.js ***!
  31304. \****************************************************/
  31305. /*! no static exports found */
  31306. /***/ (function(module, exports, __webpack_require__) {
  31307. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31308. * Use of this file is governed by the BSD 3-clause license that
  31309. * can be found in the LICENSE.txt file in the project root.
  31310. */
  31311. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  31312. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  31313. var ATNType = __webpack_require__(/*! ./ATNType */ "./node_modules/antlr4/atn/ATNType.js").ATNType;
  31314. var ATNStates = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js");
  31315. var ATNState = ATNStates.ATNState;
  31316. var BasicState = ATNStates.BasicState;
  31317. var DecisionState = ATNStates.DecisionState;
  31318. var BlockStartState = ATNStates.BlockStartState;
  31319. var BlockEndState = ATNStates.BlockEndState;
  31320. var LoopEndState = ATNStates.LoopEndState;
  31321. var RuleStartState = ATNStates.RuleStartState;
  31322. var RuleStopState = ATNStates.RuleStopState;
  31323. var TokensStartState = ATNStates.TokensStartState;
  31324. var PlusLoopbackState = ATNStates.PlusLoopbackState;
  31325. var StarLoopbackState = ATNStates.StarLoopbackState;
  31326. var StarLoopEntryState = ATNStates.StarLoopEntryState;
  31327. var PlusBlockStartState = ATNStates.PlusBlockStartState;
  31328. var StarBlockStartState = ATNStates.StarBlockStartState;
  31329. var BasicBlockStartState = ATNStates.BasicBlockStartState;
  31330. var Transitions = __webpack_require__(/*! ./Transition */ "./node_modules/antlr4/atn/Transition.js");
  31331. var Transition = Transitions.Transition;
  31332. var AtomTransition = Transitions.AtomTransition;
  31333. var SetTransition = Transitions.SetTransition;
  31334. var NotSetTransition = Transitions.NotSetTransition;
  31335. var RuleTransition = Transitions.RuleTransition;
  31336. var RangeTransition = Transitions.RangeTransition;
  31337. var ActionTransition = Transitions.ActionTransition;
  31338. var EpsilonTransition = Transitions.EpsilonTransition;
  31339. var WildcardTransition = Transitions.WildcardTransition;
  31340. var PredicateTransition = Transitions.PredicateTransition;
  31341. var PrecedencePredicateTransition = Transitions.PrecedencePredicateTransition;
  31342. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  31343. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  31344. var ATNDeserializationOptions = __webpack_require__(/*! ./ATNDeserializationOptions */ "./node_modules/antlr4/atn/ATNDeserializationOptions.js").ATNDeserializationOptions;
  31345. var LexerActions = __webpack_require__(/*! ./LexerAction */ "./node_modules/antlr4/atn/LexerAction.js");
  31346. var LexerActionType = LexerActions.LexerActionType;
  31347. var LexerSkipAction = LexerActions.LexerSkipAction;
  31348. var LexerChannelAction = LexerActions.LexerChannelAction;
  31349. var LexerCustomAction = LexerActions.LexerCustomAction;
  31350. var LexerMoreAction = LexerActions.LexerMoreAction;
  31351. var LexerTypeAction = LexerActions.LexerTypeAction;
  31352. var LexerPushModeAction = LexerActions.LexerPushModeAction;
  31353. var LexerPopModeAction = LexerActions.LexerPopModeAction;
  31354. var LexerModeAction = LexerActions.LexerModeAction;
  31355. // This is the earliest supported serialized UUID.
  31356. // stick to serialized version for now, we don't need a UUID instance
  31357. var BASE_SERIALIZED_UUID = "AADB8D7E-AEEF-4415-AD2B-8204D6CF042E";
  31358. //
  31359. // This UUID indicates the serialized ATN contains two sets of
  31360. // IntervalSets, where the second set's values are encoded as
  31361. // 32-bit integers to support the full Unicode SMP range up to U+10FFFF.
  31362. //
  31363. var ADDED_UNICODE_SMP = "59627784-3BE5-417A-B9EB-8131A7286089";
  31364. // This list contains all of the currently supported UUIDs, ordered by when
  31365. // the feature first appeared in this branch.
  31366. var SUPPORTED_UUIDS = [ BASE_SERIALIZED_UUID, ADDED_UNICODE_SMP ];
  31367. var SERIALIZED_VERSION = 3;
  31368. // This is the current serialized UUID.
  31369. var SERIALIZED_UUID = ADDED_UNICODE_SMP;
  31370. function initArray( length, value) {
  31371. var tmp = [];
  31372. tmp[length-1] = value;
  31373. return tmp.map(function(i) {return value;});
  31374. }
  31375. function ATNDeserializer (options) {
  31376. if ( options=== undefined || options === null ) {
  31377. options = ATNDeserializationOptions.defaultOptions;
  31378. }
  31379. this.deserializationOptions = options;
  31380. this.stateFactories = null;
  31381. this.actionFactories = null;
  31382. return this;
  31383. }
  31384. // Determines if a particular serialized representation of an ATN supports
  31385. // a particular feature, identified by the {@link UUID} used for serializing
  31386. // the ATN at the time the feature was first introduced.
  31387. //
  31388. // @param feature The {@link UUID} marking the first time the feature was
  31389. // supported in the serialized ATN.
  31390. // @param actualUuid The {@link UUID} of the actual serialized ATN which is
  31391. // currently being deserialized.
  31392. // @return {@code true} if the {@code actualUuid} value represents a
  31393. // serialized ATN at or after the feature identified by {@code feature} was
  31394. // introduced; otherwise, {@code false}.
  31395. ATNDeserializer.prototype.isFeatureSupported = function(feature, actualUuid) {
  31396. var idx1 = SUPPORTED_UUIDS.indexOf(feature);
  31397. if (idx1<0) {
  31398. return false;
  31399. }
  31400. var idx2 = SUPPORTED_UUIDS.indexOf(actualUuid);
  31401. return idx2 >= idx1;
  31402. };
  31403. ATNDeserializer.prototype.deserialize = function(data) {
  31404. this.reset(data);
  31405. this.checkVersion();
  31406. this.checkUUID();
  31407. var atn = this.readATN();
  31408. this.readStates(atn);
  31409. this.readRules(atn);
  31410. this.readModes(atn);
  31411. var sets = [];
  31412. // First, deserialize sets with 16-bit arguments <= U+FFFF.
  31413. this.readSets(atn, sets, this.readInt.bind(this));
  31414. // Next, if the ATN was serialized with the Unicode SMP feature,
  31415. // deserialize sets with 32-bit arguments <= U+10FFFF.
  31416. if (this.isFeatureSupported(ADDED_UNICODE_SMP, this.uuid)) {
  31417. this.readSets(atn, sets, this.readInt32.bind(this));
  31418. }
  31419. this.readEdges(atn, sets);
  31420. this.readDecisions(atn);
  31421. this.readLexerActions(atn);
  31422. this.markPrecedenceDecisions(atn);
  31423. this.verifyATN(atn);
  31424. if (this.deserializationOptions.generateRuleBypassTransitions && atn.grammarType === ATNType.PARSER ) {
  31425. this.generateRuleBypassTransitions(atn);
  31426. // re-verify after modification
  31427. this.verifyATN(atn);
  31428. }
  31429. return atn;
  31430. };
  31431. ATNDeserializer.prototype.reset = function(data) {
  31432. var adjust = function(c) {
  31433. var v = c.charCodeAt(0);
  31434. return v>1 ? v-2 : v + 65533;
  31435. };
  31436. var temp = data.split("").map(adjust);
  31437. // don't adjust the first value since that's the version number
  31438. temp[0] = data.charCodeAt(0);
  31439. this.data = temp;
  31440. this.pos = 0;
  31441. };
  31442. ATNDeserializer.prototype.checkVersion = function() {
  31443. var version = this.readInt();
  31444. if ( version !== SERIALIZED_VERSION ) {
  31445. throw ("Could not deserialize ATN with version " + version + " (expected " + SERIALIZED_VERSION + ").");
  31446. }
  31447. };
  31448. ATNDeserializer.prototype.checkUUID = function() {
  31449. var uuid = this.readUUID();
  31450. if (SUPPORTED_UUIDS.indexOf(uuid)<0) {
  31451. throw ("Could not deserialize ATN with UUID: " + uuid +
  31452. " (expected " + SERIALIZED_UUID + " or a legacy UUID).", uuid, SERIALIZED_UUID);
  31453. }
  31454. this.uuid = uuid;
  31455. };
  31456. ATNDeserializer.prototype.readATN = function() {
  31457. var grammarType = this.readInt();
  31458. var maxTokenType = this.readInt();
  31459. return new ATN(grammarType, maxTokenType);
  31460. };
  31461. ATNDeserializer.prototype.readStates = function(atn) {
  31462. var j, pair, stateNumber;
  31463. var loopBackStateNumbers = [];
  31464. var endStateNumbers = [];
  31465. var nstates = this.readInt();
  31466. for(var i=0; i<nstates; i++) {
  31467. var stype = this.readInt();
  31468. // ignore bad type of states
  31469. if (stype===ATNState.INVALID_TYPE) {
  31470. atn.addState(null);
  31471. continue;
  31472. }
  31473. var ruleIndex = this.readInt();
  31474. if (ruleIndex === 0xFFFF) {
  31475. ruleIndex = -1;
  31476. }
  31477. var s = this.stateFactory(stype, ruleIndex);
  31478. if (stype === ATNState.LOOP_END) { // special case
  31479. var loopBackStateNumber = this.readInt();
  31480. loopBackStateNumbers.push([s, loopBackStateNumber]);
  31481. } else if(s instanceof BlockStartState) {
  31482. var endStateNumber = this.readInt();
  31483. endStateNumbers.push([s, endStateNumber]);
  31484. }
  31485. atn.addState(s);
  31486. }
  31487. // delay the assignment of loop back and end states until we know all the
  31488. // state instances have been initialized
  31489. for (j=0; j<loopBackStateNumbers.length; j++) {
  31490. pair = loopBackStateNumbers[j];
  31491. pair[0].loopBackState = atn.states[pair[1]];
  31492. }
  31493. for (j=0; j<endStateNumbers.length; j++) {
  31494. pair = endStateNumbers[j];
  31495. pair[0].endState = atn.states[pair[1]];
  31496. }
  31497. var numNonGreedyStates = this.readInt();
  31498. for (j=0; j<numNonGreedyStates; j++) {
  31499. stateNumber = this.readInt();
  31500. atn.states[stateNumber].nonGreedy = true;
  31501. }
  31502. var numPrecedenceStates = this.readInt();
  31503. for (j=0; j<numPrecedenceStates; j++) {
  31504. stateNumber = this.readInt();
  31505. atn.states[stateNumber].isPrecedenceRule = true;
  31506. }
  31507. };
  31508. ATNDeserializer.prototype.readRules = function(atn) {
  31509. var i;
  31510. var nrules = this.readInt();
  31511. if (atn.grammarType === ATNType.LEXER ) {
  31512. atn.ruleToTokenType = initArray(nrules, 0);
  31513. }
  31514. atn.ruleToStartState = initArray(nrules, 0);
  31515. for (i=0; i<nrules; i++) {
  31516. var s = this.readInt();
  31517. var startState = atn.states[s];
  31518. atn.ruleToStartState[i] = startState;
  31519. if ( atn.grammarType === ATNType.LEXER ) {
  31520. var tokenType = this.readInt();
  31521. if (tokenType === 0xFFFF) {
  31522. tokenType = Token.EOF;
  31523. }
  31524. atn.ruleToTokenType[i] = tokenType;
  31525. }
  31526. }
  31527. atn.ruleToStopState = initArray(nrules, 0);
  31528. for (i=0; i<atn.states.length; i++) {
  31529. var state = atn.states[i];
  31530. if (!(state instanceof RuleStopState)) {
  31531. continue;
  31532. }
  31533. atn.ruleToStopState[state.ruleIndex] = state;
  31534. atn.ruleToStartState[state.ruleIndex].stopState = state;
  31535. }
  31536. };
  31537. ATNDeserializer.prototype.readModes = function(atn) {
  31538. var nmodes = this.readInt();
  31539. for (var i=0; i<nmodes; i++) {
  31540. var s = this.readInt();
  31541. atn.modeToStartState.push(atn.states[s]);
  31542. }
  31543. };
  31544. ATNDeserializer.prototype.readSets = function(atn, sets, readUnicode) {
  31545. var m = this.readInt();
  31546. for (var i=0; i<m; i++) {
  31547. var iset = new IntervalSet();
  31548. sets.push(iset);
  31549. var n = this.readInt();
  31550. var containsEof = this.readInt();
  31551. if (containsEof!==0) {
  31552. iset.addOne(-1);
  31553. }
  31554. for (var j=0; j<n; j++) {
  31555. var i1 = readUnicode();
  31556. var i2 = readUnicode();
  31557. iset.addRange(i1, i2);
  31558. }
  31559. }
  31560. };
  31561. ATNDeserializer.prototype.readEdges = function(atn, sets) {
  31562. var i, j, state, trans, target;
  31563. var nedges = this.readInt();
  31564. for (i=0; i<nedges; i++) {
  31565. var src = this.readInt();
  31566. var trg = this.readInt();
  31567. var ttype = this.readInt();
  31568. var arg1 = this.readInt();
  31569. var arg2 = this.readInt();
  31570. var arg3 = this.readInt();
  31571. trans = this.edgeFactory(atn, ttype, src, trg, arg1, arg2, arg3, sets);
  31572. var srcState = atn.states[src];
  31573. srcState.addTransition(trans);
  31574. }
  31575. // edges for rule stop states can be derived, so they aren't serialized
  31576. for (i=0; i<atn.states.length; i++) {
  31577. state = atn.states[i];
  31578. for (j=0; j<state.transitions.length; j++) {
  31579. var t = state.transitions[j];
  31580. if (!(t instanceof RuleTransition)) {
  31581. continue;
  31582. }
  31583. var outermostPrecedenceReturn = -1;
  31584. if (atn.ruleToStartState[t.target.ruleIndex].isPrecedenceRule) {
  31585. if (t.precedence === 0) {
  31586. outermostPrecedenceReturn = t.target.ruleIndex;
  31587. }
  31588. }
  31589. trans = new EpsilonTransition(t.followState, outermostPrecedenceReturn);
  31590. atn.ruleToStopState[t.target.ruleIndex].addTransition(trans);
  31591. }
  31592. }
  31593. for (i=0; i<atn.states.length; i++) {
  31594. state = atn.states[i];
  31595. if (state instanceof BlockStartState) {
  31596. // we need to know the end state to set its start state
  31597. if (state.endState === null) {
  31598. throw ("IllegalState");
  31599. }
  31600. // block end states can only be associated to a single block start
  31601. // state
  31602. if ( state.endState.startState !== null) {
  31603. throw ("IllegalState");
  31604. }
  31605. state.endState.startState = state;
  31606. }
  31607. if (state instanceof PlusLoopbackState) {
  31608. for (j=0; j<state.transitions.length; j++) {
  31609. target = state.transitions[j].target;
  31610. if (target instanceof PlusBlockStartState) {
  31611. target.loopBackState = state;
  31612. }
  31613. }
  31614. } else if (state instanceof StarLoopbackState) {
  31615. for (j=0; j<state.transitions.length; j++) {
  31616. target = state.transitions[j].target;
  31617. if (target instanceof StarLoopEntryState) {
  31618. target.loopBackState = state;
  31619. }
  31620. }
  31621. }
  31622. }
  31623. };
  31624. ATNDeserializer.prototype.readDecisions = function(atn) {
  31625. var ndecisions = this.readInt();
  31626. for (var i=0; i<ndecisions; i++) {
  31627. var s = this.readInt();
  31628. var decState = atn.states[s];
  31629. atn.decisionToState.push(decState);
  31630. decState.decision = i;
  31631. }
  31632. };
  31633. ATNDeserializer.prototype.readLexerActions = function(atn) {
  31634. if (atn.grammarType === ATNType.LEXER) {
  31635. var count = this.readInt();
  31636. atn.lexerActions = initArray(count, null);
  31637. for (var i=0; i<count; i++) {
  31638. var actionType = this.readInt();
  31639. var data1 = this.readInt();
  31640. if (data1 === 0xFFFF) {
  31641. data1 = -1;
  31642. }
  31643. var data2 = this.readInt();
  31644. if (data2 === 0xFFFF) {
  31645. data2 = -1;
  31646. }
  31647. var lexerAction = this.lexerActionFactory(actionType, data1, data2);
  31648. atn.lexerActions[i] = lexerAction;
  31649. }
  31650. }
  31651. };
  31652. ATNDeserializer.prototype.generateRuleBypassTransitions = function(atn) {
  31653. var i;
  31654. var count = atn.ruleToStartState.length;
  31655. for(i=0; i<count; i++) {
  31656. atn.ruleToTokenType[i] = atn.maxTokenType + i + 1;
  31657. }
  31658. for(i=0; i<count; i++) {
  31659. this.generateRuleBypassTransition(atn, i);
  31660. }
  31661. };
  31662. ATNDeserializer.prototype.generateRuleBypassTransition = function(atn, idx) {
  31663. var i, state;
  31664. var bypassStart = new BasicBlockStartState();
  31665. bypassStart.ruleIndex = idx;
  31666. atn.addState(bypassStart);
  31667. var bypassStop = new BlockEndState();
  31668. bypassStop.ruleIndex = idx;
  31669. atn.addState(bypassStop);
  31670. bypassStart.endState = bypassStop;
  31671. atn.defineDecisionState(bypassStart);
  31672. bypassStop.startState = bypassStart;
  31673. var excludeTransition = null;
  31674. var endState = null;
  31675. if (atn.ruleToStartState[idx].isPrecedenceRule) {
  31676. // wrap from the beginning of the rule to the StarLoopEntryState
  31677. endState = null;
  31678. for(i=0; i<atn.states.length; i++) {
  31679. state = atn.states[i];
  31680. if (this.stateIsEndStateFor(state, idx)) {
  31681. endState = state;
  31682. excludeTransition = state.loopBackState.transitions[0];
  31683. break;
  31684. }
  31685. }
  31686. if (excludeTransition === null) {
  31687. throw ("Couldn't identify final state of the precedence rule prefix section.");
  31688. }
  31689. } else {
  31690. endState = atn.ruleToStopState[idx];
  31691. }
  31692. // all non-excluded transitions that currently target end state need to
  31693. // target blockEnd instead
  31694. for(i=0; i<atn.states.length; i++) {
  31695. state = atn.states[i];
  31696. for(var j=0; j<state.transitions.length; j++) {
  31697. var transition = state.transitions[j];
  31698. if (transition === excludeTransition) {
  31699. continue;
  31700. }
  31701. if (transition.target === endState) {
  31702. transition.target = bypassStop;
  31703. }
  31704. }
  31705. }
  31706. // all transitions leaving the rule start state need to leave blockStart
  31707. // instead
  31708. var ruleToStartState = atn.ruleToStartState[idx];
  31709. var count = ruleToStartState.transitions.length;
  31710. while ( count > 0) {
  31711. bypassStart.addTransition(ruleToStartState.transitions[count-1]);
  31712. ruleToStartState.transitions = ruleToStartState.transitions.slice(-1);
  31713. }
  31714. // link the new states
  31715. atn.ruleToStartState[idx].addTransition(new EpsilonTransition(bypassStart));
  31716. bypassStop.addTransition(new EpsilonTransition(endState));
  31717. var matchState = new BasicState();
  31718. atn.addState(matchState);
  31719. matchState.addTransition(new AtomTransition(bypassStop, atn.ruleToTokenType[idx]));
  31720. bypassStart.addTransition(new EpsilonTransition(matchState));
  31721. };
  31722. ATNDeserializer.prototype.stateIsEndStateFor = function(state, idx) {
  31723. if ( state.ruleIndex !== idx) {
  31724. return null;
  31725. }
  31726. if (!( state instanceof StarLoopEntryState)) {
  31727. return null;
  31728. }
  31729. var maybeLoopEndState = state.transitions[state.transitions.length - 1].target;
  31730. if (!( maybeLoopEndState instanceof LoopEndState)) {
  31731. return null;
  31732. }
  31733. if (maybeLoopEndState.epsilonOnlyTransitions &&
  31734. (maybeLoopEndState.transitions[0].target instanceof RuleStopState)) {
  31735. return state;
  31736. } else {
  31737. return null;
  31738. }
  31739. };
  31740. //
  31741. // Analyze the {@link StarLoopEntryState} states in the specified ATN to set
  31742. // the {@link StarLoopEntryState//isPrecedenceDecision} field to the
  31743. // correct value.
  31744. //
  31745. // @param atn The ATN.
  31746. //
  31747. ATNDeserializer.prototype.markPrecedenceDecisions = function(atn) {
  31748. for(var i=0; i<atn.states.length; i++) {
  31749. var state = atn.states[i];
  31750. if (!( state instanceof StarLoopEntryState)) {
  31751. continue;
  31752. }
  31753. // We analyze the ATN to determine if this ATN decision state is the
  31754. // decision for the closure block that determines whether a
  31755. // precedence rule should continue or complete.
  31756. //
  31757. if ( atn.ruleToStartState[state.ruleIndex].isPrecedenceRule) {
  31758. var maybeLoopEndState = state.transitions[state.transitions.length - 1].target;
  31759. if (maybeLoopEndState instanceof LoopEndState) {
  31760. if ( maybeLoopEndState.epsilonOnlyTransitions &&
  31761. (maybeLoopEndState.transitions[0].target instanceof RuleStopState)) {
  31762. state.isPrecedenceDecision = true;
  31763. }
  31764. }
  31765. }
  31766. }
  31767. };
  31768. ATNDeserializer.prototype.verifyATN = function(atn) {
  31769. if (!this.deserializationOptions.verifyATN) {
  31770. return;
  31771. }
  31772. // verify assumptions
  31773. for(var i=0; i<atn.states.length; i++) {
  31774. var state = atn.states[i];
  31775. if (state === null) {
  31776. continue;
  31777. }
  31778. this.checkCondition(state.epsilonOnlyTransitions || state.transitions.length <= 1);
  31779. if (state instanceof PlusBlockStartState) {
  31780. this.checkCondition(state.loopBackState !== null);
  31781. } else if (state instanceof StarLoopEntryState) {
  31782. this.checkCondition(state.loopBackState !== null);
  31783. this.checkCondition(state.transitions.length === 2);
  31784. if (state.transitions[0].target instanceof StarBlockStartState) {
  31785. this.checkCondition(state.transitions[1].target instanceof LoopEndState);
  31786. this.checkCondition(!state.nonGreedy);
  31787. } else if (state.transitions[0].target instanceof LoopEndState) {
  31788. this.checkCondition(state.transitions[1].target instanceof StarBlockStartState);
  31789. this.checkCondition(state.nonGreedy);
  31790. } else {
  31791. throw("IllegalState");
  31792. }
  31793. } else if (state instanceof StarLoopbackState) {
  31794. this.checkCondition(state.transitions.length === 1);
  31795. this.checkCondition(state.transitions[0].target instanceof StarLoopEntryState);
  31796. } else if (state instanceof LoopEndState) {
  31797. this.checkCondition(state.loopBackState !== null);
  31798. } else if (state instanceof RuleStartState) {
  31799. this.checkCondition(state.stopState !== null);
  31800. } else if (state instanceof BlockStartState) {
  31801. this.checkCondition(state.endState !== null);
  31802. } else if (state instanceof BlockEndState) {
  31803. this.checkCondition(state.startState !== null);
  31804. } else if (state instanceof DecisionState) {
  31805. this.checkCondition(state.transitions.length <= 1 || state.decision >= 0);
  31806. } else {
  31807. this.checkCondition(state.transitions.length <= 1 || (state instanceof RuleStopState));
  31808. }
  31809. }
  31810. };
  31811. ATNDeserializer.prototype.checkCondition = function(condition, message) {
  31812. if (!condition) {
  31813. if (message === undefined || message===null) {
  31814. message = "IllegalState";
  31815. }
  31816. throw (message);
  31817. }
  31818. };
  31819. ATNDeserializer.prototype.readInt = function() {
  31820. return this.data[this.pos++];
  31821. };
  31822. ATNDeserializer.prototype.readInt32 = function() {
  31823. var low = this.readInt();
  31824. var high = this.readInt();
  31825. return low | (high << 16);
  31826. };
  31827. ATNDeserializer.prototype.readLong = function() {
  31828. var low = this.readInt32();
  31829. var high = this.readInt32();
  31830. return (low & 0x00000000FFFFFFFF) | (high << 32);
  31831. };
  31832. function createByteToHex() {
  31833. var bth = [];
  31834. for (var i = 0; i < 256; i++) {
  31835. bth[i] = (i + 0x100).toString(16).substr(1).toUpperCase();
  31836. }
  31837. return bth;
  31838. }
  31839. var byteToHex = createByteToHex();
  31840. ATNDeserializer.prototype.readUUID = function() {
  31841. var bb = [];
  31842. for(var i=7;i>=0;i--) {
  31843. var int = this.readInt();
  31844. /* jshint bitwise: false */
  31845. bb[(2*i)+1] = int & 0xFF;
  31846. bb[2*i] = (int >> 8) & 0xFF;
  31847. }
  31848. return byteToHex[bb[0]] + byteToHex[bb[1]] +
  31849. byteToHex[bb[2]] + byteToHex[bb[3]] + '-' +
  31850. byteToHex[bb[4]] + byteToHex[bb[5]] + '-' +
  31851. byteToHex[bb[6]] + byteToHex[bb[7]] + '-' +
  31852. byteToHex[bb[8]] + byteToHex[bb[9]] + '-' +
  31853. byteToHex[bb[10]] + byteToHex[bb[11]] +
  31854. byteToHex[bb[12]] + byteToHex[bb[13]] +
  31855. byteToHex[bb[14]] + byteToHex[bb[15]];
  31856. };
  31857. ATNDeserializer.prototype.edgeFactory = function(atn, type, src, trg, arg1, arg2, arg3, sets) {
  31858. var target = atn.states[trg];
  31859. switch(type) {
  31860. case Transition.EPSILON:
  31861. return new EpsilonTransition(target);
  31862. case Transition.RANGE:
  31863. return arg3 !== 0 ? new RangeTransition(target, Token.EOF, arg2) : new RangeTransition(target, arg1, arg2);
  31864. case Transition.RULE:
  31865. return new RuleTransition(atn.states[arg1], arg2, arg3, target);
  31866. case Transition.PREDICATE:
  31867. return new PredicateTransition(target, arg1, arg2, arg3 !== 0);
  31868. case Transition.PRECEDENCE:
  31869. return new PrecedencePredicateTransition(target, arg1);
  31870. case Transition.ATOM:
  31871. return arg3 !== 0 ? new AtomTransition(target, Token.EOF) : new AtomTransition(target, arg1);
  31872. case Transition.ACTION:
  31873. return new ActionTransition(target, arg1, arg2, arg3 !== 0);
  31874. case Transition.SET:
  31875. return new SetTransition(target, sets[arg1]);
  31876. case Transition.NOT_SET:
  31877. return new NotSetTransition(target, sets[arg1]);
  31878. case Transition.WILDCARD:
  31879. return new WildcardTransition(target);
  31880. default:
  31881. throw "The specified transition type: " + type + " is not valid.";
  31882. }
  31883. };
  31884. ATNDeserializer.prototype.stateFactory = function(type, ruleIndex) {
  31885. if (this.stateFactories === null) {
  31886. var sf = [];
  31887. sf[ATNState.INVALID_TYPE] = null;
  31888. sf[ATNState.BASIC] = function() { return new BasicState(); };
  31889. sf[ATNState.RULE_START] = function() { return new RuleStartState(); };
  31890. sf[ATNState.BLOCK_START] = function() { return new BasicBlockStartState(); };
  31891. sf[ATNState.PLUS_BLOCK_START] = function() { return new PlusBlockStartState(); };
  31892. sf[ATNState.STAR_BLOCK_START] = function() { return new StarBlockStartState(); };
  31893. sf[ATNState.TOKEN_START] = function() { return new TokensStartState(); };
  31894. sf[ATNState.RULE_STOP] = function() { return new RuleStopState(); };
  31895. sf[ATNState.BLOCK_END] = function() { return new BlockEndState(); };
  31896. sf[ATNState.STAR_LOOP_BACK] = function() { return new StarLoopbackState(); };
  31897. sf[ATNState.STAR_LOOP_ENTRY] = function() { return new StarLoopEntryState(); };
  31898. sf[ATNState.PLUS_LOOP_BACK] = function() { return new PlusLoopbackState(); };
  31899. sf[ATNState.LOOP_END] = function() { return new LoopEndState(); };
  31900. this.stateFactories = sf;
  31901. }
  31902. if (type>this.stateFactories.length || this.stateFactories[type] === null) {
  31903. throw("The specified state type " + type + " is not valid.");
  31904. } else {
  31905. var s = this.stateFactories[type]();
  31906. if (s!==null) {
  31907. s.ruleIndex = ruleIndex;
  31908. return s;
  31909. }
  31910. }
  31911. };
  31912. ATNDeserializer.prototype.lexerActionFactory = function(type, data1, data2) {
  31913. if (this.actionFactories === null) {
  31914. var af = [];
  31915. af[LexerActionType.CHANNEL] = function(data1, data2) { return new LexerChannelAction(data1); };
  31916. af[LexerActionType.CUSTOM] = function(data1, data2) { return new LexerCustomAction(data1, data2); };
  31917. af[LexerActionType.MODE] = function(data1, data2) { return new LexerModeAction(data1); };
  31918. af[LexerActionType.MORE] = function(data1, data2) { return LexerMoreAction.INSTANCE; };
  31919. af[LexerActionType.POP_MODE] = function(data1, data2) { return LexerPopModeAction.INSTANCE; };
  31920. af[LexerActionType.PUSH_MODE] = function(data1, data2) { return new LexerPushModeAction(data1); };
  31921. af[LexerActionType.SKIP] = function(data1, data2) { return LexerSkipAction.INSTANCE; };
  31922. af[LexerActionType.TYPE] = function(data1, data2) { return new LexerTypeAction(data1); };
  31923. this.actionFactories = af;
  31924. }
  31925. if (type>this.actionFactories.length || this.actionFactories[type] === null) {
  31926. throw("The specified lexer action type " + type + " is not valid.");
  31927. } else {
  31928. return this.actionFactories[type](data1, data2);
  31929. }
  31930. };
  31931. exports.ATNDeserializer = ATNDeserializer;
  31932. /***/ }),
  31933. /***/ "./node_modules/antlr4/atn/ATNSimulator.js":
  31934. /*!*************************************************!*\
  31935. !*** ./node_modules/antlr4/atn/ATNSimulator.js ***!
  31936. \*************************************************/
  31937. /*! no static exports found */
  31938. /***/ (function(module, exports, __webpack_require__) {
  31939. //
  31940. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31941. * Use of this file is governed by the BSD 3-clause license that
  31942. * can be found in the LICENSE.txt file in the project root.
  31943. */
  31944. ///
  31945. var DFAState = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  31946. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  31947. var getCachedPredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").getCachedPredictionContext;
  31948. function ATNSimulator(atn, sharedContextCache) {
  31949. // The context cache maps all PredictionContext objects that are ==
  31950. // to a single cached copy. This cache is shared across all contexts
  31951. // in all ATNConfigs in all DFA states. We rebuild each ATNConfigSet
  31952. // to use only cached nodes/graphs in addDFAState(). We don't want to
  31953. // fill this during closure() since there are lots of contexts that
  31954. // pop up but are not used ever again. It also greatly slows down closure().
  31955. //
  31956. // <p>This cache makes a huge difference in memory and a little bit in speed.
  31957. // For the Java grammar on java.*, it dropped the memory requirements
  31958. // at the end from 25M to 16M. We don't store any of the full context
  31959. // graphs in the DFA because they are limited to local context only,
  31960. // but apparently there's a lot of repetition there as well. We optimize
  31961. // the config contexts before storing the config set in the DFA states
  31962. // by literally rebuilding them with cached subgraphs only.</p>
  31963. //
  31964. // <p>I tried a cache for use during closure operations, that was
  31965. // whacked after each adaptivePredict(). It cost a little bit
  31966. // more time I think and doesn't save on the overall footprint
  31967. // so it's not worth the complexity.</p>
  31968. ///
  31969. this.atn = atn;
  31970. this.sharedContextCache = sharedContextCache;
  31971. return this;
  31972. }
  31973. // Must distinguish between missing edge and edge we know leads nowhere///
  31974. ATNSimulator.ERROR = new DFAState(0x7FFFFFFF, new ATNConfigSet());
  31975. ATNSimulator.prototype.getCachedContext = function(context) {
  31976. if (this.sharedContextCache ===null) {
  31977. return context;
  31978. }
  31979. var visited = {};
  31980. return getCachedPredictionContext(context, this.sharedContextCache, visited);
  31981. };
  31982. exports.ATNSimulator = ATNSimulator;
  31983. /***/ }),
  31984. /***/ "./node_modules/antlr4/atn/ATNState.js":
  31985. /*!*********************************************!*\
  31986. !*** ./node_modules/antlr4/atn/ATNState.js ***!
  31987. \*********************************************/
  31988. /*! no static exports found */
  31989. /***/ (function(module, exports) {
  31990. //
  31991. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31992. * Use of this file is governed by the BSD 3-clause license that
  31993. * can be found in the LICENSE.txt file in the project root.
  31994. */
  31995. //
  31996. // The following images show the relation of states and
  31997. // {@link ATNState//transitions} for various grammar constructs.
  31998. //
  31999. // <ul>
  32000. //
  32001. // <li>Solid edges marked with an &//0949; indicate a required
  32002. // {@link EpsilonTransition}.</li>
  32003. //
  32004. // <li>Dashed edges indicate locations where any transition derived from
  32005. // {@link Transition} might appear.</li>
  32006. //
  32007. // <li>Dashed nodes are place holders for either a sequence of linked
  32008. // {@link BasicState} states or the inclusion of a block representing a nested
  32009. // construct in one of the forms below.</li>
  32010. //
  32011. // <li>Nodes showing multiple outgoing alternatives with a {@code ...} support
  32012. // any number of alternatives (one or more). Nodes without the {@code ...} only
  32013. // support the exact number of alternatives shown in the diagram.</li>
  32014. //
  32015. // </ul>
  32016. //
  32017. // <h2>Basic Blocks</h2>
  32018. //
  32019. // <h3>Rule</h3>
  32020. //
  32021. // <embed src="images/Rule.svg" type="image/svg+xml"/>
  32022. //
  32023. // <h3>Block of 1 or more alternatives</h3>
  32024. //
  32025. // <embed src="images/Block.svg" type="image/svg+xml"/>
  32026. //
  32027. // <h2>Greedy Loops</h2>
  32028. //
  32029. // <h3>Greedy Closure: {@code (...)*}</h3>
  32030. //
  32031. // <embed src="images/ClosureGreedy.svg" type="image/svg+xml"/>
  32032. //
  32033. // <h3>Greedy Positive Closure: {@code (...)+}</h3>
  32034. //
  32035. // <embed src="images/PositiveClosureGreedy.svg" type="image/svg+xml"/>
  32036. //
  32037. // <h3>Greedy Optional: {@code (...)?}</h3>
  32038. //
  32039. // <embed src="images/OptionalGreedy.svg" type="image/svg+xml"/>
  32040. //
  32041. // <h2>Non-Greedy Loops</h2>
  32042. //
  32043. // <h3>Non-Greedy Closure: {@code (...)*?}</h3>
  32044. //
  32045. // <embed src="images/ClosureNonGreedy.svg" type="image/svg+xml"/>
  32046. //
  32047. // <h3>Non-Greedy Positive Closure: {@code (...)+?}</h3>
  32048. //
  32049. // <embed src="images/PositiveClosureNonGreedy.svg" type="image/svg+xml"/>
  32050. //
  32051. // <h3>Non-Greedy Optional: {@code (...)??}</h3>
  32052. //
  32053. // <embed src="images/OptionalNonGreedy.svg" type="image/svg+xml"/>
  32054. //
  32055. var INITIAL_NUM_TRANSITIONS = 4;
  32056. function ATNState() {
  32057. // Which ATN are we in?
  32058. this.atn = null;
  32059. this.stateNumber = ATNState.INVALID_STATE_NUMBER;
  32060. this.stateType = null;
  32061. this.ruleIndex = 0; // at runtime, we don't have Rule objects
  32062. this.epsilonOnlyTransitions = false;
  32063. // Track the transitions emanating from this ATN state.
  32064. this.transitions = [];
  32065. // Used to cache lookahead during parsing, not used during construction
  32066. this.nextTokenWithinRule = null;
  32067. return this;
  32068. }
  32069. // constants for serialization
  32070. ATNState.INVALID_TYPE = 0;
  32071. ATNState.BASIC = 1;
  32072. ATNState.RULE_START = 2;
  32073. ATNState.BLOCK_START = 3;
  32074. ATNState.PLUS_BLOCK_START = 4;
  32075. ATNState.STAR_BLOCK_START = 5;
  32076. ATNState.TOKEN_START = 6;
  32077. ATNState.RULE_STOP = 7;
  32078. ATNState.BLOCK_END = 8;
  32079. ATNState.STAR_LOOP_BACK = 9;
  32080. ATNState.STAR_LOOP_ENTRY = 10;
  32081. ATNState.PLUS_LOOP_BACK = 11;
  32082. ATNState.LOOP_END = 12;
  32083. ATNState.serializationNames = [
  32084. "INVALID",
  32085. "BASIC",
  32086. "RULE_START",
  32087. "BLOCK_START",
  32088. "PLUS_BLOCK_START",
  32089. "STAR_BLOCK_START",
  32090. "TOKEN_START",
  32091. "RULE_STOP",
  32092. "BLOCK_END",
  32093. "STAR_LOOP_BACK",
  32094. "STAR_LOOP_ENTRY",
  32095. "PLUS_LOOP_BACK",
  32096. "LOOP_END" ];
  32097. ATNState.INVALID_STATE_NUMBER = -1;
  32098. ATNState.prototype.toString = function() {
  32099. return this.stateNumber;
  32100. };
  32101. ATNState.prototype.equals = function(other) {
  32102. if (other instanceof ATNState) {
  32103. return this.stateNumber===other.stateNumber;
  32104. } else {
  32105. return false;
  32106. }
  32107. };
  32108. ATNState.prototype.isNonGreedyExitState = function() {
  32109. return false;
  32110. };
  32111. ATNState.prototype.addTransition = function(trans, index) {
  32112. if(index===undefined) {
  32113. index = -1;
  32114. }
  32115. if (this.transitions.length===0) {
  32116. this.epsilonOnlyTransitions = trans.isEpsilon;
  32117. } else if(this.epsilonOnlyTransitions !== trans.isEpsilon) {
  32118. this.epsilonOnlyTransitions = false;
  32119. }
  32120. if (index===-1) {
  32121. this.transitions.push(trans);
  32122. } else {
  32123. this.transitions.splice(index, 1, trans);
  32124. }
  32125. };
  32126. function BasicState() {
  32127. ATNState.call(this);
  32128. this.stateType = ATNState.BASIC;
  32129. return this;
  32130. }
  32131. BasicState.prototype = Object.create(ATNState.prototype);
  32132. BasicState.prototype.constructor = BasicState;
  32133. function DecisionState() {
  32134. ATNState.call(this);
  32135. this.decision = -1;
  32136. this.nonGreedy = false;
  32137. return this;
  32138. }
  32139. DecisionState.prototype = Object.create(ATNState.prototype);
  32140. DecisionState.prototype.constructor = DecisionState;
  32141. // The start of a regular {@code (...)} block.
  32142. function BlockStartState() {
  32143. DecisionState.call(this);
  32144. this.endState = null;
  32145. return this;
  32146. }
  32147. BlockStartState.prototype = Object.create(DecisionState.prototype);
  32148. BlockStartState.prototype.constructor = BlockStartState;
  32149. function BasicBlockStartState() {
  32150. BlockStartState.call(this);
  32151. this.stateType = ATNState.BLOCK_START;
  32152. return this;
  32153. }
  32154. BasicBlockStartState.prototype = Object.create(BlockStartState.prototype);
  32155. BasicBlockStartState.prototype.constructor = BasicBlockStartState;
  32156. // Terminal node of a simple {@code (a|b|c)} block.
  32157. function BlockEndState() {
  32158. ATNState.call(this);
  32159. this.stateType = ATNState.BLOCK_END;
  32160. this.startState = null;
  32161. return this;
  32162. }
  32163. BlockEndState.prototype = Object.create(ATNState.prototype);
  32164. BlockEndState.prototype.constructor = BlockEndState;
  32165. // The last node in the ATN for a rule, unless that rule is the start symbol.
  32166. // In that case, there is one transition to EOF. Later, we might encode
  32167. // references to all calls to this rule to compute FOLLOW sets for
  32168. // error handling.
  32169. //
  32170. function RuleStopState() {
  32171. ATNState.call(this);
  32172. this.stateType = ATNState.RULE_STOP;
  32173. return this;
  32174. }
  32175. RuleStopState.prototype = Object.create(ATNState.prototype);
  32176. RuleStopState.prototype.constructor = RuleStopState;
  32177. function RuleStartState() {
  32178. ATNState.call(this);
  32179. this.stateType = ATNState.RULE_START;
  32180. this.stopState = null;
  32181. this.isPrecedenceRule = false;
  32182. return this;
  32183. }
  32184. RuleStartState.prototype = Object.create(ATNState.prototype);
  32185. RuleStartState.prototype.constructor = RuleStartState;
  32186. // Decision state for {@code A+} and {@code (A|B)+}. It has two transitions:
  32187. // one to the loop back to start of the block and one to exit.
  32188. //
  32189. function PlusLoopbackState() {
  32190. DecisionState.call(this);
  32191. this.stateType = ATNState.PLUS_LOOP_BACK;
  32192. return this;
  32193. }
  32194. PlusLoopbackState.prototype = Object.create(DecisionState.prototype);
  32195. PlusLoopbackState.prototype.constructor = PlusLoopbackState;
  32196. // Start of {@code (A|B|...)+} loop. Technically a decision state, but
  32197. // we don't use for code generation; somebody might need it, so I'm defining
  32198. // it for completeness. In reality, the {@link PlusLoopbackState} node is the
  32199. // real decision-making note for {@code A+}.
  32200. //
  32201. function PlusBlockStartState() {
  32202. BlockStartState.call(this);
  32203. this.stateType = ATNState.PLUS_BLOCK_START;
  32204. this.loopBackState = null;
  32205. return this;
  32206. }
  32207. PlusBlockStartState.prototype = Object.create(BlockStartState.prototype);
  32208. PlusBlockStartState.prototype.constructor = PlusBlockStartState;
  32209. // The block that begins a closure loop.
  32210. function StarBlockStartState() {
  32211. BlockStartState.call(this);
  32212. this.stateType = ATNState.STAR_BLOCK_START;
  32213. return this;
  32214. }
  32215. StarBlockStartState.prototype = Object.create(BlockStartState.prototype);
  32216. StarBlockStartState.prototype.constructor = StarBlockStartState;
  32217. function StarLoopbackState() {
  32218. ATNState.call(this);
  32219. this.stateType = ATNState.STAR_LOOP_BACK;
  32220. return this;
  32221. }
  32222. StarLoopbackState.prototype = Object.create(ATNState.prototype);
  32223. StarLoopbackState.prototype.constructor = StarLoopbackState;
  32224. function StarLoopEntryState() {
  32225. DecisionState.call(this);
  32226. this.stateType = ATNState.STAR_LOOP_ENTRY;
  32227. this.loopBackState = null;
  32228. // Indicates whether this state can benefit from a precedence DFA during SLL decision making.
  32229. this.isPrecedenceDecision = null;
  32230. return this;
  32231. }
  32232. StarLoopEntryState.prototype = Object.create(DecisionState.prototype);
  32233. StarLoopEntryState.prototype.constructor = StarLoopEntryState;
  32234. // Mark the end of a * or + loop.
  32235. function LoopEndState() {
  32236. ATNState.call(this);
  32237. this.stateType = ATNState.LOOP_END;
  32238. this.loopBackState = null;
  32239. return this;
  32240. }
  32241. LoopEndState.prototype = Object.create(ATNState.prototype);
  32242. LoopEndState.prototype.constructor = LoopEndState;
  32243. // The Tokens rule start state linking to each lexer rule start state */
  32244. function TokensStartState() {
  32245. DecisionState.call(this);
  32246. this.stateType = ATNState.TOKEN_START;
  32247. return this;
  32248. }
  32249. TokensStartState.prototype = Object.create(DecisionState.prototype);
  32250. TokensStartState.prototype.constructor = TokensStartState;
  32251. exports.ATNState = ATNState;
  32252. exports.BasicState = BasicState;
  32253. exports.DecisionState = DecisionState;
  32254. exports.BlockStartState = BlockStartState;
  32255. exports.BlockEndState = BlockEndState;
  32256. exports.LoopEndState = LoopEndState;
  32257. exports.RuleStartState = RuleStartState;
  32258. exports.RuleStopState = RuleStopState;
  32259. exports.TokensStartState = TokensStartState;
  32260. exports.PlusLoopbackState = PlusLoopbackState;
  32261. exports.StarLoopbackState = StarLoopbackState;
  32262. exports.StarLoopEntryState = StarLoopEntryState;
  32263. exports.PlusBlockStartState = PlusBlockStartState;
  32264. exports.StarBlockStartState = StarBlockStartState;
  32265. exports.BasicBlockStartState = BasicBlockStartState;
  32266. /***/ }),
  32267. /***/ "./node_modules/antlr4/atn/ATNType.js":
  32268. /*!********************************************!*\
  32269. !*** ./node_modules/antlr4/atn/ATNType.js ***!
  32270. \********************************************/
  32271. /*! no static exports found */
  32272. /***/ (function(module, exports) {
  32273. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  32274. * Use of this file is governed by the BSD 3-clause license that
  32275. * can be found in the LICENSE.txt file in the project root.
  32276. */
  32277. ///
  32278. // Represents the type of recognizer an ATN applies to.
  32279. function ATNType() {
  32280. }
  32281. ATNType.LEXER = 0;
  32282. ATNType.PARSER = 1;
  32283. exports.ATNType = ATNType;
  32284. /***/ }),
  32285. /***/ "./node_modules/antlr4/atn/LexerATNSimulator.js":
  32286. /*!******************************************************!*\
  32287. !*** ./node_modules/antlr4/atn/LexerATNSimulator.js ***!
  32288. \******************************************************/
  32289. /*! no static exports found */
  32290. /***/ (function(module, exports, __webpack_require__) {
  32291. //
  32292. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  32293. * Use of this file is governed by the BSD 3-clause license that
  32294. * can be found in the LICENSE.txt file in the project root.
  32295. */
  32296. ///
  32297. // When we hit an accept state in either the DFA or the ATN, we
  32298. // have to notify the character stream to start buffering characters
  32299. // via {@link IntStream//mark} and record the current state. The current sim state
  32300. // includes the current index into the input, the current line,
  32301. // and current character position in that line. Note that the Lexer is
  32302. // tracking the starting line and characterization of the token. These
  32303. // variables track the "state" of the simulator when it hits an accept state.
  32304. //
  32305. // <p>We track these variables separately for the DFA and ATN simulation
  32306. // because the DFA simulation often has to fail over to the ATN
  32307. // simulation. If the ATN simulation fails, we need the DFA to fall
  32308. // back to its previously accepted state, if any. If the ATN succeeds,
  32309. // then the ATN does the accept and the DFA simulator that invoked it
  32310. // can simply return the predicted token type.</p>
  32311. ///
  32312. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  32313. var Lexer = __webpack_require__(/*! ./../Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  32314. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  32315. var ATNSimulator = __webpack_require__(/*! ./ATNSimulator */ "./node_modules/antlr4/atn/ATNSimulator.js").ATNSimulator;
  32316. var DFAState = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  32317. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  32318. var OrderedATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").OrderedATNConfigSet;
  32319. var PredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").PredictionContext;
  32320. var SingletonPredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").SingletonPredictionContext;
  32321. var RuleStopState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  32322. var LexerATNConfig = __webpack_require__(/*! ./ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").LexerATNConfig;
  32323. var Transition = __webpack_require__(/*! ./Transition */ "./node_modules/antlr4/atn/Transition.js").Transition;
  32324. var LexerActionExecutor = __webpack_require__(/*! ./LexerActionExecutor */ "./node_modules/antlr4/atn/LexerActionExecutor.js").LexerActionExecutor;
  32325. var LexerNoViableAltException = __webpack_require__(/*! ./../error/Errors */ "./node_modules/antlr4/error/Errors.js").LexerNoViableAltException;
  32326. function resetSimState(sim) {
  32327. sim.index = -1;
  32328. sim.line = 0;
  32329. sim.column = -1;
  32330. sim.dfaState = null;
  32331. }
  32332. function SimState() {
  32333. resetSimState(this);
  32334. return this;
  32335. }
  32336. SimState.prototype.reset = function() {
  32337. resetSimState(this);
  32338. };
  32339. function LexerATNSimulator(recog, atn, decisionToDFA, sharedContextCache) {
  32340. ATNSimulator.call(this, atn, sharedContextCache);
  32341. this.decisionToDFA = decisionToDFA;
  32342. this.recog = recog;
  32343. // The current token's starting index into the character stream.
  32344. // Shared across DFA to ATN simulation in case the ATN fails and the
  32345. // DFA did not have a previous accept state. In this case, we use the
  32346. // ATN-generated exception object.
  32347. this.startIndex = -1;
  32348. // line number 1..n within the input///
  32349. this.line = 1;
  32350. // The index of the character relative to the beginning of the line
  32351. // 0..n-1///
  32352. this.column = 0;
  32353. this.mode = Lexer.DEFAULT_MODE;
  32354. // Used during DFA/ATN exec to record the most recent accept configuration
  32355. // info
  32356. this.prevAccept = new SimState();
  32357. // done
  32358. return this;
  32359. }
  32360. LexerATNSimulator.prototype = Object.create(ATNSimulator.prototype);
  32361. LexerATNSimulator.prototype.constructor = LexerATNSimulator;
  32362. LexerATNSimulator.debug = false;
  32363. LexerATNSimulator.dfa_debug = false;
  32364. LexerATNSimulator.MIN_DFA_EDGE = 0;
  32365. LexerATNSimulator.MAX_DFA_EDGE = 127; // forces unicode to stay in ATN
  32366. LexerATNSimulator.match_calls = 0;
  32367. LexerATNSimulator.prototype.copyState = function(simulator) {
  32368. this.column = simulator.column;
  32369. this.line = simulator.line;
  32370. this.mode = simulator.mode;
  32371. this.startIndex = simulator.startIndex;
  32372. };
  32373. LexerATNSimulator.prototype.match = function(input, mode) {
  32374. this.match_calls += 1;
  32375. this.mode = mode;
  32376. var mark = input.mark();
  32377. try {
  32378. this.startIndex = input.index;
  32379. this.prevAccept.reset();
  32380. var dfa = this.decisionToDFA[mode];
  32381. if (dfa.s0 === null) {
  32382. return this.matchATN(input);
  32383. } else {
  32384. return this.execATN(input, dfa.s0);
  32385. }
  32386. } finally {
  32387. input.release(mark);
  32388. }
  32389. };
  32390. LexerATNSimulator.prototype.reset = function() {
  32391. this.prevAccept.reset();
  32392. this.startIndex = -1;
  32393. this.line = 1;
  32394. this.column = 0;
  32395. this.mode = Lexer.DEFAULT_MODE;
  32396. };
  32397. LexerATNSimulator.prototype.matchATN = function(input) {
  32398. var startState = this.atn.modeToStartState[this.mode];
  32399. if (LexerATNSimulator.debug) {
  32400. console.log("matchATN mode " + this.mode + " start: " + startState);
  32401. }
  32402. var old_mode = this.mode;
  32403. var s0_closure = this.computeStartState(input, startState);
  32404. var suppressEdge = s0_closure.hasSemanticContext;
  32405. s0_closure.hasSemanticContext = false;
  32406. var next = this.addDFAState(s0_closure);
  32407. if (!suppressEdge) {
  32408. this.decisionToDFA[this.mode].s0 = next;
  32409. }
  32410. var predict = this.execATN(input, next);
  32411. if (LexerATNSimulator.debug) {
  32412. console.log("DFA after matchATN: " + this.decisionToDFA[old_mode].toLexerString());
  32413. }
  32414. return predict;
  32415. };
  32416. LexerATNSimulator.prototype.execATN = function(input, ds0) {
  32417. if (LexerATNSimulator.debug) {
  32418. console.log("start state closure=" + ds0.configs);
  32419. }
  32420. if (ds0.isAcceptState) {
  32421. // allow zero-length tokens
  32422. this.captureSimState(this.prevAccept, input, ds0);
  32423. }
  32424. var t = input.LA(1);
  32425. var s = ds0; // s is current/from DFA state
  32426. while (true) { // while more work
  32427. if (LexerATNSimulator.debug) {
  32428. console.log("execATN loop starting closure: " + s.configs);
  32429. }
  32430. // As we move src->trg, src->trg, we keep track of the previous trg to
  32431. // avoid looking up the DFA state again, which is expensive.
  32432. // If the previous target was already part of the DFA, we might
  32433. // be able to avoid doing a reach operation upon t. If s!=null,
  32434. // it means that semantic predicates didn't prevent us from
  32435. // creating a DFA state. Once we know s!=null, we check to see if
  32436. // the DFA state has an edge already for t. If so, we can just reuse
  32437. // it's configuration set; there's no point in re-computing it.
  32438. // This is kind of like doing DFA simulation within the ATN
  32439. // simulation because DFA simulation is really just a way to avoid
  32440. // computing reach/closure sets. Technically, once we know that
  32441. // we have a previously added DFA state, we could jump over to
  32442. // the DFA simulator. But, that would mean popping back and forth
  32443. // a lot and making things more complicated algorithmically.
  32444. // This optimization makes a lot of sense for loops within DFA.
  32445. // A character will take us back to an existing DFA state
  32446. // that already has lots of edges out of it. e.g., .* in comments.
  32447. // print("Target for:" + str(s) + " and:" + str(t))
  32448. var target = this.getExistingTargetState(s, t);
  32449. // print("Existing:" + str(target))
  32450. if (target === null) {
  32451. target = this.computeTargetState(input, s, t);
  32452. // print("Computed:" + str(target))
  32453. }
  32454. if (target === ATNSimulator.ERROR) {
  32455. break;
  32456. }
  32457. // If this is a consumable input element, make sure to consume before
  32458. // capturing the accept state so the input index, line, and char
  32459. // position accurately reflect the state of the interpreter at the
  32460. // end of the token.
  32461. if (t !== Token.EOF) {
  32462. this.consume(input);
  32463. }
  32464. if (target.isAcceptState) {
  32465. this.captureSimState(this.prevAccept, input, target);
  32466. if (t === Token.EOF) {
  32467. break;
  32468. }
  32469. }
  32470. t = input.LA(1);
  32471. s = target; // flip; current DFA target becomes new src/from state
  32472. }
  32473. return this.failOrAccept(this.prevAccept, input, s.configs, t);
  32474. };
  32475. // Get an existing target state for an edge in the DFA. If the target state
  32476. // for the edge has not yet been computed or is otherwise not available,
  32477. // this method returns {@code null}.
  32478. //
  32479. // @param s The current DFA state
  32480. // @param t The next input symbol
  32481. // @return The existing target DFA state for the given input symbol
  32482. // {@code t}, or {@code null} if the target state for this edge is not
  32483. // already cached
  32484. LexerATNSimulator.prototype.getExistingTargetState = function(s, t) {
  32485. if (s.edges === null || t < LexerATNSimulator.MIN_DFA_EDGE || t > LexerATNSimulator.MAX_DFA_EDGE) {
  32486. return null;
  32487. }
  32488. var target = s.edges[t - LexerATNSimulator.MIN_DFA_EDGE];
  32489. if(target===undefined) {
  32490. target = null;
  32491. }
  32492. if (LexerATNSimulator.debug && target !== null) {
  32493. console.log("reuse state " + s.stateNumber + " edge to " + target.stateNumber);
  32494. }
  32495. return target;
  32496. };
  32497. // Compute a target state for an edge in the DFA, and attempt to add the
  32498. // computed state and corresponding edge to the DFA.
  32499. //
  32500. // @param input The input stream
  32501. // @param s The current DFA state
  32502. // @param t The next input symbol
  32503. //
  32504. // @return The computed target DFA state for the given input symbol
  32505. // {@code t}. If {@code t} does not lead to a valid DFA state, this method
  32506. // returns {@link //ERROR}.
  32507. LexerATNSimulator.prototype.computeTargetState = function(input, s, t) {
  32508. var reach = new OrderedATNConfigSet();
  32509. // if we don't find an existing DFA state
  32510. // Fill reach starting from closure, following t transitions
  32511. this.getReachableConfigSet(input, s.configs, reach, t);
  32512. if (reach.items.length === 0) { // we got nowhere on t from s
  32513. if (!reach.hasSemanticContext) {
  32514. // we got nowhere on t, don't throw out this knowledge; it'd
  32515. // cause a failover from DFA later.
  32516. this.addDFAEdge(s, t, ATNSimulator.ERROR);
  32517. }
  32518. // stop when we can't match any more char
  32519. return ATNSimulator.ERROR;
  32520. }
  32521. // Add an edge from s to target DFA found/created for reach
  32522. return this.addDFAEdge(s, t, null, reach);
  32523. };
  32524. LexerATNSimulator.prototype.failOrAccept = function(prevAccept, input, reach, t) {
  32525. if (this.prevAccept.dfaState !== null) {
  32526. var lexerActionExecutor = prevAccept.dfaState.lexerActionExecutor;
  32527. this.accept(input, lexerActionExecutor, this.startIndex,
  32528. prevAccept.index, prevAccept.line, prevAccept.column);
  32529. return prevAccept.dfaState.prediction;
  32530. } else {
  32531. // if no accept and EOF is first char, return EOF
  32532. if (t === Token.EOF && input.index === this.startIndex) {
  32533. return Token.EOF;
  32534. }
  32535. throw new LexerNoViableAltException(this.recog, input, this.startIndex, reach);
  32536. }
  32537. };
  32538. // Given a starting configuration set, figure out all ATN configurations
  32539. // we can reach upon input {@code t}. Parameter {@code reach} is a return
  32540. // parameter.
  32541. LexerATNSimulator.prototype.getReachableConfigSet = function(input, closure,
  32542. reach, t) {
  32543. // this is used to skip processing for configs which have a lower priority
  32544. // than a config that already reached an accept state for the same rule
  32545. var skipAlt = ATN.INVALID_ALT_NUMBER;
  32546. for (var i = 0; i < closure.items.length; i++) {
  32547. var cfg = closure.items[i];
  32548. var currentAltReachedAcceptState = (cfg.alt === skipAlt);
  32549. if (currentAltReachedAcceptState && cfg.passedThroughNonGreedyDecision) {
  32550. continue;
  32551. }
  32552. if (LexerATNSimulator.debug) {
  32553. console.log("testing %s at %s\n", this.getTokenName(t), cfg
  32554. .toString(this.recog, true));
  32555. }
  32556. for (var j = 0; j < cfg.state.transitions.length; j++) {
  32557. var trans = cfg.state.transitions[j]; // for each transition
  32558. var target = this.getReachableTarget(trans, t);
  32559. if (target !== null) {
  32560. var lexerActionExecutor = cfg.lexerActionExecutor;
  32561. if (lexerActionExecutor !== null) {
  32562. lexerActionExecutor = lexerActionExecutor.fixOffsetBeforeMatch(input.index - this.startIndex);
  32563. }
  32564. var treatEofAsEpsilon = (t === Token.EOF);
  32565. var config = new LexerATNConfig({state:target, lexerActionExecutor:lexerActionExecutor}, cfg);
  32566. if (this.closure(input, config, reach,
  32567. currentAltReachedAcceptState, true, treatEofAsEpsilon)) {
  32568. // any remaining configs for this alt have a lower priority
  32569. // than the one that just reached an accept state.
  32570. skipAlt = cfg.alt;
  32571. }
  32572. }
  32573. }
  32574. }
  32575. };
  32576. LexerATNSimulator.prototype.accept = function(input, lexerActionExecutor,
  32577. startIndex, index, line, charPos) {
  32578. if (LexerATNSimulator.debug) {
  32579. console.log("ACTION %s\n", lexerActionExecutor);
  32580. }
  32581. // seek to after last char in token
  32582. input.seek(index);
  32583. this.line = line;
  32584. this.column = charPos;
  32585. if (lexerActionExecutor !== null && this.recog !== null) {
  32586. lexerActionExecutor.execute(this.recog, input, startIndex);
  32587. }
  32588. };
  32589. LexerATNSimulator.prototype.getReachableTarget = function(trans, t) {
  32590. if (trans.matches(t, 0, Lexer.MAX_CHAR_VALUE)) {
  32591. return trans.target;
  32592. } else {
  32593. return null;
  32594. }
  32595. };
  32596. LexerATNSimulator.prototype.computeStartState = function(input, p) {
  32597. var initialContext = PredictionContext.EMPTY;
  32598. var configs = new OrderedATNConfigSet();
  32599. for (var i = 0; i < p.transitions.length; i++) {
  32600. var target = p.transitions[i].target;
  32601. var cfg = new LexerATNConfig({state:target, alt:i+1, context:initialContext}, null);
  32602. this.closure(input, cfg, configs, false, false, false);
  32603. }
  32604. return configs;
  32605. };
  32606. // Since the alternatives within any lexer decision are ordered by
  32607. // preference, this method stops pursuing the closure as soon as an accept
  32608. // state is reached. After the first accept state is reached by depth-first
  32609. // search from {@code config}, all other (potentially reachable) states for
  32610. // this rule would have a lower priority.
  32611. //
  32612. // @return {@code true} if an accept state is reached, otherwise
  32613. // {@code false}.
  32614. LexerATNSimulator.prototype.closure = function(input, config, configs,
  32615. currentAltReachedAcceptState, speculative, treatEofAsEpsilon) {
  32616. var cfg = null;
  32617. if (LexerATNSimulator.debug) {
  32618. console.log("closure(" + config.toString(this.recog, true) + ")");
  32619. }
  32620. if (config.state instanceof RuleStopState) {
  32621. if (LexerATNSimulator.debug) {
  32622. if (this.recog !== null) {
  32623. console.log("closure at %s rule stop %s\n", this.recog.ruleNames[config.state.ruleIndex], config);
  32624. } else {
  32625. console.log("closure at rule stop %s\n", config);
  32626. }
  32627. }
  32628. if (config.context === null || config.context.hasEmptyPath()) {
  32629. if (config.context === null || config.context.isEmpty()) {
  32630. configs.add(config);
  32631. return true;
  32632. } else {
  32633. configs.add(new LexerATNConfig({ state:config.state, context:PredictionContext.EMPTY}, config));
  32634. currentAltReachedAcceptState = true;
  32635. }
  32636. }
  32637. if (config.context !== null && !config.context.isEmpty()) {
  32638. for (var i = 0; i < config.context.length; i++) {
  32639. if (config.context.getReturnState(i) !== PredictionContext.EMPTY_RETURN_STATE) {
  32640. var newContext = config.context.getParent(i); // "pop" return state
  32641. var returnState = this.atn.states[config.context.getReturnState(i)];
  32642. cfg = new LexerATNConfig({ state:returnState, context:newContext }, config);
  32643. currentAltReachedAcceptState = this.closure(input, cfg,
  32644. configs, currentAltReachedAcceptState, speculative,
  32645. treatEofAsEpsilon);
  32646. }
  32647. }
  32648. }
  32649. return currentAltReachedAcceptState;
  32650. }
  32651. // optimization
  32652. if (!config.state.epsilonOnlyTransitions) {
  32653. if (!currentAltReachedAcceptState || !config.passedThroughNonGreedyDecision) {
  32654. configs.add(config);
  32655. }
  32656. }
  32657. for (var j = 0; j < config.state.transitions.length; j++) {
  32658. var trans = config.state.transitions[j];
  32659. cfg = this.getEpsilonTarget(input, config, trans, configs, speculative, treatEofAsEpsilon);
  32660. if (cfg !== null) {
  32661. currentAltReachedAcceptState = this.closure(input, cfg, configs,
  32662. currentAltReachedAcceptState, speculative, treatEofAsEpsilon);
  32663. }
  32664. }
  32665. return currentAltReachedAcceptState;
  32666. };
  32667. // side-effect: can alter configs.hasSemanticContext
  32668. LexerATNSimulator.prototype.getEpsilonTarget = function(input, config, trans,
  32669. configs, speculative, treatEofAsEpsilon) {
  32670. var cfg = null;
  32671. if (trans.serializationType === Transition.RULE) {
  32672. var newContext = SingletonPredictionContext.create(config.context, trans.followState.stateNumber);
  32673. cfg = new LexerATNConfig( { state:trans.target, context:newContext}, config);
  32674. } else if (trans.serializationType === Transition.PRECEDENCE) {
  32675. throw "Precedence predicates are not supported in lexers.";
  32676. } else if (trans.serializationType === Transition.PREDICATE) {
  32677. // Track traversing semantic predicates. If we traverse,
  32678. // we cannot add a DFA state for this "reach" computation
  32679. // because the DFA would not test the predicate again in the
  32680. // future. Rather than creating collections of semantic predicates
  32681. // like v3 and testing them on prediction, v4 will test them on the
  32682. // fly all the time using the ATN not the DFA. This is slower but
  32683. // semantically it's not used that often. One of the key elements to
  32684. // this predicate mechanism is not adding DFA states that see
  32685. // predicates immediately afterwards in the ATN. For example,
  32686. // a : ID {p1}? | ID {p2}? ;
  32687. // should create the start state for rule 'a' (to save start state
  32688. // competition), but should not create target of ID state. The
  32689. // collection of ATN states the following ID references includes
  32690. // states reached by traversing predicates. Since this is when we
  32691. // test them, we cannot cash the DFA state target of ID.
  32692. if (LexerATNSimulator.debug) {
  32693. console.log("EVAL rule " + trans.ruleIndex + ":" + trans.predIndex);
  32694. }
  32695. configs.hasSemanticContext = true;
  32696. if (this.evaluatePredicate(input, trans.ruleIndex, trans.predIndex, speculative)) {
  32697. cfg = new LexerATNConfig({ state:trans.target}, config);
  32698. }
  32699. } else if (trans.serializationType === Transition.ACTION) {
  32700. if (config.context === null || config.context.hasEmptyPath()) {
  32701. // execute actions anywhere in the start rule for a token.
  32702. //
  32703. // TODO: if the entry rule is invoked recursively, some
  32704. // actions may be executed during the recursive call. The
  32705. // problem can appear when hasEmptyPath() is true but
  32706. // isEmpty() is false. In this case, the config needs to be
  32707. // split into two contexts - one with just the empty path
  32708. // and another with everything but the empty path.
  32709. // Unfortunately, the current algorithm does not allow
  32710. // getEpsilonTarget to return two configurations, so
  32711. // additional modifications are needed before we can support
  32712. // the split operation.
  32713. var lexerActionExecutor = LexerActionExecutor.append(config.lexerActionExecutor,
  32714. this.atn.lexerActions[trans.actionIndex]);
  32715. cfg = new LexerATNConfig({ state:trans.target, lexerActionExecutor:lexerActionExecutor }, config);
  32716. } else {
  32717. // ignore actions in referenced rules
  32718. cfg = new LexerATNConfig( { state:trans.target}, config);
  32719. }
  32720. } else if (trans.serializationType === Transition.EPSILON) {
  32721. cfg = new LexerATNConfig({ state:trans.target}, config);
  32722. } else if (trans.serializationType === Transition.ATOM ||
  32723. trans.serializationType === Transition.RANGE ||
  32724. trans.serializationType === Transition.SET) {
  32725. if (treatEofAsEpsilon) {
  32726. if (trans.matches(Token.EOF, 0, Lexer.MAX_CHAR_VALUE)) {
  32727. cfg = new LexerATNConfig( { state:trans.target }, config);
  32728. }
  32729. }
  32730. }
  32731. return cfg;
  32732. };
  32733. // Evaluate a predicate specified in the lexer.
  32734. //
  32735. // <p>If {@code speculative} is {@code true}, this method was called before
  32736. // {@link //consume} for the matched character. This method should call
  32737. // {@link //consume} before evaluating the predicate to ensure position
  32738. // sensitive values, including {@link Lexer//getText}, {@link Lexer//getLine},
  32739. // and {@link Lexer//getcolumn}, properly reflect the current
  32740. // lexer state. This method should restore {@code input} and the simulator
  32741. // to the original state before returning (i.e. undo the actions made by the
  32742. // call to {@link //consume}.</p>
  32743. //
  32744. // @param input The input stream.
  32745. // @param ruleIndex The rule containing the predicate.
  32746. // @param predIndex The index of the predicate within the rule.
  32747. // @param speculative {@code true} if the current index in {@code input} is
  32748. // one character before the predicate's location.
  32749. //
  32750. // @return {@code true} if the specified predicate evaluates to
  32751. // {@code true}.
  32752. // /
  32753. LexerATNSimulator.prototype.evaluatePredicate = function(input, ruleIndex,
  32754. predIndex, speculative) {
  32755. // assume true if no recognizer was provided
  32756. if (this.recog === null) {
  32757. return true;
  32758. }
  32759. if (!speculative) {
  32760. return this.recog.sempred(null, ruleIndex, predIndex);
  32761. }
  32762. var savedcolumn = this.column;
  32763. var savedLine = this.line;
  32764. var index = input.index;
  32765. var marker = input.mark();
  32766. try {
  32767. this.consume(input);
  32768. return this.recog.sempred(null, ruleIndex, predIndex);
  32769. } finally {
  32770. this.column = savedcolumn;
  32771. this.line = savedLine;
  32772. input.seek(index);
  32773. input.release(marker);
  32774. }
  32775. };
  32776. LexerATNSimulator.prototype.captureSimState = function(settings, input, dfaState) {
  32777. settings.index = input.index;
  32778. settings.line = this.line;
  32779. settings.column = this.column;
  32780. settings.dfaState = dfaState;
  32781. };
  32782. LexerATNSimulator.prototype.addDFAEdge = function(from_, tk, to, cfgs) {
  32783. if (to === undefined) {
  32784. to = null;
  32785. }
  32786. if (cfgs === undefined) {
  32787. cfgs = null;
  32788. }
  32789. if (to === null && cfgs !== null) {
  32790. // leading to this call, ATNConfigSet.hasSemanticContext is used as a
  32791. // marker indicating dynamic predicate evaluation makes this edge
  32792. // dependent on the specific input sequence, so the static edge in the
  32793. // DFA should be omitted. The target DFAState is still created since
  32794. // execATN has the ability to resynchronize with the DFA state cache
  32795. // following the predicate evaluation step.
  32796. //
  32797. // TJP notes: next time through the DFA, we see a pred again and eval.
  32798. // If that gets us to a previously created (but dangling) DFA
  32799. // state, we can continue in pure DFA mode from there.
  32800. // /
  32801. var suppressEdge = cfgs.hasSemanticContext;
  32802. cfgs.hasSemanticContext = false;
  32803. to = this.addDFAState(cfgs);
  32804. if (suppressEdge) {
  32805. return to;
  32806. }
  32807. }
  32808. // add the edge
  32809. if (tk < LexerATNSimulator.MIN_DFA_EDGE || tk > LexerATNSimulator.MAX_DFA_EDGE) {
  32810. // Only track edges within the DFA bounds
  32811. return to;
  32812. }
  32813. if (LexerATNSimulator.debug) {
  32814. console.log("EDGE " + from_ + " -> " + to + " upon " + tk);
  32815. }
  32816. if (from_.edges === null) {
  32817. // make room for tokens 1..n and -1 masquerading as index 0
  32818. from_.edges = [];
  32819. }
  32820. from_.edges[tk - LexerATNSimulator.MIN_DFA_EDGE] = to; // connect
  32821. return to;
  32822. };
  32823. // Add a new DFA state if there isn't one with this set of
  32824. // configurations already. This method also detects the first
  32825. // configuration containing an ATN rule stop state. Later, when
  32826. // traversing the DFA, we will know which rule to accept.
  32827. LexerATNSimulator.prototype.addDFAState = function(configs) {
  32828. var proposed = new DFAState(null, configs);
  32829. var firstConfigWithRuleStopState = null;
  32830. for (var i = 0; i < configs.items.length; i++) {
  32831. var cfg = configs.items[i];
  32832. if (cfg.state instanceof RuleStopState) {
  32833. firstConfigWithRuleStopState = cfg;
  32834. break;
  32835. }
  32836. }
  32837. if (firstConfigWithRuleStopState !== null) {
  32838. proposed.isAcceptState = true;
  32839. proposed.lexerActionExecutor = firstConfigWithRuleStopState.lexerActionExecutor;
  32840. proposed.prediction = this.atn.ruleToTokenType[firstConfigWithRuleStopState.state.ruleIndex];
  32841. }
  32842. var dfa = this.decisionToDFA[this.mode];
  32843. var existing = dfa.states.get(proposed);
  32844. if (existing!==null) {
  32845. return existing;
  32846. }
  32847. var newState = proposed;
  32848. newState.stateNumber = dfa.states.length;
  32849. configs.setReadonly(true);
  32850. newState.configs = configs;
  32851. dfa.states.add(newState);
  32852. return newState;
  32853. };
  32854. LexerATNSimulator.prototype.getDFA = function(mode) {
  32855. return this.decisionToDFA[mode];
  32856. };
  32857. // Get the text matched so far for the current token.
  32858. LexerATNSimulator.prototype.getText = function(input) {
  32859. // index is first lookahead char, don't include.
  32860. return input.getText(this.startIndex, input.index - 1);
  32861. };
  32862. LexerATNSimulator.prototype.consume = function(input) {
  32863. var curChar = input.LA(1);
  32864. if (curChar === "\n".charCodeAt(0)) {
  32865. this.line += 1;
  32866. this.column = 0;
  32867. } else {
  32868. this.column += 1;
  32869. }
  32870. input.consume();
  32871. };
  32872. LexerATNSimulator.prototype.getTokenName = function(tt) {
  32873. if (tt === -1) {
  32874. return "EOF";
  32875. } else {
  32876. return "'" + String.fromCharCode(tt) + "'";
  32877. }
  32878. };
  32879. exports.LexerATNSimulator = LexerATNSimulator;
  32880. /***/ }),
  32881. /***/ "./node_modules/antlr4/atn/LexerAction.js":
  32882. /*!************************************************!*\
  32883. !*** ./node_modules/antlr4/atn/LexerAction.js ***!
  32884. \************************************************/
  32885. /*! no static exports found */
  32886. /***/ (function(module, exports) {
  32887. //
  32888. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  32889. * Use of this file is governed by the BSD 3-clause license that
  32890. * can be found in the LICENSE.txt file in the project root.
  32891. */
  32892. //
  32893. function LexerActionType() {
  32894. }
  32895. LexerActionType.CHANNEL = 0; //The type of a {@link LexerChannelAction} action.
  32896. LexerActionType.CUSTOM = 1; //The type of a {@link LexerCustomAction} action.
  32897. LexerActionType.MODE = 2; //The type of a {@link LexerModeAction} action.
  32898. LexerActionType.MORE = 3; //The type of a {@link LexerMoreAction} action.
  32899. LexerActionType.POP_MODE = 4; //The type of a {@link LexerPopModeAction} action.
  32900. LexerActionType.PUSH_MODE = 5; //The type of a {@link LexerPushModeAction} action.
  32901. LexerActionType.SKIP = 6; //The type of a {@link LexerSkipAction} action.
  32902. LexerActionType.TYPE = 7; //The type of a {@link LexerTypeAction} action.
  32903. function LexerAction(action) {
  32904. this.actionType = action;
  32905. this.isPositionDependent = false;
  32906. return this;
  32907. }
  32908. LexerAction.prototype.hashCode = function() {
  32909. var hash = new Hash();
  32910. this.updateHashCode(hash);
  32911. return hash.finish()
  32912. };
  32913. LexerAction.prototype.updateHashCode = function(hash) {
  32914. hash.update(this.actionType);
  32915. };
  32916. LexerAction.prototype.equals = function(other) {
  32917. return this === other;
  32918. };
  32919. //
  32920. // Implements the {@code skip} lexer action by calling {@link Lexer//skip}.
  32921. //
  32922. // <p>The {@code skip} command does not have any parameters, so this action is
  32923. // implemented as a singleton instance exposed by {@link //INSTANCE}.</p>
  32924. function LexerSkipAction() {
  32925. LexerAction.call(this, LexerActionType.SKIP);
  32926. return this;
  32927. }
  32928. LexerSkipAction.prototype = Object.create(LexerAction.prototype);
  32929. LexerSkipAction.prototype.constructor = LexerSkipAction;
  32930. // Provides a singleton instance of this parameterless lexer action.
  32931. LexerSkipAction.INSTANCE = new LexerSkipAction();
  32932. LexerSkipAction.prototype.execute = function(lexer) {
  32933. lexer.skip();
  32934. };
  32935. LexerSkipAction.prototype.toString = function() {
  32936. return "skip";
  32937. };
  32938. // Implements the {@code type} lexer action by calling {@link Lexer//setType}
  32939. // with the assigned type.
  32940. function LexerTypeAction(type) {
  32941. LexerAction.call(this, LexerActionType.TYPE);
  32942. this.type = type;
  32943. return this;
  32944. }
  32945. LexerTypeAction.prototype = Object.create(LexerAction.prototype);
  32946. LexerTypeAction.prototype.constructor = LexerTypeAction;
  32947. LexerTypeAction.prototype.execute = function(lexer) {
  32948. lexer.type = this.type;
  32949. };
  32950. LexerTypeAction.prototype.updateHashCode = function(hash) {
  32951. hash.update(this.actionType, this.type);
  32952. };
  32953. LexerTypeAction.prototype.equals = function(other) {
  32954. if(this === other) {
  32955. return true;
  32956. } else if (! (other instanceof LexerTypeAction)) {
  32957. return false;
  32958. } else {
  32959. return this.type === other.type;
  32960. }
  32961. };
  32962. LexerTypeAction.prototype.toString = function() {
  32963. return "type(" + this.type + ")";
  32964. };
  32965. // Implements the {@code pushMode} lexer action by calling
  32966. // {@link Lexer//pushMode} with the assigned mode.
  32967. function LexerPushModeAction(mode) {
  32968. LexerAction.call(this, LexerActionType.PUSH_MODE);
  32969. this.mode = mode;
  32970. return this;
  32971. }
  32972. LexerPushModeAction.prototype = Object.create(LexerAction.prototype);
  32973. LexerPushModeAction.prototype.constructor = LexerPushModeAction;
  32974. // <p>This action is implemented by calling {@link Lexer//pushMode} with the
  32975. // value provided by {@link //getMode}.</p>
  32976. LexerPushModeAction.prototype.execute = function(lexer) {
  32977. lexer.pushMode(this.mode);
  32978. };
  32979. LexerPushModeAction.prototype.updateHashCode = function(hash) {
  32980. hash.update(this.actionType, this.mode);
  32981. };
  32982. LexerPushModeAction.prototype.equals = function(other) {
  32983. if (this === other) {
  32984. return true;
  32985. } else if (! (other instanceof LexerPushModeAction)) {
  32986. return false;
  32987. } else {
  32988. return this.mode === other.mode;
  32989. }
  32990. };
  32991. LexerPushModeAction.prototype.toString = function() {
  32992. return "pushMode(" + this.mode + ")";
  32993. };
  32994. // Implements the {@code popMode} lexer action by calling {@link Lexer//popMode}.
  32995. //
  32996. // <p>The {@code popMode} command does not have any parameters, so this action is
  32997. // implemented as a singleton instance exposed by {@link //INSTANCE}.</p>
  32998. function LexerPopModeAction() {
  32999. LexerAction.call(this,LexerActionType.POP_MODE);
  33000. return this;
  33001. }
  33002. LexerPopModeAction.prototype = Object.create(LexerAction.prototype);
  33003. LexerPopModeAction.prototype.constructor = LexerPopModeAction;
  33004. LexerPopModeAction.INSTANCE = new LexerPopModeAction();
  33005. // <p>This action is implemented by calling {@link Lexer//popMode}.</p>
  33006. LexerPopModeAction.prototype.execute = function(lexer) {
  33007. lexer.popMode();
  33008. };
  33009. LexerPopModeAction.prototype.toString = function() {
  33010. return "popMode";
  33011. };
  33012. // Implements the {@code more} lexer action by calling {@link Lexer//more}.
  33013. //
  33014. // <p>The {@code more} command does not have any parameters, so this action is
  33015. // implemented as a singleton instance exposed by {@link //INSTANCE}.</p>
  33016. function LexerMoreAction() {
  33017. LexerAction.call(this, LexerActionType.MORE);
  33018. return this;
  33019. }
  33020. LexerMoreAction.prototype = Object.create(LexerAction.prototype);
  33021. LexerMoreAction.prototype.constructor = LexerMoreAction;
  33022. LexerMoreAction.INSTANCE = new LexerMoreAction();
  33023. // <p>This action is implemented by calling {@link Lexer//popMode}.</p>
  33024. LexerMoreAction.prototype.execute = function(lexer) {
  33025. lexer.more();
  33026. };
  33027. LexerMoreAction.prototype.toString = function() {
  33028. return "more";
  33029. };
  33030. // Implements the {@code mode} lexer action by calling {@link Lexer//mode} with
  33031. // the assigned mode.
  33032. function LexerModeAction(mode) {
  33033. LexerAction.call(this, LexerActionType.MODE);
  33034. this.mode = mode;
  33035. return this;
  33036. }
  33037. LexerModeAction.prototype = Object.create(LexerAction.prototype);
  33038. LexerModeAction.prototype.constructor = LexerModeAction;
  33039. // <p>This action is implemented by calling {@link Lexer//mode} with the
  33040. // value provided by {@link //getMode}.</p>
  33041. LexerModeAction.prototype.execute = function(lexer) {
  33042. lexer.mode(this.mode);
  33043. };
  33044. LexerModeAction.prototype.updateHashCode = function(hash) {
  33045. hash.update(this.actionType, this.mode);
  33046. };
  33047. LexerModeAction.prototype.equals = function(other) {
  33048. if (this === other) {
  33049. return true;
  33050. } else if (! (other instanceof LexerModeAction)) {
  33051. return false;
  33052. } else {
  33053. return this.mode === other.mode;
  33054. }
  33055. };
  33056. LexerModeAction.prototype.toString = function() {
  33057. return "mode(" + this.mode + ")";
  33058. };
  33059. // Executes a custom lexer action by calling {@link Recognizer//action} with the
  33060. // rule and action indexes assigned to the custom action. The implementation of
  33061. // a custom action is added to the generated code for the lexer in an override
  33062. // of {@link Recognizer//action} when the grammar is compiled.
  33063. //
  33064. // <p>This class may represent embedded actions created with the <code>{...}</code>
  33065. // syntax in ANTLR 4, as well as actions created for lexer commands where the
  33066. // command argument could not be evaluated when the grammar was compiled.</p>
  33067. // Constructs a custom lexer action with the specified rule and action
  33068. // indexes.
  33069. //
  33070. // @param ruleIndex The rule index to use for calls to
  33071. // {@link Recognizer//action}.
  33072. // @param actionIndex The action index to use for calls to
  33073. // {@link Recognizer//action}.
  33074. function LexerCustomAction(ruleIndex, actionIndex) {
  33075. LexerAction.call(this, LexerActionType.CUSTOM);
  33076. this.ruleIndex = ruleIndex;
  33077. this.actionIndex = actionIndex;
  33078. this.isPositionDependent = true;
  33079. return this;
  33080. }
  33081. LexerCustomAction.prototype = Object.create(LexerAction.prototype);
  33082. LexerCustomAction.prototype.constructor = LexerCustomAction;
  33083. // <p>Custom actions are implemented by calling {@link Lexer//action} with the
  33084. // appropriate rule and action indexes.</p>
  33085. LexerCustomAction.prototype.execute = function(lexer) {
  33086. lexer.action(null, this.ruleIndex, this.actionIndex);
  33087. };
  33088. LexerCustomAction.prototype.updateHashCode = function(hash) {
  33089. hash.update(this.actionType, this.ruleIndex, this.actionIndex);
  33090. };
  33091. LexerCustomAction.prototype.equals = function(other) {
  33092. if (this === other) {
  33093. return true;
  33094. } else if (! (other instanceof LexerCustomAction)) {
  33095. return false;
  33096. } else {
  33097. return this.ruleIndex === other.ruleIndex && this.actionIndex === other.actionIndex;
  33098. }
  33099. };
  33100. // Implements the {@code channel} lexer action by calling
  33101. // {@link Lexer//setChannel} with the assigned channel.
  33102. // Constructs a new {@code channel} action with the specified channel value.
  33103. // @param channel The channel value to pass to {@link Lexer//setChannel}.
  33104. function LexerChannelAction(channel) {
  33105. LexerAction.call(this, LexerActionType.CHANNEL);
  33106. this.channel = channel;
  33107. return this;
  33108. }
  33109. LexerChannelAction.prototype = Object.create(LexerAction.prototype);
  33110. LexerChannelAction.prototype.constructor = LexerChannelAction;
  33111. // <p>This action is implemented by calling {@link Lexer//setChannel} with the
  33112. // value provided by {@link //getChannel}.</p>
  33113. LexerChannelAction.prototype.execute = function(lexer) {
  33114. lexer._channel = this.channel;
  33115. };
  33116. LexerChannelAction.prototype.updateHashCode = function(hash) {
  33117. hash.update(this.actionType, this.channel);
  33118. };
  33119. LexerChannelAction.prototype.equals = function(other) {
  33120. if (this === other) {
  33121. return true;
  33122. } else if (! (other instanceof LexerChannelAction)) {
  33123. return false;
  33124. } else {
  33125. return this.channel === other.channel;
  33126. }
  33127. };
  33128. LexerChannelAction.prototype.toString = function() {
  33129. return "channel(" + this.channel + ")";
  33130. };
  33131. // This implementation of {@link LexerAction} is used for tracking input offsets
  33132. // for position-dependent actions within a {@link LexerActionExecutor}.
  33133. //
  33134. // <p>This action is not serialized as part of the ATN, and is only required for
  33135. // position-dependent lexer actions which appear at a location other than the
  33136. // end of a rule. For more information about DFA optimizations employed for
  33137. // lexer actions, see {@link LexerActionExecutor//append} and
  33138. // {@link LexerActionExecutor//fixOffsetBeforeMatch}.</p>
  33139. // Constructs a new indexed custom action by associating a character offset
  33140. // with a {@link LexerAction}.
  33141. //
  33142. // <p>Note: This class is only required for lexer actions for which
  33143. // {@link LexerAction//isPositionDependent} returns {@code true}.</p>
  33144. //
  33145. // @param offset The offset into the input {@link CharStream}, relative to
  33146. // the token start index, at which the specified lexer action should be
  33147. // executed.
  33148. // @param action The lexer action to execute at a particular offset in the
  33149. // input {@link CharStream}.
  33150. function LexerIndexedCustomAction(offset, action) {
  33151. LexerAction.call(this, action.actionType);
  33152. this.offset = offset;
  33153. this.action = action;
  33154. this.isPositionDependent = true;
  33155. return this;
  33156. }
  33157. LexerIndexedCustomAction.prototype = Object.create(LexerAction.prototype);
  33158. LexerIndexedCustomAction.prototype.constructor = LexerIndexedCustomAction;
  33159. // <p>This method calls {@link //execute} on the result of {@link //getAction}
  33160. // using the provided {@code lexer}.</p>
  33161. LexerIndexedCustomAction.prototype.execute = function(lexer) {
  33162. // assume the input stream position was properly set by the calling code
  33163. this.action.execute(lexer);
  33164. };
  33165. LexerIndexedCustomAction.prototype.updateHashCode = function(hash) {
  33166. hash.update(this.actionType, this.offset, this.action);
  33167. };
  33168. LexerIndexedCustomAction.prototype.equals = function(other) {
  33169. if (this === other) {
  33170. return true;
  33171. } else if (! (other instanceof LexerIndexedCustomAction)) {
  33172. return false;
  33173. } else {
  33174. return this.offset === other.offset && this.action === other.action;
  33175. }
  33176. };
  33177. exports.LexerActionType = LexerActionType;
  33178. exports.LexerSkipAction = LexerSkipAction;
  33179. exports.LexerChannelAction = LexerChannelAction;
  33180. exports.LexerCustomAction = LexerCustomAction;
  33181. exports.LexerIndexedCustomAction = LexerIndexedCustomAction;
  33182. exports.LexerMoreAction = LexerMoreAction;
  33183. exports.LexerTypeAction = LexerTypeAction;
  33184. exports.LexerPushModeAction = LexerPushModeAction;
  33185. exports.LexerPopModeAction = LexerPopModeAction;
  33186. exports.LexerModeAction = LexerModeAction;
  33187. /***/ }),
  33188. /***/ "./node_modules/antlr4/atn/LexerActionExecutor.js":
  33189. /*!********************************************************!*\
  33190. !*** ./node_modules/antlr4/atn/LexerActionExecutor.js ***!
  33191. \********************************************************/
  33192. /*! no static exports found */
  33193. /***/ (function(module, exports, __webpack_require__) {
  33194. //
  33195. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  33196. * Use of this file is governed by the BSD 3-clause license that
  33197. * can be found in the LICENSE.txt file in the project root.
  33198. */
  33199. ///
  33200. // Represents an executor for a sequence of lexer actions which traversed during
  33201. // the matching operation of a lexer rule (token).
  33202. //
  33203. // <p>The executor tracks position information for position-dependent lexer actions
  33204. // efficiently, ensuring that actions appearing only at the end of the rule do
  33205. // not cause bloating of the {@link DFA} created for the lexer.</p>
  33206. var hashStuff = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").hashStuff;
  33207. var LexerIndexedCustomAction = __webpack_require__(/*! ./LexerAction */ "./node_modules/antlr4/atn/LexerAction.js").LexerIndexedCustomAction;
  33208. function LexerActionExecutor(lexerActions) {
  33209. this.lexerActions = lexerActions === null ? [] : lexerActions;
  33210. // Caches the result of {@link //hashCode} since the hash code is an element
  33211. // of the performance-critical {@link LexerATNConfig//hashCode} operation.
  33212. this.cachedHashCode = hashStuff(lexerActions); // "".join([str(la) for la in
  33213. // lexerActions]))
  33214. return this;
  33215. }
  33216. // Creates a {@link LexerActionExecutor} which executes the actions for
  33217. // the input {@code lexerActionExecutor} followed by a specified
  33218. // {@code lexerAction}.
  33219. //
  33220. // @param lexerActionExecutor The executor for actions already traversed by
  33221. // the lexer while matching a token within a particular
  33222. // {@link LexerATNConfig}. If this is {@code null}, the method behaves as
  33223. // though it were an empty executor.
  33224. // @param lexerAction The lexer action to execute after the actions
  33225. // specified in {@code lexerActionExecutor}.
  33226. //
  33227. // @return A {@link LexerActionExecutor} for executing the combine actions
  33228. // of {@code lexerActionExecutor} and {@code lexerAction}.
  33229. LexerActionExecutor.append = function(lexerActionExecutor, lexerAction) {
  33230. if (lexerActionExecutor === null) {
  33231. return new LexerActionExecutor([ lexerAction ]);
  33232. }
  33233. var lexerActions = lexerActionExecutor.lexerActions.concat([ lexerAction ]);
  33234. return new LexerActionExecutor(lexerActions);
  33235. };
  33236. // Creates a {@link LexerActionExecutor} which encodes the current offset
  33237. // for position-dependent lexer actions.
  33238. //
  33239. // <p>Normally, when the executor encounters lexer actions where
  33240. // {@link LexerAction//isPositionDependent} returns {@code true}, it calls
  33241. // {@link IntStream//seek} on the input {@link CharStream} to set the input
  33242. // position to the <em>end</em> of the current token. This behavior provides
  33243. // for efficient DFA representation of lexer actions which appear at the end
  33244. // of a lexer rule, even when the lexer rule matches a variable number of
  33245. // characters.</p>
  33246. //
  33247. // <p>Prior to traversing a match transition in the ATN, the current offset
  33248. // from the token start index is assigned to all position-dependent lexer
  33249. // actions which have not already been assigned a fixed offset. By storing
  33250. // the offsets relative to the token start index, the DFA representation of
  33251. // lexer actions which appear in the middle of tokens remains efficient due
  33252. // to sharing among tokens of the same length, regardless of their absolute
  33253. // position in the input stream.</p>
  33254. //
  33255. // <p>If the current executor already has offsets assigned to all
  33256. // position-dependent lexer actions, the method returns {@code this}.</p>
  33257. //
  33258. // @param offset The current offset to assign to all position-dependent
  33259. // lexer actions which do not already have offsets assigned.
  33260. //
  33261. // @return A {@link LexerActionExecutor} which stores input stream offsets
  33262. // for all position-dependent lexer actions.
  33263. // /
  33264. LexerActionExecutor.prototype.fixOffsetBeforeMatch = function(offset) {
  33265. var updatedLexerActions = null;
  33266. for (var i = 0; i < this.lexerActions.length; i++) {
  33267. if (this.lexerActions[i].isPositionDependent &&
  33268. !(this.lexerActions[i] instanceof LexerIndexedCustomAction)) {
  33269. if (updatedLexerActions === null) {
  33270. updatedLexerActions = this.lexerActions.concat([]);
  33271. }
  33272. updatedLexerActions[i] = new LexerIndexedCustomAction(offset,
  33273. this.lexerActions[i]);
  33274. }
  33275. }
  33276. if (updatedLexerActions === null) {
  33277. return this;
  33278. } else {
  33279. return new LexerActionExecutor(updatedLexerActions);
  33280. }
  33281. };
  33282. // Execute the actions encapsulated by this executor within the context of a
  33283. // particular {@link Lexer}.
  33284. //
  33285. // <p>This method calls {@link IntStream//seek} to set the position of the
  33286. // {@code input} {@link CharStream} prior to calling
  33287. // {@link LexerAction//execute} on a position-dependent action. Before the
  33288. // method returns, the input position will be restored to the same position
  33289. // it was in when the method was invoked.</p>
  33290. //
  33291. // @param lexer The lexer instance.
  33292. // @param input The input stream which is the source for the current token.
  33293. // When this method is called, the current {@link IntStream//index} for
  33294. // {@code input} should be the start of the following token, i.e. 1
  33295. // character past the end of the current token.
  33296. // @param startIndex The token start index. This value may be passed to
  33297. // {@link IntStream//seek} to set the {@code input} position to the beginning
  33298. // of the token.
  33299. // /
  33300. LexerActionExecutor.prototype.execute = function(lexer, input, startIndex) {
  33301. var requiresSeek = false;
  33302. var stopIndex = input.index;
  33303. try {
  33304. for (var i = 0; i < this.lexerActions.length; i++) {
  33305. var lexerAction = this.lexerActions[i];
  33306. if (lexerAction instanceof LexerIndexedCustomAction) {
  33307. var offset = lexerAction.offset;
  33308. input.seek(startIndex + offset);
  33309. lexerAction = lexerAction.action;
  33310. requiresSeek = (startIndex + offset) !== stopIndex;
  33311. } else if (lexerAction.isPositionDependent) {
  33312. input.seek(stopIndex);
  33313. requiresSeek = false;
  33314. }
  33315. lexerAction.execute(lexer);
  33316. }
  33317. } finally {
  33318. if (requiresSeek) {
  33319. input.seek(stopIndex);
  33320. }
  33321. }
  33322. };
  33323. LexerActionExecutor.prototype.hashCode = function() {
  33324. return this.cachedHashCode;
  33325. };
  33326. LexerActionExecutor.prototype.updateHashCode = function(hash) {
  33327. hash.update(this.cachedHashCode);
  33328. };
  33329. LexerActionExecutor.prototype.equals = function(other) {
  33330. if (this === other) {
  33331. return true;
  33332. } else if (!(other instanceof LexerActionExecutor)) {
  33333. return false;
  33334. } else if (this.cachedHashCode != other.cachedHashCode) {
  33335. return false;
  33336. } else if (this.lexerActions.length != other.lexerActions.length) {
  33337. return false;
  33338. } else {
  33339. var numActions = this.lexerActions.length
  33340. for (var idx = 0; idx < numActions; ++idx) {
  33341. if (!this.lexerActions[idx].equals(other.lexerActions[idx])) {
  33342. return false;
  33343. }
  33344. }
  33345. return true;
  33346. }
  33347. };
  33348. exports.LexerActionExecutor = LexerActionExecutor;
  33349. /***/ }),
  33350. /***/ "./node_modules/antlr4/atn/ParserATNSimulator.js":
  33351. /*!*******************************************************!*\
  33352. !*** ./node_modules/antlr4/atn/ParserATNSimulator.js ***!
  33353. \*******************************************************/
  33354. /*! no static exports found */
  33355. /***/ (function(module, exports, __webpack_require__) {
  33356. //
  33357. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  33358. * Use of this file is governed by the BSD 3-clause license that
  33359. * can be found in the LICENSE.txt file in the project root.
  33360. */
  33361. //
  33362. //
  33363. // The embodiment of the adaptive LL(*), ALL(*), parsing strategy.
  33364. //
  33365. // <p>
  33366. // The basic complexity of the adaptive strategy makes it harder to understand.
  33367. // We begin with ATN simulation to build paths in a DFA. Subsequent prediction
  33368. // requests go through the DFA first. If they reach a state without an edge for
  33369. // the current symbol, the algorithm fails over to the ATN simulation to
  33370. // complete the DFA path for the current input (until it finds a conflict state
  33371. // or uniquely predicting state).</p>
  33372. //
  33373. // <p>
  33374. // All of that is done without using the outer context because we want to create
  33375. // a DFA that is not dependent upon the rule invocation stack when we do a
  33376. // prediction. One DFA works in all contexts. We avoid using context not
  33377. // necessarily because it's slower, although it can be, but because of the DFA
  33378. // caching problem. The closure routine only considers the rule invocation stack
  33379. // created during prediction beginning in the decision rule. For example, if
  33380. // prediction occurs without invoking another rule's ATN, there are no context
  33381. // stacks in the configurations. When lack of context leads to a conflict, we
  33382. // don't know if it's an ambiguity or a weakness in the strong LL(*) parsing
  33383. // strategy (versus full LL(*)).</p>
  33384. //
  33385. // <p>
  33386. // When SLL yields a configuration set with conflict, we rewind the input and
  33387. // retry the ATN simulation, this time using full outer context without adding
  33388. // to the DFA. Configuration context stacks will be the full invocation stacks
  33389. // from the start rule. If we get a conflict using full context, then we can
  33390. // definitively say we have a true ambiguity for that input sequence. If we
  33391. // don't get a conflict, it implies that the decision is sensitive to the outer
  33392. // context. (It is not context-sensitive in the sense of context-sensitive
  33393. // grammars.)</p>
  33394. //
  33395. // <p>
  33396. // The next time we reach this DFA state with an SLL conflict, through DFA
  33397. // simulation, we will again retry the ATN simulation using full context mode.
  33398. // This is slow because we can't save the results and have to "interpret" the
  33399. // ATN each time we get that input.</p>
  33400. //
  33401. // <p>
  33402. // <strong>CACHING FULL CONTEXT PREDICTIONS</strong></p>
  33403. //
  33404. // <p>
  33405. // We could cache results from full context to predicted alternative easily and
  33406. // that saves a lot of time but doesn't work in presence of predicates. The set
  33407. // of visible predicates from the ATN start state changes depending on the
  33408. // context, because closure can fall off the end of a rule. I tried to cache
  33409. // tuples (stack context, semantic context, predicted alt) but it was slower
  33410. // than interpreting and much more complicated. Also required a huge amount of
  33411. // memory. The goal is not to create the world's fastest parser anyway. I'd like
  33412. // to keep this algorithm simple. By launching multiple threads, we can improve
  33413. // the speed of parsing across a large number of files.</p>
  33414. //
  33415. // <p>
  33416. // There is no strict ordering between the amount of input used by SLL vs LL,
  33417. // which makes it really hard to build a cache for full context. Let's say that
  33418. // we have input A B C that leads to an SLL conflict with full context X. That
  33419. // implies that using X we might only use A B but we could also use A B C D to
  33420. // resolve conflict. Input A B C D could predict alternative 1 in one position
  33421. // in the input and A B C E could predict alternative 2 in another position in
  33422. // input. The conflicting SLL configurations could still be non-unique in the
  33423. // full context prediction, which would lead us to requiring more input than the
  33424. // original A B C. To make a prediction cache work, we have to track the exact
  33425. // input used during the previous prediction. That amounts to a cache that maps
  33426. // X to a specific DFA for that context.</p>
  33427. //
  33428. // <p>
  33429. // Something should be done for left-recursive expression predictions. They are
  33430. // likely LL(1) + pred eval. Easier to do the whole SLL unless error and retry
  33431. // with full LL thing Sam does.</p>
  33432. //
  33433. // <p>
  33434. // <strong>AVOIDING FULL CONTEXT PREDICTION</strong></p>
  33435. //
  33436. // <p>
  33437. // We avoid doing full context retry when the outer context is empty, we did not
  33438. // dip into the outer context by falling off the end of the decision state rule,
  33439. // or when we force SLL mode.</p>
  33440. //
  33441. // <p>
  33442. // As an example of the not dip into outer context case, consider as super
  33443. // constructor calls versus function calls. One grammar might look like
  33444. // this:</p>
  33445. //
  33446. // <pre>
  33447. // ctorBody
  33448. // : '{' superCall? stat* '}'
  33449. // ;
  33450. // </pre>
  33451. //
  33452. // <p>
  33453. // Or, you might see something like</p>
  33454. //
  33455. // <pre>
  33456. // stat
  33457. // : superCall ';'
  33458. // | expression ';'
  33459. // | ...
  33460. // ;
  33461. // </pre>
  33462. //
  33463. // <p>
  33464. // In both cases I believe that no closure operations will dip into the outer
  33465. // context. In the first case ctorBody in the worst case will stop at the '}'.
  33466. // In the 2nd case it should stop at the ';'. Both cases should stay within the
  33467. // entry rule and not dip into the outer context.</p>
  33468. //
  33469. // <p>
  33470. // <strong>PREDICATES</strong></p>
  33471. //
  33472. // <p>
  33473. // Predicates are always evaluated if present in either SLL or LL both. SLL and
  33474. // LL simulation deals with predicates differently. SLL collects predicates as
  33475. // it performs closure operations like ANTLR v3 did. It delays predicate
  33476. // evaluation until it reaches and accept state. This allows us to cache the SLL
  33477. // ATN simulation whereas, if we had evaluated predicates on-the-fly during
  33478. // closure, the DFA state configuration sets would be different and we couldn't
  33479. // build up a suitable DFA.</p>
  33480. //
  33481. // <p>
  33482. // When building a DFA accept state during ATN simulation, we evaluate any
  33483. // predicates and return the sole semantically valid alternative. If there is
  33484. // more than 1 alternative, we report an ambiguity. If there are 0 alternatives,
  33485. // we throw an exception. Alternatives without predicates act like they have
  33486. // true predicates. The simple way to think about it is to strip away all
  33487. // alternatives with false predicates and choose the minimum alternative that
  33488. // remains.</p>
  33489. //
  33490. // <p>
  33491. // When we start in the DFA and reach an accept state that's predicated, we test
  33492. // those and return the minimum semantically viable alternative. If no
  33493. // alternatives are viable, we throw an exception.</p>
  33494. //
  33495. // <p>
  33496. // During full LL ATN simulation, closure always evaluates predicates and
  33497. // on-the-fly. This is crucial to reducing the configuration set size during
  33498. // closure. It hits a landmine when parsing with the Java grammar, for example,
  33499. // without this on-the-fly evaluation.</p>
  33500. //
  33501. // <p>
  33502. // <strong>SHARING DFA</strong></p>
  33503. //
  33504. // <p>
  33505. // All instances of the same parser share the same decision DFAs through a
  33506. // static field. Each instance gets its own ATN simulator but they share the
  33507. // same {@link //decisionToDFA} field. They also share a
  33508. // {@link PredictionContextCache} object that makes sure that all
  33509. // {@link PredictionContext} objects are shared among the DFA states. This makes
  33510. // a big size difference.</p>
  33511. //
  33512. // <p>
  33513. // <strong>THREAD SAFETY</strong></p>
  33514. //
  33515. // <p>
  33516. // The {@link ParserATNSimulator} locks on the {@link //decisionToDFA} field when
  33517. // it adds a new DFA object to that array. {@link //addDFAEdge}
  33518. // locks on the DFA for the current decision when setting the
  33519. // {@link DFAState//edges} field. {@link //addDFAState} locks on
  33520. // the DFA for the current decision when looking up a DFA state to see if it
  33521. // already exists. We must make sure that all requests to add DFA states that
  33522. // are equivalent result in the same shared DFA object. This is because lots of
  33523. // threads will be trying to update the DFA at once. The
  33524. // {@link //addDFAState} method also locks inside the DFA lock
  33525. // but this time on the shared context cache when it rebuilds the
  33526. // configurations' {@link PredictionContext} objects using cached
  33527. // subgraphs/nodes. No other locking occurs, even during DFA simulation. This is
  33528. // safe as long as we can guarantee that all threads referencing
  33529. // {@code s.edge[t]} get the same physical target {@link DFAState}, or
  33530. // {@code null}. Once into the DFA, the DFA simulation does not reference the
  33531. // {@link DFA//states} map. It follows the {@link DFAState//edges} field to new
  33532. // targets. The DFA simulator will either find {@link DFAState//edges} to be
  33533. // {@code null}, to be non-{@code null} and {@code dfa.edges[t]} null, or
  33534. // {@code dfa.edges[t]} to be non-null. The
  33535. // {@link //addDFAEdge} method could be racing to set the field
  33536. // but in either case the DFA simulator works; if {@code null}, and requests ATN
  33537. // simulation. It could also race trying to get {@code dfa.edges[t]}, but either
  33538. // way it will work because it's not doing a test and set operation.</p>
  33539. //
  33540. // <p>
  33541. // <strong>Starting with SLL then failing to combined SLL/LL (Two-Stage
  33542. // Parsing)</strong></p>
  33543. //
  33544. // <p>
  33545. // Sam pointed out that if SLL does not give a syntax error, then there is no
  33546. // point in doing full LL, which is slower. We only have to try LL if we get a
  33547. // syntax error. For maximum speed, Sam starts the parser set to pure SLL
  33548. // mode with the {@link BailErrorStrategy}:</p>
  33549. //
  33550. // <pre>
  33551. // parser.{@link Parser//getInterpreter() getInterpreter()}.{@link //setPredictionMode setPredictionMode}{@code (}{@link PredictionMode//SLL}{@code )};
  33552. // parser.{@link Parser//setErrorHandler setErrorHandler}(new {@link BailErrorStrategy}());
  33553. // </pre>
  33554. //
  33555. // <p>
  33556. // If it does not get a syntax error, then we're done. If it does get a syntax
  33557. // error, we need to retry with the combined SLL/LL strategy.</p>
  33558. //
  33559. // <p>
  33560. // The reason this works is as follows. If there are no SLL conflicts, then the
  33561. // grammar is SLL (at least for that input set). If there is an SLL conflict,
  33562. // the full LL analysis must yield a set of viable alternatives which is a
  33563. // subset of the alternatives reported by SLL. If the LL set is a singleton,
  33564. // then the grammar is LL but not SLL. If the LL set is the same size as the SLL
  33565. // set, the decision is SLL. If the LL set has size &gt; 1, then that decision
  33566. // is truly ambiguous on the current input. If the LL set is smaller, then the
  33567. // SLL conflict resolution might choose an alternative that the full LL would
  33568. // rule out as a possibility based upon better context information. If that's
  33569. // the case, then the SLL parse will definitely get an error because the full LL
  33570. // analysis says it's not viable. If SLL conflict resolution chooses an
  33571. // alternative within the LL set, them both SLL and LL would choose the same
  33572. // alternative because they both choose the minimum of multiple conflicting
  33573. // alternatives.</p>
  33574. //
  33575. // <p>
  33576. // Let's say we have a set of SLL conflicting alternatives {@code {1, 2, 3}} and
  33577. // a smaller LL set called <em>s</em>. If <em>s</em> is {@code {2, 3}}, then SLL
  33578. // parsing will get an error because SLL will pursue alternative 1. If
  33579. // <em>s</em> is {@code {1, 2}} or {@code {1, 3}} then both SLL and LL will
  33580. // choose the same alternative because alternative one is the minimum of either
  33581. // set. If <em>s</em> is {@code {2}} or {@code {3}} then SLL will get a syntax
  33582. // error. If <em>s</em> is {@code {1}} then SLL will succeed.</p>
  33583. //
  33584. // <p>
  33585. // Of course, if the input is invalid, then we will get an error for sure in
  33586. // both SLL and LL parsing. Erroneous input will therefore require 2 passes over
  33587. // the input.</p>
  33588. //
  33589. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  33590. var Set = Utils.Set;
  33591. var BitSet = Utils.BitSet;
  33592. var DoubleDict = Utils.DoubleDict;
  33593. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  33594. var ATNState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").ATNState;
  33595. var ATNConfig = __webpack_require__(/*! ./ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").ATNConfig;
  33596. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  33597. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  33598. var DFAState = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  33599. var PredPrediction = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").PredPrediction;
  33600. var ATNSimulator = __webpack_require__(/*! ./ATNSimulator */ "./node_modules/antlr4/atn/ATNSimulator.js").ATNSimulator;
  33601. var PredictionMode = __webpack_require__(/*! ./PredictionMode */ "./node_modules/antlr4/atn/PredictionMode.js").PredictionMode;
  33602. var RuleContext = __webpack_require__(/*! ./../RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  33603. var ParserRuleContext = __webpack_require__(/*! ./../ParserRuleContext */ "./node_modules/antlr4/ParserRuleContext.js").ParserRuleContext;
  33604. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  33605. var StarLoopEntryState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").StarLoopEntryState;
  33606. var RuleStopState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  33607. var PredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").PredictionContext;
  33608. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  33609. var Transitions = __webpack_require__(/*! ./Transition */ "./node_modules/antlr4/atn/Transition.js");
  33610. var Transition = Transitions.Transition;
  33611. var SetTransition = Transitions.SetTransition;
  33612. var NotSetTransition = Transitions.NotSetTransition;
  33613. var RuleTransition = Transitions.RuleTransition;
  33614. var ActionTransition = Transitions.ActionTransition;
  33615. var NoViableAltException = __webpack_require__(/*! ./../error/Errors */ "./node_modules/antlr4/error/Errors.js").NoViableAltException;
  33616. var SingletonPredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").SingletonPredictionContext;
  33617. var predictionContextFromRuleContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").predictionContextFromRuleContext;
  33618. function ParserATNSimulator(parser, atn, decisionToDFA, sharedContextCache) {
  33619. ATNSimulator.call(this, atn, sharedContextCache);
  33620. this.parser = parser;
  33621. this.decisionToDFA = decisionToDFA;
  33622. // SLL, LL, or LL + exact ambig detection?//
  33623. this.predictionMode = PredictionMode.LL;
  33624. // LAME globals to avoid parameters!!!!! I need these down deep in predTransition
  33625. this._input = null;
  33626. this._startIndex = 0;
  33627. this._outerContext = null;
  33628. this._dfa = null;
  33629. // Each prediction operation uses a cache for merge of prediction contexts.
  33630. // Don't keep around as it wastes huge amounts of memory. DoubleKeyMap
  33631. // isn't synchronized but we're ok since two threads shouldn't reuse same
  33632. // parser/atnsim object because it can only handle one input at a time.
  33633. // This maps graphs a and b to merged result c. (a,b)&rarr;c. We can avoid
  33634. // the merge if we ever see a and b again. Note that (b,a)&rarr;c should
  33635. // also be examined during cache lookup.
  33636. //
  33637. this.mergeCache = null;
  33638. return this;
  33639. }
  33640. ParserATNSimulator.prototype = Object.create(ATNSimulator.prototype);
  33641. ParserATNSimulator.prototype.constructor = ParserATNSimulator;
  33642. ParserATNSimulator.prototype.debug = false;
  33643. ParserATNSimulator.prototype.debug_closure = false;
  33644. ParserATNSimulator.prototype.debug_add = false;
  33645. ParserATNSimulator.prototype.debug_list_atn_decisions = false;
  33646. ParserATNSimulator.prototype.dfa_debug = false;
  33647. ParserATNSimulator.prototype.retry_debug = false;
  33648. ParserATNSimulator.prototype.reset = function() {
  33649. };
  33650. ParserATNSimulator.prototype.adaptivePredict = function(input, decision, outerContext) {
  33651. if (this.debug || this.debug_list_atn_decisions) {
  33652. console.log("adaptivePredict decision " + decision +
  33653. " exec LA(1)==" + this.getLookaheadName(input) +
  33654. " line " + input.LT(1).line + ":" +
  33655. input.LT(1).column);
  33656. }
  33657. this._input = input;
  33658. this._startIndex = input.index;
  33659. this._outerContext = outerContext;
  33660. var dfa = this.decisionToDFA[decision];
  33661. this._dfa = dfa;
  33662. var m = input.mark();
  33663. var index = input.index;
  33664. // Now we are certain to have a specific decision's DFA
  33665. // But, do we still need an initial state?
  33666. try {
  33667. var s0;
  33668. if (dfa.precedenceDfa) {
  33669. // the start state for a precedence DFA depends on the current
  33670. // parser precedence, and is provided by a DFA method.
  33671. s0 = dfa.getPrecedenceStartState(this.parser.getPrecedence());
  33672. } else {
  33673. // the start state for a "regular" DFA is just s0
  33674. s0 = dfa.s0;
  33675. }
  33676. if (s0===null) {
  33677. if (outerContext===null) {
  33678. outerContext = RuleContext.EMPTY;
  33679. }
  33680. if (this.debug || this.debug_list_atn_decisions) {
  33681. console.log("predictATN decision " + dfa.decision +
  33682. " exec LA(1)==" + this.getLookaheadName(input) +
  33683. ", outerContext=" + outerContext.toString(this.parser.ruleNames));
  33684. }
  33685. var fullCtx = false;
  33686. var s0_closure = this.computeStartState(dfa.atnStartState, RuleContext.EMPTY, fullCtx);
  33687. if( dfa.precedenceDfa) {
  33688. // If this is a precedence DFA, we use applyPrecedenceFilter
  33689. // to convert the computed start state to a precedence start
  33690. // state. We then use DFA.setPrecedenceStartState to set the
  33691. // appropriate start state for the precedence level rather
  33692. // than simply setting DFA.s0.
  33693. //
  33694. dfa.s0.configs = s0_closure; // not used for prediction but useful to know start configs anyway
  33695. s0_closure = this.applyPrecedenceFilter(s0_closure);
  33696. s0 = this.addDFAState(dfa, new DFAState(null, s0_closure));
  33697. dfa.setPrecedenceStartState(this.parser.getPrecedence(), s0);
  33698. } else {
  33699. s0 = this.addDFAState(dfa, new DFAState(null, s0_closure));
  33700. dfa.s0 = s0;
  33701. }
  33702. }
  33703. var alt = this.execATN(dfa, s0, input, index, outerContext);
  33704. if (this.debug) {
  33705. console.log("DFA after predictATN: " + dfa.toString(this.parser.literalNames));
  33706. }
  33707. return alt;
  33708. } finally {
  33709. this._dfa = null;
  33710. this.mergeCache = null; // wack cache after each prediction
  33711. input.seek(index);
  33712. input.release(m);
  33713. }
  33714. };
  33715. // Performs ATN simulation to compute a predicted alternative based
  33716. // upon the remaining input, but also updates the DFA cache to avoid
  33717. // having to traverse the ATN again for the same input sequence.
  33718. // There are some key conditions we're looking for after computing a new
  33719. // set of ATN configs (proposed DFA state):
  33720. // if the set is empty, there is no viable alternative for current symbol
  33721. // does the state uniquely predict an alternative?
  33722. // does the state have a conflict that would prevent us from
  33723. // putting it on the work list?
  33724. // We also have some key operations to do:
  33725. // add an edge from previous DFA state to potentially new DFA state, D,
  33726. // upon current symbol but only if adding to work list, which means in all
  33727. // cases except no viable alternative (and possibly non-greedy decisions?)
  33728. // collecting predicates and adding semantic context to DFA accept states
  33729. // adding rule context to context-sensitive DFA accept states
  33730. // consuming an input symbol
  33731. // reporting a conflict
  33732. // reporting an ambiguity
  33733. // reporting a context sensitivity
  33734. // reporting insufficient predicates
  33735. // cover these cases:
  33736. // dead end
  33737. // single alt
  33738. // single alt + preds
  33739. // conflict
  33740. // conflict + preds
  33741. //
  33742. ParserATNSimulator.prototype.execATN = function(dfa, s0, input, startIndex, outerContext ) {
  33743. if (this.debug || this.debug_list_atn_decisions) {
  33744. console.log("execATN decision " + dfa.decision +
  33745. " exec LA(1)==" + this.getLookaheadName(input) +
  33746. " line " + input.LT(1).line + ":" + input.LT(1).column);
  33747. }
  33748. var alt;
  33749. var previousD = s0;
  33750. if (this.debug) {
  33751. console.log("s0 = " + s0);
  33752. }
  33753. var t = input.LA(1);
  33754. while(true) { // while more work
  33755. var D = this.getExistingTargetState(previousD, t);
  33756. if(D===null) {
  33757. D = this.computeTargetState(dfa, previousD, t);
  33758. }
  33759. if(D===ATNSimulator.ERROR) {
  33760. // if any configs in previous dipped into outer context, that
  33761. // means that input up to t actually finished entry rule
  33762. // at least for SLL decision. Full LL doesn't dip into outer
  33763. // so don't need special case.
  33764. // We will get an error no matter what so delay until after
  33765. // decision; better error message. Also, no reachable target
  33766. // ATN states in SLL implies LL will also get nowhere.
  33767. // If conflict in states that dip out, choose min since we
  33768. // will get error no matter what.
  33769. var e = this.noViableAlt(input, outerContext, previousD.configs, startIndex);
  33770. input.seek(startIndex);
  33771. alt = this.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule(previousD.configs, outerContext);
  33772. if(alt!==ATN.INVALID_ALT_NUMBER) {
  33773. return alt;
  33774. } else {
  33775. throw e;
  33776. }
  33777. }
  33778. if(D.requiresFullContext && this.predictionMode !== PredictionMode.SLL) {
  33779. // IF PREDS, MIGHT RESOLVE TO SINGLE ALT => SLL (or syntax error)
  33780. var conflictingAlts = null;
  33781. if (D.predicates!==null) {
  33782. if (this.debug) {
  33783. console.log("DFA state has preds in DFA sim LL failover");
  33784. }
  33785. var conflictIndex = input.index;
  33786. if(conflictIndex !== startIndex) {
  33787. input.seek(startIndex);
  33788. }
  33789. conflictingAlts = this.evalSemanticContext(D.predicates, outerContext, true);
  33790. if (conflictingAlts.length===1) {
  33791. if(this.debug) {
  33792. console.log("Full LL avoided");
  33793. }
  33794. return conflictingAlts.minValue();
  33795. }
  33796. if (conflictIndex !== startIndex) {
  33797. // restore the index so reporting the fallback to full
  33798. // context occurs with the index at the correct spot
  33799. input.seek(conflictIndex);
  33800. }
  33801. }
  33802. if (this.dfa_debug) {
  33803. console.log("ctx sensitive state " + outerContext +" in " + D);
  33804. }
  33805. var fullCtx = true;
  33806. var s0_closure = this.computeStartState(dfa.atnStartState, outerContext, fullCtx);
  33807. this.reportAttemptingFullContext(dfa, conflictingAlts, D.configs, startIndex, input.index);
  33808. alt = this.execATNWithFullContext(dfa, D, s0_closure, input, startIndex, outerContext);
  33809. return alt;
  33810. }
  33811. if (D.isAcceptState) {
  33812. if (D.predicates===null) {
  33813. return D.prediction;
  33814. }
  33815. var stopIndex = input.index;
  33816. input.seek(startIndex);
  33817. var alts = this.evalSemanticContext(D.predicates, outerContext, true);
  33818. if (alts.length===0) {
  33819. throw this.noViableAlt(input, outerContext, D.configs, startIndex);
  33820. } else if (alts.length===1) {
  33821. return alts.minValue();
  33822. } else {
  33823. // report ambiguity after predicate evaluation to make sure the correct set of ambig alts is reported.
  33824. this.reportAmbiguity(dfa, D, startIndex, stopIndex, false, alts, D.configs);
  33825. return alts.minValue();
  33826. }
  33827. }
  33828. previousD = D;
  33829. if (t !== Token.EOF) {
  33830. input.consume();
  33831. t = input.LA(1);
  33832. }
  33833. }
  33834. };
  33835. //
  33836. // Get an existing target state for an edge in the DFA. If the target state
  33837. // for the edge has not yet been computed or is otherwise not available,
  33838. // this method returns {@code null}.
  33839. //
  33840. // @param previousD The current DFA state
  33841. // @param t The next input symbol
  33842. // @return The existing target DFA state for the given input symbol
  33843. // {@code t}, or {@code null} if the target state for this edge is not
  33844. // already cached
  33845. //
  33846. ParserATNSimulator.prototype.getExistingTargetState = function(previousD, t) {
  33847. var edges = previousD.edges;
  33848. if (edges===null) {
  33849. return null;
  33850. } else {
  33851. return edges[t + 1] || null;
  33852. }
  33853. };
  33854. //
  33855. // Compute a target state for an edge in the DFA, and attempt to add the
  33856. // computed state and corresponding edge to the DFA.
  33857. //
  33858. // @param dfa The DFA
  33859. // @param previousD The current DFA state
  33860. // @param t The next input symbol
  33861. //
  33862. // @return The computed target DFA state for the given input symbol
  33863. // {@code t}. If {@code t} does not lead to a valid DFA state, this method
  33864. // returns {@link //ERROR}.
  33865. //
  33866. ParserATNSimulator.prototype.computeTargetState = function(dfa, previousD, t) {
  33867. var reach = this.computeReachSet(previousD.configs, t, false);
  33868. if(reach===null) {
  33869. this.addDFAEdge(dfa, previousD, t, ATNSimulator.ERROR);
  33870. return ATNSimulator.ERROR;
  33871. }
  33872. // create new target state; we'll add to DFA after it's complete
  33873. var D = new DFAState(null, reach);
  33874. var predictedAlt = this.getUniqueAlt(reach);
  33875. if (this.debug) {
  33876. var altSubSets = PredictionMode.getConflictingAltSubsets(reach);
  33877. console.log("SLL altSubSets=" + Utils.arrayToString(altSubSets) +
  33878. ", previous=" + previousD.configs +
  33879. ", configs=" + reach +
  33880. ", predict=" + predictedAlt +
  33881. ", allSubsetsConflict=" +
  33882. PredictionMode.allSubsetsConflict(altSubSets) + ", conflictingAlts=" +
  33883. this.getConflictingAlts(reach));
  33884. }
  33885. if (predictedAlt!==ATN.INVALID_ALT_NUMBER) {
  33886. // NO CONFLICT, UNIQUELY PREDICTED ALT
  33887. D.isAcceptState = true;
  33888. D.configs.uniqueAlt = predictedAlt;
  33889. D.prediction = predictedAlt;
  33890. } else if (PredictionMode.hasSLLConflictTerminatingPrediction(this.predictionMode, reach)) {
  33891. // MORE THAN ONE VIABLE ALTERNATIVE
  33892. D.configs.conflictingAlts = this.getConflictingAlts(reach);
  33893. D.requiresFullContext = true;
  33894. // in SLL-only mode, we will stop at this state and return the minimum alt
  33895. D.isAcceptState = true;
  33896. D.prediction = D.configs.conflictingAlts.minValue();
  33897. }
  33898. if (D.isAcceptState && D.configs.hasSemanticContext) {
  33899. this.predicateDFAState(D, this.atn.getDecisionState(dfa.decision));
  33900. if( D.predicates!==null) {
  33901. D.prediction = ATN.INVALID_ALT_NUMBER;
  33902. }
  33903. }
  33904. // all adds to dfa are done after we've created full D state
  33905. D = this.addDFAEdge(dfa, previousD, t, D);
  33906. return D;
  33907. };
  33908. ParserATNSimulator.prototype.predicateDFAState = function(dfaState, decisionState) {
  33909. // We need to test all predicates, even in DFA states that
  33910. // uniquely predict alternative.
  33911. var nalts = decisionState.transitions.length;
  33912. // Update DFA so reach becomes accept state with (predicate,alt)
  33913. // pairs if preds found for conflicting alts
  33914. var altsToCollectPredsFrom = this.getConflictingAltsOrUniqueAlt(dfaState.configs);
  33915. var altToPred = this.getPredsForAmbigAlts(altsToCollectPredsFrom, dfaState.configs, nalts);
  33916. if (altToPred!==null) {
  33917. dfaState.predicates = this.getPredicatePredictions(altsToCollectPredsFrom, altToPred);
  33918. dfaState.prediction = ATN.INVALID_ALT_NUMBER; // make sure we use preds
  33919. } else {
  33920. // There are preds in configs but they might go away
  33921. // when OR'd together like {p}? || NONE == NONE. If neither
  33922. // alt has preds, resolve to min alt
  33923. dfaState.prediction = altsToCollectPredsFrom.minValue();
  33924. }
  33925. };
  33926. // comes back with reach.uniqueAlt set to a valid alt
  33927. ParserATNSimulator.prototype.execATNWithFullContext = function(dfa, D, // how far we got before failing over
  33928. s0,
  33929. input,
  33930. startIndex,
  33931. outerContext) {
  33932. if (this.debug || this.debug_list_atn_decisions) {
  33933. console.log("execATNWithFullContext "+s0);
  33934. }
  33935. var fullCtx = true;
  33936. var foundExactAmbig = false;
  33937. var reach = null;
  33938. var previous = s0;
  33939. input.seek(startIndex);
  33940. var t = input.LA(1);
  33941. var predictedAlt = -1;
  33942. while (true) { // while more work
  33943. reach = this.computeReachSet(previous, t, fullCtx);
  33944. if (reach===null) {
  33945. // if any configs in previous dipped into outer context, that
  33946. // means that input up to t actually finished entry rule
  33947. // at least for LL decision. Full LL doesn't dip into outer
  33948. // so don't need special case.
  33949. // We will get an error no matter what so delay until after
  33950. // decision; better error message. Also, no reachable target
  33951. // ATN states in SLL implies LL will also get nowhere.
  33952. // If conflict in states that dip out, choose min since we
  33953. // will get error no matter what.
  33954. var e = this.noViableAlt(input, outerContext, previous, startIndex);
  33955. input.seek(startIndex);
  33956. var alt = this.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule(previous, outerContext);
  33957. if(alt!==ATN.INVALID_ALT_NUMBER) {
  33958. return alt;
  33959. } else {
  33960. throw e;
  33961. }
  33962. }
  33963. var altSubSets = PredictionMode.getConflictingAltSubsets(reach);
  33964. if(this.debug) {
  33965. console.log("LL altSubSets=" + altSubSets + ", predict=" +
  33966. PredictionMode.getUniqueAlt(altSubSets) + ", resolvesToJustOneViableAlt=" +
  33967. PredictionMode.resolvesToJustOneViableAlt(altSubSets));
  33968. }
  33969. reach.uniqueAlt = this.getUniqueAlt(reach);
  33970. // unique prediction?
  33971. if(reach.uniqueAlt!==ATN.INVALID_ALT_NUMBER) {
  33972. predictedAlt = reach.uniqueAlt;
  33973. break;
  33974. } else if (this.predictionMode !== PredictionMode.LL_EXACT_AMBIG_DETECTION) {
  33975. predictedAlt = PredictionMode.resolvesToJustOneViableAlt(altSubSets);
  33976. if(predictedAlt !== ATN.INVALID_ALT_NUMBER) {
  33977. break;
  33978. }
  33979. } else {
  33980. // In exact ambiguity mode, we never try to terminate early.
  33981. // Just keeps scarfing until we know what the conflict is
  33982. if (PredictionMode.allSubsetsConflict(altSubSets) && PredictionMode.allSubsetsEqual(altSubSets)) {
  33983. foundExactAmbig = true;
  33984. predictedAlt = PredictionMode.getSingleViableAlt(altSubSets);
  33985. break;
  33986. }
  33987. // else there are multiple non-conflicting subsets or
  33988. // we're not sure what the ambiguity is yet.
  33989. // So, keep going.
  33990. }
  33991. previous = reach;
  33992. if( t !== Token.EOF) {
  33993. input.consume();
  33994. t = input.LA(1);
  33995. }
  33996. }
  33997. // If the configuration set uniquely predicts an alternative,
  33998. // without conflict, then we know that it's a full LL decision
  33999. // not SLL.
  34000. if (reach.uniqueAlt !== ATN.INVALID_ALT_NUMBER ) {
  34001. this.reportContextSensitivity(dfa, predictedAlt, reach, startIndex, input.index);
  34002. return predictedAlt;
  34003. }
  34004. // We do not check predicates here because we have checked them
  34005. // on-the-fly when doing full context prediction.
  34006. //
  34007. // In non-exact ambiguity detection mode, we might actually be able to
  34008. // detect an exact ambiguity, but I'm not going to spend the cycles
  34009. // needed to check. We only emit ambiguity warnings in exact ambiguity
  34010. // mode.
  34011. //
  34012. // For example, we might know that we have conflicting configurations.
  34013. // But, that does not mean that there is no way forward without a
  34014. // conflict. It's possible to have nonconflicting alt subsets as in:
  34015. // altSubSets=[{1, 2}, {1, 2}, {1}, {1, 2}]
  34016. // from
  34017. //
  34018. // [(17,1,[5 $]), (13,1,[5 10 $]), (21,1,[5 10 $]), (11,1,[$]),
  34019. // (13,2,[5 10 $]), (21,2,[5 10 $]), (11,2,[$])]
  34020. //
  34021. // In this case, (17,1,[5 $]) indicates there is some next sequence that
  34022. // would resolve this without conflict to alternative 1. Any other viable
  34023. // next sequence, however, is associated with a conflict. We stop
  34024. // looking for input because no amount of further lookahead will alter
  34025. // the fact that we should predict alternative 1. We just can't say for
  34026. // sure that there is an ambiguity without looking further.
  34027. this.reportAmbiguity(dfa, D, startIndex, input.index, foundExactAmbig, null, reach);
  34028. return predictedAlt;
  34029. };
  34030. ParserATNSimulator.prototype.computeReachSet = function(closure, t, fullCtx) {
  34031. if (this.debug) {
  34032. console.log("in computeReachSet, starting closure: " + closure);
  34033. }
  34034. if( this.mergeCache===null) {
  34035. this.mergeCache = new DoubleDict();
  34036. }
  34037. var intermediate = new ATNConfigSet(fullCtx);
  34038. // Configurations already in a rule stop state indicate reaching the end
  34039. // of the decision rule (local context) or end of the start rule (full
  34040. // context). Once reached, these configurations are never updated by a
  34041. // closure operation, so they are handled separately for the performance
  34042. // advantage of having a smaller intermediate set when calling closure.
  34043. //
  34044. // For full-context reach operations, separate handling is required to
  34045. // ensure that the alternative matching the longest overall sequence is
  34046. // chosen when multiple such configurations can match the input.
  34047. var skippedStopStates = null;
  34048. // First figure out where we can reach on input t
  34049. for (var i=0; i<closure.items.length;i++) {
  34050. var c = closure.items[i];
  34051. if(this.debug_add) {
  34052. console.log("testing " + this.getTokenName(t) + " at " + c);
  34053. }
  34054. if (c.state instanceof RuleStopState) {
  34055. if (fullCtx || t === Token.EOF) {
  34056. if (skippedStopStates===null) {
  34057. skippedStopStates = [];
  34058. }
  34059. skippedStopStates.push(c);
  34060. if(this.debug_add) {
  34061. console.log("added " + c + " to skippedStopStates");
  34062. }
  34063. }
  34064. continue;
  34065. }
  34066. for(var j=0;j<c.state.transitions.length;j++) {
  34067. var trans = c.state.transitions[j];
  34068. var target = this.getReachableTarget(trans, t);
  34069. if (target!==null) {
  34070. var cfg = new ATNConfig({state:target}, c);
  34071. intermediate.add(cfg, this.mergeCache);
  34072. if(this.debug_add) {
  34073. console.log("added " + cfg + " to intermediate");
  34074. }
  34075. }
  34076. }
  34077. }
  34078. // Now figure out where the reach operation can take us...
  34079. var reach = null;
  34080. // This block optimizes the reach operation for intermediate sets which
  34081. // trivially indicate a termination state for the overall
  34082. // adaptivePredict operation.
  34083. //
  34084. // The conditions assume that intermediate
  34085. // contains all configurations relevant to the reach set, but this
  34086. // condition is not true when one or more configurations have been
  34087. // withheld in skippedStopStates, or when the current symbol is EOF.
  34088. //
  34089. if (skippedStopStates===null && t!==Token.EOF) {
  34090. if (intermediate.items.length===1) {
  34091. // Don't pursue the closure if there is just one state.
  34092. // It can only have one alternative; just add to result
  34093. // Also don't pursue the closure if there is unique alternative
  34094. // among the configurations.
  34095. reach = intermediate;
  34096. } else if (this.getUniqueAlt(intermediate)!==ATN.INVALID_ALT_NUMBER) {
  34097. // Also don't pursue the closure if there is unique alternative
  34098. // among the configurations.
  34099. reach = intermediate;
  34100. }
  34101. }
  34102. // If the reach set could not be trivially determined, perform a closure
  34103. // operation on the intermediate set to compute its initial value.
  34104. //
  34105. if (reach===null) {
  34106. reach = new ATNConfigSet(fullCtx);
  34107. var closureBusy = new Set();
  34108. var treatEofAsEpsilon = t === Token.EOF;
  34109. for (var k=0; k<intermediate.items.length;k++) {
  34110. this.closure(intermediate.items[k], reach, closureBusy, false, fullCtx, treatEofAsEpsilon);
  34111. }
  34112. }
  34113. if (t === Token.EOF) {
  34114. // After consuming EOF no additional input is possible, so we are
  34115. // only interested in configurations which reached the end of the
  34116. // decision rule (local context) or end of the start rule (full
  34117. // context). Update reach to contain only these configurations. This
  34118. // handles both explicit EOF transitions in the grammar and implicit
  34119. // EOF transitions following the end of the decision or start rule.
  34120. //
  34121. // When reach==intermediate, no closure operation was performed. In
  34122. // this case, removeAllConfigsNotInRuleStopState needs to check for
  34123. // reachable rule stop states as well as configurations already in
  34124. // a rule stop state.
  34125. //
  34126. // This is handled before the configurations in skippedStopStates,
  34127. // because any configurations potentially added from that list are
  34128. // already guaranteed to meet this condition whether or not it's
  34129. // required.
  34130. //
  34131. reach = this.removeAllConfigsNotInRuleStopState(reach, reach === intermediate);
  34132. }
  34133. // If skippedStopStates!==null, then it contains at least one
  34134. // configuration. For full-context reach operations, these
  34135. // configurations reached the end of the start rule, in which case we
  34136. // only add them back to reach if no configuration during the current
  34137. // closure operation reached such a state. This ensures adaptivePredict
  34138. // chooses an alternative matching the longest overall sequence when
  34139. // multiple alternatives are viable.
  34140. //
  34141. if (skippedStopStates!==null && ( (! fullCtx) || (! PredictionMode.hasConfigInRuleStopState(reach)))) {
  34142. for (var l=0; l<skippedStopStates.length;l++) {
  34143. reach.add(skippedStopStates[l], this.mergeCache);
  34144. }
  34145. }
  34146. if (reach.items.length===0) {
  34147. return null;
  34148. } else {
  34149. return reach;
  34150. }
  34151. };
  34152. //
  34153. // Return a configuration set containing only the configurations from
  34154. // {@code configs} which are in a {@link RuleStopState}. If all
  34155. // configurations in {@code configs} are already in a rule stop state, this
  34156. // method simply returns {@code configs}.
  34157. //
  34158. // <p>When {@code lookToEndOfRule} is true, this method uses
  34159. // {@link ATN//nextTokens} for each configuration in {@code configs} which is
  34160. // not already in a rule stop state to see if a rule stop state is reachable
  34161. // from the configuration via epsilon-only transitions.</p>
  34162. //
  34163. // @param configs the configuration set to update
  34164. // @param lookToEndOfRule when true, this method checks for rule stop states
  34165. // reachable by epsilon-only transitions from each configuration in
  34166. // {@code configs}.
  34167. //
  34168. // @return {@code configs} if all configurations in {@code configs} are in a
  34169. // rule stop state, otherwise return a new configuration set containing only
  34170. // the configurations from {@code configs} which are in a rule stop state
  34171. //
  34172. ParserATNSimulator.prototype.removeAllConfigsNotInRuleStopState = function(configs, lookToEndOfRule) {
  34173. if (PredictionMode.allConfigsInRuleStopStates(configs)) {
  34174. return configs;
  34175. }
  34176. var result = new ATNConfigSet(configs.fullCtx);
  34177. for(var i=0; i<configs.items.length;i++) {
  34178. var config = configs.items[i];
  34179. if (config.state instanceof RuleStopState) {
  34180. result.add(config, this.mergeCache);
  34181. continue;
  34182. }
  34183. if (lookToEndOfRule && config.state.epsilonOnlyTransitions) {
  34184. var nextTokens = this.atn.nextTokens(config.state);
  34185. if (nextTokens.contains(Token.EPSILON)) {
  34186. var endOfRuleState = this.atn.ruleToStopState[config.state.ruleIndex];
  34187. result.add(new ATNConfig({state:endOfRuleState}, config), this.mergeCache);
  34188. }
  34189. }
  34190. }
  34191. return result;
  34192. };
  34193. ParserATNSimulator.prototype.computeStartState = function(p, ctx, fullCtx) {
  34194. // always at least the implicit call to start rule
  34195. var initialContext = predictionContextFromRuleContext(this.atn, ctx);
  34196. var configs = new ATNConfigSet(fullCtx);
  34197. for(var i=0;i<p.transitions.length;i++) {
  34198. var target = p.transitions[i].target;
  34199. var c = new ATNConfig({ state:target, alt:i+1, context:initialContext }, null);
  34200. var closureBusy = new Set();
  34201. this.closure(c, configs, closureBusy, true, fullCtx, false);
  34202. }
  34203. return configs;
  34204. };
  34205. //
  34206. // This method transforms the start state computed by
  34207. // {@link //computeStartState} to the special start state used by a
  34208. // precedence DFA for a particular precedence value. The transformation
  34209. // process applies the following changes to the start state's configuration
  34210. // set.
  34211. //
  34212. // <ol>
  34213. // <li>Evaluate the precedence predicates for each configuration using
  34214. // {@link SemanticContext//evalPrecedence}.</li>
  34215. // <li>Remove all configurations which predict an alternative greater than
  34216. // 1, for which another configuration that predicts alternative 1 is in the
  34217. // same ATN state with the same prediction context. This transformation is
  34218. // valid for the following reasons:
  34219. // <ul>
  34220. // <li>The closure block cannot contain any epsilon transitions which bypass
  34221. // the body of the closure, so all states reachable via alternative 1 are
  34222. // part of the precedence alternatives of the transformed left-recursive
  34223. // rule.</li>
  34224. // <li>The "primary" portion of a left recursive rule cannot contain an
  34225. // epsilon transition, so the only way an alternative other than 1 can exist
  34226. // in a state that is also reachable via alternative 1 is by nesting calls
  34227. // to the left-recursive rule, with the outer calls not being at the
  34228. // preferred precedence level.</li>
  34229. // </ul>
  34230. // </li>
  34231. // </ol>
  34232. //
  34233. // <p>
  34234. // The prediction context must be considered by this filter to address
  34235. // situations like the following.
  34236. // </p>
  34237. // <code>
  34238. // <pre>
  34239. // grammar TA;
  34240. // prog: statement* EOF;
  34241. // statement: letterA | statement letterA 'b' ;
  34242. // letterA: 'a';
  34243. // </pre>
  34244. // </code>
  34245. // <p>
  34246. // If the above grammar, the ATN state immediately before the token
  34247. // reference {@code 'a'} in {@code letterA} is reachable from the left edge
  34248. // of both the primary and closure blocks of the left-recursive rule
  34249. // {@code statement}. The prediction context associated with each of these
  34250. // configurations distinguishes between them, and prevents the alternative
  34251. // which stepped out to {@code prog} (and then back in to {@code statement}
  34252. // from being eliminated by the filter.
  34253. // </p>
  34254. //
  34255. // @param configs The configuration set computed by
  34256. // {@link //computeStartState} as the start state for the DFA.
  34257. // @return The transformed configuration set representing the start state
  34258. // for a precedence DFA at a particular precedence level (determined by
  34259. // calling {@link Parser//getPrecedence}).
  34260. //
  34261. ParserATNSimulator.prototype.applyPrecedenceFilter = function(configs) {
  34262. var config;
  34263. var statesFromAlt1 = [];
  34264. var configSet = new ATNConfigSet(configs.fullCtx);
  34265. for(var i=0; i<configs.items.length; i++) {
  34266. config = configs.items[i];
  34267. // handle alt 1 first
  34268. if (config.alt !== 1) {
  34269. continue;
  34270. }
  34271. var updatedContext = config.semanticContext.evalPrecedence(this.parser, this._outerContext);
  34272. if (updatedContext===null) {
  34273. // the configuration was eliminated
  34274. continue;
  34275. }
  34276. statesFromAlt1[config.state.stateNumber] = config.context;
  34277. if (updatedContext !== config.semanticContext) {
  34278. configSet.add(new ATNConfig({semanticContext:updatedContext}, config), this.mergeCache);
  34279. } else {
  34280. configSet.add(config, this.mergeCache);
  34281. }
  34282. }
  34283. for(i=0; i<configs.items.length; i++) {
  34284. config = configs.items[i];
  34285. if (config.alt === 1) {
  34286. // already handled
  34287. continue;
  34288. }
  34289. // In the future, this elimination step could be updated to also
  34290. // filter the prediction context for alternatives predicting alt>1
  34291. // (basically a graph subtraction algorithm).
  34292. if (!config.precedenceFilterSuppressed) {
  34293. var context = statesFromAlt1[config.state.stateNumber] || null;
  34294. if (context!==null && context.equals(config.context)) {
  34295. // eliminated
  34296. continue;
  34297. }
  34298. }
  34299. configSet.add(config, this.mergeCache);
  34300. }
  34301. return configSet;
  34302. };
  34303. ParserATNSimulator.prototype.getReachableTarget = function(trans, ttype) {
  34304. if (trans.matches(ttype, 0, this.atn.maxTokenType)) {
  34305. return trans.target;
  34306. } else {
  34307. return null;
  34308. }
  34309. };
  34310. ParserATNSimulator.prototype.getPredsForAmbigAlts = function(ambigAlts, configs, nalts) {
  34311. // REACH=[1|1|[]|0:0, 1|2|[]|0:1]
  34312. // altToPred starts as an array of all null contexts. The entry at index i
  34313. // corresponds to alternative i. altToPred[i] may have one of three values:
  34314. // 1. null: no ATNConfig c is found such that c.alt==i
  34315. // 2. SemanticContext.NONE: At least one ATNConfig c exists such that
  34316. // c.alt==i and c.semanticContext==SemanticContext.NONE. In other words,
  34317. // alt i has at least one unpredicated config.
  34318. // 3. Non-NONE Semantic Context: There exists at least one, and for all
  34319. // ATNConfig c such that c.alt==i, c.semanticContext!=SemanticContext.NONE.
  34320. //
  34321. // From this, it is clear that NONE||anything==NONE.
  34322. //
  34323. var altToPred = [];
  34324. for(var i=0;i<configs.items.length;i++) {
  34325. var c = configs.items[i];
  34326. if(ambigAlts.contains( c.alt )) {
  34327. altToPred[c.alt] = SemanticContext.orContext(altToPred[c.alt] || null, c.semanticContext);
  34328. }
  34329. }
  34330. var nPredAlts = 0;
  34331. for (i =1;i< nalts+1;i++) {
  34332. var pred = altToPred[i] || null;
  34333. if (pred===null) {
  34334. altToPred[i] = SemanticContext.NONE;
  34335. } else if (pred !== SemanticContext.NONE) {
  34336. nPredAlts += 1;
  34337. }
  34338. }
  34339. // nonambig alts are null in altToPred
  34340. if (nPredAlts===0) {
  34341. altToPred = null;
  34342. }
  34343. if (this.debug) {
  34344. console.log("getPredsForAmbigAlts result " + Utils.arrayToString(altToPred));
  34345. }
  34346. return altToPred;
  34347. };
  34348. ParserATNSimulator.prototype.getPredicatePredictions = function(ambigAlts, altToPred) {
  34349. var pairs = [];
  34350. var containsPredicate = false;
  34351. for (var i=1; i<altToPred.length;i++) {
  34352. var pred = altToPred[i];
  34353. // unpredicated is indicated by SemanticContext.NONE
  34354. if( ambigAlts!==null && ambigAlts.contains( i )) {
  34355. pairs.push(new PredPrediction(pred, i));
  34356. }
  34357. if (pred !== SemanticContext.NONE) {
  34358. containsPredicate = true;
  34359. }
  34360. }
  34361. if (! containsPredicate) {
  34362. return null;
  34363. }
  34364. return pairs;
  34365. };
  34366. //
  34367. // This method is used to improve the localization of error messages by
  34368. // choosing an alternative rather than throwing a
  34369. // {@link NoViableAltException} in particular prediction scenarios where the
  34370. // {@link //ERROR} state was reached during ATN simulation.
  34371. //
  34372. // <p>
  34373. // The default implementation of this method uses the following
  34374. // algorithm to identify an ATN configuration which successfully parsed the
  34375. // decision entry rule. Choosing such an alternative ensures that the
  34376. // {@link ParserRuleContext} returned by the calling rule will be complete
  34377. // and valid, and the syntax error will be reported later at a more
  34378. // localized location.</p>
  34379. //
  34380. // <ul>
  34381. // <li>If a syntactically valid path or paths reach the end of the decision rule and
  34382. // they are semantically valid if predicated, return the min associated alt.</li>
  34383. // <li>Else, if a semantically invalid but syntactically valid path exist
  34384. // or paths exist, return the minimum associated alt.
  34385. // </li>
  34386. // <li>Otherwise, return {@link ATN//INVALID_ALT_NUMBER}.</li>
  34387. // </ul>
  34388. //
  34389. // <p>
  34390. // In some scenarios, the algorithm described above could predict an
  34391. // alternative which will result in a {@link FailedPredicateException} in
  34392. // the parser. Specifically, this could occur if the <em>only</em> configuration
  34393. // capable of successfully parsing to the end of the decision rule is
  34394. // blocked by a semantic predicate. By choosing this alternative within
  34395. // {@link //adaptivePredict} instead of throwing a
  34396. // {@link NoViableAltException}, the resulting
  34397. // {@link FailedPredicateException} in the parser will identify the specific
  34398. // predicate which is preventing the parser from successfully parsing the
  34399. // decision rule, which helps developers identify and correct logic errors
  34400. // in semantic predicates.
  34401. // </p>
  34402. //
  34403. // @param configs The ATN configurations which were valid immediately before
  34404. // the {@link //ERROR} state was reached
  34405. // @param outerContext The is the \gamma_0 initial parser context from the paper
  34406. // or the parser stack at the instant before prediction commences.
  34407. //
  34408. // @return The value to return from {@link //adaptivePredict}, or
  34409. // {@link ATN//INVALID_ALT_NUMBER} if a suitable alternative was not
  34410. // identified and {@link //adaptivePredict} should report an error instead.
  34411. //
  34412. ParserATNSimulator.prototype.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule = function(configs, outerContext) {
  34413. var cfgs = this.splitAccordingToSemanticValidity(configs, outerContext);
  34414. var semValidConfigs = cfgs[0];
  34415. var semInvalidConfigs = cfgs[1];
  34416. var alt = this.getAltThatFinishedDecisionEntryRule(semValidConfigs);
  34417. if (alt!==ATN.INVALID_ALT_NUMBER) { // semantically/syntactically viable path exists
  34418. return alt;
  34419. }
  34420. // Is there a syntactically valid path with a failed pred?
  34421. if (semInvalidConfigs.items.length>0) {
  34422. alt = this.getAltThatFinishedDecisionEntryRule(semInvalidConfigs);
  34423. if (alt!==ATN.INVALID_ALT_NUMBER) { // syntactically viable path exists
  34424. return alt;
  34425. }
  34426. }
  34427. return ATN.INVALID_ALT_NUMBER;
  34428. };
  34429. ParserATNSimulator.prototype.getAltThatFinishedDecisionEntryRule = function(configs) {
  34430. var alts = [];
  34431. for(var i=0;i<configs.items.length; i++) {
  34432. var c = configs.items[i];
  34433. if (c.reachesIntoOuterContext>0 || ((c.state instanceof RuleStopState) && c.context.hasEmptyPath())) {
  34434. if(alts.indexOf(c.alt)<0) {
  34435. alts.push(c.alt);
  34436. }
  34437. }
  34438. }
  34439. if (alts.length===0) {
  34440. return ATN.INVALID_ALT_NUMBER;
  34441. } else {
  34442. return Math.min.apply(null, alts);
  34443. }
  34444. };
  34445. // Walk the list of configurations and split them according to
  34446. // those that have preds evaluating to true/false. If no pred, assume
  34447. // true pred and include in succeeded set. Returns Pair of sets.
  34448. //
  34449. // Create a new set so as not to alter the incoming parameter.
  34450. //
  34451. // Assumption: the input stream has been restored to the starting point
  34452. // prediction, which is where predicates need to evaluate.
  34453. //
  34454. ParserATNSimulator.prototype.splitAccordingToSemanticValidity = function( configs, outerContext) {
  34455. var succeeded = new ATNConfigSet(configs.fullCtx);
  34456. var failed = new ATNConfigSet(configs.fullCtx);
  34457. for(var i=0;i<configs.items.length; i++) {
  34458. var c = configs.items[i];
  34459. if (c.semanticContext !== SemanticContext.NONE) {
  34460. var predicateEvaluationResult = c.semanticContext.evaluate(this.parser, outerContext);
  34461. if (predicateEvaluationResult) {
  34462. succeeded.add(c);
  34463. } else {
  34464. failed.add(c);
  34465. }
  34466. } else {
  34467. succeeded.add(c);
  34468. }
  34469. }
  34470. return [succeeded, failed];
  34471. };
  34472. // Look through a list of predicate/alt pairs, returning alts for the
  34473. // pairs that win. A {@code NONE} predicate indicates an alt containing an
  34474. // unpredicated config which behaves as "always true." If !complete
  34475. // then we stop at the first predicate that evaluates to true. This
  34476. // includes pairs with null predicates.
  34477. //
  34478. ParserATNSimulator.prototype.evalSemanticContext = function(predPredictions, outerContext, complete) {
  34479. var predictions = new BitSet();
  34480. for(var i=0;i<predPredictions.length;i++) {
  34481. var pair = predPredictions[i];
  34482. if (pair.pred === SemanticContext.NONE) {
  34483. predictions.add(pair.alt);
  34484. if (! complete) {
  34485. break;
  34486. }
  34487. continue;
  34488. }
  34489. var predicateEvaluationResult = pair.pred.evaluate(this.parser, outerContext);
  34490. if (this.debug || this.dfa_debug) {
  34491. console.log("eval pred " + pair + "=" + predicateEvaluationResult);
  34492. }
  34493. if (predicateEvaluationResult) {
  34494. if (this.debug || this.dfa_debug) {
  34495. console.log("PREDICT " + pair.alt);
  34496. }
  34497. predictions.add(pair.alt);
  34498. if (! complete) {
  34499. break;
  34500. }
  34501. }
  34502. }
  34503. return predictions;
  34504. };
  34505. // TODO: If we are doing predicates, there is no point in pursuing
  34506. // closure operations if we reach a DFA state that uniquely predicts
  34507. // alternative. We will not be caching that DFA state and it is a
  34508. // waste to pursue the closure. Might have to advance when we do
  34509. // ambig detection thought :(
  34510. //
  34511. ParserATNSimulator.prototype.closure = function(config, configs, closureBusy, collectPredicates, fullCtx, treatEofAsEpsilon) {
  34512. var initialDepth = 0;
  34513. this.closureCheckingStopState(config, configs, closureBusy, collectPredicates,
  34514. fullCtx, initialDepth, treatEofAsEpsilon);
  34515. };
  34516. ParserATNSimulator.prototype.closureCheckingStopState = function(config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon) {
  34517. if (this.debug || this.debug_closure) {
  34518. console.log("closure(" + config.toString(this.parser,true) + ")");
  34519. // console.log("configs(" + configs.toString() + ")");
  34520. if(config.reachesIntoOuterContext>50) {
  34521. throw "problem";
  34522. }
  34523. }
  34524. if (config.state instanceof RuleStopState) {
  34525. // We hit rule end. If we have context info, use it
  34526. // run thru all possible stack tops in ctx
  34527. if (! config.context.isEmpty()) {
  34528. for ( var i =0; i<config.context.length; i++) {
  34529. if (config.context.getReturnState(i) === PredictionContext.EMPTY_RETURN_STATE) {
  34530. if (fullCtx) {
  34531. configs.add(new ATNConfig({state:config.state, context:PredictionContext.EMPTY}, config), this.mergeCache);
  34532. continue;
  34533. } else {
  34534. // we have no context info, just chase follow links (if greedy)
  34535. if (this.debug) {
  34536. console.log("FALLING off rule " + this.getRuleName(config.state.ruleIndex));
  34537. }
  34538. this.closure_(config, configs, closureBusy, collectPredicates,
  34539. fullCtx, depth, treatEofAsEpsilon);
  34540. }
  34541. continue;
  34542. }
  34543. var returnState = this.atn.states[config.context.getReturnState(i)];
  34544. var newContext = config.context.getParent(i); // "pop" return state
  34545. var parms = {state:returnState, alt:config.alt, context:newContext, semanticContext:config.semanticContext};
  34546. var c = new ATNConfig(parms, null);
  34547. // While we have context to pop back from, we may have
  34548. // gotten that context AFTER having falling off a rule.
  34549. // Make sure we track that we are now out of context.
  34550. c.reachesIntoOuterContext = config.reachesIntoOuterContext;
  34551. this.closureCheckingStopState(c, configs, closureBusy, collectPredicates, fullCtx, depth - 1, treatEofAsEpsilon);
  34552. }
  34553. return;
  34554. } else if( fullCtx) {
  34555. // reached end of start rule
  34556. configs.add(config, this.mergeCache);
  34557. return;
  34558. } else {
  34559. // else if we have no context info, just chase follow links (if greedy)
  34560. if (this.debug) {
  34561. console.log("FALLING off rule " + this.getRuleName(config.state.ruleIndex));
  34562. }
  34563. }
  34564. }
  34565. this.closure_(config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon);
  34566. };
  34567. // Do the actual work of walking epsilon edges//
  34568. ParserATNSimulator.prototype.closure_ = function(config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon) {
  34569. var p = config.state;
  34570. // optimization
  34571. if (! p.epsilonOnlyTransitions) {
  34572. configs.add(config, this.mergeCache);
  34573. // make sure to not return here, because EOF transitions can act as
  34574. // both epsilon transitions and non-epsilon transitions.
  34575. }
  34576. for(var i = 0;i<p.transitions.length; i++) {
  34577. if(i==0 && this.canDropLoopEntryEdgeInLeftRecursiveRule(config))
  34578. continue;
  34579. var t = p.transitions[i];
  34580. var continueCollecting = collectPredicates && !(t instanceof ActionTransition);
  34581. var c = this.getEpsilonTarget(config, t, continueCollecting, depth === 0, fullCtx, treatEofAsEpsilon);
  34582. if (c!==null) {
  34583. if (!t.isEpsilon && closureBusy.add(c)!==c){
  34584. // avoid infinite recursion for EOF* and EOF+
  34585. continue;
  34586. }
  34587. var newDepth = depth;
  34588. if ( config.state instanceof RuleStopState) {
  34589. // target fell off end of rule; mark resulting c as having dipped into outer context
  34590. // We can't get here if incoming config was rule stop and we had context
  34591. // track how far we dip into outer context. Might
  34592. // come in handy and we avoid evaluating context dependent
  34593. // preds if this is > 0.
  34594. if (closureBusy.add(c)!==c) {
  34595. // avoid infinite recursion for right-recursive rules
  34596. continue;
  34597. }
  34598. if (this._dfa !== null && this._dfa.precedenceDfa) {
  34599. if (t.outermostPrecedenceReturn === this._dfa.atnStartState.ruleIndex) {
  34600. c.precedenceFilterSuppressed = true;
  34601. }
  34602. }
  34603. c.reachesIntoOuterContext += 1;
  34604. configs.dipsIntoOuterContext = true; // TODO: can remove? only care when we add to set per middle of this method
  34605. newDepth -= 1;
  34606. if (this.debug) {
  34607. console.log("dips into outer ctx: " + c);
  34608. }
  34609. } else if (t instanceof RuleTransition) {
  34610. // latch when newDepth goes negative - once we step out of the entry context we can't return
  34611. if (newDepth >= 0) {
  34612. newDepth += 1;
  34613. }
  34614. }
  34615. this.closureCheckingStopState(c, configs, closureBusy, continueCollecting, fullCtx, newDepth, treatEofAsEpsilon);
  34616. }
  34617. }
  34618. };
  34619. ParserATNSimulator.prototype.canDropLoopEntryEdgeInLeftRecursiveRule = function(config) {
  34620. // return False
  34621. var p = config.state;
  34622. // First check to see if we are in StarLoopEntryState generated during
  34623. // left-recursion elimination. For efficiency, also check if
  34624. // the context has an empty stack case. If so, it would mean
  34625. // global FOLLOW so we can't perform optimization
  34626. // Are we the special loop entry/exit state? or SLL wildcard
  34627. if(p.stateType != ATNState.STAR_LOOP_ENTRY)
  34628. return false;
  34629. if(p.stateType != ATNState.STAR_LOOP_ENTRY || !p.isPrecedenceDecision ||
  34630. config.context.isEmpty() || config.context.hasEmptyPath())
  34631. return false;
  34632. // Require all return states to return back to the same rule that p is in.
  34633. var numCtxs = config.context.length;
  34634. for(var i=0; i<numCtxs; i++) { // for each stack context
  34635. var returnState = this.atn.states[config.context.getReturnState(i)];
  34636. if (returnState.ruleIndex != p.ruleIndex)
  34637. return false;
  34638. }
  34639. var decisionStartState = p.transitions[0].target;
  34640. var blockEndStateNum = decisionStartState.endState.stateNumber;
  34641. var blockEndState = this.atn.states[blockEndStateNum];
  34642. // Verify that the top of each stack context leads to loop entry/exit
  34643. // state through epsilon edges and w/o leaving rule.
  34644. for(var i=0; i<numCtxs; i++) { // for each stack context
  34645. var returnStateNumber = config.context.getReturnState(i);
  34646. var returnState = this.atn.states[returnStateNumber];
  34647. // all states must have single outgoing epsilon edge
  34648. if (returnState.transitions.length != 1 || !returnState.transitions[0].isEpsilon)
  34649. return false;
  34650. // Look for prefix op case like 'not expr', (' type ')' expr
  34651. var returnStateTarget = returnState.transitions[0].target;
  34652. if ( returnState.stateType == ATNState.BLOCK_END && returnStateTarget == p )
  34653. continue;
  34654. // Look for 'expr op expr' or case where expr's return state is block end
  34655. // of (...)* internal block; the block end points to loop back
  34656. // which points to p but we don't need to check that
  34657. if ( returnState == blockEndState )
  34658. continue;
  34659. // Look for ternary expr ? expr : expr. The return state points at block end,
  34660. // which points at loop entry state
  34661. if ( returnStateTarget == blockEndState )
  34662. continue;
  34663. // Look for complex prefix 'between expr and expr' case where 2nd expr's
  34664. // return state points at block end state of (...)* internal block
  34665. if (returnStateTarget.stateType == ATNState.BLOCK_END && returnStateTarget.transitions.length == 1
  34666. && returnStateTarget.transitions[0].isEpsilon && returnStateTarget.transitions[0].target == p)
  34667. continue;
  34668. // anything else ain't conforming
  34669. return false;
  34670. }
  34671. return true;
  34672. };
  34673. ParserATNSimulator.prototype.getRuleName = function( index) {
  34674. if (this.parser!==null && index>=0) {
  34675. return this.parser.ruleNames[index];
  34676. } else {
  34677. return "<rule " + index + ">";
  34678. }
  34679. };
  34680. ParserATNSimulator.prototype.getEpsilonTarget = function(config, t, collectPredicates, inContext, fullCtx, treatEofAsEpsilon) {
  34681. switch(t.serializationType) {
  34682. case Transition.RULE:
  34683. return this.ruleTransition(config, t);
  34684. case Transition.PRECEDENCE:
  34685. return this.precedenceTransition(config, t, collectPredicates, inContext, fullCtx);
  34686. case Transition.PREDICATE:
  34687. return this.predTransition(config, t, collectPredicates, inContext, fullCtx);
  34688. case Transition.ACTION:
  34689. return this.actionTransition(config, t);
  34690. case Transition.EPSILON:
  34691. return new ATNConfig({state:t.target}, config);
  34692. case Transition.ATOM:
  34693. case Transition.RANGE:
  34694. case Transition.SET:
  34695. // EOF transitions act like epsilon transitions after the first EOF
  34696. // transition is traversed
  34697. if (treatEofAsEpsilon) {
  34698. if (t.matches(Token.EOF, 0, 1)) {
  34699. return new ATNConfig({state: t.target}, config);
  34700. }
  34701. }
  34702. return null;
  34703. default:
  34704. return null;
  34705. }
  34706. };
  34707. ParserATNSimulator.prototype.actionTransition = function(config, t) {
  34708. if (this.debug) {
  34709. var index = t.actionIndex==-1 ? 65535 : t.actionIndex;
  34710. console.log("ACTION edge " + t.ruleIndex + ":" + index);
  34711. }
  34712. return new ATNConfig({state:t.target}, config);
  34713. };
  34714. ParserATNSimulator.prototype.precedenceTransition = function(config, pt, collectPredicates, inContext, fullCtx) {
  34715. if (this.debug) {
  34716. console.log("PRED (collectPredicates=" + collectPredicates + ") " +
  34717. pt.precedence + ">=_p, ctx dependent=true");
  34718. if (this.parser!==null) {
  34719. console.log("context surrounding pred is " + Utils.arrayToString(this.parser.getRuleInvocationStack()));
  34720. }
  34721. }
  34722. var c = null;
  34723. if (collectPredicates && inContext) {
  34724. if (fullCtx) {
  34725. // In full context mode, we can evaluate predicates on-the-fly
  34726. // during closure, which dramatically reduces the size of
  34727. // the config sets. It also obviates the need to test predicates
  34728. // later during conflict resolution.
  34729. var currentPosition = this._input.index;
  34730. this._input.seek(this._startIndex);
  34731. var predSucceeds = pt.getPredicate().evaluate(this.parser, this._outerContext);
  34732. this._input.seek(currentPosition);
  34733. if (predSucceeds) {
  34734. c = new ATNConfig({state:pt.target}, config); // no pred context
  34735. }
  34736. } else {
  34737. var newSemCtx = SemanticContext.andContext(config.semanticContext, pt.getPredicate());
  34738. c = new ATNConfig({state:pt.target, semanticContext:newSemCtx}, config);
  34739. }
  34740. } else {
  34741. c = new ATNConfig({state:pt.target}, config);
  34742. }
  34743. if (this.debug) {
  34744. console.log("config from pred transition=" + c);
  34745. }
  34746. return c;
  34747. };
  34748. ParserATNSimulator.prototype.predTransition = function(config, pt, collectPredicates, inContext, fullCtx) {
  34749. if (this.debug) {
  34750. console.log("PRED (collectPredicates=" + collectPredicates + ") " + pt.ruleIndex +
  34751. ":" + pt.predIndex + ", ctx dependent=" + pt.isCtxDependent);
  34752. if (this.parser!==null) {
  34753. console.log("context surrounding pred is " + Utils.arrayToString(this.parser.getRuleInvocationStack()));
  34754. }
  34755. }
  34756. var c = null;
  34757. if (collectPredicates && ((pt.isCtxDependent && inContext) || ! pt.isCtxDependent)) {
  34758. if (fullCtx) {
  34759. // In full context mode, we can evaluate predicates on-the-fly
  34760. // during closure, which dramatically reduces the size of
  34761. // the config sets. It also obviates the need to test predicates
  34762. // later during conflict resolution.
  34763. var currentPosition = this._input.index;
  34764. this._input.seek(this._startIndex);
  34765. var predSucceeds = pt.getPredicate().evaluate(this.parser, this._outerContext);
  34766. this._input.seek(currentPosition);
  34767. if (predSucceeds) {
  34768. c = new ATNConfig({state:pt.target}, config); // no pred context
  34769. }
  34770. } else {
  34771. var newSemCtx = SemanticContext.andContext(config.semanticContext, pt.getPredicate());
  34772. c = new ATNConfig({state:pt.target, semanticContext:newSemCtx}, config);
  34773. }
  34774. } else {
  34775. c = new ATNConfig({state:pt.target}, config);
  34776. }
  34777. if (this.debug) {
  34778. console.log("config from pred transition=" + c);
  34779. }
  34780. return c;
  34781. };
  34782. ParserATNSimulator.prototype.ruleTransition = function(config, t) {
  34783. if (this.debug) {
  34784. console.log("CALL rule " + this.getRuleName(t.target.ruleIndex) + ", ctx=" + config.context);
  34785. }
  34786. var returnState = t.followState;
  34787. var newContext = SingletonPredictionContext.create(config.context, returnState.stateNumber);
  34788. return new ATNConfig({state:t.target, context:newContext}, config );
  34789. };
  34790. ParserATNSimulator.prototype.getConflictingAlts = function(configs) {
  34791. var altsets = PredictionMode.getConflictingAltSubsets(configs);
  34792. return PredictionMode.getAlts(altsets);
  34793. };
  34794. // Sam pointed out a problem with the previous definition, v3, of
  34795. // ambiguous states. If we have another state associated with conflicting
  34796. // alternatives, we should keep going. For example, the following grammar
  34797. //
  34798. // s : (ID | ID ID?) ';' ;
  34799. //
  34800. // When the ATN simulation reaches the state before ';', it has a DFA
  34801. // state that looks like: [12|1|[], 6|2|[], 12|2|[]]. Naturally
  34802. // 12|1|[] and 12|2|[] conflict, but we cannot stop processing this node
  34803. // because alternative to has another way to continue, via [6|2|[]].
  34804. // The key is that we have a single state that has config's only associated
  34805. // with a single alternative, 2, and crucially the state transitions
  34806. // among the configurations are all non-epsilon transitions. That means
  34807. // we don't consider any conflicts that include alternative 2. So, we
  34808. // ignore the conflict between alts 1 and 2. We ignore a set of
  34809. // conflicting alts when there is an intersection with an alternative
  34810. // associated with a single alt state in the state&rarr;config-list map.
  34811. //
  34812. // It's also the case that we might have two conflicting configurations but
  34813. // also a 3rd nonconflicting configuration for a different alternative:
  34814. // [1|1|[], 1|2|[], 8|3|[]]. This can come about from grammar:
  34815. //
  34816. // a : A | A | A B ;
  34817. //
  34818. // After matching input A, we reach the stop state for rule A, state 1.
  34819. // State 8 is the state right before B. Clearly alternatives 1 and 2
  34820. // conflict and no amount of further lookahead will separate the two.
  34821. // However, alternative 3 will be able to continue and so we do not
  34822. // stop working on this state. In the previous example, we're concerned
  34823. // with states associated with the conflicting alternatives. Here alt
  34824. // 3 is not associated with the conflicting configs, but since we can continue
  34825. // looking for input reasonably, I don't declare the state done. We
  34826. // ignore a set of conflicting alts when we have an alternative
  34827. // that we still need to pursue.
  34828. //
  34829. ParserATNSimulator.prototype.getConflictingAltsOrUniqueAlt = function(configs) {
  34830. var conflictingAlts = null;
  34831. if (configs.uniqueAlt!== ATN.INVALID_ALT_NUMBER) {
  34832. conflictingAlts = new BitSet();
  34833. conflictingAlts.add(configs.uniqueAlt);
  34834. } else {
  34835. conflictingAlts = configs.conflictingAlts;
  34836. }
  34837. return conflictingAlts;
  34838. };
  34839. ParserATNSimulator.prototype.getTokenName = function( t) {
  34840. if (t===Token.EOF) {
  34841. return "EOF";
  34842. }
  34843. if( this.parser!==null && this.parser.literalNames!==null) {
  34844. if (t >= this.parser.literalNames.length && t >= this.parser.symbolicNames.length) {
  34845. console.log("" + t + " ttype out of range: " + this.parser.literalNames);
  34846. console.log("" + this.parser.getInputStream().getTokens());
  34847. } else {
  34848. var name = this.parser.literalNames[t] || this.parser.symbolicNames[t];
  34849. return name + "<" + t + ">";
  34850. }
  34851. }
  34852. return "" + t;
  34853. };
  34854. ParserATNSimulator.prototype.getLookaheadName = function(input) {
  34855. return this.getTokenName(input.LA(1));
  34856. };
  34857. // Used for debugging in adaptivePredict around execATN but I cut
  34858. // it out for clarity now that alg. works well. We can leave this
  34859. // "dead" code for a bit.
  34860. //
  34861. ParserATNSimulator.prototype.dumpDeadEndConfigs = function(nvae) {
  34862. console.log("dead end configs: ");
  34863. var decs = nvae.getDeadEndConfigs();
  34864. for(var i=0; i<decs.length; i++) {
  34865. var c = decs[i];
  34866. var trans = "no edges";
  34867. if (c.state.transitions.length>0) {
  34868. var t = c.state.transitions[0];
  34869. if (t instanceof AtomTransition) {
  34870. trans = "Atom "+ this.getTokenName(t.label);
  34871. } else if (t instanceof SetTransition) {
  34872. var neg = (t instanceof NotSetTransition);
  34873. trans = (neg ? "~" : "") + "Set " + t.set;
  34874. }
  34875. }
  34876. console.error(c.toString(this.parser, true) + ":" + trans);
  34877. }
  34878. };
  34879. ParserATNSimulator.prototype.noViableAlt = function(input, outerContext, configs, startIndex) {
  34880. return new NoViableAltException(this.parser, input, input.get(startIndex), input.LT(1), configs, outerContext);
  34881. };
  34882. ParserATNSimulator.prototype.getUniqueAlt = function(configs) {
  34883. var alt = ATN.INVALID_ALT_NUMBER;
  34884. for(var i=0;i<configs.items.length;i++) {
  34885. var c = configs.items[i];
  34886. if (alt === ATN.INVALID_ALT_NUMBER) {
  34887. alt = c.alt // found first alt
  34888. } else if( c.alt!==alt) {
  34889. return ATN.INVALID_ALT_NUMBER;
  34890. }
  34891. }
  34892. return alt;
  34893. };
  34894. //
  34895. // Add an edge to the DFA, if possible. This method calls
  34896. // {@link //addDFAState} to ensure the {@code to} state is present in the
  34897. // DFA. If {@code from} is {@code null}, or if {@code t} is outside the
  34898. // range of edges that can be represented in the DFA tables, this method
  34899. // returns without adding the edge to the DFA.
  34900. //
  34901. // <p>If {@code to} is {@code null}, this method returns {@code null}.
  34902. // Otherwise, this method returns the {@link DFAState} returned by calling
  34903. // {@link //addDFAState} for the {@code to} state.</p>
  34904. //
  34905. // @param dfa The DFA
  34906. // @param from The source state for the edge
  34907. // @param t The input symbol
  34908. // @param to The target state for the edge
  34909. //
  34910. // @return If {@code to} is {@code null}, this method returns {@code null};
  34911. // otherwise this method returns the result of calling {@link //addDFAState}
  34912. // on {@code to}
  34913. //
  34914. ParserATNSimulator.prototype.addDFAEdge = function(dfa, from_, t, to) {
  34915. if( this.debug) {
  34916. console.log("EDGE " + from_ + " -> " + to + " upon " + this.getTokenName(t));
  34917. }
  34918. if (to===null) {
  34919. return null;
  34920. }
  34921. to = this.addDFAState(dfa, to); // used existing if possible not incoming
  34922. if (from_===null || t < -1 || t > this.atn.maxTokenType) {
  34923. return to;
  34924. }
  34925. if (from_.edges===null) {
  34926. from_.edges = [];
  34927. }
  34928. from_.edges[t+1] = to; // connect
  34929. if (this.debug) {
  34930. var literalNames = this.parser===null ? null : this.parser.literalNames;
  34931. var symbolicNames = this.parser===null ? null : this.parser.symbolicNames;
  34932. console.log("DFA=\n" + dfa.toString(literalNames, symbolicNames));
  34933. }
  34934. return to;
  34935. };
  34936. //
  34937. // Add state {@code D} to the DFA if it is not already present, and return
  34938. // the actual instance stored in the DFA. If a state equivalent to {@code D}
  34939. // is already in the DFA, the existing state is returned. Otherwise this
  34940. // method returns {@code D} after adding it to the DFA.
  34941. //
  34942. // <p>If {@code D} is {@link //ERROR}, this method returns {@link //ERROR} and
  34943. // does not change the DFA.</p>
  34944. //
  34945. // @param dfa The dfa
  34946. // @param D The DFA state to add
  34947. // @return The state stored in the DFA. This will be either the existing
  34948. // state if {@code D} is already in the DFA, or {@code D} itself if the
  34949. // state was not already present.
  34950. //
  34951. ParserATNSimulator.prototype.addDFAState = function(dfa, D) {
  34952. if (D == ATNSimulator.ERROR) {
  34953. return D;
  34954. }
  34955. var existing = dfa.states.get(D);
  34956. if(existing!==null) {
  34957. return existing;
  34958. }
  34959. D.stateNumber = dfa.states.length;
  34960. if (! D.configs.readOnly) {
  34961. D.configs.optimizeConfigs(this);
  34962. D.configs.setReadonly(true);
  34963. }
  34964. dfa.states.add(D);
  34965. if (this.debug) {
  34966. console.log("adding new DFA state: " + D);
  34967. }
  34968. return D;
  34969. };
  34970. ParserATNSimulator.prototype.reportAttemptingFullContext = function(dfa, conflictingAlts, configs, startIndex, stopIndex) {
  34971. if (this.debug || this.retry_debug) {
  34972. var interval = new Interval(startIndex, stopIndex + 1);
  34973. console.log("reportAttemptingFullContext decision=" + dfa.decision + ":" + configs +
  34974. ", input=" + this.parser.getTokenStream().getText(interval));
  34975. }
  34976. if (this.parser!==null) {
  34977. this.parser.getErrorListenerDispatch().reportAttemptingFullContext(this.parser, dfa, startIndex, stopIndex, conflictingAlts, configs);
  34978. }
  34979. };
  34980. ParserATNSimulator.prototype.reportContextSensitivity = function(dfa, prediction, configs, startIndex, stopIndex) {
  34981. if (this.debug || this.retry_debug) {
  34982. var interval = new Interval(startIndex, stopIndex + 1);
  34983. console.log("reportContextSensitivity decision=" + dfa.decision + ":" + configs +
  34984. ", input=" + this.parser.getTokenStream().getText(interval));
  34985. }
  34986. if (this.parser!==null) {
  34987. this.parser.getErrorListenerDispatch().reportContextSensitivity(this.parser, dfa, startIndex, stopIndex, prediction, configs);
  34988. }
  34989. };
  34990. // If context sensitive parsing, we know it's ambiguity not conflict//
  34991. ParserATNSimulator.prototype.reportAmbiguity = function(dfa, D, startIndex, stopIndex,
  34992. exact, ambigAlts, configs ) {
  34993. if (this.debug || this.retry_debug) {
  34994. var interval = new Interval(startIndex, stopIndex + 1);
  34995. console.log("reportAmbiguity " + ambigAlts + ":" + configs +
  34996. ", input=" + this.parser.getTokenStream().getText(interval));
  34997. }
  34998. if (this.parser!==null) {
  34999. this.parser.getErrorListenerDispatch().reportAmbiguity(this.parser, dfa, startIndex, stopIndex, exact, ambigAlts, configs);
  35000. }
  35001. };
  35002. exports.ParserATNSimulator = ParserATNSimulator;
  35003. /***/ }),
  35004. /***/ "./node_modules/antlr4/atn/PredictionMode.js":
  35005. /*!***************************************************!*\
  35006. !*** ./node_modules/antlr4/atn/PredictionMode.js ***!
  35007. \***************************************************/
  35008. /*! no static exports found */
  35009. /***/ (function(module, exports, __webpack_require__) {
  35010. //
  35011. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  35012. * Use of this file is governed by the BSD 3-clause license that
  35013. * can be found in the LICENSE.txt file in the project root.
  35014. */
  35015. //
  35016. //
  35017. // This enumeration defines the prediction modes available in ANTLR 4 along with
  35018. // utility methods for analyzing configuration sets for conflicts and/or
  35019. // ambiguities.
  35020. var Set = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Set;
  35021. var Map = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Map;
  35022. var BitSet = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").BitSet;
  35023. var AltDict = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").AltDict;
  35024. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  35025. var RuleStopState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  35026. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  35027. var ATNConfig = __webpack_require__(/*! ./ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").ATNConfig;
  35028. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  35029. var Hash = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").Hash;
  35030. var hashStuff = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").hashStuff;
  35031. var equalArrays = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").equalArrays;
  35032. function PredictionMode() {
  35033. return this;
  35034. }
  35035. //
  35036. // The SLL(*) prediction mode. This prediction mode ignores the current
  35037. // parser context when making predictions. This is the fastest prediction
  35038. // mode, and provides correct results for many grammars. This prediction
  35039. // mode is more powerful than the prediction mode provided by ANTLR 3, but
  35040. // may result in syntax errors for grammar and input combinations which are
  35041. // not SLL.
  35042. //
  35043. // <p>
  35044. // When using this prediction mode, the parser will either return a correct
  35045. // parse tree (i.e. the same parse tree that would be returned with the
  35046. // {@link //LL} prediction mode), or it will report a syntax error. If a
  35047. // syntax error is encountered when using the {@link //SLL} prediction mode,
  35048. // it may be due to either an actual syntax error in the input or indicate
  35049. // that the particular combination of grammar and input requires the more
  35050. // powerful {@link //LL} prediction abilities to complete successfully.</p>
  35051. //
  35052. // <p>
  35053. // This prediction mode does not provide any guarantees for prediction
  35054. // behavior for syntactically-incorrect inputs.</p>
  35055. //
  35056. PredictionMode.SLL = 0;
  35057. //
  35058. // The LL(*) prediction mode. This prediction mode allows the current parser
  35059. // context to be used for resolving SLL conflicts that occur during
  35060. // prediction. This is the fastest prediction mode that guarantees correct
  35061. // parse results for all combinations of grammars with syntactically correct
  35062. // inputs.
  35063. //
  35064. // <p>
  35065. // When using this prediction mode, the parser will make correct decisions
  35066. // for all syntactically-correct grammar and input combinations. However, in
  35067. // cases where the grammar is truly ambiguous this prediction mode might not
  35068. // report a precise answer for <em>exactly which</em> alternatives are
  35069. // ambiguous.</p>
  35070. //
  35071. // <p>
  35072. // This prediction mode does not provide any guarantees for prediction
  35073. // behavior for syntactically-incorrect inputs.</p>
  35074. //
  35075. PredictionMode.LL = 1;
  35076. //
  35077. // The LL(*) prediction mode with exact ambiguity detection. In addition to
  35078. // the correctness guarantees provided by the {@link //LL} prediction mode,
  35079. // this prediction mode instructs the prediction algorithm to determine the
  35080. // complete and exact set of ambiguous alternatives for every ambiguous
  35081. // decision encountered while parsing.
  35082. //
  35083. // <p>
  35084. // This prediction mode may be used for diagnosing ambiguities during
  35085. // grammar development. Due to the performance overhead of calculating sets
  35086. // of ambiguous alternatives, this prediction mode should be avoided when
  35087. // the exact results are not necessary.</p>
  35088. //
  35089. // <p>
  35090. // This prediction mode does not provide any guarantees for prediction
  35091. // behavior for syntactically-incorrect inputs.</p>
  35092. //
  35093. PredictionMode.LL_EXACT_AMBIG_DETECTION = 2;
  35094. //
  35095. // Computes the SLL prediction termination condition.
  35096. //
  35097. // <p>
  35098. // This method computes the SLL prediction termination condition for both of
  35099. // the following cases.</p>
  35100. //
  35101. // <ul>
  35102. // <li>The usual SLL+LL fallback upon SLL conflict</li>
  35103. // <li>Pure SLL without LL fallback</li>
  35104. // </ul>
  35105. //
  35106. // <p><strong>COMBINED SLL+LL PARSING</strong></p>
  35107. //
  35108. // <p>When LL-fallback is enabled upon SLL conflict, correct predictions are
  35109. // ensured regardless of how the termination condition is computed by this
  35110. // method. Due to the substantially higher cost of LL prediction, the
  35111. // prediction should only fall back to LL when the additional lookahead
  35112. // cannot lead to a unique SLL prediction.</p>
  35113. //
  35114. // <p>Assuming combined SLL+LL parsing, an SLL configuration set with only
  35115. // conflicting subsets should fall back to full LL, even if the
  35116. // configuration sets don't resolve to the same alternative (e.g.
  35117. // {@code {1,2}} and {@code {3,4}}. If there is at least one non-conflicting
  35118. // configuration, SLL could continue with the hopes that more lookahead will
  35119. // resolve via one of those non-conflicting configurations.</p>
  35120. //
  35121. // <p>Here's the prediction termination rule them: SLL (for SLL+LL parsing)
  35122. // stops when it sees only conflicting configuration subsets. In contrast,
  35123. // full LL keeps going when there is uncertainty.</p>
  35124. //
  35125. // <p><strong>HEURISTIC</strong></p>
  35126. //
  35127. // <p>As a heuristic, we stop prediction when we see any conflicting subset
  35128. // unless we see a state that only has one alternative associated with it.
  35129. // The single-alt-state thing lets prediction continue upon rules like
  35130. // (otherwise, it would admit defeat too soon):</p>
  35131. //
  35132. // <p>{@code [12|1|[], 6|2|[], 12|2|[]]. s : (ID | ID ID?) ';' ;}</p>
  35133. //
  35134. // <p>When the ATN simulation reaches the state before {@code ';'}, it has a
  35135. // DFA state that looks like: {@code [12|1|[], 6|2|[], 12|2|[]]}. Naturally
  35136. // {@code 12|1|[]} and {@code 12|2|[]} conflict, but we cannot stop
  35137. // processing this node because alternative to has another way to continue,
  35138. // via {@code [6|2|[]]}.</p>
  35139. //
  35140. // <p>It also let's us continue for this rule:</p>
  35141. //
  35142. // <p>{@code [1|1|[], 1|2|[], 8|3|[]] a : A | A | A B ;}</p>
  35143. //
  35144. // <p>After matching input A, we reach the stop state for rule A, state 1.
  35145. // State 8 is the state right before B. Clearly alternatives 1 and 2
  35146. // conflict and no amount of further lookahead will separate the two.
  35147. // However, alternative 3 will be able to continue and so we do not stop
  35148. // working on this state. In the previous example, we're concerned with
  35149. // states associated with the conflicting alternatives. Here alt 3 is not
  35150. // associated with the conflicting configs, but since we can continue
  35151. // looking for input reasonably, don't declare the state done.</p>
  35152. //
  35153. // <p><strong>PURE SLL PARSING</strong></p>
  35154. //
  35155. // <p>To handle pure SLL parsing, all we have to do is make sure that we
  35156. // combine stack contexts for configurations that differ only by semantic
  35157. // predicate. From there, we can do the usual SLL termination heuristic.</p>
  35158. //
  35159. // <p><strong>PREDICATES IN SLL+LL PARSING</strong></p>
  35160. //
  35161. // <p>SLL decisions don't evaluate predicates until after they reach DFA stop
  35162. // states because they need to create the DFA cache that works in all
  35163. // semantic situations. In contrast, full LL evaluates predicates collected
  35164. // during start state computation so it can ignore predicates thereafter.
  35165. // This means that SLL termination detection can totally ignore semantic
  35166. // predicates.</p>
  35167. //
  35168. // <p>Implementation-wise, {@link ATNConfigSet} combines stack contexts but not
  35169. // semantic predicate contexts so we might see two configurations like the
  35170. // following.</p>
  35171. //
  35172. // <p>{@code (s, 1, x, {}), (s, 1, x', {p})}</p>
  35173. //
  35174. // <p>Before testing these configurations against others, we have to merge
  35175. // {@code x} and {@code x'} (without modifying the existing configurations).
  35176. // For example, we test {@code (x+x')==x''} when looking for conflicts in
  35177. // the following configurations.</p>
  35178. //
  35179. // <p>{@code (s, 1, x, {}), (s, 1, x', {p}), (s, 2, x'', {})}</p>
  35180. //
  35181. // <p>If the configuration set has predicates (as indicated by
  35182. // {@link ATNConfigSet//hasSemanticContext}), this algorithm makes a copy of
  35183. // the configurations to strip out all of the predicates so that a standard
  35184. // {@link ATNConfigSet} will merge everything ignoring predicates.</p>
  35185. //
  35186. PredictionMode.hasSLLConflictTerminatingPrediction = function( mode, configs) {
  35187. // Configs in rule stop states indicate reaching the end of the decision
  35188. // rule (local context) or end of start rule (full context). If all
  35189. // configs meet this condition, then none of the configurations is able
  35190. // to match additional input so we terminate prediction.
  35191. //
  35192. if (PredictionMode.allConfigsInRuleStopStates(configs)) {
  35193. return true;
  35194. }
  35195. // pure SLL mode parsing
  35196. if (mode === PredictionMode.SLL) {
  35197. // Don't bother with combining configs from different semantic
  35198. // contexts if we can fail over to full LL; costs more time
  35199. // since we'll often fail over anyway.
  35200. if (configs.hasSemanticContext) {
  35201. // dup configs, tossing out semantic predicates
  35202. var dup = new ATNConfigSet();
  35203. for(var i=0;i<configs.items.length;i++) {
  35204. var c = configs.items[i];
  35205. c = new ATNConfig({semanticContext:SemanticContext.NONE}, c);
  35206. dup.add(c);
  35207. }
  35208. configs = dup;
  35209. }
  35210. // now we have combined contexts for configs with dissimilar preds
  35211. }
  35212. // pure SLL or combined SLL+LL mode parsing
  35213. var altsets = PredictionMode.getConflictingAltSubsets(configs);
  35214. return PredictionMode.hasConflictingAltSet(altsets) && !PredictionMode.hasStateAssociatedWithOneAlt(configs);
  35215. };
  35216. // Checks if any configuration in {@code configs} is in a
  35217. // {@link RuleStopState}. Configurations meeting this condition have reached
  35218. // the end of the decision rule (local context) or end of start rule (full
  35219. // context).
  35220. //
  35221. // @param configs the configuration set to test
  35222. // @return {@code true} if any configuration in {@code configs} is in a
  35223. // {@link RuleStopState}, otherwise {@code false}
  35224. PredictionMode.hasConfigInRuleStopState = function(configs) {
  35225. for(var i=0;i<configs.items.length;i++) {
  35226. var c = configs.items[i];
  35227. if (c.state instanceof RuleStopState) {
  35228. return true;
  35229. }
  35230. }
  35231. return false;
  35232. };
  35233. // Checks if all configurations in {@code configs} are in a
  35234. // {@link RuleStopState}. Configurations meeting this condition have reached
  35235. // the end of the decision rule (local context) or end of start rule (full
  35236. // context).
  35237. //
  35238. // @param configs the configuration set to test
  35239. // @return {@code true} if all configurations in {@code configs} are in a
  35240. // {@link RuleStopState}, otherwise {@code false}
  35241. PredictionMode.allConfigsInRuleStopStates = function(configs) {
  35242. for(var i=0;i<configs.items.length;i++) {
  35243. var c = configs.items[i];
  35244. if (!(c.state instanceof RuleStopState)) {
  35245. return false;
  35246. }
  35247. }
  35248. return true;
  35249. };
  35250. //
  35251. // Full LL prediction termination.
  35252. //
  35253. // <p>Can we stop looking ahead during ATN simulation or is there some
  35254. // uncertainty as to which alternative we will ultimately pick, after
  35255. // consuming more input? Even if there are partial conflicts, we might know
  35256. // that everything is going to resolve to the same minimum alternative. That
  35257. // means we can stop since no more lookahead will change that fact. On the
  35258. // other hand, there might be multiple conflicts that resolve to different
  35259. // minimums. That means we need more look ahead to decide which of those
  35260. // alternatives we should predict.</p>
  35261. //
  35262. // <p>The basic idea is to split the set of configurations {@code C}, into
  35263. // conflicting subsets {@code (s, _, ctx, _)} and singleton subsets with
  35264. // non-conflicting configurations. Two configurations conflict if they have
  35265. // identical {@link ATNConfig//state} and {@link ATNConfig//context} values
  35266. // but different {@link ATNConfig//alt} value, e.g. {@code (s, i, ctx, _)}
  35267. // and {@code (s, j, ctx, _)} for {@code i!=j}.</p>
  35268. //
  35269. // <p>Reduce these configuration subsets to the set of possible alternatives.
  35270. // You can compute the alternative subsets in one pass as follows:</p>
  35271. //
  35272. // <p>{@code A_s,ctx = {i | (s, i, ctx, _)}} for each configuration in
  35273. // {@code C} holding {@code s} and {@code ctx} fixed.</p>
  35274. //
  35275. // <p>Or in pseudo-code, for each configuration {@code c} in {@code C}:</p>
  35276. //
  35277. // <pre>
  35278. // map[c] U= c.{@link ATNConfig//alt alt} // map hash/equals uses s and x, not
  35279. // alt and not pred
  35280. // </pre>
  35281. //
  35282. // <p>The values in {@code map} are the set of {@code A_s,ctx} sets.</p>
  35283. //
  35284. // <p>If {@code |A_s,ctx|=1} then there is no conflict associated with
  35285. // {@code s} and {@code ctx}.</p>
  35286. //
  35287. // <p>Reduce the subsets to singletons by choosing a minimum of each subset. If
  35288. // the union of these alternative subsets is a singleton, then no amount of
  35289. // more lookahead will help us. We will always pick that alternative. If,
  35290. // however, there is more than one alternative, then we are uncertain which
  35291. // alternative to predict and must continue looking for resolution. We may
  35292. // or may not discover an ambiguity in the future, even if there are no
  35293. // conflicting subsets this round.</p>
  35294. //
  35295. // <p>The biggest sin is to terminate early because it means we've made a
  35296. // decision but were uncertain as to the eventual outcome. We haven't used
  35297. // enough lookahead. On the other hand, announcing a conflict too late is no
  35298. // big deal; you will still have the conflict. It's just inefficient. It
  35299. // might even look until the end of file.</p>
  35300. //
  35301. // <p>No special consideration for semantic predicates is required because
  35302. // predicates are evaluated on-the-fly for full LL prediction, ensuring that
  35303. // no configuration contains a semantic context during the termination
  35304. // check.</p>
  35305. //
  35306. // <p><strong>CONFLICTING CONFIGS</strong></p>
  35307. //
  35308. // <p>Two configurations {@code (s, i, x)} and {@code (s, j, x')}, conflict
  35309. // when {@code i!=j} but {@code x=x'}. Because we merge all
  35310. // {@code (s, i, _)} configurations together, that means that there are at
  35311. // most {@code n} configurations associated with state {@code s} for
  35312. // {@code n} possible alternatives in the decision. The merged stacks
  35313. // complicate the comparison of configuration contexts {@code x} and
  35314. // {@code x'}. Sam checks to see if one is a subset of the other by calling
  35315. // merge and checking to see if the merged result is either {@code x} or
  35316. // {@code x'}. If the {@code x} associated with lowest alternative {@code i}
  35317. // is the superset, then {@code i} is the only possible prediction since the
  35318. // others resolve to {@code min(i)} as well. However, if {@code x} is
  35319. // associated with {@code j>i} then at least one stack configuration for
  35320. // {@code j} is not in conflict with alternative {@code i}. The algorithm
  35321. // should keep going, looking for more lookahead due to the uncertainty.</p>
  35322. //
  35323. // <p>For simplicity, I'm doing a equality check between {@code x} and
  35324. // {@code x'} that lets the algorithm continue to consume lookahead longer
  35325. // than necessary. The reason I like the equality is of course the
  35326. // simplicity but also because that is the test you need to detect the
  35327. // alternatives that are actually in conflict.</p>
  35328. //
  35329. // <p><strong>CONTINUE/STOP RULE</strong></p>
  35330. //
  35331. // <p>Continue if union of resolved alternative sets from non-conflicting and
  35332. // conflicting alternative subsets has more than one alternative. We are
  35333. // uncertain about which alternative to predict.</p>
  35334. //
  35335. // <p>The complete set of alternatives, {@code [i for (_,i,_)]}, tells us which
  35336. // alternatives are still in the running for the amount of input we've
  35337. // consumed at this point. The conflicting sets let us to strip away
  35338. // configurations that won't lead to more states because we resolve
  35339. // conflicts to the configuration with a minimum alternate for the
  35340. // conflicting set.</p>
  35341. //
  35342. // <p><strong>CASES</strong></p>
  35343. //
  35344. // <ul>
  35345. //
  35346. // <li>no conflicts and more than 1 alternative in set =&gt; continue</li>
  35347. //
  35348. // <li> {@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s, 3, z)},
  35349. // {@code (s', 1, y)}, {@code (s', 2, y)} yields non-conflicting set
  35350. // {@code {3}} U conflicting sets {@code min({1,2})} U {@code min({1,2})} =
  35351. // {@code {1,3}} =&gt; continue
  35352. // </li>
  35353. //
  35354. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 1, y)},
  35355. // {@code (s', 2, y)}, {@code (s'', 1, z)} yields non-conflicting set
  35356. // {@code {1}} U conflicting sets {@code min({1,2})} U {@code min({1,2})} =
  35357. // {@code {1}} =&gt; stop and predict 1</li>
  35358. //
  35359. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 1, y)},
  35360. // {@code (s', 2, y)} yields conflicting, reduced sets {@code {1}} U
  35361. // {@code {1}} = {@code {1}} =&gt; stop and predict 1, can announce
  35362. // ambiguity {@code {1,2}}</li>
  35363. //
  35364. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 2, y)},
  35365. // {@code (s', 3, y)} yields conflicting, reduced sets {@code {1}} U
  35366. // {@code {2}} = {@code {1,2}} =&gt; continue</li>
  35367. //
  35368. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 3, y)},
  35369. // {@code (s', 4, y)} yields conflicting, reduced sets {@code {1}} U
  35370. // {@code {3}} = {@code {1,3}} =&gt; continue</li>
  35371. //
  35372. // </ul>
  35373. //
  35374. // <p><strong>EXACT AMBIGUITY DETECTION</strong></p>
  35375. //
  35376. // <p>If all states report the same conflicting set of alternatives, then we
  35377. // know we have the exact ambiguity set.</p>
  35378. //
  35379. // <p><code>|A_<em>i</em>|&gt;1</code> and
  35380. // <code>A_<em>i</em> = A_<em>j</em></code> for all <em>i</em>, <em>j</em>.</p>
  35381. //
  35382. // <p>In other words, we continue examining lookahead until all {@code A_i}
  35383. // have more than one alternative and all {@code A_i} are the same. If
  35384. // {@code A={{1,2}, {1,3}}}, then regular LL prediction would terminate
  35385. // because the resolved set is {@code {1}}. To determine what the real
  35386. // ambiguity is, we have to know whether the ambiguity is between one and
  35387. // two or one and three so we keep going. We can only stop prediction when
  35388. // we need exact ambiguity detection when the sets look like
  35389. // {@code A={{1,2}}} or {@code {{1,2},{1,2}}}, etc...</p>
  35390. //
  35391. PredictionMode.resolvesToJustOneViableAlt = function(altsets) {
  35392. return PredictionMode.getSingleViableAlt(altsets);
  35393. };
  35394. //
  35395. // Determines if every alternative subset in {@code altsets} contains more
  35396. // than one alternative.
  35397. //
  35398. // @param altsets a collection of alternative subsets
  35399. // @return {@code true} if every {@link BitSet} in {@code altsets} has
  35400. // {@link BitSet//cardinality cardinality} &gt; 1, otherwise {@code false}
  35401. //
  35402. PredictionMode.allSubsetsConflict = function(altsets) {
  35403. return ! PredictionMode.hasNonConflictingAltSet(altsets);
  35404. };
  35405. //
  35406. // Determines if any single alternative subset in {@code altsets} contains
  35407. // exactly one alternative.
  35408. //
  35409. // @param altsets a collection of alternative subsets
  35410. // @return {@code true} if {@code altsets} contains a {@link BitSet} with
  35411. // {@link BitSet//cardinality cardinality} 1, otherwise {@code false}
  35412. //
  35413. PredictionMode.hasNonConflictingAltSet = function(altsets) {
  35414. for(var i=0;i<altsets.length;i++) {
  35415. var alts = altsets[i];
  35416. if (alts.length===1) {
  35417. return true;
  35418. }
  35419. }
  35420. return false;
  35421. };
  35422. //
  35423. // Determines if any single alternative subset in {@code altsets} contains
  35424. // more than one alternative.
  35425. //
  35426. // @param altsets a collection of alternative subsets
  35427. // @return {@code true} if {@code altsets} contains a {@link BitSet} with
  35428. // {@link BitSet//cardinality cardinality} &gt; 1, otherwise {@code false}
  35429. //
  35430. PredictionMode.hasConflictingAltSet = function(altsets) {
  35431. for(var i=0;i<altsets.length;i++) {
  35432. var alts = altsets[i];
  35433. if (alts.length>1) {
  35434. return true;
  35435. }
  35436. }
  35437. return false;
  35438. };
  35439. //
  35440. // Determines if every alternative subset in {@code altsets} is equivalent.
  35441. //
  35442. // @param altsets a collection of alternative subsets
  35443. // @return {@code true} if every member of {@code altsets} is equal to the
  35444. // others, otherwise {@code false}
  35445. //
  35446. PredictionMode.allSubsetsEqual = function(altsets) {
  35447. var first = null;
  35448. for(var i=0;i<altsets.length;i++) {
  35449. var alts = altsets[i];
  35450. if (first === null) {
  35451. first = alts;
  35452. } else if (alts!==first) {
  35453. return false;
  35454. }
  35455. }
  35456. return true;
  35457. };
  35458. //
  35459. // Returns the unique alternative predicted by all alternative subsets in
  35460. // {@code altsets}. If no such alternative exists, this method returns
  35461. // {@link ATN//INVALID_ALT_NUMBER}.
  35462. //
  35463. // @param altsets a collection of alternative subsets
  35464. //
  35465. PredictionMode.getUniqueAlt = function(altsets) {
  35466. var all = PredictionMode.getAlts(altsets);
  35467. if (all.length===1) {
  35468. return all.minValue();
  35469. } else {
  35470. return ATN.INVALID_ALT_NUMBER;
  35471. }
  35472. };
  35473. // Gets the complete set of represented alternatives for a collection of
  35474. // alternative subsets. This method returns the union of each {@link BitSet}
  35475. // in {@code altsets}.
  35476. //
  35477. // @param altsets a collection of alternative subsets
  35478. // @return the set of represented alternatives in {@code altsets}
  35479. //
  35480. PredictionMode.getAlts = function(altsets) {
  35481. var all = new BitSet();
  35482. altsets.map( function(alts) { all.or(alts); });
  35483. return all;
  35484. };
  35485. //
  35486. // This function gets the conflicting alt subsets from a configuration set.
  35487. // For each configuration {@code c} in {@code configs}:
  35488. //
  35489. // <pre>
  35490. // map[c] U= c.{@link ATNConfig//alt alt} // map hash/equals uses s and x, not
  35491. // alt and not pred
  35492. // </pre>
  35493. PredictionMode.getConflictingAltSubsets = function(configs) {
  35494. var configToAlts = new Map();
  35495. configToAlts.hashFunction = function(cfg) { hashStuff(cfg.state.stateNumber, cfg.context); };
  35496. configToAlts.equalsFunction = function(c1, c2) { return c1.state.stateNumber==c2.state.stateNumber && c1.context.equals(c2.context);}
  35497. configs.items.map(function(cfg) {
  35498. var alts = configToAlts.get(cfg);
  35499. if (alts === null) {
  35500. alts = new BitSet();
  35501. configToAlts.put(cfg, alts);
  35502. }
  35503. alts.add(cfg.alt);
  35504. });
  35505. return configToAlts.getValues();
  35506. };
  35507. //
  35508. // Get a map from state to alt subset from a configuration set. For each
  35509. // configuration {@code c} in {@code configs}:
  35510. //
  35511. // <pre>
  35512. // map[c.{@link ATNConfig//state state}] U= c.{@link ATNConfig//alt alt}
  35513. // </pre>
  35514. //
  35515. PredictionMode.getStateToAltMap = function(configs) {
  35516. var m = new AltDict();
  35517. configs.items.map(function(c) {
  35518. var alts = m.get(c.state);
  35519. if (alts === null) {
  35520. alts = new BitSet();
  35521. m.put(c.state, alts);
  35522. }
  35523. alts.add(c.alt);
  35524. });
  35525. return m;
  35526. };
  35527. PredictionMode.hasStateAssociatedWithOneAlt = function(configs) {
  35528. var values = PredictionMode.getStateToAltMap(configs).values();
  35529. for(var i=0;i<values.length;i++) {
  35530. if (values[i].length===1) {
  35531. return true;
  35532. }
  35533. }
  35534. return false;
  35535. };
  35536. PredictionMode.getSingleViableAlt = function(altsets) {
  35537. var result = null;
  35538. for(var i=0;i<altsets.length;i++) {
  35539. var alts = altsets[i];
  35540. var minAlt = alts.minValue();
  35541. if(result===null) {
  35542. result = minAlt;
  35543. } else if(result!==minAlt) { // more than 1 viable alt
  35544. return ATN.INVALID_ALT_NUMBER;
  35545. }
  35546. }
  35547. return result;
  35548. };
  35549. exports.PredictionMode = PredictionMode;
  35550. /***/ }),
  35551. /***/ "./node_modules/antlr4/atn/SemanticContext.js":
  35552. /*!****************************************************!*\
  35553. !*** ./node_modules/antlr4/atn/SemanticContext.js ***!
  35554. \****************************************************/
  35555. /*! no static exports found */
  35556. /***/ (function(module, exports, __webpack_require__) {
  35557. //
  35558. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  35559. * Use of this file is governed by the BSD 3-clause license that
  35560. * can be found in the LICENSE.txt file in the project root.
  35561. */
  35562. //
  35563. // A tree structure used to record the semantic context in which
  35564. // an ATN configuration is valid. It's either a single predicate,
  35565. // a conjunction {@code p1&&p2}, or a sum of products {@code p1||p2}.
  35566. //
  35567. // <p>I have scoped the {@link AND}, {@link OR}, and {@link Predicate} subclasses of
  35568. // {@link SemanticContext} within the scope of this outer class.</p>
  35569. //
  35570. var Set = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Set;
  35571. var Hash = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Hash;
  35572. function SemanticContext() {
  35573. return this;
  35574. }
  35575. SemanticContext.prototype.hashCode = function() {
  35576. var hash = new Hash();
  35577. this.updateHashCode(hash);
  35578. return hash.finish();
  35579. };
  35580. // For context independent predicates, we evaluate them without a local
  35581. // context (i.e., null context). That way, we can evaluate them without
  35582. // having to create proper rule-specific context during prediction (as
  35583. // opposed to the parser, which creates them naturally). In a practical
  35584. // sense, this avoids a cast exception from RuleContext to myruleContext.
  35585. //
  35586. // <p>For context dependent predicates, we must pass in a local context so that
  35587. // references such as $arg evaluate properly as _localctx.arg. We only
  35588. // capture context dependent predicates in the context in which we begin
  35589. // prediction, so we passed in the outer context here in case of context
  35590. // dependent predicate evaluation.</p>
  35591. //
  35592. SemanticContext.prototype.evaluate = function(parser, outerContext) {
  35593. };
  35594. //
  35595. // Evaluate the precedence predicates for the context and reduce the result.
  35596. //
  35597. // @param parser The parser instance.
  35598. // @param outerContext The current parser context object.
  35599. // @return The simplified semantic context after precedence predicates are
  35600. // evaluated, which will be one of the following values.
  35601. // <ul>
  35602. // <li>{@link //NONE}: if the predicate simplifies to {@code true} after
  35603. // precedence predicates are evaluated.</li>
  35604. // <li>{@code null}: if the predicate simplifies to {@code false} after
  35605. // precedence predicates are evaluated.</li>
  35606. // <li>{@code this}: if the semantic context is not changed as a result of
  35607. // precedence predicate evaluation.</li>
  35608. // <li>A non-{@code null} {@link SemanticContext}: the new simplified
  35609. // semantic context after precedence predicates are evaluated.</li>
  35610. // </ul>
  35611. //
  35612. SemanticContext.prototype.evalPrecedence = function(parser, outerContext) {
  35613. return this;
  35614. };
  35615. SemanticContext.andContext = function(a, b) {
  35616. if (a === null || a === SemanticContext.NONE) {
  35617. return b;
  35618. }
  35619. if (b === null || b === SemanticContext.NONE) {
  35620. return a;
  35621. }
  35622. var result = new AND(a, b);
  35623. if (result.opnds.length === 1) {
  35624. return result.opnds[0];
  35625. } else {
  35626. return result;
  35627. }
  35628. };
  35629. SemanticContext.orContext = function(a, b) {
  35630. if (a === null) {
  35631. return b;
  35632. }
  35633. if (b === null) {
  35634. return a;
  35635. }
  35636. if (a === SemanticContext.NONE || b === SemanticContext.NONE) {
  35637. return SemanticContext.NONE;
  35638. }
  35639. var result = new OR(a, b);
  35640. if (result.opnds.length === 1) {
  35641. return result.opnds[0];
  35642. } else {
  35643. return result;
  35644. }
  35645. };
  35646. function Predicate(ruleIndex, predIndex, isCtxDependent) {
  35647. SemanticContext.call(this);
  35648. this.ruleIndex = ruleIndex === undefined ? -1 : ruleIndex;
  35649. this.predIndex = predIndex === undefined ? -1 : predIndex;
  35650. this.isCtxDependent = isCtxDependent === undefined ? false : isCtxDependent; // e.g., $i ref in pred
  35651. return this;
  35652. }
  35653. Predicate.prototype = Object.create(SemanticContext.prototype);
  35654. Predicate.prototype.constructor = Predicate;
  35655. //The default {@link SemanticContext}, which is semantically equivalent to
  35656. //a predicate of the form {@code {true}?}.
  35657. //
  35658. SemanticContext.NONE = new Predicate();
  35659. Predicate.prototype.evaluate = function(parser, outerContext) {
  35660. var localctx = this.isCtxDependent ? outerContext : null;
  35661. return parser.sempred(localctx, this.ruleIndex, this.predIndex);
  35662. };
  35663. Predicate.prototype.updateHashCode = function(hash) {
  35664. hash.update(this.ruleIndex, this.predIndex, this.isCtxDependent);
  35665. };
  35666. Predicate.prototype.equals = function(other) {
  35667. if (this === other) {
  35668. return true;
  35669. } else if (!(other instanceof Predicate)) {
  35670. return false;
  35671. } else {
  35672. return this.ruleIndex === other.ruleIndex &&
  35673. this.predIndex === other.predIndex &&
  35674. this.isCtxDependent === other.isCtxDependent;
  35675. }
  35676. };
  35677. Predicate.prototype.toString = function() {
  35678. return "{" + this.ruleIndex + ":" + this.predIndex + "}?";
  35679. };
  35680. function PrecedencePredicate(precedence) {
  35681. SemanticContext.call(this);
  35682. this.precedence = precedence === undefined ? 0 : precedence;
  35683. }
  35684. PrecedencePredicate.prototype = Object.create(SemanticContext.prototype);
  35685. PrecedencePredicate.prototype.constructor = PrecedencePredicate;
  35686. PrecedencePredicate.prototype.evaluate = function(parser, outerContext) {
  35687. return parser.precpred(outerContext, this.precedence);
  35688. };
  35689. PrecedencePredicate.prototype.evalPrecedence = function(parser, outerContext) {
  35690. if (parser.precpred(outerContext, this.precedence)) {
  35691. return SemanticContext.NONE;
  35692. } else {
  35693. return null;
  35694. }
  35695. };
  35696. PrecedencePredicate.prototype.compareTo = function(other) {
  35697. return this.precedence - other.precedence;
  35698. };
  35699. PrecedencePredicate.prototype.updateHashCode = function(hash) {
  35700. hash.update(31);
  35701. };
  35702. PrecedencePredicate.prototype.equals = function(other) {
  35703. if (this === other) {
  35704. return true;
  35705. } else if (!(other instanceof PrecedencePredicate)) {
  35706. return false;
  35707. } else {
  35708. return this.precedence === other.precedence;
  35709. }
  35710. };
  35711. PrecedencePredicate.prototype.toString = function() {
  35712. return "{"+this.precedence+">=prec}?";
  35713. };
  35714. PrecedencePredicate.filterPrecedencePredicates = function(set) {
  35715. var result = [];
  35716. set.values().map( function(context) {
  35717. if (context instanceof PrecedencePredicate) {
  35718. result.push(context);
  35719. }
  35720. });
  35721. return result;
  35722. };
  35723. // A semantic context which is true whenever none of the contained contexts
  35724. // is false.
  35725. //
  35726. function AND(a, b) {
  35727. SemanticContext.call(this);
  35728. var operands = new Set();
  35729. if (a instanceof AND) {
  35730. a.opnds.map(function(o) {
  35731. operands.add(o);
  35732. });
  35733. } else {
  35734. operands.add(a);
  35735. }
  35736. if (b instanceof AND) {
  35737. b.opnds.map(function(o) {
  35738. operands.add(o);
  35739. });
  35740. } else {
  35741. operands.add(b);
  35742. }
  35743. var precedencePredicates = PrecedencePredicate.filterPrecedencePredicates(operands);
  35744. if (precedencePredicates.length > 0) {
  35745. // interested in the transition with the lowest precedence
  35746. var reduced = null;
  35747. precedencePredicates.map( function(p) {
  35748. if(reduced===null || p.precedence<reduced.precedence) {
  35749. reduced = p;
  35750. }
  35751. });
  35752. operands.add(reduced);
  35753. }
  35754. this.opnds = operands.values();
  35755. return this;
  35756. }
  35757. AND.prototype = Object.create(SemanticContext.prototype);
  35758. AND.prototype.constructor = AND;
  35759. AND.prototype.equals = function(other) {
  35760. if (this === other) {
  35761. return true;
  35762. } else if (!(other instanceof AND)) {
  35763. return false;
  35764. } else {
  35765. return this.opnds === other.opnds;
  35766. }
  35767. };
  35768. AND.prototype.updateHashCode = function(hash) {
  35769. hash.update(this.opnds, "AND");
  35770. };
  35771. //
  35772. // {@inheritDoc}
  35773. //
  35774. // <p>
  35775. // The evaluation of predicates by this context is short-circuiting, but
  35776. // unordered.</p>
  35777. //
  35778. AND.prototype.evaluate = function(parser, outerContext) {
  35779. for (var i = 0; i < this.opnds.length; i++) {
  35780. if (!this.opnds[i].evaluate(parser, outerContext)) {
  35781. return false;
  35782. }
  35783. }
  35784. return true;
  35785. };
  35786. AND.prototype.evalPrecedence = function(parser, outerContext) {
  35787. var differs = false;
  35788. var operands = [];
  35789. for (var i = 0; i < this.opnds.length; i++) {
  35790. var context = this.opnds[i];
  35791. var evaluated = context.evalPrecedence(parser, outerContext);
  35792. differs |= (evaluated !== context);
  35793. if (evaluated === null) {
  35794. // The AND context is false if any element is false
  35795. return null;
  35796. } else if (evaluated !== SemanticContext.NONE) {
  35797. // Reduce the result by skipping true elements
  35798. operands.push(evaluated);
  35799. }
  35800. }
  35801. if (!differs) {
  35802. return this;
  35803. }
  35804. if (operands.length === 0) {
  35805. // all elements were true, so the AND context is true
  35806. return SemanticContext.NONE;
  35807. }
  35808. var result = null;
  35809. operands.map(function(o) {
  35810. result = result === null ? o : SemanticContext.andContext(result, o);
  35811. });
  35812. return result;
  35813. };
  35814. AND.prototype.toString = function() {
  35815. var s = "";
  35816. this.opnds.map(function(o) {
  35817. s += "&& " + o.toString();
  35818. });
  35819. return s.length > 3 ? s.slice(3) : s;
  35820. };
  35821. //
  35822. // A semantic context which is true whenever at least one of the contained
  35823. // contexts is true.
  35824. //
  35825. function OR(a, b) {
  35826. SemanticContext.call(this);
  35827. var operands = new Set();
  35828. if (a instanceof OR) {
  35829. a.opnds.map(function(o) {
  35830. operands.add(o);
  35831. });
  35832. } else {
  35833. operands.add(a);
  35834. }
  35835. if (b instanceof OR) {
  35836. b.opnds.map(function(o) {
  35837. operands.add(o);
  35838. });
  35839. } else {
  35840. operands.add(b);
  35841. }
  35842. var precedencePredicates = PrecedencePredicate.filterPrecedencePredicates(operands);
  35843. if (precedencePredicates.length > 0) {
  35844. // interested in the transition with the highest precedence
  35845. var s = precedencePredicates.sort(function(a, b) {
  35846. return a.compareTo(b);
  35847. });
  35848. var reduced = s[s.length-1];
  35849. operands.add(reduced);
  35850. }
  35851. this.opnds = operands.values();
  35852. return this;
  35853. }
  35854. OR.prototype = Object.create(SemanticContext.prototype);
  35855. OR.prototype.constructor = OR;
  35856. OR.prototype.constructor = function(other) {
  35857. if (this === other) {
  35858. return true;
  35859. } else if (!(other instanceof OR)) {
  35860. return false;
  35861. } else {
  35862. return this.opnds === other.opnds;
  35863. }
  35864. };
  35865. OR.prototype.updateHashCode = function(hash) {
  35866. hash.update(this.opnds, "OR");
  35867. };
  35868. // <p>
  35869. // The evaluation of predicates by this context is short-circuiting, but
  35870. // unordered.</p>
  35871. //
  35872. OR.prototype.evaluate = function(parser, outerContext) {
  35873. for (var i = 0; i < this.opnds.length; i++) {
  35874. if (this.opnds[i].evaluate(parser, outerContext)) {
  35875. return true;
  35876. }
  35877. }
  35878. return false;
  35879. };
  35880. OR.prototype.evalPrecedence = function(parser, outerContext) {
  35881. var differs = false;
  35882. var operands = [];
  35883. for (var i = 0; i < this.opnds.length; i++) {
  35884. var context = this.opnds[i];
  35885. var evaluated = context.evalPrecedence(parser, outerContext);
  35886. differs |= (evaluated !== context);
  35887. if (evaluated === SemanticContext.NONE) {
  35888. // The OR context is true if any element is true
  35889. return SemanticContext.NONE;
  35890. } else if (evaluated !== null) {
  35891. // Reduce the result by skipping false elements
  35892. operands.push(evaluated);
  35893. }
  35894. }
  35895. if (!differs) {
  35896. return this;
  35897. }
  35898. if (operands.length === 0) {
  35899. // all elements were false, so the OR context is false
  35900. return null;
  35901. }
  35902. var result = null;
  35903. operands.map(function(o) {
  35904. return result === null ? o : SemanticContext.orContext(result, o);
  35905. });
  35906. return result;
  35907. };
  35908. OR.prototype.toString = function() {
  35909. var s = "";
  35910. this.opnds.map(function(o) {
  35911. s += "|| " + o.toString();
  35912. });
  35913. return s.length > 3 ? s.slice(3) : s;
  35914. };
  35915. exports.SemanticContext = SemanticContext;
  35916. exports.PrecedencePredicate = PrecedencePredicate;
  35917. exports.Predicate = Predicate;
  35918. /***/ }),
  35919. /***/ "./node_modules/antlr4/atn/Transition.js":
  35920. /*!***********************************************!*\
  35921. !*** ./node_modules/antlr4/atn/Transition.js ***!
  35922. \***********************************************/
  35923. /*! no static exports found */
  35924. /***/ (function(module, exports, __webpack_require__) {
  35925. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  35926. * Use of this file is governed by the BSD 3-clause license that
  35927. * can be found in the LICENSE.txt file in the project root.
  35928. */
  35929. //
  35930. // An ATN transition between any two ATN states. Subclasses define
  35931. // atom, set, epsilon, action, predicate, rule transitions.
  35932. //
  35933. // <p>This is a one way link. It emanates from a state (usually via a list of
  35934. // transitions) and has a target state.</p>
  35935. //
  35936. // <p>Since we never have to change the ATN transitions once we construct it,
  35937. // we can fix these transitions as specific classes. The DFA transitions
  35938. // on the other hand need to update the labels as it adds transitions to
  35939. // the states. We'll use the term Edge for the DFA to distinguish them from
  35940. // ATN transitions.</p>
  35941. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  35942. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  35943. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  35944. var Predicate = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").Predicate;
  35945. var PrecedencePredicate = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").PrecedencePredicate;
  35946. function Transition (target) {
  35947. // The target of this transition.
  35948. if (target===undefined || target===null) {
  35949. throw "target cannot be null.";
  35950. }
  35951. this.target = target;
  35952. // Are we epsilon, action, sempred?
  35953. this.isEpsilon = false;
  35954. this.label = null;
  35955. return this;
  35956. }
  35957. // constants for serialization
  35958. Transition.EPSILON = 1;
  35959. Transition.RANGE = 2;
  35960. Transition.RULE = 3;
  35961. Transition.PREDICATE = 4; // e.g., {isType(input.LT(1))}?
  35962. Transition.ATOM = 5;
  35963. Transition.ACTION = 6;
  35964. Transition.SET = 7; // ~(A|B) or ~atom, wildcard, which convert to next 2
  35965. Transition.NOT_SET = 8;
  35966. Transition.WILDCARD = 9;
  35967. Transition.PRECEDENCE = 10;
  35968. Transition.serializationNames = [
  35969. "INVALID",
  35970. "EPSILON",
  35971. "RANGE",
  35972. "RULE",
  35973. "PREDICATE",
  35974. "ATOM",
  35975. "ACTION",
  35976. "SET",
  35977. "NOT_SET",
  35978. "WILDCARD",
  35979. "PRECEDENCE"
  35980. ];
  35981. Transition.serializationTypes = {
  35982. EpsilonTransition: Transition.EPSILON,
  35983. RangeTransition: Transition.RANGE,
  35984. RuleTransition: Transition.RULE,
  35985. PredicateTransition: Transition.PREDICATE,
  35986. AtomTransition: Transition.ATOM,
  35987. ActionTransition: Transition.ACTION,
  35988. SetTransition: Transition.SET,
  35989. NotSetTransition: Transition.NOT_SET,
  35990. WildcardTransition: Transition.WILDCARD,
  35991. PrecedencePredicateTransition: Transition.PRECEDENCE
  35992. };
  35993. // TODO: make all transitions sets? no, should remove set edges
  35994. function AtomTransition(target, label) {
  35995. Transition.call(this, target);
  35996. this.label_ = label; // The token type or character value; or, signifies special label.
  35997. this.label = this.makeLabel();
  35998. this.serializationType = Transition.ATOM;
  35999. return this;
  36000. }
  36001. AtomTransition.prototype = Object.create(Transition.prototype);
  36002. AtomTransition.prototype.constructor = AtomTransition;
  36003. AtomTransition.prototype.makeLabel = function() {
  36004. var s = new IntervalSet();
  36005. s.addOne(this.label_);
  36006. return s;
  36007. };
  36008. AtomTransition.prototype.matches = function( symbol, minVocabSymbol, maxVocabSymbol) {
  36009. return this.label_ === symbol;
  36010. };
  36011. AtomTransition.prototype.toString = function() {
  36012. return this.label_;
  36013. };
  36014. function RuleTransition(ruleStart, ruleIndex, precedence, followState) {
  36015. Transition.call(this, ruleStart);
  36016. this.ruleIndex = ruleIndex; // ptr to the rule definition object for this rule ref
  36017. this.precedence = precedence;
  36018. this.followState = followState; // what node to begin computations following ref to rule
  36019. this.serializationType = Transition.RULE;
  36020. this.isEpsilon = true;
  36021. return this;
  36022. }
  36023. RuleTransition.prototype = Object.create(Transition.prototype);
  36024. RuleTransition.prototype.constructor = RuleTransition;
  36025. RuleTransition.prototype.matches = function(symbol, minVocabSymbol, maxVocabSymbol) {
  36026. return false;
  36027. };
  36028. function EpsilonTransition(target, outermostPrecedenceReturn) {
  36029. Transition.call(this, target);
  36030. this.serializationType = Transition.EPSILON;
  36031. this.isEpsilon = true;
  36032. this.outermostPrecedenceReturn = outermostPrecedenceReturn;
  36033. return this;
  36034. }
  36035. EpsilonTransition.prototype = Object.create(Transition.prototype);
  36036. EpsilonTransition.prototype.constructor = EpsilonTransition;
  36037. EpsilonTransition.prototype.matches = function( symbol, minVocabSymbol, maxVocabSymbol) {
  36038. return false;
  36039. };
  36040. EpsilonTransition.prototype.toString = function() {
  36041. return "epsilon";
  36042. };
  36043. function RangeTransition(target, start, stop) {
  36044. Transition.call(this, target);
  36045. this.serializationType = Transition.RANGE;
  36046. this.start = start;
  36047. this.stop = stop;
  36048. this.label = this.makeLabel();
  36049. return this;
  36050. }
  36051. RangeTransition.prototype = Object.create(Transition.prototype);
  36052. RangeTransition.prototype.constructor = RangeTransition;
  36053. RangeTransition.prototype.makeLabel = function() {
  36054. var s = new IntervalSet();
  36055. s.addRange(this.start, this.stop);
  36056. return s;
  36057. };
  36058. RangeTransition.prototype.matches = function(symbol, minVocabSymbol, maxVocabSymbol) {
  36059. return symbol >= this.start && symbol <= this.stop;
  36060. };
  36061. RangeTransition.prototype.toString = function() {
  36062. return "'" + String.fromCharCode(this.start) + "'..'" + String.fromCharCode(this.stop) + "'";
  36063. };
  36064. function AbstractPredicateTransition(target) {
  36065. Transition.call(this, target);
  36066. return this;
  36067. }
  36068. AbstractPredicateTransition.prototype = Object.create(Transition.prototype);
  36069. AbstractPredicateTransition.prototype.constructor = AbstractPredicateTransition;
  36070. function PredicateTransition(target, ruleIndex, predIndex, isCtxDependent) {
  36071. AbstractPredicateTransition.call(this, target);
  36072. this.serializationType = Transition.PREDICATE;
  36073. this.ruleIndex = ruleIndex;
  36074. this.predIndex = predIndex;
  36075. this.isCtxDependent = isCtxDependent; // e.g., $i ref in pred
  36076. this.isEpsilon = true;
  36077. return this;
  36078. }
  36079. PredicateTransition.prototype = Object.create(AbstractPredicateTransition.prototype);
  36080. PredicateTransition.prototype.constructor = PredicateTransition;
  36081. PredicateTransition.prototype.matches = function(symbol, minVocabSymbol, maxVocabSymbol) {
  36082. return false;
  36083. };
  36084. PredicateTransition.prototype.getPredicate = function() {
  36085. return new Predicate(this.ruleIndex, this.predIndex, this.isCtxDependent);
  36086. };
  36087. PredicateTransition.prototype.toString = function() {
  36088. return "pred_" + this.ruleIndex + ":" + this.predIndex;
  36089. };
  36090. function ActionTransition(target, ruleIndex, actionIndex, isCtxDependent) {
  36091. Transition.call(this, target);
  36092. this.serializationType = Transition.ACTION;
  36093. this.ruleIndex = ruleIndex;
  36094. this.actionIndex = actionIndex===undefined ? -1 : actionIndex;
  36095. this.isCtxDependent = isCtxDependent===undefined ? false : isCtxDependent; // e.g., $i ref in pred
  36096. this.isEpsilon = true;
  36097. return this;
  36098. }
  36099. ActionTransition.prototype = Object.create(Transition.prototype);
  36100. ActionTransition.prototype.constructor = ActionTransition;
  36101. ActionTransition.prototype.matches = function(symbol, minVocabSymbol, maxVocabSymbol) {
  36102. return false;
  36103. };
  36104. ActionTransition.prototype.toString = function() {
  36105. return "action_" + this.ruleIndex + ":" + this.actionIndex;
  36106. };
  36107. // A transition containing a set of values.
  36108. function SetTransition(target, set) {
  36109. Transition.call(this, target);
  36110. this.serializationType = Transition.SET;
  36111. if (set !==undefined && set !==null) {
  36112. this.label = set;
  36113. } else {
  36114. this.label = new IntervalSet();
  36115. this.label.addOne(Token.INVALID_TYPE);
  36116. }
  36117. return this;
  36118. }
  36119. SetTransition.prototype = Object.create(Transition.prototype);
  36120. SetTransition.prototype.constructor = SetTransition;
  36121. SetTransition.prototype.matches = function(symbol, minVocabSymbol, maxVocabSymbol) {
  36122. return this.label.contains(symbol);
  36123. };
  36124. SetTransition.prototype.toString = function() {
  36125. return this.label.toString();
  36126. };
  36127. function NotSetTransition(target, set) {
  36128. SetTransition.call(this, target, set);
  36129. this.serializationType = Transition.NOT_SET;
  36130. return this;
  36131. }
  36132. NotSetTransition.prototype = Object.create(SetTransition.prototype);
  36133. NotSetTransition.prototype.constructor = NotSetTransition;
  36134. NotSetTransition.prototype.matches = function(symbol, minVocabSymbol, maxVocabSymbol) {
  36135. return symbol >= minVocabSymbol && symbol <= maxVocabSymbol &&
  36136. !SetTransition.prototype.matches.call(this, symbol, minVocabSymbol, maxVocabSymbol);
  36137. };
  36138. NotSetTransition.prototype.toString = function() {
  36139. return '~' + SetTransition.prototype.toString.call(this);
  36140. };
  36141. function WildcardTransition(target) {
  36142. Transition.call(this, target);
  36143. this.serializationType = Transition.WILDCARD;
  36144. return this;
  36145. }
  36146. WildcardTransition.prototype = Object.create(Transition.prototype);
  36147. WildcardTransition.prototype.constructor = WildcardTransition;
  36148. WildcardTransition.prototype.matches = function(symbol, minVocabSymbol, maxVocabSymbol) {
  36149. return symbol >= minVocabSymbol && symbol <= maxVocabSymbol;
  36150. };
  36151. WildcardTransition.prototype.toString = function() {
  36152. return ".";
  36153. };
  36154. function PrecedencePredicateTransition(target, precedence) {
  36155. AbstractPredicateTransition.call(this, target);
  36156. this.serializationType = Transition.PRECEDENCE;
  36157. this.precedence = precedence;
  36158. this.isEpsilon = true;
  36159. return this;
  36160. }
  36161. PrecedencePredicateTransition.prototype = Object.create(AbstractPredicateTransition.prototype);
  36162. PrecedencePredicateTransition.prototype.constructor = PrecedencePredicateTransition;
  36163. PrecedencePredicateTransition.prototype.matches = function(symbol, minVocabSymbol, maxVocabSymbol) {
  36164. return false;
  36165. };
  36166. PrecedencePredicateTransition.prototype.getPredicate = function() {
  36167. return new PrecedencePredicate(this.precedence);
  36168. };
  36169. PrecedencePredicateTransition.prototype.toString = function() {
  36170. return this.precedence + " >= _p";
  36171. };
  36172. exports.Transition = Transition;
  36173. exports.AtomTransition = AtomTransition;
  36174. exports.SetTransition = SetTransition;
  36175. exports.NotSetTransition = NotSetTransition;
  36176. exports.RuleTransition = RuleTransition;
  36177. exports.ActionTransition = ActionTransition;
  36178. exports.EpsilonTransition = EpsilonTransition;
  36179. exports.RangeTransition = RangeTransition;
  36180. exports.WildcardTransition = WildcardTransition;
  36181. exports.PredicateTransition = PredicateTransition;
  36182. exports.PrecedencePredicateTransition = PrecedencePredicateTransition;
  36183. exports.AbstractPredicateTransition = AbstractPredicateTransition;
  36184. /***/ }),
  36185. /***/ "./node_modules/antlr4/atn/index.js":
  36186. /*!******************************************!*\
  36187. !*** ./node_modules/antlr4/atn/index.js ***!
  36188. \******************************************/
  36189. /*! no static exports found */
  36190. /***/ (function(module, exports, __webpack_require__) {
  36191. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  36192. * Use of this file is governed by the BSD 3-clause license that
  36193. * can be found in the LICENSE.txt file in the project root.
  36194. */
  36195. exports.ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  36196. exports.ATNDeserializer = __webpack_require__(/*! ./ATNDeserializer */ "./node_modules/antlr4/atn/ATNDeserializer.js").ATNDeserializer;
  36197. exports.LexerATNSimulator = __webpack_require__(/*! ./LexerATNSimulator */ "./node_modules/antlr4/atn/LexerATNSimulator.js").LexerATNSimulator;
  36198. exports.ParserATNSimulator = __webpack_require__(/*! ./ParserATNSimulator */ "./node_modules/antlr4/atn/ParserATNSimulator.js").ParserATNSimulator;
  36199. exports.PredictionMode = __webpack_require__(/*! ./PredictionMode */ "./node_modules/antlr4/atn/PredictionMode.js").PredictionMode;
  36200. /***/ }),
  36201. /***/ "./node_modules/antlr4/dfa/DFA.js":
  36202. /*!****************************************!*\
  36203. !*** ./node_modules/antlr4/dfa/DFA.js ***!
  36204. \****************************************/
  36205. /*! no static exports found */
  36206. /***/ (function(module, exports, __webpack_require__) {
  36207. //
  36208. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  36209. * Use of this file is governed by the BSD 3-clause license that
  36210. * can be found in the LICENSE.txt file in the project root.
  36211. */
  36212. var Set = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").Set;
  36213. var DFAState = __webpack_require__(/*! ./DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  36214. var StarLoopEntryState = __webpack_require__(/*! ../atn/ATNState */ "./node_modules/antlr4/atn/ATNState.js").StarLoopEntryState;
  36215. var ATNConfigSet = __webpack_require__(/*! ./../atn/ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  36216. var DFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").DFASerializer;
  36217. var LexerDFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").LexerDFASerializer;
  36218. function DFA(atnStartState, decision) {
  36219. if (decision === undefined) {
  36220. decision = 0;
  36221. }
  36222. // From which ATN state did we create this DFA?
  36223. this.atnStartState = atnStartState;
  36224. this.decision = decision;
  36225. // A set of all DFA states. Use {@link Map} so we can get old state back
  36226. // ({@link Set} only allows you to see if it's there).
  36227. this._states = new Set();
  36228. this.s0 = null;
  36229. // {@code true} if this DFA is for a precedence decision; otherwise,
  36230. // {@code false}. This is the backing field for {@link //isPrecedenceDfa},
  36231. // {@link //setPrecedenceDfa}.
  36232. this.precedenceDfa = false;
  36233. if (atnStartState instanceof StarLoopEntryState)
  36234. {
  36235. if (atnStartState.isPrecedenceDecision) {
  36236. this.precedenceDfa = true;
  36237. var precedenceState = new DFAState(null, new ATNConfigSet());
  36238. precedenceState.edges = [];
  36239. precedenceState.isAcceptState = false;
  36240. precedenceState.requiresFullContext = false;
  36241. this.s0 = precedenceState;
  36242. }
  36243. }
  36244. return this;
  36245. }
  36246. // Get the start state for a specific precedence value.
  36247. //
  36248. // @param precedence The current precedence.
  36249. // @return The start state corresponding to the specified precedence, or
  36250. // {@code null} if no start state exists for the specified precedence.
  36251. //
  36252. // @throws IllegalStateException if this is not a precedence DFA.
  36253. // @see //isPrecedenceDfa()
  36254. DFA.prototype.getPrecedenceStartState = function(precedence) {
  36255. if (!(this.precedenceDfa)) {
  36256. throw ("Only precedence DFAs may contain a precedence start state.");
  36257. }
  36258. // s0.edges is never null for a precedence DFA
  36259. if (precedence < 0 || precedence >= this.s0.edges.length) {
  36260. return null;
  36261. }
  36262. return this.s0.edges[precedence] || null;
  36263. };
  36264. // Set the start state for a specific precedence value.
  36265. //
  36266. // @param precedence The current precedence.
  36267. // @param startState The start state corresponding to the specified
  36268. // precedence.
  36269. //
  36270. // @throws IllegalStateException if this is not a precedence DFA.
  36271. // @see //isPrecedenceDfa()
  36272. //
  36273. DFA.prototype.setPrecedenceStartState = function(precedence, startState) {
  36274. if (!(this.precedenceDfa)) {
  36275. throw ("Only precedence DFAs may contain a precedence start state.");
  36276. }
  36277. if (precedence < 0) {
  36278. return;
  36279. }
  36280. // synchronization on s0 here is ok. when the DFA is turned into a
  36281. // precedence DFA, s0 will be initialized once and not updated again
  36282. // s0.edges is never null for a precedence DFA
  36283. this.s0.edges[precedence] = startState;
  36284. };
  36285. //
  36286. // Sets whether this is a precedence DFA. If the specified value differs
  36287. // from the current DFA configuration, the following actions are taken;
  36288. // otherwise no changes are made to the current DFA.
  36289. //
  36290. // <ul>
  36291. // <li>The {@link //states} map is cleared</li>
  36292. // <li>If {@code precedenceDfa} is {@code false}, the initial state
  36293. // {@link //s0} is set to {@code null}; otherwise, it is initialized to a new
  36294. // {@link DFAState} with an empty outgoing {@link DFAState//edges} array to
  36295. // store the start states for individual precedence values.</li>
  36296. // <li>The {@link //precedenceDfa} field is updated</li>
  36297. // </ul>
  36298. //
  36299. // @param precedenceDfa {@code true} if this is a precedence DFA; otherwise,
  36300. // {@code false}
  36301. DFA.prototype.setPrecedenceDfa = function(precedenceDfa) {
  36302. if (this.precedenceDfa!==precedenceDfa) {
  36303. this._states = new DFAStatesSet();
  36304. if (precedenceDfa) {
  36305. var precedenceState = new DFAState(null, new ATNConfigSet());
  36306. precedenceState.edges = [];
  36307. precedenceState.isAcceptState = false;
  36308. precedenceState.requiresFullContext = false;
  36309. this.s0 = precedenceState;
  36310. } else {
  36311. this.s0 = null;
  36312. }
  36313. this.precedenceDfa = precedenceDfa;
  36314. }
  36315. };
  36316. Object.defineProperty(DFA.prototype, "states", {
  36317. get : function() {
  36318. return this._states;
  36319. }
  36320. });
  36321. // Return a list of all states in this DFA, ordered by state number.
  36322. DFA.prototype.sortedStates = function() {
  36323. var list = this._states.values();
  36324. return list.sort(function(a, b) {
  36325. return a.stateNumber - b.stateNumber;
  36326. });
  36327. };
  36328. DFA.prototype.toString = function(literalNames, symbolicNames) {
  36329. literalNames = literalNames || null;
  36330. symbolicNames = symbolicNames || null;
  36331. if (this.s0 === null) {
  36332. return "";
  36333. }
  36334. var serializer = new DFASerializer(this, literalNames, symbolicNames);
  36335. return serializer.toString();
  36336. };
  36337. DFA.prototype.toLexerString = function() {
  36338. if (this.s0 === null) {
  36339. return "";
  36340. }
  36341. var serializer = new LexerDFASerializer(this);
  36342. return serializer.toString();
  36343. };
  36344. exports.DFA = DFA;
  36345. /***/ }),
  36346. /***/ "./node_modules/antlr4/dfa/DFASerializer.js":
  36347. /*!**************************************************!*\
  36348. !*** ./node_modules/antlr4/dfa/DFASerializer.js ***!
  36349. \**************************************************/
  36350. /*! no static exports found */
  36351. /***/ (function(module, exports) {
  36352. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  36353. * Use of this file is governed by the BSD 3-clause license that
  36354. * can be found in the LICENSE.txt file in the project root.
  36355. */
  36356. // A DFA walker that knows how to dump them to serialized strings.#/
  36357. function DFASerializer(dfa, literalNames, symbolicNames) {
  36358. this.dfa = dfa;
  36359. this.literalNames = literalNames || [];
  36360. this.symbolicNames = symbolicNames || [];
  36361. return this;
  36362. }
  36363. DFASerializer.prototype.toString = function() {
  36364. if(this.dfa.s0 === null) {
  36365. return null;
  36366. }
  36367. var buf = "";
  36368. var states = this.dfa.sortedStates();
  36369. for(var i=0;i<states.length;i++) {
  36370. var s = states[i];
  36371. if(s.edges!==null) {
  36372. var n = s.edges.length;
  36373. for(var j=0;j<n;j++) {
  36374. var t = s.edges[j] || null;
  36375. if(t!==null && t.stateNumber !== 0x7FFFFFFF) {
  36376. buf = buf.concat(this.getStateString(s));
  36377. buf = buf.concat("-");
  36378. buf = buf.concat(this.getEdgeLabel(j));
  36379. buf = buf.concat("->");
  36380. buf = buf.concat(this.getStateString(t));
  36381. buf = buf.concat('\n');
  36382. }
  36383. }
  36384. }
  36385. }
  36386. return buf.length===0 ? null : buf;
  36387. };
  36388. DFASerializer.prototype.getEdgeLabel = function(i) {
  36389. if (i===0) {
  36390. return "EOF";
  36391. } else if(this.literalNames !==null || this.symbolicNames!==null) {
  36392. return this.literalNames[i-1] || this.symbolicNames[i-1];
  36393. } else {
  36394. return String.fromCharCode(i-1);
  36395. }
  36396. };
  36397. DFASerializer.prototype.getStateString = function(s) {
  36398. var baseStateStr = ( s.isAcceptState ? ":" : "") + "s" + s.stateNumber + ( s.requiresFullContext ? "^" : "");
  36399. if(s.isAcceptState) {
  36400. if (s.predicates !== null) {
  36401. return baseStateStr + "=>" + s.predicates.toString();
  36402. } else {
  36403. return baseStateStr + "=>" + s.prediction.toString();
  36404. }
  36405. } else {
  36406. return baseStateStr;
  36407. }
  36408. };
  36409. function LexerDFASerializer(dfa) {
  36410. DFASerializer.call(this, dfa, null);
  36411. return this;
  36412. }
  36413. LexerDFASerializer.prototype = Object.create(DFASerializer.prototype);
  36414. LexerDFASerializer.prototype.constructor = LexerDFASerializer;
  36415. LexerDFASerializer.prototype.getEdgeLabel = function(i) {
  36416. return "'" + String.fromCharCode(i) + "'";
  36417. };
  36418. exports.DFASerializer = DFASerializer;
  36419. exports.LexerDFASerializer = LexerDFASerializer;
  36420. /***/ }),
  36421. /***/ "./node_modules/antlr4/dfa/DFAState.js":
  36422. /*!*********************************************!*\
  36423. !*** ./node_modules/antlr4/dfa/DFAState.js ***!
  36424. \*********************************************/
  36425. /*! no static exports found */
  36426. /***/ (function(module, exports, __webpack_require__) {
  36427. //
  36428. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  36429. * Use of this file is governed by the BSD 3-clause license that
  36430. * can be found in the LICENSE.txt file in the project root.
  36431. */
  36432. ///
  36433. var ATNConfigSet = __webpack_require__(/*! ./../atn/ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  36434. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  36435. var Hash = Utils.Hash;
  36436. var Set = Utils.Set;
  36437. // Map a predicate to a predicted alternative.///
  36438. function PredPrediction(pred, alt) {
  36439. this.alt = alt;
  36440. this.pred = pred;
  36441. return this;
  36442. }
  36443. PredPrediction.prototype.toString = function() {
  36444. return "(" + this.pred + ", " + this.alt + ")";
  36445. };
  36446. // A DFA state represents a set of possible ATN configurations.
  36447. // As Aho, Sethi, Ullman p. 117 says "The DFA uses its state
  36448. // to keep track of all possible states the ATN can be in after
  36449. // reading each input symbol. That is to say, after reading
  36450. // input a1a2..an, the DFA is in a state that represents the
  36451. // subset T of the states of the ATN that are reachable from the
  36452. // ATN's start state along some path labeled a1a2..an."
  36453. // In conventional NFA&rarr;DFA conversion, therefore, the subset T
  36454. // would be a bitset representing the set of states the
  36455. // ATN could be in. We need to track the alt predicted by each
  36456. // state as well, however. More importantly, we need to maintain
  36457. // a stack of states, tracking the closure operations as they
  36458. // jump from rule to rule, emulating rule invocations (method calls).
  36459. // I have to add a stack to simulate the proper lookahead sequences for
  36460. // the underlying LL grammar from which the ATN was derived.
  36461. //
  36462. // <p>I use a set of ATNConfig objects not simple states. An ATNConfig
  36463. // is both a state (ala normal conversion) and a RuleContext describing
  36464. // the chain of rules (if any) followed to arrive at that state.</p>
  36465. //
  36466. // <p>A DFA state may have multiple references to a particular state,
  36467. // but with different ATN contexts (with same or different alts)
  36468. // meaning that state was reached via a different set of rule invocations.</p>
  36469. // /
  36470. function DFAState(stateNumber, configs) {
  36471. if (stateNumber === null) {
  36472. stateNumber = -1;
  36473. }
  36474. if (configs === null) {
  36475. configs = new ATNConfigSet();
  36476. }
  36477. this.stateNumber = stateNumber;
  36478. this.configs = configs;
  36479. // {@code edges[symbol]} points to target of symbol. Shift up by 1 so (-1)
  36480. // {@link Token//EOF} maps to {@code edges[0]}.
  36481. this.edges = null;
  36482. this.isAcceptState = false;
  36483. // if accept state, what ttype do we match or alt do we predict?
  36484. // This is set to {@link ATN//INVALID_ALT_NUMBER} when {@link
  36485. // //predicates}{@code !=null} or
  36486. // {@link //requiresFullContext}.
  36487. this.prediction = 0;
  36488. this.lexerActionExecutor = null;
  36489. // Indicates that this state was created during SLL prediction that
  36490. // discovered a conflict between the configurations in the state. Future
  36491. // {@link ParserATNSimulator//execATN} invocations immediately jumped doing
  36492. // full context prediction if this field is true.
  36493. this.requiresFullContext = false;
  36494. // During SLL parsing, this is a list of predicates associated with the
  36495. // ATN configurations of the DFA state. When we have predicates,
  36496. // {@link //requiresFullContext} is {@code false} since full context
  36497. // prediction evaluates predicates
  36498. // on-the-fly. If this is not null, then {@link //prediction} is
  36499. // {@link ATN//INVALID_ALT_NUMBER}.
  36500. //
  36501. // <p>We only use these for non-{@link //requiresFullContext} but
  36502. // conflicting states. That
  36503. // means we know from the context (it's $ or we don't dip into outer
  36504. // context) that it's an ambiguity not a conflict.</p>
  36505. //
  36506. // <p>This list is computed by {@link
  36507. // ParserATNSimulator//predicateDFAState}.</p>
  36508. this.predicates = null;
  36509. return this;
  36510. }
  36511. // Get the set of all alts mentioned by all ATN configurations in this
  36512. // DFA state.
  36513. DFAState.prototype.getAltSet = function() {
  36514. var alts = new Set();
  36515. if (this.configs !== null) {
  36516. for (var i = 0; i < this.configs.length; i++) {
  36517. var c = this.configs[i];
  36518. alts.add(c.alt);
  36519. }
  36520. }
  36521. if (alts.length === 0) {
  36522. return null;
  36523. } else {
  36524. return alts;
  36525. }
  36526. };
  36527. // Two {@link DFAState} instances are equal if their ATN configuration sets
  36528. // are the same. This method is used to see if a state already exists.
  36529. //
  36530. // <p>Because the number of alternatives and number of ATN configurations are
  36531. // finite, there is a finite number of DFA states that can be processed.
  36532. // This is necessary to show that the algorithm terminates.</p>
  36533. //
  36534. // <p>Cannot test the DFA state numbers here because in
  36535. // {@link ParserATNSimulator//addDFAState} we need to know if any other state
  36536. // exists that has this exact set of ATN configurations. The
  36537. // {@link //stateNumber} is irrelevant.</p>
  36538. DFAState.prototype.equals = function(other) {
  36539. // compare set of ATN configurations in this set with other
  36540. return this === other ||
  36541. (other instanceof DFAState &&
  36542. this.configs.equals(other.configs));
  36543. };
  36544. DFAState.prototype.toString = function() {
  36545. var s = "" + this.stateNumber + ":" + this.configs;
  36546. if(this.isAcceptState) {
  36547. s = s + "=>";
  36548. if (this.predicates !== null)
  36549. s = s + this.predicates;
  36550. else
  36551. s = s + this.prediction;
  36552. }
  36553. return s;
  36554. };
  36555. DFAState.prototype.hashCode = function() {
  36556. var hash = new Hash();
  36557. hash.update(this.configs);
  36558. if(this.isAcceptState) {
  36559. if (this.predicates !== null)
  36560. hash.update(this.predicates);
  36561. else
  36562. hash.update(this.prediction);
  36563. }
  36564. return hash.finish();
  36565. };
  36566. exports.DFAState = DFAState;
  36567. exports.PredPrediction = PredPrediction;
  36568. /***/ }),
  36569. /***/ "./node_modules/antlr4/dfa/index.js":
  36570. /*!******************************************!*\
  36571. !*** ./node_modules/antlr4/dfa/index.js ***!
  36572. \******************************************/
  36573. /*! no static exports found */
  36574. /***/ (function(module, exports, __webpack_require__) {
  36575. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  36576. * Use of this file is governed by the BSD 3-clause license that
  36577. * can be found in the LICENSE.txt file in the project root.
  36578. */
  36579. exports.DFA = __webpack_require__(/*! ./DFA */ "./node_modules/antlr4/dfa/DFA.js").DFA;
  36580. exports.DFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").DFASerializer;
  36581. exports.LexerDFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").LexerDFASerializer;
  36582. exports.PredPrediction = __webpack_require__(/*! ./DFAState */ "./node_modules/antlr4/dfa/DFAState.js").PredPrediction;
  36583. /***/ }),
  36584. /***/ "./node_modules/antlr4/error/DiagnosticErrorListener.js":
  36585. /*!**************************************************************!*\
  36586. !*** ./node_modules/antlr4/error/DiagnosticErrorListener.js ***!
  36587. \**************************************************************/
  36588. /*! no static exports found */
  36589. /***/ (function(module, exports, __webpack_require__) {
  36590. //
  36591. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  36592. * Use of this file is governed by the BSD 3-clause license that
  36593. * can be found in the LICENSE.txt file in the project root.
  36594. */
  36595. //
  36596. //
  36597. // This implementation of {@link ANTLRErrorListener} can be used to identify
  36598. // certain potential correctness and performance problems in grammars. "Reports"
  36599. // are made by calling {@link Parser//notifyErrorListeners} with the appropriate
  36600. // message.
  36601. //
  36602. // <ul>
  36603. // <li><b>Ambiguities</b>: These are cases where more than one path through the
  36604. // grammar can match the input.</li>
  36605. // <li><b>Weak context sensitivity</b>: These are cases where full-context
  36606. // prediction resolved an SLL conflict to a unique alternative which equaled the
  36607. // minimum alternative of the SLL conflict.</li>
  36608. // <li><b>Strong (forced) context sensitivity</b>: These are cases where the
  36609. // full-context prediction resolved an SLL conflict to a unique alternative,
  36610. // <em>and</em> the minimum alternative of the SLL conflict was found to not be
  36611. // a truly viable alternative. Two-stage parsing cannot be used for inputs where
  36612. // this situation occurs.</li>
  36613. // </ul>
  36614. var BitSet = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").BitSet;
  36615. var ErrorListener = __webpack_require__(/*! ./ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ErrorListener;
  36616. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  36617. function DiagnosticErrorListener(exactOnly) {
  36618. ErrorListener.call(this);
  36619. exactOnly = exactOnly || true;
  36620. // whether all ambiguities or only exact ambiguities are reported.
  36621. this.exactOnly = exactOnly;
  36622. return this;
  36623. }
  36624. DiagnosticErrorListener.prototype = Object.create(ErrorListener.prototype);
  36625. DiagnosticErrorListener.prototype.constructor = DiagnosticErrorListener;
  36626. DiagnosticErrorListener.prototype.reportAmbiguity = function(recognizer, dfa,
  36627. startIndex, stopIndex, exact, ambigAlts, configs) {
  36628. if (this.exactOnly && !exact) {
  36629. return;
  36630. }
  36631. var msg = "reportAmbiguity d=" +
  36632. this.getDecisionDescription(recognizer, dfa) +
  36633. ": ambigAlts=" +
  36634. this.getConflictingAlts(ambigAlts, configs) +
  36635. ", input='" +
  36636. recognizer.getTokenStream().getText(new Interval(startIndex, stopIndex)) + "'";
  36637. recognizer.notifyErrorListeners(msg);
  36638. };
  36639. DiagnosticErrorListener.prototype.reportAttemptingFullContext = function(
  36640. recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs) {
  36641. var msg = "reportAttemptingFullContext d=" +
  36642. this.getDecisionDescription(recognizer, dfa) +
  36643. ", input='" +
  36644. recognizer.getTokenStream().getText(new Interval(startIndex, stopIndex)) + "'";
  36645. recognizer.notifyErrorListeners(msg);
  36646. };
  36647. DiagnosticErrorListener.prototype.reportContextSensitivity = function(
  36648. recognizer, dfa, startIndex, stopIndex, prediction, configs) {
  36649. var msg = "reportContextSensitivity d=" +
  36650. this.getDecisionDescription(recognizer, dfa) +
  36651. ", input='" +
  36652. recognizer.getTokenStream().getText(new Interval(startIndex, stopIndex)) + "'";
  36653. recognizer.notifyErrorListeners(msg);
  36654. };
  36655. DiagnosticErrorListener.prototype.getDecisionDescription = function(recognizer, dfa) {
  36656. var decision = dfa.decision;
  36657. var ruleIndex = dfa.atnStartState.ruleIndex;
  36658. var ruleNames = recognizer.ruleNames;
  36659. if (ruleIndex < 0 || ruleIndex >= ruleNames.length) {
  36660. return "" + decision;
  36661. }
  36662. var ruleName = ruleNames[ruleIndex] || null;
  36663. if (ruleName === null || ruleName.length === 0) {
  36664. return "" + decision;
  36665. }
  36666. return "" + decision + " (" + ruleName + ")";
  36667. };
  36668. //
  36669. // Computes the set of conflicting or ambiguous alternatives from a
  36670. // configuration set, if that information was not already provided by the
  36671. // parser.
  36672. //
  36673. // @param reportedAlts The set of conflicting or ambiguous alternatives, as
  36674. // reported by the parser.
  36675. // @param configs The conflicting or ambiguous configuration set.
  36676. // @return Returns {@code reportedAlts} if it is not {@code null}, otherwise
  36677. // returns the set of alternatives represented in {@code configs}.
  36678. //
  36679. DiagnosticErrorListener.prototype.getConflictingAlts = function(reportedAlts, configs) {
  36680. if (reportedAlts !== null) {
  36681. return reportedAlts;
  36682. }
  36683. var result = new BitSet();
  36684. for (var i = 0; i < configs.items.length; i++) {
  36685. result.add(configs.items[i].alt);
  36686. }
  36687. return "{" + result.values().join(", ") + "}";
  36688. };
  36689. exports.DiagnosticErrorListener = DiagnosticErrorListener;
  36690. /***/ }),
  36691. /***/ "./node_modules/antlr4/error/ErrorListener.js":
  36692. /*!****************************************************!*\
  36693. !*** ./node_modules/antlr4/error/ErrorListener.js ***!
  36694. \****************************************************/
  36695. /*! no static exports found */
  36696. /***/ (function(module, exports) {
  36697. //
  36698. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  36699. * Use of this file is governed by the BSD 3-clause license that
  36700. * can be found in the LICENSE.txt file in the project root.
  36701. */
  36702. // Provides an empty default implementation of {@link ANTLRErrorListener}. The
  36703. // default implementation of each method does nothing, but can be overridden as
  36704. // necessary.
  36705. function ErrorListener() {
  36706. return this;
  36707. }
  36708. ErrorListener.prototype.syntaxError = function(recognizer, offendingSymbol, line, column, msg, e) {
  36709. };
  36710. ErrorListener.prototype.reportAmbiguity = function(recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs) {
  36711. };
  36712. ErrorListener.prototype.reportAttemptingFullContext = function(recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs) {
  36713. };
  36714. ErrorListener.prototype.reportContextSensitivity = function(recognizer, dfa, startIndex, stopIndex, prediction, configs) {
  36715. };
  36716. function ConsoleErrorListener() {
  36717. ErrorListener.call(this);
  36718. return this;
  36719. }
  36720. ConsoleErrorListener.prototype = Object.create(ErrorListener.prototype);
  36721. ConsoleErrorListener.prototype.constructor = ConsoleErrorListener;
  36722. //
  36723. // Provides a default instance of {@link ConsoleErrorListener}.
  36724. //
  36725. ConsoleErrorListener.INSTANCE = new ConsoleErrorListener();
  36726. //
  36727. // {@inheritDoc}
  36728. //
  36729. // <p>
  36730. // This implementation prints messages to {@link System//err} containing the
  36731. // values of {@code line}, {@code charPositionInLine}, and {@code msg} using
  36732. // the following format.</p>
  36733. //
  36734. // <pre>
  36735. // line <em>line</em>:<em>charPositionInLine</em> <em>msg</em>
  36736. // </pre>
  36737. //
  36738. ConsoleErrorListener.prototype.syntaxError = function(recognizer, offendingSymbol, line, column, msg, e) {
  36739. console.error("line " + line + ":" + column + " " + msg);
  36740. };
  36741. function ProxyErrorListener(delegates) {
  36742. ErrorListener.call(this);
  36743. if (delegates===null) {
  36744. throw "delegates";
  36745. }
  36746. this.delegates = delegates;
  36747. return this;
  36748. }
  36749. ProxyErrorListener.prototype = Object.create(ErrorListener.prototype);
  36750. ProxyErrorListener.prototype.constructor = ProxyErrorListener;
  36751. ProxyErrorListener.prototype.syntaxError = function(recognizer, offendingSymbol, line, column, msg, e) {
  36752. this.delegates.map(function(d) { d.syntaxError(recognizer, offendingSymbol, line, column, msg, e); });
  36753. };
  36754. ProxyErrorListener.prototype.reportAmbiguity = function(recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs) {
  36755. this.delegates.map(function(d) { d.reportAmbiguity(recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs); });
  36756. };
  36757. ProxyErrorListener.prototype.reportAttemptingFullContext = function(recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs) {
  36758. this.delegates.map(function(d) { d.reportAttemptingFullContext(recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs); });
  36759. };
  36760. ProxyErrorListener.prototype.reportContextSensitivity = function(recognizer, dfa, startIndex, stopIndex, prediction, configs) {
  36761. this.delegates.map(function(d) { d.reportContextSensitivity(recognizer, dfa, startIndex, stopIndex, prediction, configs); });
  36762. };
  36763. exports.ErrorListener = ErrorListener;
  36764. exports.ConsoleErrorListener = ConsoleErrorListener;
  36765. exports.ProxyErrorListener = ProxyErrorListener;
  36766. /***/ }),
  36767. /***/ "./node_modules/antlr4/error/ErrorStrategy.js":
  36768. /*!****************************************************!*\
  36769. !*** ./node_modules/antlr4/error/ErrorStrategy.js ***!
  36770. \****************************************************/
  36771. /*! no static exports found */
  36772. /***/ (function(module, exports, __webpack_require__) {
  36773. //
  36774. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  36775. * Use of this file is governed by the BSD 3-clause license that
  36776. * can be found in the LICENSE.txt file in the project root.
  36777. */
  36778. //
  36779. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  36780. var Errors = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js");
  36781. var NoViableAltException = Errors.NoViableAltException;
  36782. var InputMismatchException = Errors.InputMismatchException;
  36783. var FailedPredicateException = Errors.FailedPredicateException;
  36784. var ParseCancellationException = Errors.ParseCancellationException;
  36785. var ATNState = __webpack_require__(/*! ./../atn/ATNState */ "./node_modules/antlr4/atn/ATNState.js").ATNState;
  36786. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  36787. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  36788. function ErrorStrategy() {
  36789. }
  36790. ErrorStrategy.prototype.reset = function(recognizer){
  36791. };
  36792. ErrorStrategy.prototype.recoverInline = function(recognizer){
  36793. };
  36794. ErrorStrategy.prototype.recover = function(recognizer, e){
  36795. };
  36796. ErrorStrategy.prototype.sync = function(recognizer){
  36797. };
  36798. ErrorStrategy.prototype.inErrorRecoveryMode = function(recognizer){
  36799. };
  36800. ErrorStrategy.prototype.reportError = function(recognizer){
  36801. };
  36802. // This is the default implementation of {@link ANTLRErrorStrategy} used for
  36803. // error reporting and recovery in ANTLR parsers.
  36804. //
  36805. function DefaultErrorStrategy() {
  36806. ErrorStrategy.call(this);
  36807. // Indicates whether the error strategy is currently "recovering from an
  36808. // error". This is used to suppress reporting multiple error messages while
  36809. // attempting to recover from a detected syntax error.
  36810. //
  36811. // @see //inErrorRecoveryMode
  36812. //
  36813. this.errorRecoveryMode = false;
  36814. // The index into the input stream where the last error occurred.
  36815. // This is used to prevent infinite loops where an error is found
  36816. // but no token is consumed during recovery...another error is found,
  36817. // ad nauseum. This is a failsafe mechanism to guarantee that at least
  36818. // one token/tree node is consumed for two errors.
  36819. //
  36820. this.lastErrorIndex = -1;
  36821. this.lastErrorStates = null;
  36822. return this;
  36823. }
  36824. DefaultErrorStrategy.prototype = Object.create(ErrorStrategy.prototype);
  36825. DefaultErrorStrategy.prototype.constructor = DefaultErrorStrategy;
  36826. // <p>The default implementation simply calls {@link //endErrorCondition} to
  36827. // ensure that the handler is not in error recovery mode.</p>
  36828. DefaultErrorStrategy.prototype.reset = function(recognizer) {
  36829. this.endErrorCondition(recognizer);
  36830. };
  36831. //
  36832. // This method is called to enter error recovery mode when a recognition
  36833. // exception is reported.
  36834. //
  36835. // @param recognizer the parser instance
  36836. //
  36837. DefaultErrorStrategy.prototype.beginErrorCondition = function(recognizer) {
  36838. this.errorRecoveryMode = true;
  36839. };
  36840. DefaultErrorStrategy.prototype.inErrorRecoveryMode = function(recognizer) {
  36841. return this.errorRecoveryMode;
  36842. };
  36843. //
  36844. // This method is called to leave error recovery mode after recovering from
  36845. // a recognition exception.
  36846. //
  36847. // @param recognizer
  36848. //
  36849. DefaultErrorStrategy.prototype.endErrorCondition = function(recognizer) {
  36850. this.errorRecoveryMode = false;
  36851. this.lastErrorStates = null;
  36852. this.lastErrorIndex = -1;
  36853. };
  36854. //
  36855. // {@inheritDoc}
  36856. //
  36857. // <p>The default implementation simply calls {@link //endErrorCondition}.</p>
  36858. //
  36859. DefaultErrorStrategy.prototype.reportMatch = function(recognizer) {
  36860. this.endErrorCondition(recognizer);
  36861. };
  36862. //
  36863. // {@inheritDoc}
  36864. //
  36865. // <p>The default implementation returns immediately if the handler is already
  36866. // in error recovery mode. Otherwise, it calls {@link //beginErrorCondition}
  36867. // and dispatches the reporting task based on the runtime type of {@code e}
  36868. // according to the following table.</p>
  36869. //
  36870. // <ul>
  36871. // <li>{@link NoViableAltException}: Dispatches the call to
  36872. // {@link //reportNoViableAlternative}</li>
  36873. // <li>{@link InputMismatchException}: Dispatches the call to
  36874. // {@link //reportInputMismatch}</li>
  36875. // <li>{@link FailedPredicateException}: Dispatches the call to
  36876. // {@link //reportFailedPredicate}</li>
  36877. // <li>All other types: calls {@link Parser//notifyErrorListeners} to report
  36878. // the exception</li>
  36879. // </ul>
  36880. //
  36881. DefaultErrorStrategy.prototype.reportError = function(recognizer, e) {
  36882. // if we've already reported an error and have not matched a token
  36883. // yet successfully, don't report any errors.
  36884. if(this.inErrorRecoveryMode(recognizer)) {
  36885. return; // don't report spurious errors
  36886. }
  36887. this.beginErrorCondition(recognizer);
  36888. if ( e instanceof NoViableAltException ) {
  36889. this.reportNoViableAlternative(recognizer, e);
  36890. } else if ( e instanceof InputMismatchException ) {
  36891. this.reportInputMismatch(recognizer, e);
  36892. } else if ( e instanceof FailedPredicateException ) {
  36893. this.reportFailedPredicate(recognizer, e);
  36894. } else {
  36895. console.log("unknown recognition error type: " + e.constructor.name);
  36896. console.log(e.stack);
  36897. recognizer.notifyErrorListeners(e.getOffendingToken(), e.getMessage(), e);
  36898. }
  36899. };
  36900. //
  36901. // {@inheritDoc}
  36902. //
  36903. // <p>The default implementation resynchronizes the parser by consuming tokens
  36904. // until we find one in the resynchronization set--loosely the set of tokens
  36905. // that can follow the current rule.</p>
  36906. //
  36907. DefaultErrorStrategy.prototype.recover = function(recognizer, e) {
  36908. if (this.lastErrorIndex===recognizer.getInputStream().index &&
  36909. this.lastErrorStates !== null && this.lastErrorStates.indexOf(recognizer.state)>=0) {
  36910. // uh oh, another error at same token index and previously-visited
  36911. // state in ATN; must be a case where LT(1) is in the recovery
  36912. // token set so nothing got consumed. Consume a single token
  36913. // at least to prevent an infinite loop; this is a failsafe.
  36914. recognizer.consume();
  36915. }
  36916. this.lastErrorIndex = recognizer._input.index;
  36917. if (this.lastErrorStates === null) {
  36918. this.lastErrorStates = [];
  36919. }
  36920. this.lastErrorStates.push(recognizer.state);
  36921. var followSet = this.getErrorRecoverySet(recognizer);
  36922. this.consumeUntil(recognizer, followSet);
  36923. };
  36924. // The default implementation of {@link ANTLRErrorStrategy//sync} makes sure
  36925. // that the current lookahead symbol is consistent with what were expecting
  36926. // at this point in the ATN. You can call this anytime but ANTLR only
  36927. // generates code to check before subrules/loops and each iteration.
  36928. //
  36929. // <p>Implements Jim Idle's magic sync mechanism in closures and optional
  36930. // subrules. E.g.,</p>
  36931. //
  36932. // <pre>
  36933. // a : sync ( stuff sync )* ;
  36934. // sync : {consume to what can follow sync} ;
  36935. // </pre>
  36936. //
  36937. // At the start of a sub rule upon error, {@link //sync} performs single
  36938. // token deletion, if possible. If it can't do that, it bails on the current
  36939. // rule and uses the default error recovery, which consumes until the
  36940. // resynchronization set of the current rule.
  36941. //
  36942. // <p>If the sub rule is optional ({@code (...)?}, {@code (...)*}, or block
  36943. // with an empty alternative), then the expected set includes what follows
  36944. // the subrule.</p>
  36945. //
  36946. // <p>During loop iteration, it consumes until it sees a token that can start a
  36947. // sub rule or what follows loop. Yes, that is pretty aggressive. We opt to
  36948. // stay in the loop as long as possible.</p>
  36949. //
  36950. // <p><strong>ORIGINS</strong></p>
  36951. //
  36952. // <p>Previous versions of ANTLR did a poor job of their recovery within loops.
  36953. // A single mismatch token or missing token would force the parser to bail
  36954. // out of the entire rules surrounding the loop. So, for rule</p>
  36955. //
  36956. // <pre>
  36957. // classDef : 'class' ID '{' member* '}'
  36958. // </pre>
  36959. //
  36960. // input with an extra token between members would force the parser to
  36961. // consume until it found the next class definition rather than the next
  36962. // member definition of the current class.
  36963. //
  36964. // <p>This functionality cost a little bit of effort because the parser has to
  36965. // compare token set at the start of the loop and at each iteration. If for
  36966. // some reason speed is suffering for you, you can turn off this
  36967. // functionality by simply overriding this method as a blank { }.</p>
  36968. //
  36969. DefaultErrorStrategy.prototype.sync = function(recognizer) {
  36970. // If already recovering, don't try to sync
  36971. if (this.inErrorRecoveryMode(recognizer)) {
  36972. return;
  36973. }
  36974. var s = recognizer._interp.atn.states[recognizer.state];
  36975. var la = recognizer.getTokenStream().LA(1);
  36976. // try cheaper subset first; might get lucky. seems to shave a wee bit off
  36977. var nextTokens = recognizer.atn.nextTokens(s);
  36978. if (nextTokens.contains(Token.EPSILON) || nextTokens.contains(la)) {
  36979. return;
  36980. }
  36981. switch (s.stateType) {
  36982. case ATNState.BLOCK_START:
  36983. case ATNState.STAR_BLOCK_START:
  36984. case ATNState.PLUS_BLOCK_START:
  36985. case ATNState.STAR_LOOP_ENTRY:
  36986. // report error and recover if possible
  36987. if( this.singleTokenDeletion(recognizer) !== null) {
  36988. return;
  36989. } else {
  36990. throw new InputMismatchException(recognizer);
  36991. }
  36992. break;
  36993. case ATNState.PLUS_LOOP_BACK:
  36994. case ATNState.STAR_LOOP_BACK:
  36995. this.reportUnwantedToken(recognizer);
  36996. var expecting = new IntervalSet();
  36997. expecting.addSet(recognizer.getExpectedTokens());
  36998. var whatFollowsLoopIterationOrRule = expecting.addSet(this.getErrorRecoverySet(recognizer));
  36999. this.consumeUntil(recognizer, whatFollowsLoopIterationOrRule);
  37000. break;
  37001. default:
  37002. // do nothing if we can't identify the exact kind of ATN state
  37003. }
  37004. };
  37005. // This is called by {@link //reportError} when the exception is a
  37006. // {@link NoViableAltException}.
  37007. //
  37008. // @see //reportError
  37009. //
  37010. // @param recognizer the parser instance
  37011. // @param e the recognition exception
  37012. //
  37013. DefaultErrorStrategy.prototype.reportNoViableAlternative = function(recognizer, e) {
  37014. var tokens = recognizer.getTokenStream();
  37015. var input;
  37016. if(tokens !== null) {
  37017. if (e.startToken.type===Token.EOF) {
  37018. input = "<EOF>";
  37019. } else {
  37020. input = tokens.getText(new Interval(e.startToken.tokenIndex, e.offendingToken.tokenIndex));
  37021. }
  37022. } else {
  37023. input = "<unknown input>";
  37024. }
  37025. var msg = "no viable alternative at input " + this.escapeWSAndQuote(input);
  37026. recognizer.notifyErrorListeners(msg, e.offendingToken, e);
  37027. };
  37028. //
  37029. // This is called by {@link //reportError} when the exception is an
  37030. // {@link InputMismatchException}.
  37031. //
  37032. // @see //reportError
  37033. //
  37034. // @param recognizer the parser instance
  37035. // @param e the recognition exception
  37036. //
  37037. DefaultErrorStrategy.prototype.reportInputMismatch = function(recognizer, e) {
  37038. var msg = "mismatched input " + this.getTokenErrorDisplay(e.offendingToken) +
  37039. " expecting " + e.getExpectedTokens().toString(recognizer.literalNames, recognizer.symbolicNames);
  37040. recognizer.notifyErrorListeners(msg, e.offendingToken, e);
  37041. };
  37042. //
  37043. // This is called by {@link //reportError} when the exception is a
  37044. // {@link FailedPredicateException}.
  37045. //
  37046. // @see //reportError
  37047. //
  37048. // @param recognizer the parser instance
  37049. // @param e the recognition exception
  37050. //
  37051. DefaultErrorStrategy.prototype.reportFailedPredicate = function(recognizer, e) {
  37052. var ruleName = recognizer.ruleNames[recognizer._ctx.ruleIndex];
  37053. var msg = "rule " + ruleName + " " + e.message;
  37054. recognizer.notifyErrorListeners(msg, e.offendingToken, e);
  37055. };
  37056. // This method is called to report a syntax error which requires the removal
  37057. // of a token from the input stream. At the time this method is called, the
  37058. // erroneous symbol is current {@code LT(1)} symbol and has not yet been
  37059. // removed from the input stream. When this method returns,
  37060. // {@code recognizer} is in error recovery mode.
  37061. //
  37062. // <p>This method is called when {@link //singleTokenDeletion} identifies
  37063. // single-token deletion as a viable recovery strategy for a mismatched
  37064. // input error.</p>
  37065. //
  37066. // <p>The default implementation simply returns if the handler is already in
  37067. // error recovery mode. Otherwise, it calls {@link //beginErrorCondition} to
  37068. // enter error recovery mode, followed by calling
  37069. // {@link Parser//notifyErrorListeners}.</p>
  37070. //
  37071. // @param recognizer the parser instance
  37072. //
  37073. DefaultErrorStrategy.prototype.reportUnwantedToken = function(recognizer) {
  37074. if (this.inErrorRecoveryMode(recognizer)) {
  37075. return;
  37076. }
  37077. this.beginErrorCondition(recognizer);
  37078. var t = recognizer.getCurrentToken();
  37079. var tokenName = this.getTokenErrorDisplay(t);
  37080. var expecting = this.getExpectedTokens(recognizer);
  37081. var msg = "extraneous input " + tokenName + " expecting " +
  37082. expecting.toString(recognizer.literalNames, recognizer.symbolicNames);
  37083. recognizer.notifyErrorListeners(msg, t, null);
  37084. };
  37085. // This method is called to report a syntax error which requires the
  37086. // insertion of a missing token into the input stream. At the time this
  37087. // method is called, the missing token has not yet been inserted. When this
  37088. // method returns, {@code recognizer} is in error recovery mode.
  37089. //
  37090. // <p>This method is called when {@link //singleTokenInsertion} identifies
  37091. // single-token insertion as a viable recovery strategy for a mismatched
  37092. // input error.</p>
  37093. //
  37094. // <p>The default implementation simply returns if the handler is already in
  37095. // error recovery mode. Otherwise, it calls {@link //beginErrorCondition} to
  37096. // enter error recovery mode, followed by calling
  37097. // {@link Parser//notifyErrorListeners}.</p>
  37098. //
  37099. // @param recognizer the parser instance
  37100. //
  37101. DefaultErrorStrategy.prototype.reportMissingToken = function(recognizer) {
  37102. if ( this.inErrorRecoveryMode(recognizer)) {
  37103. return;
  37104. }
  37105. this.beginErrorCondition(recognizer);
  37106. var t = recognizer.getCurrentToken();
  37107. var expecting = this.getExpectedTokens(recognizer);
  37108. var msg = "missing " + expecting.toString(recognizer.literalNames, recognizer.symbolicNames) +
  37109. " at " + this.getTokenErrorDisplay(t);
  37110. recognizer.notifyErrorListeners(msg, t, null);
  37111. };
  37112. // <p>The default implementation attempts to recover from the mismatched input
  37113. // by using single token insertion and deletion as described below. If the
  37114. // recovery attempt fails, this method throws an
  37115. // {@link InputMismatchException}.</p>
  37116. //
  37117. // <p><strong>EXTRA TOKEN</strong> (single token deletion)</p>
  37118. //
  37119. // <p>{@code LA(1)} is not what we are looking for. If {@code LA(2)} has the
  37120. // right token, however, then assume {@code LA(1)} is some extra spurious
  37121. // token and delete it. Then consume and return the next token (which was
  37122. // the {@code LA(2)} token) as the successful result of the match operation.</p>
  37123. //
  37124. // <p>This recovery strategy is implemented by {@link
  37125. // //singleTokenDeletion}.</p>
  37126. //
  37127. // <p><strong>MISSING TOKEN</strong> (single token insertion)</p>
  37128. //
  37129. // <p>If current token (at {@code LA(1)}) is consistent with what could come
  37130. // after the expected {@code LA(1)} token, then assume the token is missing
  37131. // and use the parser's {@link TokenFactory} to create it on the fly. The
  37132. // "insertion" is performed by returning the created token as the successful
  37133. // result of the match operation.</p>
  37134. //
  37135. // <p>This recovery strategy is implemented by {@link
  37136. // //singleTokenInsertion}.</p>
  37137. //
  37138. // <p><strong>EXAMPLE</strong></p>
  37139. //
  37140. // <p>For example, Input {@code i=(3;} is clearly missing the {@code ')'}. When
  37141. // the parser returns from the nested call to {@code expr}, it will have
  37142. // call chain:</p>
  37143. //
  37144. // <pre>
  37145. // stat &rarr; expr &rarr; atom
  37146. // </pre>
  37147. //
  37148. // and it will be trying to match the {@code ')'} at this point in the
  37149. // derivation:
  37150. //
  37151. // <pre>
  37152. // =&gt; ID '=' '(' INT ')' ('+' atom)* ';'
  37153. // ^
  37154. // </pre>
  37155. //
  37156. // The attempt to match {@code ')'} will fail when it sees {@code ';'} and
  37157. // call {@link //recoverInline}. To recover, it sees that {@code LA(1)==';'}
  37158. // is in the set of tokens that can follow the {@code ')'} token reference
  37159. // in rule {@code atom}. It can assume that you forgot the {@code ')'}.
  37160. //
  37161. DefaultErrorStrategy.prototype.recoverInline = function(recognizer) {
  37162. // SINGLE TOKEN DELETION
  37163. var matchedSymbol = this.singleTokenDeletion(recognizer);
  37164. if (matchedSymbol !== null) {
  37165. // we have deleted the extra token.
  37166. // now, move past ttype token as if all were ok
  37167. recognizer.consume();
  37168. return matchedSymbol;
  37169. }
  37170. // SINGLE TOKEN INSERTION
  37171. if (this.singleTokenInsertion(recognizer)) {
  37172. return this.getMissingSymbol(recognizer);
  37173. }
  37174. // even that didn't work; must throw the exception
  37175. throw new InputMismatchException(recognizer);
  37176. };
  37177. //
  37178. // This method implements the single-token insertion inline error recovery
  37179. // strategy. It is called by {@link //recoverInline} if the single-token
  37180. // deletion strategy fails to recover from the mismatched input. If this
  37181. // method returns {@code true}, {@code recognizer} will be in error recovery
  37182. // mode.
  37183. //
  37184. // <p>This method determines whether or not single-token insertion is viable by
  37185. // checking if the {@code LA(1)} input symbol could be successfully matched
  37186. // if it were instead the {@code LA(2)} symbol. If this method returns
  37187. // {@code true}, the caller is responsible for creating and inserting a
  37188. // token with the correct type to produce this behavior.</p>
  37189. //
  37190. // @param recognizer the parser instance
  37191. // @return {@code true} if single-token insertion is a viable recovery
  37192. // strategy for the current mismatched input, otherwise {@code false}
  37193. //
  37194. DefaultErrorStrategy.prototype.singleTokenInsertion = function(recognizer) {
  37195. var currentSymbolType = recognizer.getTokenStream().LA(1);
  37196. // if current token is consistent with what could come after current
  37197. // ATN state, then we know we're missing a token; error recovery
  37198. // is free to conjure up and insert the missing token
  37199. var atn = recognizer._interp.atn;
  37200. var currentState = atn.states[recognizer.state];
  37201. var next = currentState.transitions[0].target;
  37202. var expectingAtLL2 = atn.nextTokens(next, recognizer._ctx);
  37203. if (expectingAtLL2.contains(currentSymbolType) ){
  37204. this.reportMissingToken(recognizer);
  37205. return true;
  37206. } else {
  37207. return false;
  37208. }
  37209. };
  37210. // This method implements the single-token deletion inline error recovery
  37211. // strategy. It is called by {@link //recoverInline} to attempt to recover
  37212. // from mismatched input. If this method returns null, the parser and error
  37213. // handler state will not have changed. If this method returns non-null,
  37214. // {@code recognizer} will <em>not</em> be in error recovery mode since the
  37215. // returned token was a successful match.
  37216. //
  37217. // <p>If the single-token deletion is successful, this method calls
  37218. // {@link //reportUnwantedToken} to report the error, followed by
  37219. // {@link Parser//consume} to actually "delete" the extraneous token. Then,
  37220. // before returning {@link //reportMatch} is called to signal a successful
  37221. // match.</p>
  37222. //
  37223. // @param recognizer the parser instance
  37224. // @return the successfully matched {@link Token} instance if single-token
  37225. // deletion successfully recovers from the mismatched input, otherwise
  37226. // {@code null}
  37227. //
  37228. DefaultErrorStrategy.prototype.singleTokenDeletion = function(recognizer) {
  37229. var nextTokenType = recognizer.getTokenStream().LA(2);
  37230. var expecting = this.getExpectedTokens(recognizer);
  37231. if (expecting.contains(nextTokenType)) {
  37232. this.reportUnwantedToken(recognizer);
  37233. // print("recoverFromMismatchedToken deleting " \
  37234. // + str(recognizer.getTokenStream().LT(1)) \
  37235. // + " since " + str(recognizer.getTokenStream().LT(2)) \
  37236. // + " is what we want", file=sys.stderr)
  37237. recognizer.consume(); // simply delete extra token
  37238. // we want to return the token we're actually matching
  37239. var matchedSymbol = recognizer.getCurrentToken();
  37240. this.reportMatch(recognizer); // we know current token is correct
  37241. return matchedSymbol;
  37242. } else {
  37243. return null;
  37244. }
  37245. };
  37246. // Conjure up a missing token during error recovery.
  37247. //
  37248. // The recognizer attempts to recover from single missing
  37249. // symbols. But, actions might refer to that missing symbol.
  37250. // For example, x=ID {f($x);}. The action clearly assumes
  37251. // that there has been an identifier matched previously and that
  37252. // $x points at that token. If that token is missing, but
  37253. // the next token in the stream is what we want we assume that
  37254. // this token is missing and we keep going. Because we
  37255. // have to return some token to replace the missing token,
  37256. // we have to conjure one up. This method gives the user control
  37257. // over the tokens returned for missing tokens. Mostly,
  37258. // you will want to create something special for identifier
  37259. // tokens. For literals such as '{' and ',', the default
  37260. // action in the parser or tree parser works. It simply creates
  37261. // a CommonToken of the appropriate type. The text will be the token.
  37262. // If you change what tokens must be created by the lexer,
  37263. // override this method to create the appropriate tokens.
  37264. //
  37265. DefaultErrorStrategy.prototype.getMissingSymbol = function(recognizer) {
  37266. var currentSymbol = recognizer.getCurrentToken();
  37267. var expecting = this.getExpectedTokens(recognizer);
  37268. var expectedTokenType = expecting.first(); // get any element
  37269. var tokenText;
  37270. if (expectedTokenType===Token.EOF) {
  37271. tokenText = "<missing EOF>";
  37272. } else {
  37273. tokenText = "<missing " + recognizer.literalNames[expectedTokenType] + ">";
  37274. }
  37275. var current = currentSymbol;
  37276. var lookback = recognizer.getTokenStream().LT(-1);
  37277. if (current.type===Token.EOF && lookback !== null) {
  37278. current = lookback;
  37279. }
  37280. return recognizer.getTokenFactory().create(current.source,
  37281. expectedTokenType, tokenText, Token.DEFAULT_CHANNEL,
  37282. -1, -1, current.line, current.column);
  37283. };
  37284. DefaultErrorStrategy.prototype.getExpectedTokens = function(recognizer) {
  37285. return recognizer.getExpectedTokens();
  37286. };
  37287. // How should a token be displayed in an error message? The default
  37288. // is to display just the text, but during development you might
  37289. // want to have a lot of information spit out. Override in that case
  37290. // to use t.toString() (which, for CommonToken, dumps everything about
  37291. // the token). This is better than forcing you to override a method in
  37292. // your token objects because you don't have to go modify your lexer
  37293. // so that it creates a new Java type.
  37294. //
  37295. DefaultErrorStrategy.prototype.getTokenErrorDisplay = function(t) {
  37296. if (t === null) {
  37297. return "<no token>";
  37298. }
  37299. var s = t.text;
  37300. if (s === null) {
  37301. if (t.type===Token.EOF) {
  37302. s = "<EOF>";
  37303. } else {
  37304. s = "<" + t.type + ">";
  37305. }
  37306. }
  37307. return this.escapeWSAndQuote(s);
  37308. };
  37309. DefaultErrorStrategy.prototype.escapeWSAndQuote = function(s) {
  37310. s = s.replace(/\n/g,"\\n");
  37311. s = s.replace(/\r/g,"\\r");
  37312. s = s.replace(/\t/g,"\\t");
  37313. return "'" + s + "'";
  37314. };
  37315. // Compute the error recovery set for the current rule. During
  37316. // rule invocation, the parser pushes the set of tokens that can
  37317. // follow that rule reference on the stack; this amounts to
  37318. // computing FIRST of what follows the rule reference in the
  37319. // enclosing rule. See LinearApproximator.FIRST().
  37320. // This local follow set only includes tokens
  37321. // from within the rule; i.e., the FIRST computation done by
  37322. // ANTLR stops at the end of a rule.
  37323. //
  37324. // EXAMPLE
  37325. //
  37326. // When you find a "no viable alt exception", the input is not
  37327. // consistent with any of the alternatives for rule r. The best
  37328. // thing to do is to consume tokens until you see something that
  37329. // can legally follow a call to r//or* any rule that called r.
  37330. // You don't want the exact set of viable next tokens because the
  37331. // input might just be missing a token--you might consume the
  37332. // rest of the input looking for one of the missing tokens.
  37333. //
  37334. // Consider grammar:
  37335. //
  37336. // a : '[' b ']'
  37337. // | '(' b ')'
  37338. // ;
  37339. // b : c '^' INT ;
  37340. // c : ID
  37341. // | INT
  37342. // ;
  37343. //
  37344. // At each rule invocation, the set of tokens that could follow
  37345. // that rule is pushed on a stack. Here are the various
  37346. // context-sensitive follow sets:
  37347. //
  37348. // FOLLOW(b1_in_a) = FIRST(']') = ']'
  37349. // FOLLOW(b2_in_a) = FIRST(')') = ')'
  37350. // FOLLOW(c_in_b) = FIRST('^') = '^'
  37351. //
  37352. // Upon erroneous input "[]", the call chain is
  37353. //
  37354. // a -> b -> c
  37355. //
  37356. // and, hence, the follow context stack is:
  37357. //
  37358. // depth follow set start of rule execution
  37359. // 0 <EOF> a (from main())
  37360. // 1 ']' b
  37361. // 2 '^' c
  37362. //
  37363. // Notice that ')' is not included, because b would have to have
  37364. // been called from a different context in rule a for ')' to be
  37365. // included.
  37366. //
  37367. // For error recovery, we cannot consider FOLLOW(c)
  37368. // (context-sensitive or otherwise). We need the combined set of
  37369. // all context-sensitive FOLLOW sets--the set of all tokens that
  37370. // could follow any reference in the call chain. We need to
  37371. // resync to one of those tokens. Note that FOLLOW(c)='^' and if
  37372. // we resync'd to that token, we'd consume until EOF. We need to
  37373. // sync to context-sensitive FOLLOWs for a, b, and c: {']','^'}.
  37374. // In this case, for input "[]", LA(1) is ']' and in the set, so we would
  37375. // not consume anything. After printing an error, rule c would
  37376. // return normally. Rule b would not find the required '^' though.
  37377. // At this point, it gets a mismatched token error and throws an
  37378. // exception (since LA(1) is not in the viable following token
  37379. // set). The rule exception handler tries to recover, but finds
  37380. // the same recovery set and doesn't consume anything. Rule b
  37381. // exits normally returning to rule a. Now it finds the ']' (and
  37382. // with the successful match exits errorRecovery mode).
  37383. //
  37384. // So, you can see that the parser walks up the call chain looking
  37385. // for the token that was a member of the recovery set.
  37386. //
  37387. // Errors are not generated in errorRecovery mode.
  37388. //
  37389. // ANTLR's error recovery mechanism is based upon original ideas:
  37390. //
  37391. // "Algorithms + Data Structures = Programs" by Niklaus Wirth
  37392. //
  37393. // and
  37394. //
  37395. // "A note on error recovery in recursive descent parsers":
  37396. // http://portal.acm.org/citation.cfm?id=947902.947905
  37397. //
  37398. // Later, Josef Grosch had some good ideas:
  37399. //
  37400. // "Efficient and Comfortable Error Recovery in Recursive Descent
  37401. // Parsers":
  37402. // ftp://www.cocolab.com/products/cocktail/doca4.ps/ell.ps.zip
  37403. //
  37404. // Like Grosch I implement context-sensitive FOLLOW sets that are combined
  37405. // at run-time upon error to avoid overhead during parsing.
  37406. //
  37407. DefaultErrorStrategy.prototype.getErrorRecoverySet = function(recognizer) {
  37408. var atn = recognizer._interp.atn;
  37409. var ctx = recognizer._ctx;
  37410. var recoverSet = new IntervalSet();
  37411. while (ctx !== null && ctx.invokingState>=0) {
  37412. // compute what follows who invoked us
  37413. var invokingState = atn.states[ctx.invokingState];
  37414. var rt = invokingState.transitions[0];
  37415. var follow = atn.nextTokens(rt.followState);
  37416. recoverSet.addSet(follow);
  37417. ctx = ctx.parentCtx;
  37418. }
  37419. recoverSet.removeOne(Token.EPSILON);
  37420. return recoverSet;
  37421. };
  37422. // Consume tokens until one matches the given token set.//
  37423. DefaultErrorStrategy.prototype.consumeUntil = function(recognizer, set) {
  37424. var ttype = recognizer.getTokenStream().LA(1);
  37425. while( ttype !== Token.EOF && !set.contains(ttype)) {
  37426. recognizer.consume();
  37427. ttype = recognizer.getTokenStream().LA(1);
  37428. }
  37429. };
  37430. //
  37431. // This implementation of {@link ANTLRErrorStrategy} responds to syntax errors
  37432. // by immediately canceling the parse operation with a
  37433. // {@link ParseCancellationException}. The implementation ensures that the
  37434. // {@link ParserRuleContext//exception} field is set for all parse tree nodes
  37435. // that were not completed prior to encountering the error.
  37436. //
  37437. // <p>
  37438. // This error strategy is useful in the following scenarios.</p>
  37439. //
  37440. // <ul>
  37441. // <li><strong>Two-stage parsing:</strong> This error strategy allows the first
  37442. // stage of two-stage parsing to immediately terminate if an error is
  37443. // encountered, and immediately fall back to the second stage. In addition to
  37444. // avoiding wasted work by attempting to recover from errors here, the empty
  37445. // implementation of {@link BailErrorStrategy//sync} improves the performance of
  37446. // the first stage.</li>
  37447. // <li><strong>Silent validation:</strong> When syntax errors are not being
  37448. // reported or logged, and the parse result is simply ignored if errors occur,
  37449. // the {@link BailErrorStrategy} avoids wasting work on recovering from errors
  37450. // when the result will be ignored either way.</li>
  37451. // </ul>
  37452. //
  37453. // <p>
  37454. // {@code myparser.setErrorHandler(new BailErrorStrategy());}</p>
  37455. //
  37456. // @see Parser//setErrorHandler(ANTLRErrorStrategy)
  37457. //
  37458. function BailErrorStrategy() {
  37459. DefaultErrorStrategy.call(this);
  37460. return this;
  37461. }
  37462. BailErrorStrategy.prototype = Object.create(DefaultErrorStrategy.prototype);
  37463. BailErrorStrategy.prototype.constructor = BailErrorStrategy;
  37464. // Instead of recovering from exception {@code e}, re-throw it wrapped
  37465. // in a {@link ParseCancellationException} so it is not caught by the
  37466. // rule function catches. Use {@link Exception//getCause()} to get the
  37467. // original {@link RecognitionException}.
  37468. //
  37469. BailErrorStrategy.prototype.recover = function(recognizer, e) {
  37470. var context = recognizer._ctx;
  37471. while (context !== null) {
  37472. context.exception = e;
  37473. context = context.parentCtx;
  37474. }
  37475. throw new ParseCancellationException(e);
  37476. };
  37477. // Make sure we don't attempt to recover inline; if the parser
  37478. // successfully recovers, it won't throw an exception.
  37479. //
  37480. BailErrorStrategy.prototype.recoverInline = function(recognizer) {
  37481. this.recover(recognizer, new InputMismatchException(recognizer));
  37482. };
  37483. // Make sure we don't attempt to recover from problems in subrules.//
  37484. BailErrorStrategy.prototype.sync = function(recognizer) {
  37485. // pass
  37486. };
  37487. exports.BailErrorStrategy = BailErrorStrategy;
  37488. exports.DefaultErrorStrategy = DefaultErrorStrategy;
  37489. /***/ }),
  37490. /***/ "./node_modules/antlr4/error/Errors.js":
  37491. /*!*********************************************!*\
  37492. !*** ./node_modules/antlr4/error/Errors.js ***!
  37493. \*********************************************/
  37494. /*! no static exports found */
  37495. /***/ (function(module, exports, __webpack_require__) {
  37496. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  37497. * Use of this file is governed by the BSD 3-clause license that
  37498. * can be found in the LICENSE.txt file in the project root.
  37499. */
  37500. // The root of the ANTLR exception hierarchy. In general, ANTLR tracks just
  37501. // 3 kinds of errors: prediction errors, failed predicate errors, and
  37502. // mismatched input errors. In each case, the parser knows where it is
  37503. // in the input, where it is in the ATN, the rule invocation stack,
  37504. // and what kind of problem occurred.
  37505. var PredicateTransition = __webpack_require__(/*! ./../atn/Transition */ "./node_modules/antlr4/atn/Transition.js").PredicateTransition;
  37506. function RecognitionException(params) {
  37507. Error.call(this);
  37508. if (!!Error.captureStackTrace) {
  37509. Error.captureStackTrace(this, RecognitionException);
  37510. } else {
  37511. var stack = new Error().stack;
  37512. }
  37513. this.message = params.message;
  37514. this.recognizer = params.recognizer;
  37515. this.input = params.input;
  37516. this.ctx = params.ctx;
  37517. // The current {@link Token} when an error occurred. Since not all streams
  37518. // support accessing symbols by index, we have to track the {@link Token}
  37519. // instance itself.
  37520. this.offendingToken = null;
  37521. // Get the ATN state number the parser was in at the time the error
  37522. // occurred. For {@link NoViableAltException} and
  37523. // {@link LexerNoViableAltException} exceptions, this is the
  37524. // {@link DecisionState} number. For others, it is the state whose outgoing
  37525. // edge we couldn't match.
  37526. this.offendingState = -1;
  37527. if (this.recognizer!==null) {
  37528. this.offendingState = this.recognizer.state;
  37529. }
  37530. return this;
  37531. }
  37532. RecognitionException.prototype = Object.create(Error.prototype);
  37533. RecognitionException.prototype.constructor = RecognitionException;
  37534. // <p>If the state number is not known, this method returns -1.</p>
  37535. //
  37536. // Gets the set of input symbols which could potentially follow the
  37537. // previously matched symbol at the time this exception was thrown.
  37538. //
  37539. // <p>If the set of expected tokens is not known and could not be computed,
  37540. // this method returns {@code null}.</p>
  37541. //
  37542. // @return The set of token types that could potentially follow the current
  37543. // state in the ATN, or {@code null} if the information is not available.
  37544. // /
  37545. RecognitionException.prototype.getExpectedTokens = function() {
  37546. if (this.recognizer!==null) {
  37547. return this.recognizer.atn.getExpectedTokens(this.offendingState, this.ctx);
  37548. } else {
  37549. return null;
  37550. }
  37551. };
  37552. RecognitionException.prototype.toString = function() {
  37553. return this.message;
  37554. };
  37555. function LexerNoViableAltException(lexer, input, startIndex, deadEndConfigs) {
  37556. RecognitionException.call(this, {message:"", recognizer:lexer, input:input, ctx:null});
  37557. this.startIndex = startIndex;
  37558. this.deadEndConfigs = deadEndConfigs;
  37559. return this;
  37560. }
  37561. LexerNoViableAltException.prototype = Object.create(RecognitionException.prototype);
  37562. LexerNoViableAltException.prototype.constructor = LexerNoViableAltException;
  37563. LexerNoViableAltException.prototype.toString = function() {
  37564. var symbol = "";
  37565. if (this.startIndex >= 0 && this.startIndex < this.input.size) {
  37566. symbol = this.input.getText((this.startIndex,this.startIndex));
  37567. }
  37568. return "LexerNoViableAltException" + symbol;
  37569. };
  37570. // Indicates that the parser could not decide which of two or more paths
  37571. // to take based upon the remaining input. It tracks the starting token
  37572. // of the offending input and also knows where the parser was
  37573. // in the various paths when the error. Reported by reportNoViableAlternative()
  37574. //
  37575. function NoViableAltException(recognizer, input, startToken, offendingToken, deadEndConfigs, ctx) {
  37576. ctx = ctx || recognizer._ctx;
  37577. offendingToken = offendingToken || recognizer.getCurrentToken();
  37578. startToken = startToken || recognizer.getCurrentToken();
  37579. input = input || recognizer.getInputStream();
  37580. RecognitionException.call(this, {message:"", recognizer:recognizer, input:input, ctx:ctx});
  37581. // Which configurations did we try at input.index() that couldn't match
  37582. // input.LT(1)?//
  37583. this.deadEndConfigs = deadEndConfigs;
  37584. // The token object at the start index; the input stream might
  37585. // not be buffering tokens so get a reference to it. (At the
  37586. // time the error occurred, of course the stream needs to keep a
  37587. // buffer all of the tokens but later we might not have access to those.)
  37588. this.startToken = startToken;
  37589. this.offendingToken = offendingToken;
  37590. }
  37591. NoViableAltException.prototype = Object.create(RecognitionException.prototype);
  37592. NoViableAltException.prototype.constructor = NoViableAltException;
  37593. // This signifies any kind of mismatched input exceptions such as
  37594. // when the current input does not match the expected token.
  37595. //
  37596. function InputMismatchException(recognizer) {
  37597. RecognitionException.call(this, {message:"", recognizer:recognizer, input:recognizer.getInputStream(), ctx:recognizer._ctx});
  37598. this.offendingToken = recognizer.getCurrentToken();
  37599. }
  37600. InputMismatchException.prototype = Object.create(RecognitionException.prototype);
  37601. InputMismatchException.prototype.constructor = InputMismatchException;
  37602. // A semantic predicate failed during validation. Validation of predicates
  37603. // occurs when normally parsing the alternative just like matching a token.
  37604. // Disambiguating predicate evaluation occurs when we test a predicate during
  37605. // prediction.
  37606. function FailedPredicateException(recognizer, predicate, message) {
  37607. RecognitionException.call(this, {message:this.formatMessage(predicate,message || null), recognizer:recognizer,
  37608. input:recognizer.getInputStream(), ctx:recognizer._ctx});
  37609. var s = recognizer._interp.atn.states[recognizer.state];
  37610. var trans = s.transitions[0];
  37611. if (trans instanceof PredicateTransition) {
  37612. this.ruleIndex = trans.ruleIndex;
  37613. this.predicateIndex = trans.predIndex;
  37614. } else {
  37615. this.ruleIndex = 0;
  37616. this.predicateIndex = 0;
  37617. }
  37618. this.predicate = predicate;
  37619. this.offendingToken = recognizer.getCurrentToken();
  37620. return this;
  37621. }
  37622. FailedPredicateException.prototype = Object.create(RecognitionException.prototype);
  37623. FailedPredicateException.prototype.constructor = FailedPredicateException;
  37624. FailedPredicateException.prototype.formatMessage = function(predicate, message) {
  37625. if (message !==null) {
  37626. return message;
  37627. } else {
  37628. return "failed predicate: {" + predicate + "}?";
  37629. }
  37630. };
  37631. function ParseCancellationException() {
  37632. Error.call(this);
  37633. Error.captureStackTrace(this, ParseCancellationException);
  37634. return this;
  37635. }
  37636. ParseCancellationException.prototype = Object.create(Error.prototype);
  37637. ParseCancellationException.prototype.constructor = ParseCancellationException;
  37638. exports.RecognitionException = RecognitionException;
  37639. exports.NoViableAltException = NoViableAltException;
  37640. exports.LexerNoViableAltException = LexerNoViableAltException;
  37641. exports.InputMismatchException = InputMismatchException;
  37642. exports.FailedPredicateException = FailedPredicateException;
  37643. exports.ParseCancellationException = ParseCancellationException;
  37644. /***/ }),
  37645. /***/ "./node_modules/antlr4/error/index.js":
  37646. /*!********************************************!*\
  37647. !*** ./node_modules/antlr4/error/index.js ***!
  37648. \********************************************/
  37649. /*! no static exports found */
  37650. /***/ (function(module, exports, __webpack_require__) {
  37651. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  37652. * Use of this file is governed by the BSD 3-clause license that
  37653. * can be found in the LICENSE.txt file in the project root.
  37654. */
  37655. exports.RecognitionException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").RecognitionException;
  37656. exports.NoViableAltException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").NoViableAltException;
  37657. exports.LexerNoViableAltException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").LexerNoViableAltException;
  37658. exports.InputMismatchException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").InputMismatchException;
  37659. exports.FailedPredicateException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").FailedPredicateException;
  37660. exports.DiagnosticErrorListener = __webpack_require__(/*! ./DiagnosticErrorListener */ "./node_modules/antlr4/error/DiagnosticErrorListener.js").DiagnosticErrorListener;
  37661. exports.BailErrorStrategy = __webpack_require__(/*! ./ErrorStrategy */ "./node_modules/antlr4/error/ErrorStrategy.js").BailErrorStrategy;
  37662. exports.ErrorListener = __webpack_require__(/*! ./ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ErrorListener;
  37663. /***/ }),
  37664. /***/ "./node_modules/antlr4/index.js":
  37665. /*!**************************************!*\
  37666. !*** ./node_modules/antlr4/index.js ***!
  37667. \**************************************/
  37668. /*! no static exports found */
  37669. /***/ (function(module, exports, __webpack_require__) {
  37670. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  37671. * Use of this file is governed by the BSD 3-clause license that
  37672. * can be found in the LICENSE.txt file in the project root.
  37673. */
  37674. exports.atn = __webpack_require__(/*! ./atn/index */ "./node_modules/antlr4/atn/index.js");
  37675. exports.codepointat = __webpack_require__(/*! ./polyfills/codepointat */ "./node_modules/antlr4/polyfills/codepointat.js");
  37676. exports.dfa = __webpack_require__(/*! ./dfa/index */ "./node_modules/antlr4/dfa/index.js");
  37677. exports.fromcodepoint = __webpack_require__(/*! ./polyfills/fromcodepoint */ "./node_modules/antlr4/polyfills/fromcodepoint.js");
  37678. exports.tree = __webpack_require__(/*! ./tree/index */ "./node_modules/antlr4/tree/index.js");
  37679. exports.error = __webpack_require__(/*! ./error/index */ "./node_modules/antlr4/error/index.js");
  37680. exports.Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  37681. exports.CharStreams = __webpack_require__(/*! ./CharStreams */ "./node_modules/antlr4/CharStreams.js").CharStreams;
  37682. exports.CommonToken = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").CommonToken;
  37683. exports.InputStream = __webpack_require__(/*! ./InputStream */ "./node_modules/antlr4/InputStream.js").InputStream;
  37684. exports.FileStream = __webpack_require__(/*! ./FileStream */ "./node_modules/antlr4/FileStream.js").FileStream;
  37685. exports.CommonTokenStream = __webpack_require__(/*! ./CommonTokenStream */ "./node_modules/antlr4/CommonTokenStream.js").CommonTokenStream;
  37686. exports.Lexer = __webpack_require__(/*! ./Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  37687. exports.Parser = __webpack_require__(/*! ./Parser */ "./node_modules/antlr4/Parser.js").Parser;
  37688. var pc = __webpack_require__(/*! ./PredictionContext */ "./node_modules/antlr4/PredictionContext.js");
  37689. exports.PredictionContextCache = pc.PredictionContextCache;
  37690. exports.ParserRuleContext = __webpack_require__(/*! ./ParserRuleContext */ "./node_modules/antlr4/ParserRuleContext.js").ParserRuleContext;
  37691. exports.Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  37692. exports.Utils = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js");
  37693. /***/ }),
  37694. /***/ "./node_modules/antlr4/polyfills/codepointat.js":
  37695. /*!******************************************************!*\
  37696. !*** ./node_modules/antlr4/polyfills/codepointat.js ***!
  37697. \******************************************************/
  37698. /*! no static exports found */
  37699. /***/ (function(module, exports) {
  37700. /*! https://mths.be/codepointat v0.2.0 by @mathias */
  37701. if (!String.prototype.codePointAt) {
  37702. (function() {
  37703. 'use strict'; // needed to support `apply`/`call` with `undefined`/`null`
  37704. var defineProperty = (function() {
  37705. // IE 8 only supports `Object.defineProperty` on DOM elements
  37706. try {
  37707. var object = {};
  37708. var $defineProperty = Object.defineProperty;
  37709. var result = $defineProperty(object, object, object) && $defineProperty;
  37710. } catch(error) {}
  37711. return result;
  37712. }());
  37713. var codePointAt = function(position) {
  37714. if (this == null) {
  37715. throw TypeError();
  37716. }
  37717. var string = String(this);
  37718. var size = string.length;
  37719. // `ToInteger`
  37720. var index = position ? Number(position) : 0;
  37721. if (index != index) { // better `isNaN`
  37722. index = 0;
  37723. }
  37724. // Account for out-of-bounds indices:
  37725. if (index < 0 || index >= size) {
  37726. return undefined;
  37727. }
  37728. // Get the first code unit
  37729. var first = string.charCodeAt(index);
  37730. var second;
  37731. if ( // check if it’s the start of a surrogate pair
  37732. first >= 0xD800 && first <= 0xDBFF && // high surrogate
  37733. size > index + 1 // there is a next code unit
  37734. ) {
  37735. second = string.charCodeAt(index + 1);
  37736. if (second >= 0xDC00 && second <= 0xDFFF) { // low surrogate
  37737. // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
  37738. return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
  37739. }
  37740. }
  37741. return first;
  37742. };
  37743. if (defineProperty) {
  37744. defineProperty(String.prototype, 'codePointAt', {
  37745. 'value': codePointAt,
  37746. 'configurable': true,
  37747. 'writable': true
  37748. });
  37749. } else {
  37750. String.prototype.codePointAt = codePointAt;
  37751. }
  37752. }());
  37753. }
  37754. /***/ }),
  37755. /***/ "./node_modules/antlr4/polyfills/fromcodepoint.js":
  37756. /*!********************************************************!*\
  37757. !*** ./node_modules/antlr4/polyfills/fromcodepoint.js ***!
  37758. \********************************************************/
  37759. /*! no static exports found */
  37760. /***/ (function(module, exports) {
  37761. /*! https://mths.be/fromcodepoint v0.2.1 by @mathias */
  37762. if (!String.fromCodePoint) {
  37763. (function() {
  37764. var defineProperty = (function() {
  37765. // IE 8 only supports `Object.defineProperty` on DOM elements
  37766. try {
  37767. var object = {};
  37768. var $defineProperty = Object.defineProperty;
  37769. var result = $defineProperty(object, object, object) && $defineProperty;
  37770. } catch(error) {}
  37771. return result;
  37772. }());
  37773. var stringFromCharCode = String.fromCharCode;
  37774. var floor = Math.floor;
  37775. var fromCodePoint = function(_) {
  37776. var MAX_SIZE = 0x4000;
  37777. var codeUnits = [];
  37778. var highSurrogate;
  37779. var lowSurrogate;
  37780. var index = -1;
  37781. var length = arguments.length;
  37782. if (!length) {
  37783. return '';
  37784. }
  37785. var result = '';
  37786. while (++index < length) {
  37787. var codePoint = Number(arguments[index]);
  37788. if (
  37789. !isFinite(codePoint) || // `NaN`, `+Infinity`, or `-Infinity`
  37790. codePoint < 0 || // not a valid Unicode code point
  37791. codePoint > 0x10FFFF || // not a valid Unicode code point
  37792. floor(codePoint) != codePoint // not an integer
  37793. ) {
  37794. throw RangeError('Invalid code point: ' + codePoint);
  37795. }
  37796. if (codePoint <= 0xFFFF) { // BMP code point
  37797. codeUnits.push(codePoint);
  37798. } else { // Astral code point; split in surrogate halves
  37799. // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
  37800. codePoint -= 0x10000;
  37801. highSurrogate = (codePoint >> 10) + 0xD800;
  37802. lowSurrogate = (codePoint % 0x400) + 0xDC00;
  37803. codeUnits.push(highSurrogate, lowSurrogate);
  37804. }
  37805. if (index + 1 == length || codeUnits.length > MAX_SIZE) {
  37806. result += stringFromCharCode.apply(null, codeUnits);
  37807. codeUnits.length = 0;
  37808. }
  37809. }
  37810. return result;
  37811. };
  37812. if (defineProperty) {
  37813. defineProperty(String, 'fromCodePoint', {
  37814. 'value': fromCodePoint,
  37815. 'configurable': true,
  37816. 'writable': true
  37817. });
  37818. } else {
  37819. String.fromCodePoint = fromCodePoint;
  37820. }
  37821. }());
  37822. }
  37823. /***/ }),
  37824. /***/ "./node_modules/antlr4/tree/Tree.js":
  37825. /*!******************************************!*\
  37826. !*** ./node_modules/antlr4/tree/Tree.js ***!
  37827. \******************************************/
  37828. /*! no static exports found */
  37829. /***/ (function(module, exports, __webpack_require__) {
  37830. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  37831. * Use of this file is governed by the BSD 3-clause license that
  37832. * can be found in the LICENSE.txt file in the project root.
  37833. */
  37834. ///
  37835. // The basic notion of a tree has a parent, a payload, and a list of children.
  37836. // It is the most abstract interface for all the trees used by ANTLR.
  37837. ///
  37838. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  37839. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  37840. var INVALID_INTERVAL = new Interval(-1, -2);
  37841. var Utils = __webpack_require__(/*! ../Utils.js */ "./node_modules/antlr4/Utils.js");
  37842. function Tree() {
  37843. return this;
  37844. }
  37845. function SyntaxTree() {
  37846. Tree.call(this);
  37847. return this;
  37848. }
  37849. SyntaxTree.prototype = Object.create(Tree.prototype);
  37850. SyntaxTree.prototype.constructor = SyntaxTree;
  37851. function ParseTree() {
  37852. SyntaxTree.call(this);
  37853. return this;
  37854. }
  37855. ParseTree.prototype = Object.create(SyntaxTree.prototype);
  37856. ParseTree.prototype.constructor = ParseTree;
  37857. function RuleNode() {
  37858. ParseTree.call(this);
  37859. return this;
  37860. }
  37861. RuleNode.prototype = Object.create(ParseTree.prototype);
  37862. RuleNode.prototype.constructor = RuleNode;
  37863. function TerminalNode() {
  37864. ParseTree.call(this);
  37865. return this;
  37866. }
  37867. TerminalNode.prototype = Object.create(ParseTree.prototype);
  37868. TerminalNode.prototype.constructor = TerminalNode;
  37869. function ErrorNode() {
  37870. TerminalNode.call(this);
  37871. return this;
  37872. }
  37873. ErrorNode.prototype = Object.create(TerminalNode.prototype);
  37874. ErrorNode.prototype.constructor = ErrorNode;
  37875. function ParseTreeVisitor() {
  37876. return this;
  37877. }
  37878. ParseTreeVisitor.prototype.visit = function(ctx) {
  37879. if (Array.isArray(ctx)) {
  37880. return ctx.map(function(child) {
  37881. return child.accept(this);
  37882. }, this);
  37883. } else {
  37884. return ctx.accept(this);
  37885. }
  37886. };
  37887. ParseTreeVisitor.prototype.visitChildren = function(ctx) {
  37888. return this.visit(ctx.children);
  37889. }
  37890. ParseTreeVisitor.prototype.visitTerminal = function(node) {
  37891. };
  37892. ParseTreeVisitor.prototype.visitErrorNode = function(node) {
  37893. };
  37894. function ParseTreeListener() {
  37895. return this;
  37896. }
  37897. ParseTreeListener.prototype.visitTerminal = function(node) {
  37898. };
  37899. ParseTreeListener.prototype.visitErrorNode = function(node) {
  37900. };
  37901. ParseTreeListener.prototype.enterEveryRule = function(node) {
  37902. };
  37903. ParseTreeListener.prototype.exitEveryRule = function(node) {
  37904. };
  37905. function TerminalNodeImpl(symbol) {
  37906. TerminalNode.call(this);
  37907. this.parentCtx = null;
  37908. this.symbol = symbol;
  37909. return this;
  37910. }
  37911. TerminalNodeImpl.prototype = Object.create(TerminalNode.prototype);
  37912. TerminalNodeImpl.prototype.constructor = TerminalNodeImpl;
  37913. TerminalNodeImpl.prototype.getChild = function(i) {
  37914. return null;
  37915. };
  37916. TerminalNodeImpl.prototype.getSymbol = function() {
  37917. return this.symbol;
  37918. };
  37919. TerminalNodeImpl.prototype.getParent = function() {
  37920. return this.parentCtx;
  37921. };
  37922. TerminalNodeImpl.prototype.getPayload = function() {
  37923. return this.symbol;
  37924. };
  37925. TerminalNodeImpl.prototype.getSourceInterval = function() {
  37926. if (this.symbol === null) {
  37927. return INVALID_INTERVAL;
  37928. }
  37929. var tokenIndex = this.symbol.tokenIndex;
  37930. return new Interval(tokenIndex, tokenIndex);
  37931. };
  37932. TerminalNodeImpl.prototype.getChildCount = function() {
  37933. return 0;
  37934. };
  37935. TerminalNodeImpl.prototype.accept = function(visitor) {
  37936. return visitor.visitTerminal(this);
  37937. };
  37938. TerminalNodeImpl.prototype.getText = function() {
  37939. return this.symbol.text;
  37940. };
  37941. TerminalNodeImpl.prototype.toString = function() {
  37942. if (this.symbol.type === Token.EOF) {
  37943. return "<EOF>";
  37944. } else {
  37945. return this.symbol.text;
  37946. }
  37947. };
  37948. // Represents a token that was consumed during resynchronization
  37949. // rather than during a valid match operation. For example,
  37950. // we will create this kind of a node during single token insertion
  37951. // and deletion as well as during "consume until error recovery set"
  37952. // upon no viable alternative exceptions.
  37953. function ErrorNodeImpl(token) {
  37954. TerminalNodeImpl.call(this, token);
  37955. return this;
  37956. }
  37957. ErrorNodeImpl.prototype = Object.create(TerminalNodeImpl.prototype);
  37958. ErrorNodeImpl.prototype.constructor = ErrorNodeImpl;
  37959. ErrorNodeImpl.prototype.isErrorNode = function() {
  37960. return true;
  37961. };
  37962. ErrorNodeImpl.prototype.accept = function(visitor) {
  37963. return visitor.visitErrorNode(this);
  37964. };
  37965. function ParseTreeWalker() {
  37966. return this;
  37967. }
  37968. ParseTreeWalker.prototype.walk = function(listener, t) {
  37969. var errorNode = t instanceof ErrorNode ||
  37970. (t.isErrorNode !== undefined && t.isErrorNode());
  37971. if (errorNode) {
  37972. listener.visitErrorNode(t);
  37973. } else if (t instanceof TerminalNode) {
  37974. listener.visitTerminal(t);
  37975. } else {
  37976. this.enterRule(listener, t);
  37977. for (var i = 0; i < t.getChildCount(); i++) {
  37978. var child = t.getChild(i);
  37979. this.walk(listener, child);
  37980. }
  37981. this.exitRule(listener, t);
  37982. }
  37983. };
  37984. //
  37985. // The discovery of a rule node, involves sending two events: the generic
  37986. // {@link ParseTreeListener//enterEveryRule} and a
  37987. // {@link RuleContext}-specific event. First we trigger the generic and then
  37988. // the rule specific. We to them in reverse order upon finishing the node.
  37989. //
  37990. ParseTreeWalker.prototype.enterRule = function(listener, r) {
  37991. var ctx = r.getRuleContext();
  37992. listener.enterEveryRule(ctx);
  37993. ctx.enterRule(listener);
  37994. };
  37995. ParseTreeWalker.prototype.exitRule = function(listener, r) {
  37996. var ctx = r.getRuleContext();
  37997. ctx.exitRule(listener);
  37998. listener.exitEveryRule(ctx);
  37999. };
  38000. ParseTreeWalker.DEFAULT = new ParseTreeWalker();
  38001. exports.RuleNode = RuleNode;
  38002. exports.ErrorNode = ErrorNode;
  38003. exports.TerminalNode = TerminalNode;
  38004. exports.ErrorNodeImpl = ErrorNodeImpl;
  38005. exports.TerminalNodeImpl = TerminalNodeImpl;
  38006. exports.ParseTreeListener = ParseTreeListener;
  38007. exports.ParseTreeVisitor = ParseTreeVisitor;
  38008. exports.ParseTreeWalker = ParseTreeWalker;
  38009. exports.INVALID_INTERVAL = INVALID_INTERVAL;
  38010. /***/ }),
  38011. /***/ "./node_modules/antlr4/tree/Trees.js":
  38012. /*!*******************************************!*\
  38013. !*** ./node_modules/antlr4/tree/Trees.js ***!
  38014. \*******************************************/
  38015. /*! no static exports found */
  38016. /***/ (function(module, exports, __webpack_require__) {
  38017. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  38018. * Use of this file is governed by the BSD 3-clause license that
  38019. * can be found in the LICENSE.txt file in the project root.
  38020. */
  38021. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  38022. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  38023. var RuleNode = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js").RuleNode;
  38024. var ErrorNode = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js").ErrorNode;
  38025. var TerminalNode = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js").TerminalNode;
  38026. var ParserRuleContext = __webpack_require__(/*! ./../ParserRuleContext */ "./node_modules/antlr4/ParserRuleContext.js").ParserRuleContext;
  38027. var RuleContext = __webpack_require__(/*! ./../RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  38028. var INVALID_ALT_NUMBER = __webpack_require__(/*! ./../atn/ATN */ "./node_modules/antlr4/atn/ATN.js").INVALID_ALT_NUMBER;
  38029. /** A set of utility routines useful for all kinds of ANTLR trees. */
  38030. function Trees() {
  38031. }
  38032. // Print out a whole tree in LISP form. {@link //getNodeText} is used on the
  38033. // node payloads to get the text for the nodes. Detect
  38034. // parse trees and extract data appropriately.
  38035. Trees.toStringTree = function(tree, ruleNames, recog) {
  38036. ruleNames = ruleNames || null;
  38037. recog = recog || null;
  38038. if(recog!==null) {
  38039. ruleNames = recog.ruleNames;
  38040. }
  38041. var s = Trees.getNodeText(tree, ruleNames);
  38042. s = Utils.escapeWhitespace(s, false);
  38043. var c = tree.getChildCount();
  38044. if(c===0) {
  38045. return s;
  38046. }
  38047. var res = "(" + s + ' ';
  38048. if(c>0) {
  38049. s = Trees.toStringTree(tree.getChild(0), ruleNames);
  38050. res = res.concat(s);
  38051. }
  38052. for(var i=1;i<c;i++) {
  38053. s = Trees.toStringTree(tree.getChild(i), ruleNames);
  38054. res = res.concat(' ' + s);
  38055. }
  38056. res = res.concat(")");
  38057. return res;
  38058. };
  38059. Trees.getNodeText = function(t, ruleNames, recog) {
  38060. ruleNames = ruleNames || null;
  38061. recog = recog || null;
  38062. if(recog!==null) {
  38063. ruleNames = recog.ruleNames;
  38064. }
  38065. if(ruleNames!==null) {
  38066. if (t instanceof RuleContext) {
  38067. var altNumber = t.getAltNumber();
  38068. if ( altNumber!=INVALID_ALT_NUMBER ) {
  38069. return ruleNames[t.ruleIndex]+":"+altNumber;
  38070. }
  38071. return ruleNames[t.ruleIndex];
  38072. } else if ( t instanceof ErrorNode) {
  38073. return t.toString();
  38074. } else if(t instanceof TerminalNode) {
  38075. if(t.symbol!==null) {
  38076. return t.symbol.text;
  38077. }
  38078. }
  38079. }
  38080. // no recog for rule names
  38081. var payload = t.getPayload();
  38082. if (payload instanceof Token ) {
  38083. return payload.text;
  38084. }
  38085. return t.getPayload().toString();
  38086. };
  38087. // Return ordered list of all children of this node
  38088. Trees.getChildren = function(t) {
  38089. var list = [];
  38090. for(var i=0;i<t.getChildCount();i++) {
  38091. list.push(t.getChild(i));
  38092. }
  38093. return list;
  38094. };
  38095. // Return a list of all ancestors of this node. The first node of
  38096. // list is the root and the last is the parent of this node.
  38097. //
  38098. Trees.getAncestors = function(t) {
  38099. var ancestors = [];
  38100. t = t.getParent();
  38101. while(t!==null) {
  38102. ancestors = [t].concat(ancestors);
  38103. t = t.getParent();
  38104. }
  38105. return ancestors;
  38106. };
  38107. Trees.findAllTokenNodes = function(t, ttype) {
  38108. return Trees.findAllNodes(t, ttype, true);
  38109. };
  38110. Trees.findAllRuleNodes = function(t, ruleIndex) {
  38111. return Trees.findAllNodes(t, ruleIndex, false);
  38112. };
  38113. Trees.findAllNodes = function(t, index, findTokens) {
  38114. var nodes = [];
  38115. Trees._findAllNodes(t, index, findTokens, nodes);
  38116. return nodes;
  38117. };
  38118. Trees._findAllNodes = function(t, index, findTokens, nodes) {
  38119. // check this node (the root) first
  38120. if(findTokens && (t instanceof TerminalNode)) {
  38121. if(t.symbol.type===index) {
  38122. nodes.push(t);
  38123. }
  38124. } else if(!findTokens && (t instanceof ParserRuleContext)) {
  38125. if(t.ruleIndex===index) {
  38126. nodes.push(t);
  38127. }
  38128. }
  38129. // check children
  38130. for(var i=0;i<t.getChildCount();i++) {
  38131. Trees._findAllNodes(t.getChild(i), index, findTokens, nodes);
  38132. }
  38133. };
  38134. Trees.descendants = function(t) {
  38135. var nodes = [t];
  38136. for(var i=0;i<t.getChildCount();i++) {
  38137. nodes = nodes.concat(Trees.descendants(t.getChild(i)));
  38138. }
  38139. return nodes;
  38140. };
  38141. exports.Trees = Trees;
  38142. /***/ }),
  38143. /***/ "./node_modules/antlr4/tree/index.js":
  38144. /*!*******************************************!*\
  38145. !*** ./node_modules/antlr4/tree/index.js ***!
  38146. \*******************************************/
  38147. /*! no static exports found */
  38148. /***/ (function(module, exports, __webpack_require__) {
  38149. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  38150. * Use of this file is governed by the BSD 3-clause license that
  38151. * can be found in the LICENSE.txt file in the project root.
  38152. */
  38153. var Tree = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js");
  38154. exports.Trees = __webpack_require__(/*! ./Trees */ "./node_modules/antlr4/tree/Trees.js").Trees;
  38155. exports.RuleNode = Tree.RuleNode;
  38156. exports.ParseTreeListener = Tree.ParseTreeListener;
  38157. exports.ParseTreeVisitor = Tree.ParseTreeVisitor;
  38158. exports.ParseTreeWalker = Tree.ParseTreeWalker;
  38159. /***/ }),
  38160. /***/ "./node_modules/decimal.js/decimal.js":
  38161. /*!********************************************!*\
  38162. !*** ./node_modules/decimal.js/decimal.js ***!
  38163. \********************************************/
  38164. /*! no static exports found */
  38165. /***/ (function(module, exports, __webpack_require__) {
  38166. var __WEBPACK_AMD_DEFINE_RESULT__;/*! decimal.js v10.0.1 https://github.com/MikeMcl/decimal.js/LICENCE */
  38167. ;(function (globalScope) {
  38168. 'use strict';
  38169. /*
  38170. * decimal.js v10.0.1
  38171. * An arbitrary-precision Decimal type for JavaScript.
  38172. * https://github.com/MikeMcl/decimal.js
  38173. * Copyright (c) 2017 Michael Mclaughlin <M8ch88l@gmail.com>
  38174. * MIT Licence
  38175. */
  38176. // ----------------------------------- EDITABLE DEFAULTS ------------------------------------ //
  38177. // The maximum exponent magnitude.
  38178. // The limit on the value of `toExpNeg`, `toExpPos`, `minE` and `maxE`.
  38179. var EXP_LIMIT = 9e15, // 0 to 9e15
  38180. // The limit on the value of `precision`, and on the value of the first argument to
  38181. // `toDecimalPlaces`, `toExponential`, `toFixed`, `toPrecision` and `toSignificantDigits`.
  38182. MAX_DIGITS = 1e9, // 0 to 1e9
  38183. // Base conversion alphabet.
  38184. NUMERALS = '0123456789abcdef',
  38185. // The natural logarithm of 10 (1025 digits).
  38186. LN10 = '2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058',
  38187. // Pi (1025 digits).
  38188. PI = '3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789',
  38189. // The initial configuration properties of the Decimal constructor.
  38190. DEFAULTS = {
  38191. // These values must be integers within the stated ranges (inclusive).
  38192. // Most of these values can be changed at run-time using the `Decimal.config` method.
  38193. // The maximum number of significant digits of the result of a calculation or base conversion.
  38194. // E.g. `Decimal.config({ precision: 20 });`
  38195. precision: 20, // 1 to MAX_DIGITS
  38196. // The rounding mode used when rounding to `precision`.
  38197. //
  38198. // ROUND_UP 0 Away from zero.
  38199. // ROUND_DOWN 1 Towards zero.
  38200. // ROUND_CEIL 2 Towards +Infinity.
  38201. // ROUND_FLOOR 3 Towards -Infinity.
  38202. // ROUND_HALF_UP 4 Towards nearest neighbour. If equidistant, up.
  38203. // ROUND_HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.
  38204. // ROUND_HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.
  38205. // ROUND_HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.
  38206. // ROUND_HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.
  38207. //
  38208. // E.g.
  38209. // `Decimal.rounding = 4;`
  38210. // `Decimal.rounding = Decimal.ROUND_HALF_UP;`
  38211. rounding: 4, // 0 to 8
  38212. // The modulo mode used when calculating the modulus: a mod n.
  38213. // The quotient (q = a / n) is calculated according to the corresponding rounding mode.
  38214. // The remainder (r) is calculated as: r = a - n * q.
  38215. //
  38216. // UP 0 The remainder is positive if the dividend is negative, else is negative.
  38217. // DOWN 1 The remainder has the same sign as the dividend (JavaScript %).
  38218. // FLOOR 3 The remainder has the same sign as the divisor (Python %).
  38219. // HALF_EVEN 6 The IEEE 754 remainder function.
  38220. // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)). Always positive.
  38221. //
  38222. // Truncated division (1), floored division (3), the IEEE 754 remainder (6), and Euclidian
  38223. // division (9) are commonly used for the modulus operation. The other rounding modes can also
  38224. // be used, but they may not give useful results.
  38225. modulo: 1, // 0 to 9
  38226. // The exponent value at and beneath which `toString` returns exponential notation.
  38227. // JavaScript numbers: -7
  38228. toExpNeg: -7, // 0 to -EXP_LIMIT
  38229. // The exponent value at and above which `toString` returns exponential notation.
  38230. // JavaScript numbers: 21
  38231. toExpPos: 21, // 0 to EXP_LIMIT
  38232. // The minimum exponent value, beneath which underflow to zero occurs.
  38233. // JavaScript numbers: -324 (5e-324)
  38234. minE: -EXP_LIMIT, // -1 to -EXP_LIMIT
  38235. // The maximum exponent value, above which overflow to Infinity occurs.
  38236. // JavaScript numbers: 308 (1.7976931348623157e+308)
  38237. maxE: EXP_LIMIT, // 1 to EXP_LIMIT
  38238. // Whether to use cryptographically-secure random number generation, if available.
  38239. crypto: false // true/false
  38240. },
  38241. // ----------------------------------- END OF EDITABLE DEFAULTS ------------------------------- //
  38242. Decimal, inexact, noConflict, quadrant,
  38243. external = true,
  38244. decimalError = '[DecimalError] ',
  38245. invalidArgument = decimalError + 'Invalid argument: ',
  38246. precisionLimitExceeded = decimalError + 'Precision limit exceeded',
  38247. cryptoUnavailable = decimalError + 'crypto unavailable',
  38248. mathfloor = Math.floor,
  38249. mathpow = Math.pow,
  38250. isBinary = /^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,
  38251. isHex = /^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,
  38252. isOctal = /^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,
  38253. isDecimal = /^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,
  38254. BASE = 1e7,
  38255. LOG_BASE = 7,
  38256. MAX_SAFE_INTEGER = 9007199254740991,
  38257. LN10_PRECISION = LN10.length - 1,
  38258. PI_PRECISION = PI.length - 1,
  38259. // Decimal.prototype object
  38260. P = { name: '[object Decimal]' };
  38261. // Decimal prototype methods
  38262. /*
  38263. * absoluteValue abs
  38264. * ceil
  38265. * comparedTo cmp
  38266. * cosine cos
  38267. * cubeRoot cbrt
  38268. * decimalPlaces dp
  38269. * dividedBy div
  38270. * dividedToIntegerBy divToInt
  38271. * equals eq
  38272. * floor
  38273. * greaterThan gt
  38274. * greaterThanOrEqualTo gte
  38275. * hyperbolicCosine cosh
  38276. * hyperbolicSine sinh
  38277. * hyperbolicTangent tanh
  38278. * inverseCosine acos
  38279. * inverseHyperbolicCosine acosh
  38280. * inverseHyperbolicSine asinh
  38281. * inverseHyperbolicTangent atanh
  38282. * inverseSine asin
  38283. * inverseTangent atan
  38284. * isFinite
  38285. * isInteger isInt
  38286. * isNaN
  38287. * isNegative isNeg
  38288. * isPositive isPos
  38289. * isZero
  38290. * lessThan lt
  38291. * lessThanOrEqualTo lte
  38292. * logarithm log
  38293. * [maximum] [max]
  38294. * [minimum] [min]
  38295. * minus sub
  38296. * modulo mod
  38297. * naturalExponential exp
  38298. * naturalLogarithm ln
  38299. * negated neg
  38300. * plus add
  38301. * precision sd
  38302. * round
  38303. * sine sin
  38304. * squareRoot sqrt
  38305. * tangent tan
  38306. * times mul
  38307. * toBinary
  38308. * toDecimalPlaces toDP
  38309. * toExponential
  38310. * toFixed
  38311. * toFraction
  38312. * toHexadecimal toHex
  38313. * toNearest
  38314. * toNumber
  38315. * toOctal
  38316. * toPower pow
  38317. * toPrecision
  38318. * toSignificantDigits toSD
  38319. * toString
  38320. * truncated trunc
  38321. * valueOf toJSON
  38322. */
  38323. /*
  38324. * Return a new Decimal whose value is the absolute value of this Decimal.
  38325. *
  38326. */
  38327. P.absoluteValue = P.abs = function () {
  38328. var x = new this.constructor(this);
  38329. if (x.s < 0) x.s = 1;
  38330. return finalise(x);
  38331. };
  38332. /*
  38333. * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the
  38334. * direction of positive Infinity.
  38335. *
  38336. */
  38337. P.ceil = function () {
  38338. return finalise(new this.constructor(this), this.e + 1, 2);
  38339. };
  38340. /*
  38341. * Return
  38342. * 1 if the value of this Decimal is greater than the value of `y`,
  38343. * -1 if the value of this Decimal is less than the value of `y`,
  38344. * 0 if they have the same value,
  38345. * NaN if the value of either Decimal is NaN.
  38346. *
  38347. */
  38348. P.comparedTo = P.cmp = function (y) {
  38349. var i, j, xdL, ydL,
  38350. x = this,
  38351. xd = x.d,
  38352. yd = (y = new x.constructor(y)).d,
  38353. xs = x.s,
  38354. ys = y.s;
  38355. // Either NaN or ±Infinity?
  38356. if (!xd || !yd) {
  38357. return !xs || !ys ? NaN : xs !== ys ? xs : xd === yd ? 0 : !xd ^ xs < 0 ? 1 : -1;
  38358. }
  38359. // Either zero?
  38360. if (!xd[0] || !yd[0]) return xd[0] ? xs : yd[0] ? -ys : 0;
  38361. // Signs differ?
  38362. if (xs !== ys) return xs;
  38363. // Compare exponents.
  38364. if (x.e !== y.e) return x.e > y.e ^ xs < 0 ? 1 : -1;
  38365. xdL = xd.length;
  38366. ydL = yd.length;
  38367. // Compare digit by digit.
  38368. for (i = 0, j = xdL < ydL ? xdL : ydL; i < j; ++i) {
  38369. if (xd[i] !== yd[i]) return xd[i] > yd[i] ^ xs < 0 ? 1 : -1;
  38370. }
  38371. // Compare lengths.
  38372. return xdL === ydL ? 0 : xdL > ydL ^ xs < 0 ? 1 : -1;
  38373. };
  38374. /*
  38375. * Return a new Decimal whose value is the cosine of the value in radians of this Decimal.
  38376. *
  38377. * Domain: [-Infinity, Infinity]
  38378. * Range: [-1, 1]
  38379. *
  38380. * cos(0) = 1
  38381. * cos(-0) = 1
  38382. * cos(Infinity) = NaN
  38383. * cos(-Infinity) = NaN
  38384. * cos(NaN) = NaN
  38385. *
  38386. */
  38387. P.cosine = P.cos = function () {
  38388. var pr, rm,
  38389. x = this,
  38390. Ctor = x.constructor;
  38391. if (!x.d) return new Ctor(NaN);
  38392. // cos(0) = cos(-0) = 1
  38393. if (!x.d[0]) return new Ctor(1);
  38394. pr = Ctor.precision;
  38395. rm = Ctor.rounding;
  38396. Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE;
  38397. Ctor.rounding = 1;
  38398. x = cosine(Ctor, toLessThanHalfPi(Ctor, x));
  38399. Ctor.precision = pr;
  38400. Ctor.rounding = rm;
  38401. return finalise(quadrant == 2 || quadrant == 3 ? x.neg() : x, pr, rm, true);
  38402. };
  38403. /*
  38404. *
  38405. * Return a new Decimal whose value is the cube root of the value of this Decimal, rounded to
  38406. * `precision` significant digits using rounding mode `rounding`.
  38407. *
  38408. * cbrt(0) = 0
  38409. * cbrt(-0) = -0
  38410. * cbrt(1) = 1
  38411. * cbrt(-1) = -1
  38412. * cbrt(N) = N
  38413. * cbrt(-I) = -I
  38414. * cbrt(I) = I
  38415. *
  38416. * Math.cbrt(x) = (x < 0 ? -Math.pow(-x, 1/3) : Math.pow(x, 1/3))
  38417. *
  38418. */
  38419. P.cubeRoot = P.cbrt = function () {
  38420. var e, m, n, r, rep, s, sd, t, t3, t3plusx,
  38421. x = this,
  38422. Ctor = x.constructor;
  38423. if (!x.isFinite() || x.isZero()) return new Ctor(x);
  38424. external = false;
  38425. // Initial estimate.
  38426. s = x.s * Math.pow(x.s * x, 1 / 3);
  38427. // Math.cbrt underflow/overflow?
  38428. // Pass x to Math.pow as integer, then adjust the exponent of the result.
  38429. if (!s || Math.abs(s) == 1 / 0) {
  38430. n = digitsToString(x.d);
  38431. e = x.e;
  38432. // Adjust n exponent so it is a multiple of 3 away from x exponent.
  38433. if (s = (e - n.length + 1) % 3) n += (s == 1 || s == -2 ? '0' : '00');
  38434. s = Math.pow(n, 1 / 3);
  38435. // Rarely, e may be one less than the result exponent value.
  38436. e = mathfloor((e + 1) / 3) - (e % 3 == (e < 0 ? -1 : 2));
  38437. if (s == 1 / 0) {
  38438. n = '5e' + e;
  38439. } else {
  38440. n = s.toExponential();
  38441. n = n.slice(0, n.indexOf('e') + 1) + e;
  38442. }
  38443. r = new Ctor(n);
  38444. r.s = x.s;
  38445. } else {
  38446. r = new Ctor(s.toString());
  38447. }
  38448. sd = (e = Ctor.precision) + 3;
  38449. // Halley's method.
  38450. // TODO? Compare Newton's method.
  38451. for (;;) {
  38452. t = r;
  38453. t3 = t.times(t).times(t);
  38454. t3plusx = t3.plus(x);
  38455. r = divide(t3plusx.plus(x).times(t), t3plusx.plus(t3), sd + 2, 1);
  38456. // TODO? Replace with for-loop and checkRoundingDigits.
  38457. if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) {
  38458. n = n.slice(sd - 3, sd + 1);
  38459. // The 4th rounding digit may be in error by -1 so if the 4 rounding digits are 9999 or 4999
  38460. // , i.e. approaching a rounding boundary, continue the iteration.
  38461. if (n == '9999' || !rep && n == '4999') {
  38462. // On the first iteration only, check to see if rounding up gives the exact result as the
  38463. // nines may infinitely repeat.
  38464. if (!rep) {
  38465. finalise(t, e + 1, 0);
  38466. if (t.times(t).times(t).eq(x)) {
  38467. r = t;
  38468. break;
  38469. }
  38470. }
  38471. sd += 4;
  38472. rep = 1;
  38473. } else {
  38474. // If the rounding digits are null, 0{0,4} or 50{0,3}, check for an exact result.
  38475. // If not, then there are further digits and m will be truthy.
  38476. if (!+n || !+n.slice(1) && n.charAt(0) == '5') {
  38477. // Truncate to the first rounding digit.
  38478. finalise(r, e + 1, 1);
  38479. m = !r.times(r).times(r).eq(x);
  38480. }
  38481. break;
  38482. }
  38483. }
  38484. }
  38485. external = true;
  38486. return finalise(r, e, Ctor.rounding, m);
  38487. };
  38488. /*
  38489. * Return the number of decimal places of the value of this Decimal.
  38490. *
  38491. */
  38492. P.decimalPlaces = P.dp = function () {
  38493. var w,
  38494. d = this.d,
  38495. n = NaN;
  38496. if (d) {
  38497. w = d.length - 1;
  38498. n = (w - mathfloor(this.e / LOG_BASE)) * LOG_BASE;
  38499. // Subtract the number of trailing zeros of the last word.
  38500. w = d[w];
  38501. if (w) for (; w % 10 == 0; w /= 10) n--;
  38502. if (n < 0) n = 0;
  38503. }
  38504. return n;
  38505. };
  38506. /*
  38507. * n / 0 = I
  38508. * n / N = N
  38509. * n / I = 0
  38510. * 0 / n = 0
  38511. * 0 / 0 = N
  38512. * 0 / N = N
  38513. * 0 / I = 0
  38514. * N / n = N
  38515. * N / 0 = N
  38516. * N / N = N
  38517. * N / I = N
  38518. * I / n = I
  38519. * I / 0 = I
  38520. * I / N = N
  38521. * I / I = N
  38522. *
  38523. * Return a new Decimal whose value is the value of this Decimal divided by `y`, rounded to
  38524. * `precision` significant digits using rounding mode `rounding`.
  38525. *
  38526. */
  38527. P.dividedBy = P.div = function (y) {
  38528. return divide(this, new this.constructor(y));
  38529. };
  38530. /*
  38531. * Return a new Decimal whose value is the integer part of dividing the value of this Decimal
  38532. * by the value of `y`, rounded to `precision` significant digits using rounding mode `rounding`.
  38533. *
  38534. */
  38535. P.dividedToIntegerBy = P.divToInt = function (y) {
  38536. var x = this,
  38537. Ctor = x.constructor;
  38538. return finalise(divide(x, new Ctor(y), 0, 1, 1), Ctor.precision, Ctor.rounding);
  38539. };
  38540. /*
  38541. * Return true if the value of this Decimal is equal to the value of `y`, otherwise return false.
  38542. *
  38543. */
  38544. P.equals = P.eq = function (y) {
  38545. return this.cmp(y) === 0;
  38546. };
  38547. /*
  38548. * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the
  38549. * direction of negative Infinity.
  38550. *
  38551. */
  38552. P.floor = function () {
  38553. return finalise(new this.constructor(this), this.e + 1, 3);
  38554. };
  38555. /*
  38556. * Return true if the value of this Decimal is greater than the value of `y`, otherwise return
  38557. * false.
  38558. *
  38559. */
  38560. P.greaterThan = P.gt = function (y) {
  38561. return this.cmp(y) > 0;
  38562. };
  38563. /*
  38564. * Return true if the value of this Decimal is greater than or equal to the value of `y`,
  38565. * otherwise return false.
  38566. *
  38567. */
  38568. P.greaterThanOrEqualTo = P.gte = function (y) {
  38569. var k = this.cmp(y);
  38570. return k == 1 || k === 0;
  38571. };
  38572. /*
  38573. * Return a new Decimal whose value is the hyperbolic cosine of the value in radians of this
  38574. * Decimal.
  38575. *
  38576. * Domain: [-Infinity, Infinity]
  38577. * Range: [1, Infinity]
  38578. *
  38579. * cosh(x) = 1 + x^2/2! + x^4/4! + x^6/6! + ...
  38580. *
  38581. * cosh(0) = 1
  38582. * cosh(-0) = 1
  38583. * cosh(Infinity) = Infinity
  38584. * cosh(-Infinity) = Infinity
  38585. * cosh(NaN) = NaN
  38586. *
  38587. * x time taken (ms) result
  38588. * 1000 9 9.8503555700852349694e+433
  38589. * 10000 25 4.4034091128314607936e+4342
  38590. * 100000 171 1.4033316802130615897e+43429
  38591. * 1000000 3817 1.5166076984010437725e+434294
  38592. * 10000000 abandoned after 2 minute wait
  38593. *
  38594. * TODO? Compare performance of cosh(x) = 0.5 * (exp(x) + exp(-x))
  38595. *
  38596. */
  38597. P.hyperbolicCosine = P.cosh = function () {
  38598. var k, n, pr, rm, len,
  38599. x = this,
  38600. Ctor = x.constructor,
  38601. one = new Ctor(1);
  38602. if (!x.isFinite()) return new Ctor(x.s ? 1 / 0 : NaN);
  38603. if (x.isZero()) return one;
  38604. pr = Ctor.precision;
  38605. rm = Ctor.rounding;
  38606. Ctor.precision = pr + Math.max(x.e, x.sd()) + 4;
  38607. Ctor.rounding = 1;
  38608. len = x.d.length;
  38609. // Argument reduction: cos(4x) = 1 - 8cos^2(x) + 8cos^4(x) + 1
  38610. // i.e. cos(x) = 1 - cos^2(x/4)(8 - 8cos^2(x/4))
  38611. // Estimate the optimum number of times to use the argument reduction.
  38612. // TODO? Estimation reused from cosine() and may not be optimal here.
  38613. if (len < 32) {
  38614. k = Math.ceil(len / 3);
  38615. n = Math.pow(4, -k).toString();
  38616. } else {
  38617. k = 16;
  38618. n = '2.3283064365386962890625e-10';
  38619. }
  38620. x = taylorSeries(Ctor, 1, x.times(n), new Ctor(1), true);
  38621. // Reverse argument reduction
  38622. var cosh2_x,
  38623. i = k,
  38624. d8 = new Ctor(8);
  38625. for (; i--;) {
  38626. cosh2_x = x.times(x);
  38627. x = one.minus(cosh2_x.times(d8.minus(cosh2_x.times(d8))));
  38628. }
  38629. return finalise(x, Ctor.precision = pr, Ctor.rounding = rm, true);
  38630. };
  38631. /*
  38632. * Return a new Decimal whose value is the hyperbolic sine of the value in radians of this
  38633. * Decimal.
  38634. *
  38635. * Domain: [-Infinity, Infinity]
  38636. * Range: [-Infinity, Infinity]
  38637. *
  38638. * sinh(x) = x + x^3/3! + x^5/5! + x^7/7! + ...
  38639. *
  38640. * sinh(0) = 0
  38641. * sinh(-0) = -0
  38642. * sinh(Infinity) = Infinity
  38643. * sinh(-Infinity) = -Infinity
  38644. * sinh(NaN) = NaN
  38645. *
  38646. * x time taken (ms)
  38647. * 10 2 ms
  38648. * 100 5 ms
  38649. * 1000 14 ms
  38650. * 10000 82 ms
  38651. * 100000 886 ms 1.4033316802130615897e+43429
  38652. * 200000 2613 ms
  38653. * 300000 5407 ms
  38654. * 400000 8824 ms
  38655. * 500000 13026 ms 8.7080643612718084129e+217146
  38656. * 1000000 48543 ms
  38657. *
  38658. * TODO? Compare performance of sinh(x) = 0.5 * (exp(x) - exp(-x))
  38659. *
  38660. */
  38661. P.hyperbolicSine = P.sinh = function () {
  38662. var k, pr, rm, len,
  38663. x = this,
  38664. Ctor = x.constructor;
  38665. if (!x.isFinite() || x.isZero()) return new Ctor(x);
  38666. pr = Ctor.precision;
  38667. rm = Ctor.rounding;
  38668. Ctor.precision = pr + Math.max(x.e, x.sd()) + 4;
  38669. Ctor.rounding = 1;
  38670. len = x.d.length;
  38671. if (len < 3) {
  38672. x = taylorSeries(Ctor, 2, x, x, true);
  38673. } else {
  38674. // Alternative argument reduction: sinh(3x) = sinh(x)(3 + 4sinh^2(x))
  38675. // i.e. sinh(x) = sinh(x/3)(3 + 4sinh^2(x/3))
  38676. // 3 multiplications and 1 addition
  38677. // Argument reduction: sinh(5x) = sinh(x)(5 + sinh^2(x)(20 + 16sinh^2(x)))
  38678. // i.e. sinh(x) = sinh(x/5)(5 + sinh^2(x/5)(20 + 16sinh^2(x/5)))
  38679. // 4 multiplications and 2 additions
  38680. // Estimate the optimum number of times to use the argument reduction.
  38681. k = 1.4 * Math.sqrt(len);
  38682. k = k > 16 ? 16 : k | 0;
  38683. x = x.times(Math.pow(5, -k));
  38684. x = taylorSeries(Ctor, 2, x, x, true);
  38685. // Reverse argument reduction
  38686. var sinh2_x,
  38687. d5 = new Ctor(5),
  38688. d16 = new Ctor(16),
  38689. d20 = new Ctor(20);
  38690. for (; k--;) {
  38691. sinh2_x = x.times(x);
  38692. x = x.times(d5.plus(sinh2_x.times(d16.times(sinh2_x).plus(d20))));
  38693. }
  38694. }
  38695. Ctor.precision = pr;
  38696. Ctor.rounding = rm;
  38697. return finalise(x, pr, rm, true);
  38698. };
  38699. /*
  38700. * Return a new Decimal whose value is the hyperbolic tangent of the value in radians of this
  38701. * Decimal.
  38702. *
  38703. * Domain: [-Infinity, Infinity]
  38704. * Range: [-1, 1]
  38705. *
  38706. * tanh(x) = sinh(x) / cosh(x)
  38707. *
  38708. * tanh(0) = 0
  38709. * tanh(-0) = -0
  38710. * tanh(Infinity) = 1
  38711. * tanh(-Infinity) = -1
  38712. * tanh(NaN) = NaN
  38713. *
  38714. */
  38715. P.hyperbolicTangent = P.tanh = function () {
  38716. var pr, rm,
  38717. x = this,
  38718. Ctor = x.constructor;
  38719. if (!x.isFinite()) return new Ctor(x.s);
  38720. if (x.isZero()) return new Ctor(x);
  38721. pr = Ctor.precision;
  38722. rm = Ctor.rounding;
  38723. Ctor.precision = pr + 7;
  38724. Ctor.rounding = 1;
  38725. return divide(x.sinh(), x.cosh(), Ctor.precision = pr, Ctor.rounding = rm);
  38726. };
  38727. /*
  38728. * Return a new Decimal whose value is the arccosine (inverse cosine) in radians of the value of
  38729. * this Decimal.
  38730. *
  38731. * Domain: [-1, 1]
  38732. * Range: [0, pi]
  38733. *
  38734. * acos(x) = pi/2 - asin(x)
  38735. *
  38736. * acos(0) = pi/2
  38737. * acos(-0) = pi/2
  38738. * acos(1) = 0
  38739. * acos(-1) = pi
  38740. * acos(1/2) = pi/3
  38741. * acos(-1/2) = 2*pi/3
  38742. * acos(|x| > 1) = NaN
  38743. * acos(NaN) = NaN
  38744. *
  38745. */
  38746. P.inverseCosine = P.acos = function () {
  38747. var halfPi,
  38748. x = this,
  38749. Ctor = x.constructor,
  38750. k = x.abs().cmp(1),
  38751. pr = Ctor.precision,
  38752. rm = Ctor.rounding;
  38753. if (k !== -1) {
  38754. return k === 0
  38755. // |x| is 1
  38756. ? x.isNeg() ? getPi(Ctor, pr, rm) : new Ctor(0)
  38757. // |x| > 1 or x is NaN
  38758. : new Ctor(NaN);
  38759. }
  38760. if (x.isZero()) return getPi(Ctor, pr + 4, rm).times(0.5);
  38761. // TODO? Special case acos(0.5) = pi/3 and acos(-0.5) = 2*pi/3
  38762. Ctor.precision = pr + 6;
  38763. Ctor.rounding = 1;
  38764. x = x.asin();
  38765. halfPi = getPi(Ctor, pr + 4, rm).times(0.5);
  38766. Ctor.precision = pr;
  38767. Ctor.rounding = rm;
  38768. return halfPi.minus(x);
  38769. };
  38770. /*
  38771. * Return a new Decimal whose value is the inverse of the hyperbolic cosine in radians of the
  38772. * value of this Decimal.
  38773. *
  38774. * Domain: [1, Infinity]
  38775. * Range: [0, Infinity]
  38776. *
  38777. * acosh(x) = ln(x + sqrt(x^2 - 1))
  38778. *
  38779. * acosh(x < 1) = NaN
  38780. * acosh(NaN) = NaN
  38781. * acosh(Infinity) = Infinity
  38782. * acosh(-Infinity) = NaN
  38783. * acosh(0) = NaN
  38784. * acosh(-0) = NaN
  38785. * acosh(1) = 0
  38786. * acosh(-1) = NaN
  38787. *
  38788. */
  38789. P.inverseHyperbolicCosine = P.acosh = function () {
  38790. var pr, rm,
  38791. x = this,
  38792. Ctor = x.constructor;
  38793. if (x.lte(1)) return new Ctor(x.eq(1) ? 0 : NaN);
  38794. if (!x.isFinite()) return new Ctor(x);
  38795. pr = Ctor.precision;
  38796. rm = Ctor.rounding;
  38797. Ctor.precision = pr + Math.max(Math.abs(x.e), x.sd()) + 4;
  38798. Ctor.rounding = 1;
  38799. external = false;
  38800. x = x.times(x).minus(1).sqrt().plus(x);
  38801. external = true;
  38802. Ctor.precision = pr;
  38803. Ctor.rounding = rm;
  38804. return x.ln();
  38805. };
  38806. /*
  38807. * Return a new Decimal whose value is the inverse of the hyperbolic sine in radians of the value
  38808. * of this Decimal.
  38809. *
  38810. * Domain: [-Infinity, Infinity]
  38811. * Range: [-Infinity, Infinity]
  38812. *
  38813. * asinh(x) = ln(x + sqrt(x^2 + 1))
  38814. *
  38815. * asinh(NaN) = NaN
  38816. * asinh(Infinity) = Infinity
  38817. * asinh(-Infinity) = -Infinity
  38818. * asinh(0) = 0
  38819. * asinh(-0) = -0
  38820. *
  38821. */
  38822. P.inverseHyperbolicSine = P.asinh = function () {
  38823. var pr, rm,
  38824. x = this,
  38825. Ctor = x.constructor;
  38826. if (!x.isFinite() || x.isZero()) return new Ctor(x);
  38827. pr = Ctor.precision;
  38828. rm = Ctor.rounding;
  38829. Ctor.precision = pr + 2 * Math.max(Math.abs(x.e), x.sd()) + 6;
  38830. Ctor.rounding = 1;
  38831. external = false;
  38832. x = x.times(x).plus(1).sqrt().plus(x);
  38833. external = true;
  38834. Ctor.precision = pr;
  38835. Ctor.rounding = rm;
  38836. return x.ln();
  38837. };
  38838. /*
  38839. * Return a new Decimal whose value is the inverse of the hyperbolic tangent in radians of the
  38840. * value of this Decimal.
  38841. *
  38842. * Domain: [-1, 1]
  38843. * Range: [-Infinity, Infinity]
  38844. *
  38845. * atanh(x) = 0.5 * ln((1 + x) / (1 - x))
  38846. *
  38847. * atanh(|x| > 1) = NaN
  38848. * atanh(NaN) = NaN
  38849. * atanh(Infinity) = NaN
  38850. * atanh(-Infinity) = NaN
  38851. * atanh(0) = 0
  38852. * atanh(-0) = -0
  38853. * atanh(1) = Infinity
  38854. * atanh(-1) = -Infinity
  38855. *
  38856. */
  38857. P.inverseHyperbolicTangent = P.atanh = function () {
  38858. var pr, rm, wpr, xsd,
  38859. x = this,
  38860. Ctor = x.constructor;
  38861. if (!x.isFinite()) return new Ctor(NaN);
  38862. if (x.e >= 0) return new Ctor(x.abs().eq(1) ? x.s / 0 : x.isZero() ? x : NaN);
  38863. pr = Ctor.precision;
  38864. rm = Ctor.rounding;
  38865. xsd = x.sd();
  38866. if (Math.max(xsd, pr) < 2 * -x.e - 1) return finalise(new Ctor(x), pr, rm, true);
  38867. Ctor.precision = wpr = xsd - x.e;
  38868. x = divide(x.plus(1), new Ctor(1).minus(x), wpr + pr, 1);
  38869. Ctor.precision = pr + 4;
  38870. Ctor.rounding = 1;
  38871. x = x.ln();
  38872. Ctor.precision = pr;
  38873. Ctor.rounding = rm;
  38874. return x.times(0.5);
  38875. };
  38876. /*
  38877. * Return a new Decimal whose value is the arcsine (inverse sine) in radians of the value of this
  38878. * Decimal.
  38879. *
  38880. * Domain: [-Infinity, Infinity]
  38881. * Range: [-pi/2, pi/2]
  38882. *
  38883. * asin(x) = 2*atan(x/(1 + sqrt(1 - x^2)))
  38884. *
  38885. * asin(0) = 0
  38886. * asin(-0) = -0
  38887. * asin(1/2) = pi/6
  38888. * asin(-1/2) = -pi/6
  38889. * asin(1) = pi/2
  38890. * asin(-1) = -pi/2
  38891. * asin(|x| > 1) = NaN
  38892. * asin(NaN) = NaN
  38893. *
  38894. * TODO? Compare performance of Taylor series.
  38895. *
  38896. */
  38897. P.inverseSine = P.asin = function () {
  38898. var halfPi, k,
  38899. pr, rm,
  38900. x = this,
  38901. Ctor = x.constructor;
  38902. if (x.isZero()) return new Ctor(x);
  38903. k = x.abs().cmp(1);
  38904. pr = Ctor.precision;
  38905. rm = Ctor.rounding;
  38906. if (k !== -1) {
  38907. // |x| is 1
  38908. if (k === 0) {
  38909. halfPi = getPi(Ctor, pr + 4, rm).times(0.5);
  38910. halfPi.s = x.s;
  38911. return halfPi;
  38912. }
  38913. // |x| > 1 or x is NaN
  38914. return new Ctor(NaN);
  38915. }
  38916. // TODO? Special case asin(1/2) = pi/6 and asin(-1/2) = -pi/6
  38917. Ctor.precision = pr + 6;
  38918. Ctor.rounding = 1;
  38919. x = x.div(new Ctor(1).minus(x.times(x)).sqrt().plus(1)).atan();
  38920. Ctor.precision = pr;
  38921. Ctor.rounding = rm;
  38922. return x.times(2);
  38923. };
  38924. /*
  38925. * Return a new Decimal whose value is the arctangent (inverse tangent) in radians of the value
  38926. * of this Decimal.
  38927. *
  38928. * Domain: [-Infinity, Infinity]
  38929. * Range: [-pi/2, pi/2]
  38930. *
  38931. * atan(x) = x - x^3/3 + x^5/5 - x^7/7 + ...
  38932. *
  38933. * atan(0) = 0
  38934. * atan(-0) = -0
  38935. * atan(1) = pi/4
  38936. * atan(-1) = -pi/4
  38937. * atan(Infinity) = pi/2
  38938. * atan(-Infinity) = -pi/2
  38939. * atan(NaN) = NaN
  38940. *
  38941. */
  38942. P.inverseTangent = P.atan = function () {
  38943. var i, j, k, n, px, t, r, wpr, x2,
  38944. x = this,
  38945. Ctor = x.constructor,
  38946. pr = Ctor.precision,
  38947. rm = Ctor.rounding;
  38948. if (!x.isFinite()) {
  38949. if (!x.s) return new Ctor(NaN);
  38950. if (pr + 4 <= PI_PRECISION) {
  38951. r = getPi(Ctor, pr + 4, rm).times(0.5);
  38952. r.s = x.s;
  38953. return r;
  38954. }
  38955. } else if (x.isZero()) {
  38956. return new Ctor(x);
  38957. } else if (x.abs().eq(1) && pr + 4 <= PI_PRECISION) {
  38958. r = getPi(Ctor, pr + 4, rm).times(0.25);
  38959. r.s = x.s;
  38960. return r;
  38961. }
  38962. Ctor.precision = wpr = pr + 10;
  38963. Ctor.rounding = 1;
  38964. // TODO? if (x >= 1 && pr <= PI_PRECISION) atan(x) = halfPi * x.s - atan(1 / x);
  38965. // Argument reduction
  38966. // Ensure |x| < 0.42
  38967. // atan(x) = 2 * atan(x / (1 + sqrt(1 + x^2)))
  38968. k = Math.min(28, wpr / LOG_BASE + 2 | 0);
  38969. for (i = k; i; --i) x = x.div(x.times(x).plus(1).sqrt().plus(1));
  38970. external = false;
  38971. j = Math.ceil(wpr / LOG_BASE);
  38972. n = 1;
  38973. x2 = x.times(x);
  38974. r = new Ctor(x);
  38975. px = x;
  38976. // atan(x) = x - x^3/3 + x^5/5 - x^7/7 + ...
  38977. for (; i !== -1;) {
  38978. px = px.times(x2);
  38979. t = r.minus(px.div(n += 2));
  38980. px = px.times(x2);
  38981. r = t.plus(px.div(n += 2));
  38982. if (r.d[j] !== void 0) for (i = j; r.d[i] === t.d[i] && i--;);
  38983. }
  38984. if (k) r = r.times(2 << (k - 1));
  38985. external = true;
  38986. return finalise(r, Ctor.precision = pr, Ctor.rounding = rm, true);
  38987. };
  38988. /*
  38989. * Return true if the value of this Decimal is a finite number, otherwise return false.
  38990. *
  38991. */
  38992. P.isFinite = function () {
  38993. return !!this.d;
  38994. };
  38995. /*
  38996. * Return true if the value of this Decimal is an integer, otherwise return false.
  38997. *
  38998. */
  38999. P.isInteger = P.isInt = function () {
  39000. return !!this.d && mathfloor(this.e / LOG_BASE) > this.d.length - 2;
  39001. };
  39002. /*
  39003. * Return true if the value of this Decimal is NaN, otherwise return false.
  39004. *
  39005. */
  39006. P.isNaN = function () {
  39007. return !this.s;
  39008. };
  39009. /*
  39010. * Return true if the value of this Decimal is negative, otherwise return false.
  39011. *
  39012. */
  39013. P.isNegative = P.isNeg = function () {
  39014. return this.s < 0;
  39015. };
  39016. /*
  39017. * Return true if the value of this Decimal is positive, otherwise return false.
  39018. *
  39019. */
  39020. P.isPositive = P.isPos = function () {
  39021. return this.s > 0;
  39022. };
  39023. /*
  39024. * Return true if the value of this Decimal is 0 or -0, otherwise return false.
  39025. *
  39026. */
  39027. P.isZero = function () {
  39028. return !!this.d && this.d[0] === 0;
  39029. };
  39030. /*
  39031. * Return true if the value of this Decimal is less than `y`, otherwise return false.
  39032. *
  39033. */
  39034. P.lessThan = P.lt = function (y) {
  39035. return this.cmp(y) < 0;
  39036. };
  39037. /*
  39038. * Return true if the value of this Decimal is less than or equal to `y`, otherwise return false.
  39039. *
  39040. */
  39041. P.lessThanOrEqualTo = P.lte = function (y) {
  39042. return this.cmp(y) < 1;
  39043. };
  39044. /*
  39045. * Return the logarithm of the value of this Decimal to the specified base, rounded to `precision`
  39046. * significant digits using rounding mode `rounding`.
  39047. *
  39048. * If no base is specified, return log[10](arg).
  39049. *
  39050. * log[base](arg) = ln(arg) / ln(base)
  39051. *
  39052. * The result will always be correctly rounded if the base of the log is 10, and 'almost always'
  39053. * otherwise:
  39054. *
  39055. * Depending on the rounding mode, the result may be incorrectly rounded if the first fifteen
  39056. * rounding digits are [49]99999999999999 or [50]00000000000000. In that case, the maximum error
  39057. * between the result and the correctly rounded result will be one ulp (unit in the last place).
  39058. *
  39059. * log[-b](a) = NaN
  39060. * log[0](a) = NaN
  39061. * log[1](a) = NaN
  39062. * log[NaN](a) = NaN
  39063. * log[Infinity](a) = NaN
  39064. * log[b](0) = -Infinity
  39065. * log[b](-0) = -Infinity
  39066. * log[b](-a) = NaN
  39067. * log[b](1) = 0
  39068. * log[b](Infinity) = Infinity
  39069. * log[b](NaN) = NaN
  39070. *
  39071. * [base] {number|string|Decimal} The base of the logarithm.
  39072. *
  39073. */
  39074. P.logarithm = P.log = function (base) {
  39075. var isBase10, d, denominator, k, inf, num, sd, r,
  39076. arg = this,
  39077. Ctor = arg.constructor,
  39078. pr = Ctor.precision,
  39079. rm = Ctor.rounding,
  39080. guard = 5;
  39081. // Default base is 10.
  39082. if (base == null) {
  39083. base = new Ctor(10);
  39084. isBase10 = true;
  39085. } else {
  39086. base = new Ctor(base);
  39087. d = base.d;
  39088. // Return NaN if base is negative, or non-finite, or is 0 or 1.
  39089. if (base.s < 0 || !d || !d[0] || base.eq(1)) return new Ctor(NaN);
  39090. isBase10 = base.eq(10);
  39091. }
  39092. d = arg.d;
  39093. // Is arg negative, non-finite, 0 or 1?
  39094. if (arg.s < 0 || !d || !d[0] || arg.eq(1)) {
  39095. return new Ctor(d && !d[0] ? -1 / 0 : arg.s != 1 ? NaN : d ? 0 : 1 / 0);
  39096. }
  39097. // The result will have a non-terminating decimal expansion if base is 10 and arg is not an
  39098. // integer power of 10.
  39099. if (isBase10) {
  39100. if (d.length > 1) {
  39101. inf = true;
  39102. } else {
  39103. for (k = d[0]; k % 10 === 0;) k /= 10;
  39104. inf = k !== 1;
  39105. }
  39106. }
  39107. external = false;
  39108. sd = pr + guard;
  39109. num = naturalLogarithm(arg, sd);
  39110. denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd);
  39111. // The result will have 5 rounding digits.
  39112. r = divide(num, denominator, sd, 1);
  39113. // If at a rounding boundary, i.e. the result's rounding digits are [49]9999 or [50]0000,
  39114. // calculate 10 further digits.
  39115. //
  39116. // If the result is known to have an infinite decimal expansion, repeat this until it is clear
  39117. // that the result is above or below the boundary. Otherwise, if after calculating the 10
  39118. // further digits, the last 14 are nines, round up and assume the result is exact.
  39119. // Also assume the result is exact if the last 14 are zero.
  39120. //
  39121. // Example of a result that will be incorrectly rounded:
  39122. // log[1048576](4503599627370502) = 2.60000000000000009610279511444746...
  39123. // The above result correctly rounded using ROUND_CEIL to 1 decimal place should be 2.7, but it
  39124. // will be given as 2.6 as there are 15 zeros immediately after the requested decimal place, so
  39125. // the exact result would be assumed to be 2.6, which rounded using ROUND_CEIL to 1 decimal
  39126. // place is still 2.6.
  39127. if (checkRoundingDigits(r.d, k = pr, rm)) {
  39128. do {
  39129. sd += 10;
  39130. num = naturalLogarithm(arg, sd);
  39131. denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd);
  39132. r = divide(num, denominator, sd, 1);
  39133. if (!inf) {
  39134. // Check for 14 nines from the 2nd rounding digit, as the first may be 4.
  39135. if (+digitsToString(r.d).slice(k + 1, k + 15) + 1 == 1e14) {
  39136. r = finalise(r, pr + 1, 0);
  39137. }
  39138. break;
  39139. }
  39140. } while (checkRoundingDigits(r.d, k += 10, rm));
  39141. }
  39142. external = true;
  39143. return finalise(r, pr, rm);
  39144. };
  39145. /*
  39146. * Return a new Decimal whose value is the maximum of the arguments and the value of this Decimal.
  39147. *
  39148. * arguments {number|string|Decimal}
  39149. *
  39150. P.max = function () {
  39151. Array.prototype.push.call(arguments, this);
  39152. return maxOrMin(this.constructor, arguments, 'lt');
  39153. };
  39154. */
  39155. /*
  39156. * Return a new Decimal whose value is the minimum of the arguments and the value of this Decimal.
  39157. *
  39158. * arguments {number|string|Decimal}
  39159. *
  39160. P.min = function () {
  39161. Array.prototype.push.call(arguments, this);
  39162. return maxOrMin(this.constructor, arguments, 'gt');
  39163. };
  39164. */
  39165. /*
  39166. * n - 0 = n
  39167. * n - N = N
  39168. * n - I = -I
  39169. * 0 - n = -n
  39170. * 0 - 0 = 0
  39171. * 0 - N = N
  39172. * 0 - I = -I
  39173. * N - n = N
  39174. * N - 0 = N
  39175. * N - N = N
  39176. * N - I = N
  39177. * I - n = I
  39178. * I - 0 = I
  39179. * I - N = N
  39180. * I - I = N
  39181. *
  39182. * Return a new Decimal whose value is the value of this Decimal minus `y`, rounded to `precision`
  39183. * significant digits using rounding mode `rounding`.
  39184. *
  39185. */
  39186. P.minus = P.sub = function (y) {
  39187. var d, e, i, j, k, len, pr, rm, xd, xe, xLTy, yd,
  39188. x = this,
  39189. Ctor = x.constructor;
  39190. y = new Ctor(y);
  39191. // If either is not finite...
  39192. if (!x.d || !y.d) {
  39193. // Return NaN if either is NaN.
  39194. if (!x.s || !y.s) y = new Ctor(NaN);
  39195. // Return y negated if x is finite and y is ±Infinity.
  39196. else if (x.d) y.s = -y.s;
  39197. // Return x if y is finite and x is ±Infinity.
  39198. // Return x if both are ±Infinity with different signs.
  39199. // Return NaN if both are ±Infinity with the same sign.
  39200. else y = new Ctor(y.d || x.s !== y.s ? x : NaN);
  39201. return y;
  39202. }
  39203. // If signs differ...
  39204. if (x.s != y.s) {
  39205. y.s = -y.s;
  39206. return x.plus(y);
  39207. }
  39208. xd = x.d;
  39209. yd = y.d;
  39210. pr = Ctor.precision;
  39211. rm = Ctor.rounding;
  39212. // If either is zero...
  39213. if (!xd[0] || !yd[0]) {
  39214. // Return y negated if x is zero and y is non-zero.
  39215. if (yd[0]) y.s = -y.s;
  39216. // Return x if y is zero and x is non-zero.
  39217. else if (xd[0]) y = new Ctor(x);
  39218. // Return zero if both are zero.
  39219. // From IEEE 754 (2008) 6.3: 0 - 0 = -0 - -0 = -0 when rounding to -Infinity.
  39220. else return new Ctor(rm === 3 ? -0 : 0);
  39221. return external ? finalise(y, pr, rm) : y;
  39222. }
  39223. // x and y are finite, non-zero numbers with the same sign.
  39224. // Calculate base 1e7 exponents.
  39225. e = mathfloor(y.e / LOG_BASE);
  39226. xe = mathfloor(x.e / LOG_BASE);
  39227. xd = xd.slice();
  39228. k = xe - e;
  39229. // If base 1e7 exponents differ...
  39230. if (k) {
  39231. xLTy = k < 0;
  39232. if (xLTy) {
  39233. d = xd;
  39234. k = -k;
  39235. len = yd.length;
  39236. } else {
  39237. d = yd;
  39238. e = xe;
  39239. len = xd.length;
  39240. }
  39241. // Numbers with massively different exponents would result in a very high number of
  39242. // zeros needing to be prepended, but this can be avoided while still ensuring correct
  39243. // rounding by limiting the number of zeros to `Math.ceil(pr / LOG_BASE) + 2`.
  39244. i = Math.max(Math.ceil(pr / LOG_BASE), len) + 2;
  39245. if (k > i) {
  39246. k = i;
  39247. d.length = 1;
  39248. }
  39249. // Prepend zeros to equalise exponents.
  39250. d.reverse();
  39251. for (i = k; i--;) d.push(0);
  39252. d.reverse();
  39253. // Base 1e7 exponents equal.
  39254. } else {
  39255. // Check digits to determine which is the bigger number.
  39256. i = xd.length;
  39257. len = yd.length;
  39258. xLTy = i < len;
  39259. if (xLTy) len = i;
  39260. for (i = 0; i < len; i++) {
  39261. if (xd[i] != yd[i]) {
  39262. xLTy = xd[i] < yd[i];
  39263. break;
  39264. }
  39265. }
  39266. k = 0;
  39267. }
  39268. if (xLTy) {
  39269. d = xd;
  39270. xd = yd;
  39271. yd = d;
  39272. y.s = -y.s;
  39273. }
  39274. len = xd.length;
  39275. // Append zeros to `xd` if shorter.
  39276. // Don't add zeros to `yd` if shorter as subtraction only needs to start at `yd` length.
  39277. for (i = yd.length - len; i > 0; --i) xd[len++] = 0;
  39278. // Subtract yd from xd.
  39279. for (i = yd.length; i > k;) {
  39280. if (xd[--i] < yd[i]) {
  39281. for (j = i; j && xd[--j] === 0;) xd[j] = BASE - 1;
  39282. --xd[j];
  39283. xd[i] += BASE;
  39284. }
  39285. xd[i] -= yd[i];
  39286. }
  39287. // Remove trailing zeros.
  39288. for (; xd[--len] === 0;) xd.pop();
  39289. // Remove leading zeros and adjust exponent accordingly.
  39290. for (; xd[0] === 0; xd.shift()) --e;
  39291. // Zero?
  39292. if (!xd[0]) return new Ctor(rm === 3 ? -0 : 0);
  39293. y.d = xd;
  39294. y.e = getBase10Exponent(xd, e);
  39295. return external ? finalise(y, pr, rm) : y;
  39296. };
  39297. /*
  39298. * n % 0 = N
  39299. * n % N = N
  39300. * n % I = n
  39301. * 0 % n = 0
  39302. * -0 % n = -0
  39303. * 0 % 0 = N
  39304. * 0 % N = N
  39305. * 0 % I = 0
  39306. * N % n = N
  39307. * N % 0 = N
  39308. * N % N = N
  39309. * N % I = N
  39310. * I % n = N
  39311. * I % 0 = N
  39312. * I % N = N
  39313. * I % I = N
  39314. *
  39315. * Return a new Decimal whose value is the value of this Decimal modulo `y`, rounded to
  39316. * `precision` significant digits using rounding mode `rounding`.
  39317. *
  39318. * The result depends on the modulo mode.
  39319. *
  39320. */
  39321. P.modulo = P.mod = function (y) {
  39322. var q,
  39323. x = this,
  39324. Ctor = x.constructor;
  39325. y = new Ctor(y);
  39326. // Return NaN if x is ±Infinity or NaN, or y is NaN or ±0.
  39327. if (!x.d || !y.s || y.d && !y.d[0]) return new Ctor(NaN);
  39328. // Return x if y is ±Infinity or x is ±0.
  39329. if (!y.d || x.d && !x.d[0]) {
  39330. return finalise(new Ctor(x), Ctor.precision, Ctor.rounding);
  39331. }
  39332. // Prevent rounding of intermediate calculations.
  39333. external = false;
  39334. if (Ctor.modulo == 9) {
  39335. // Euclidian division: q = sign(y) * floor(x / abs(y))
  39336. // result = x - q * y where 0 <= result < abs(y)
  39337. q = divide(x, y.abs(), 0, 3, 1);
  39338. q.s *= y.s;
  39339. } else {
  39340. q = divide(x, y, 0, Ctor.modulo, 1);
  39341. }
  39342. q = q.times(y);
  39343. external = true;
  39344. return x.minus(q);
  39345. };
  39346. /*
  39347. * Return a new Decimal whose value is the natural exponential of the value of this Decimal,
  39348. * i.e. the base e raised to the power the value of this Decimal, rounded to `precision`
  39349. * significant digits using rounding mode `rounding`.
  39350. *
  39351. */
  39352. P.naturalExponential = P.exp = function () {
  39353. return naturalExponential(this);
  39354. };
  39355. /*
  39356. * Return a new Decimal whose value is the natural logarithm of the value of this Decimal,
  39357. * rounded to `precision` significant digits using rounding mode `rounding`.
  39358. *
  39359. */
  39360. P.naturalLogarithm = P.ln = function () {
  39361. return naturalLogarithm(this);
  39362. };
  39363. /*
  39364. * Return a new Decimal whose value is the value of this Decimal negated, i.e. as if multiplied by
  39365. * -1.
  39366. *
  39367. */
  39368. P.negated = P.neg = function () {
  39369. var x = new this.constructor(this);
  39370. x.s = -x.s;
  39371. return finalise(x);
  39372. };
  39373. /*
  39374. * n + 0 = n
  39375. * n + N = N
  39376. * n + I = I
  39377. * 0 + n = n
  39378. * 0 + 0 = 0
  39379. * 0 + N = N
  39380. * 0 + I = I
  39381. * N + n = N
  39382. * N + 0 = N
  39383. * N + N = N
  39384. * N + I = N
  39385. * I + n = I
  39386. * I + 0 = I
  39387. * I + N = N
  39388. * I + I = I
  39389. *
  39390. * Return a new Decimal whose value is the value of this Decimal plus `y`, rounded to `precision`
  39391. * significant digits using rounding mode `rounding`.
  39392. *
  39393. */
  39394. P.plus = P.add = function (y) {
  39395. var carry, d, e, i, k, len, pr, rm, xd, yd,
  39396. x = this,
  39397. Ctor = x.constructor;
  39398. y = new Ctor(y);
  39399. // If either is not finite...
  39400. if (!x.d || !y.d) {
  39401. // Return NaN if either is NaN.
  39402. if (!x.s || !y.s) y = new Ctor(NaN);
  39403. // Return x if y is finite and x is ±Infinity.
  39404. // Return x if both are ±Infinity with the same sign.
  39405. // Return NaN if both are ±Infinity with different signs.
  39406. // Return y if x is finite and y is ±Infinity.
  39407. else if (!x.d) y = new Ctor(y.d || x.s === y.s ? x : NaN);
  39408. return y;
  39409. }
  39410. // If signs differ...
  39411. if (x.s != y.s) {
  39412. y.s = -y.s;
  39413. return x.minus(y);
  39414. }
  39415. xd = x.d;
  39416. yd = y.d;
  39417. pr = Ctor.precision;
  39418. rm = Ctor.rounding;
  39419. // If either is zero...
  39420. if (!xd[0] || !yd[0]) {
  39421. // Return x if y is zero.
  39422. // Return y if y is non-zero.
  39423. if (!yd[0]) y = new Ctor(x);
  39424. return external ? finalise(y, pr, rm) : y;
  39425. }
  39426. // x and y are finite, non-zero numbers with the same sign.
  39427. // Calculate base 1e7 exponents.
  39428. k = mathfloor(x.e / LOG_BASE);
  39429. e = mathfloor(y.e / LOG_BASE);
  39430. xd = xd.slice();
  39431. i = k - e;
  39432. // If base 1e7 exponents differ...
  39433. if (i) {
  39434. if (i < 0) {
  39435. d = xd;
  39436. i = -i;
  39437. len = yd.length;
  39438. } else {
  39439. d = yd;
  39440. e = k;
  39441. len = xd.length;
  39442. }
  39443. // Limit number of zeros prepended to max(ceil(pr / LOG_BASE), len) + 1.
  39444. k = Math.ceil(pr / LOG_BASE);
  39445. len = k > len ? k + 1 : len + 1;
  39446. if (i > len) {
  39447. i = len;
  39448. d.length = 1;
  39449. }
  39450. // Prepend zeros to equalise exponents. Note: Faster to use reverse then do unshifts.
  39451. d.reverse();
  39452. for (; i--;) d.push(0);
  39453. d.reverse();
  39454. }
  39455. len = xd.length;
  39456. i = yd.length;
  39457. // If yd is longer than xd, swap xd and yd so xd points to the longer array.
  39458. if (len - i < 0) {
  39459. i = len;
  39460. d = yd;
  39461. yd = xd;
  39462. xd = d;
  39463. }
  39464. // Only start adding at yd.length - 1 as the further digits of xd can be left as they are.
  39465. for (carry = 0; i;) {
  39466. carry = (xd[--i] = xd[i] + yd[i] + carry) / BASE | 0;
  39467. xd[i] %= BASE;
  39468. }
  39469. if (carry) {
  39470. xd.unshift(carry);
  39471. ++e;
  39472. }
  39473. // Remove trailing zeros.
  39474. // No need to check for zero, as +x + +y != 0 && -x + -y != 0
  39475. for (len = xd.length; xd[--len] == 0;) xd.pop();
  39476. y.d = xd;
  39477. y.e = getBase10Exponent(xd, e);
  39478. return external ? finalise(y, pr, rm) : y;
  39479. };
  39480. /*
  39481. * Return the number of significant digits of the value of this Decimal.
  39482. *
  39483. * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.
  39484. *
  39485. */
  39486. P.precision = P.sd = function (z) {
  39487. var k,
  39488. x = this;
  39489. if (z !== void 0 && z !== !!z && z !== 1 && z !== 0) throw Error(invalidArgument + z);
  39490. if (x.d) {
  39491. k = getPrecision(x.d);
  39492. if (z && x.e + 1 > k) k = x.e + 1;
  39493. } else {
  39494. k = NaN;
  39495. }
  39496. return k;
  39497. };
  39498. /*
  39499. * Return a new Decimal whose value is the value of this Decimal rounded to a whole number using
  39500. * rounding mode `rounding`.
  39501. *
  39502. */
  39503. P.round = function () {
  39504. var x = this,
  39505. Ctor = x.constructor;
  39506. return finalise(new Ctor(x), x.e + 1, Ctor.rounding);
  39507. };
  39508. /*
  39509. * Return a new Decimal whose value is the sine of the value in radians of this Decimal.
  39510. *
  39511. * Domain: [-Infinity, Infinity]
  39512. * Range: [-1, 1]
  39513. *
  39514. * sin(x) = x - x^3/3! + x^5/5! - ...
  39515. *
  39516. * sin(0) = 0
  39517. * sin(-0) = -0
  39518. * sin(Infinity) = NaN
  39519. * sin(-Infinity) = NaN
  39520. * sin(NaN) = NaN
  39521. *
  39522. */
  39523. P.sine = P.sin = function () {
  39524. var pr, rm,
  39525. x = this,
  39526. Ctor = x.constructor;
  39527. if (!x.isFinite()) return new Ctor(NaN);
  39528. if (x.isZero()) return new Ctor(x);
  39529. pr = Ctor.precision;
  39530. rm = Ctor.rounding;
  39531. Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE;
  39532. Ctor.rounding = 1;
  39533. x = sine(Ctor, toLessThanHalfPi(Ctor, x));
  39534. Ctor.precision = pr;
  39535. Ctor.rounding = rm;
  39536. return finalise(quadrant > 2 ? x.neg() : x, pr, rm, true);
  39537. };
  39538. /*
  39539. * Return a new Decimal whose value is the square root of this Decimal, rounded to `precision`
  39540. * significant digits using rounding mode `rounding`.
  39541. *
  39542. * sqrt(-n) = N
  39543. * sqrt(N) = N
  39544. * sqrt(-I) = N
  39545. * sqrt(I) = I
  39546. * sqrt(0) = 0
  39547. * sqrt(-0) = -0
  39548. *
  39549. */
  39550. P.squareRoot = P.sqrt = function () {
  39551. var m, n, sd, r, rep, t,
  39552. x = this,
  39553. d = x.d,
  39554. e = x.e,
  39555. s = x.s,
  39556. Ctor = x.constructor;
  39557. // Negative/NaN/Infinity/zero?
  39558. if (s !== 1 || !d || !d[0]) {
  39559. return new Ctor(!s || s < 0 && (!d || d[0]) ? NaN : d ? x : 1 / 0);
  39560. }
  39561. external = false;
  39562. // Initial estimate.
  39563. s = Math.sqrt(+x);
  39564. // Math.sqrt underflow/overflow?
  39565. // Pass x to Math.sqrt as integer, then adjust the exponent of the result.
  39566. if (s == 0 || s == 1 / 0) {
  39567. n = digitsToString(d);
  39568. if ((n.length + e) % 2 == 0) n += '0';
  39569. s = Math.sqrt(n);
  39570. e = mathfloor((e + 1) / 2) - (e < 0 || e % 2);
  39571. if (s == 1 / 0) {
  39572. n = '1e' + e;
  39573. } else {
  39574. n = s.toExponential();
  39575. n = n.slice(0, n.indexOf('e') + 1) + e;
  39576. }
  39577. r = new Ctor(n);
  39578. } else {
  39579. r = new Ctor(s.toString());
  39580. }
  39581. sd = (e = Ctor.precision) + 3;
  39582. // Newton-Raphson iteration.
  39583. for (;;) {
  39584. t = r;
  39585. r = t.plus(divide(x, t, sd + 2, 1)).times(0.5);
  39586. // TODO? Replace with for-loop and checkRoundingDigits.
  39587. if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) {
  39588. n = n.slice(sd - 3, sd + 1);
  39589. // The 4th rounding digit may be in error by -1 so if the 4 rounding digits are 9999 or
  39590. // 4999, i.e. approaching a rounding boundary, continue the iteration.
  39591. if (n == '9999' || !rep && n == '4999') {
  39592. // On the first iteration only, check to see if rounding up gives the exact result as the
  39593. // nines may infinitely repeat.
  39594. if (!rep) {
  39595. finalise(t, e + 1, 0);
  39596. if (t.times(t).eq(x)) {
  39597. r = t;
  39598. break;
  39599. }
  39600. }
  39601. sd += 4;
  39602. rep = 1;
  39603. } else {
  39604. // If the rounding digits are null, 0{0,4} or 50{0,3}, check for an exact result.
  39605. // If not, then there are further digits and m will be truthy.
  39606. if (!+n || !+n.slice(1) && n.charAt(0) == '5') {
  39607. // Truncate to the first rounding digit.
  39608. finalise(r, e + 1, 1);
  39609. m = !r.times(r).eq(x);
  39610. }
  39611. break;
  39612. }
  39613. }
  39614. }
  39615. external = true;
  39616. return finalise(r, e, Ctor.rounding, m);
  39617. };
  39618. /*
  39619. * Return a new Decimal whose value is the tangent of the value in radians of this Decimal.
  39620. *
  39621. * Domain: [-Infinity, Infinity]
  39622. * Range: [-Infinity, Infinity]
  39623. *
  39624. * tan(0) = 0
  39625. * tan(-0) = -0
  39626. * tan(Infinity) = NaN
  39627. * tan(-Infinity) = NaN
  39628. * tan(NaN) = NaN
  39629. *
  39630. */
  39631. P.tangent = P.tan = function () {
  39632. var pr, rm,
  39633. x = this,
  39634. Ctor = x.constructor;
  39635. if (!x.isFinite()) return new Ctor(NaN);
  39636. if (x.isZero()) return new Ctor(x);
  39637. pr = Ctor.precision;
  39638. rm = Ctor.rounding;
  39639. Ctor.precision = pr + 10;
  39640. Ctor.rounding = 1;
  39641. x = x.sin();
  39642. x.s = 1;
  39643. x = divide(x, new Ctor(1).minus(x.times(x)).sqrt(), pr + 10, 0);
  39644. Ctor.precision = pr;
  39645. Ctor.rounding = rm;
  39646. return finalise(quadrant == 2 || quadrant == 4 ? x.neg() : x, pr, rm, true);
  39647. };
  39648. /*
  39649. * n * 0 = 0
  39650. * n * N = N
  39651. * n * I = I
  39652. * 0 * n = 0
  39653. * 0 * 0 = 0
  39654. * 0 * N = N
  39655. * 0 * I = N
  39656. * N * n = N
  39657. * N * 0 = N
  39658. * N * N = N
  39659. * N * I = N
  39660. * I * n = I
  39661. * I * 0 = N
  39662. * I * N = N
  39663. * I * I = I
  39664. *
  39665. * Return a new Decimal whose value is this Decimal times `y`, rounded to `precision` significant
  39666. * digits using rounding mode `rounding`.
  39667. *
  39668. */
  39669. P.times = P.mul = function (y) {
  39670. var carry, e, i, k, r, rL, t, xdL, ydL,
  39671. x = this,
  39672. Ctor = x.constructor,
  39673. xd = x.d,
  39674. yd = (y = new Ctor(y)).d;
  39675. y.s *= x.s;
  39676. // If either is NaN, ±Infinity or ±0...
  39677. if (!xd || !xd[0] || !yd || !yd[0]) {
  39678. return new Ctor(!y.s || xd && !xd[0] && !yd || yd && !yd[0] && !xd
  39679. // Return NaN if either is NaN.
  39680. // Return NaN if x is ±0 and y is ±Infinity, or y is ±0 and x is ±Infinity.
  39681. ? NaN
  39682. // Return ±Infinity if either is ±Infinity.
  39683. // Return ±0 if either is ±0.
  39684. : !xd || !yd ? y.s / 0 : y.s * 0);
  39685. }
  39686. e = mathfloor(x.e / LOG_BASE) + mathfloor(y.e / LOG_BASE);
  39687. xdL = xd.length;
  39688. ydL = yd.length;
  39689. // Ensure xd points to the longer array.
  39690. if (xdL < ydL) {
  39691. r = xd;
  39692. xd = yd;
  39693. yd = r;
  39694. rL = xdL;
  39695. xdL = ydL;
  39696. ydL = rL;
  39697. }
  39698. // Initialise the result array with zeros.
  39699. r = [];
  39700. rL = xdL + ydL;
  39701. for (i = rL; i--;) r.push(0);
  39702. // Multiply!
  39703. for (i = ydL; --i >= 0;) {
  39704. carry = 0;
  39705. for (k = xdL + i; k > i;) {
  39706. t = r[k] + yd[i] * xd[k - i - 1] + carry;
  39707. r[k--] = t % BASE | 0;
  39708. carry = t / BASE | 0;
  39709. }
  39710. r[k] = (r[k] + carry) % BASE | 0;
  39711. }
  39712. // Remove trailing zeros.
  39713. for (; !r[--rL];) r.pop();
  39714. if (carry) ++e;
  39715. else r.shift();
  39716. y.d = r;
  39717. y.e = getBase10Exponent(r, e);
  39718. return external ? finalise(y, Ctor.precision, Ctor.rounding) : y;
  39719. };
  39720. /*
  39721. * Return a string representing the value of this Decimal in base 2, round to `sd` significant
  39722. * digits using rounding mode `rm`.
  39723. *
  39724. * If the optional `sd` argument is present then return binary exponential notation.
  39725. *
  39726. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  39727. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  39728. *
  39729. */
  39730. P.toBinary = function (sd, rm) {
  39731. return toStringBinary(this, 2, sd, rm);
  39732. };
  39733. /*
  39734. * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `dp`
  39735. * decimal places using rounding mode `rm` or `rounding` if `rm` is omitted.
  39736. *
  39737. * If `dp` is omitted, return a new Decimal whose value is the value of this Decimal.
  39738. *
  39739. * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
  39740. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  39741. *
  39742. */
  39743. P.toDecimalPlaces = P.toDP = function (dp, rm) {
  39744. var x = this,
  39745. Ctor = x.constructor;
  39746. x = new Ctor(x);
  39747. if (dp === void 0) return x;
  39748. checkInt32(dp, 0, MAX_DIGITS);
  39749. if (rm === void 0) rm = Ctor.rounding;
  39750. else checkInt32(rm, 0, 8);
  39751. return finalise(x, dp + x.e + 1, rm);
  39752. };
  39753. /*
  39754. * Return a string representing the value of this Decimal in exponential notation rounded to
  39755. * `dp` fixed decimal places using rounding mode `rounding`.
  39756. *
  39757. * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
  39758. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  39759. *
  39760. */
  39761. P.toExponential = function (dp, rm) {
  39762. var str,
  39763. x = this,
  39764. Ctor = x.constructor;
  39765. if (dp === void 0) {
  39766. str = finiteToString(x, true);
  39767. } else {
  39768. checkInt32(dp, 0, MAX_DIGITS);
  39769. if (rm === void 0) rm = Ctor.rounding;
  39770. else checkInt32(rm, 0, 8);
  39771. x = finalise(new Ctor(x), dp + 1, rm);
  39772. str = finiteToString(x, true, dp + 1);
  39773. }
  39774. return x.isNeg() && !x.isZero() ? '-' + str : str;
  39775. };
  39776. /*
  39777. * Return a string representing the value of this Decimal in normal (fixed-point) notation to
  39778. * `dp` fixed decimal places and rounded using rounding mode `rm` or `rounding` if `rm` is
  39779. * omitted.
  39780. *
  39781. * As with JavaScript numbers, (-0).toFixed(0) is '0', but e.g. (-0.00001).toFixed(0) is '-0'.
  39782. *
  39783. * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
  39784. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  39785. *
  39786. * (-0).toFixed(0) is '0', but (-0.1).toFixed(0) is '-0'.
  39787. * (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'.
  39788. * (-0).toFixed(3) is '0.000'.
  39789. * (-0.5).toFixed(0) is '-0'.
  39790. *
  39791. */
  39792. P.toFixed = function (dp, rm) {
  39793. var str, y,
  39794. x = this,
  39795. Ctor = x.constructor;
  39796. if (dp === void 0) {
  39797. str = finiteToString(x);
  39798. } else {
  39799. checkInt32(dp, 0, MAX_DIGITS);
  39800. if (rm === void 0) rm = Ctor.rounding;
  39801. else checkInt32(rm, 0, 8);
  39802. y = finalise(new Ctor(x), dp + x.e + 1, rm);
  39803. str = finiteToString(y, false, dp + y.e + 1);
  39804. }
  39805. // To determine whether to add the minus sign look at the value before it was rounded,
  39806. // i.e. look at `x` rather than `y`.
  39807. return x.isNeg() && !x.isZero() ? '-' + str : str;
  39808. };
  39809. /*
  39810. * Return an array representing the value of this Decimal as a simple fraction with an integer
  39811. * numerator and an integer denominator.
  39812. *
  39813. * The denominator will be a positive non-zero value less than or equal to the specified maximum
  39814. * denominator. If a maximum denominator is not specified, the denominator will be the lowest
  39815. * value necessary to represent the number exactly.
  39816. *
  39817. * [maxD] {number|string|Decimal} Maximum denominator. Integer >= 1 and < Infinity.
  39818. *
  39819. */
  39820. P.toFraction = function (maxD) {
  39821. var d, d0, d1, d2, e, k, n, n0, n1, pr, q, r,
  39822. x = this,
  39823. xd = x.d,
  39824. Ctor = x.constructor;
  39825. if (!xd) return new Ctor(x);
  39826. n1 = d0 = new Ctor(1);
  39827. d1 = n0 = new Ctor(0);
  39828. d = new Ctor(d1);
  39829. e = d.e = getPrecision(xd) - x.e - 1;
  39830. k = e % LOG_BASE;
  39831. d.d[0] = mathpow(10, k < 0 ? LOG_BASE + k : k);
  39832. if (maxD == null) {
  39833. // d is 10**e, the minimum max-denominator needed.
  39834. maxD = e > 0 ? d : n1;
  39835. } else {
  39836. n = new Ctor(maxD);
  39837. if (!n.isInt() || n.lt(n1)) throw Error(invalidArgument + n);
  39838. maxD = n.gt(d) ? (e > 0 ? d : n1) : n;
  39839. }
  39840. external = false;
  39841. n = new Ctor(digitsToString(xd));
  39842. pr = Ctor.precision;
  39843. Ctor.precision = e = xd.length * LOG_BASE * 2;
  39844. for (;;) {
  39845. q = divide(n, d, 0, 1, 1);
  39846. d2 = d0.plus(q.times(d1));
  39847. if (d2.cmp(maxD) == 1) break;
  39848. d0 = d1;
  39849. d1 = d2;
  39850. d2 = n1;
  39851. n1 = n0.plus(q.times(d2));
  39852. n0 = d2;
  39853. d2 = d;
  39854. d = n.minus(q.times(d2));
  39855. n = d2;
  39856. }
  39857. d2 = divide(maxD.minus(d0), d1, 0, 1, 1);
  39858. n0 = n0.plus(d2.times(n1));
  39859. d0 = d0.plus(d2.times(d1));
  39860. n0.s = n1.s = x.s;
  39861. // Determine which fraction is closer to x, n0/d0 or n1/d1?
  39862. r = divide(n1, d1, e, 1).minus(x).abs().cmp(divide(n0, d0, e, 1).minus(x).abs()) < 1
  39863. ? [n1, d1] : [n0, d0];
  39864. Ctor.precision = pr;
  39865. external = true;
  39866. return r;
  39867. };
  39868. /*
  39869. * Return a string representing the value of this Decimal in base 16, round to `sd` significant
  39870. * digits using rounding mode `rm`.
  39871. *
  39872. * If the optional `sd` argument is present then return binary exponential notation.
  39873. *
  39874. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  39875. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  39876. *
  39877. */
  39878. P.toHexadecimal = P.toHex = function (sd, rm) {
  39879. return toStringBinary(this, 16, sd, rm);
  39880. };
  39881. /*
  39882. * Returns a new Decimal whose value is the nearest multiple of `y` in the direction of rounding
  39883. * mode `rm`, or `Decimal.rounding` if `rm` is omitted, to the value of this Decimal.
  39884. *
  39885. * The return value will always have the same sign as this Decimal, unless either this Decimal
  39886. * or `y` is NaN, in which case the return value will be also be NaN.
  39887. *
  39888. * The return value is not affected by the value of `precision`.
  39889. *
  39890. * y {number|string|Decimal} The magnitude to round to a multiple of.
  39891. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  39892. *
  39893. * 'toNearest() rounding mode not an integer: {rm}'
  39894. * 'toNearest() rounding mode out of range: {rm}'
  39895. *
  39896. */
  39897. P.toNearest = function (y, rm) {
  39898. var x = this,
  39899. Ctor = x.constructor;
  39900. x = new Ctor(x);
  39901. if (y == null) {
  39902. // If x is not finite, return x.
  39903. if (!x.d) return x;
  39904. y = new Ctor(1);
  39905. rm = Ctor.rounding;
  39906. } else {
  39907. y = new Ctor(y);
  39908. if (rm === void 0) {
  39909. rm = Ctor.rounding;
  39910. } else {
  39911. checkInt32(rm, 0, 8);
  39912. }
  39913. // If x is not finite, return x if y is not NaN, else NaN.
  39914. if (!x.d) return y.s ? x : y;
  39915. // If y is not finite, return Infinity with the sign of x if y is Infinity, else NaN.
  39916. if (!y.d) {
  39917. if (y.s) y.s = x.s;
  39918. return y;
  39919. }
  39920. }
  39921. // If y is not zero, calculate the nearest multiple of y to x.
  39922. if (y.d[0]) {
  39923. external = false;
  39924. x = divide(x, y, 0, rm, 1).times(y);
  39925. external = true;
  39926. finalise(x);
  39927. // If y is zero, return zero with the sign of x.
  39928. } else {
  39929. y.s = x.s;
  39930. x = y;
  39931. }
  39932. return x;
  39933. };
  39934. /*
  39935. * Return the value of this Decimal converted to a number primitive.
  39936. * Zero keeps its sign.
  39937. *
  39938. */
  39939. P.toNumber = function () {
  39940. return +this;
  39941. };
  39942. /*
  39943. * Return a string representing the value of this Decimal in base 8, round to `sd` significant
  39944. * digits using rounding mode `rm`.
  39945. *
  39946. * If the optional `sd` argument is present then return binary exponential notation.
  39947. *
  39948. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  39949. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  39950. *
  39951. */
  39952. P.toOctal = function (sd, rm) {
  39953. return toStringBinary(this, 8, sd, rm);
  39954. };
  39955. /*
  39956. * Return a new Decimal whose value is the value of this Decimal raised to the power `y`, rounded
  39957. * to `precision` significant digits using rounding mode `rounding`.
  39958. *
  39959. * ECMAScript compliant.
  39960. *
  39961. * pow(x, NaN) = NaN
  39962. * pow(x, ±0) = 1
  39963. * pow(NaN, non-zero) = NaN
  39964. * pow(abs(x) > 1, +Infinity) = +Infinity
  39965. * pow(abs(x) > 1, -Infinity) = +0
  39966. * pow(abs(x) == 1, ±Infinity) = NaN
  39967. * pow(abs(x) < 1, +Infinity) = +0
  39968. * pow(abs(x) < 1, -Infinity) = +Infinity
  39969. * pow(+Infinity, y > 0) = +Infinity
  39970. * pow(+Infinity, y < 0) = +0
  39971. * pow(-Infinity, odd integer > 0) = -Infinity
  39972. * pow(-Infinity, even integer > 0) = +Infinity
  39973. * pow(-Infinity, odd integer < 0) = -0
  39974. * pow(-Infinity, even integer < 0) = +0
  39975. * pow(+0, y > 0) = +0
  39976. * pow(+0, y < 0) = +Infinity
  39977. * pow(-0, odd integer > 0) = -0
  39978. * pow(-0, even integer > 0) = +0
  39979. * pow(-0, odd integer < 0) = -Infinity
  39980. * pow(-0, even integer < 0) = +Infinity
  39981. * pow(finite x < 0, finite non-integer) = NaN
  39982. *
  39983. * For non-integer or very large exponents pow(x, y) is calculated using
  39984. *
  39985. * x^y = exp(y*ln(x))
  39986. *
  39987. * Assuming the first 15 rounding digits are each equally likely to be any digit 0-9, the
  39988. * probability of an incorrectly rounded result
  39989. * P([49]9{14} | [50]0{14}) = 2 * 0.2 * 10^-14 = 4e-15 = 1/2.5e+14
  39990. * i.e. 1 in 250,000,000,000,000
  39991. *
  39992. * If a result is incorrectly rounded the maximum error will be 1 ulp (unit in last place).
  39993. *
  39994. * y {number|string|Decimal} The power to which to raise this Decimal.
  39995. *
  39996. */
  39997. P.toPower = P.pow = function (y) {
  39998. var e, k, pr, r, rm, s,
  39999. x = this,
  40000. Ctor = x.constructor,
  40001. yn = +(y = new Ctor(y));
  40002. // Either ±Infinity, NaN or ±0?
  40003. if (!x.d || !y.d || !x.d[0] || !y.d[0]) return new Ctor(mathpow(+x, yn));
  40004. x = new Ctor(x);
  40005. if (x.eq(1)) return x;
  40006. pr = Ctor.precision;
  40007. rm = Ctor.rounding;
  40008. if (y.eq(1)) return finalise(x, pr, rm);
  40009. // y exponent
  40010. e = mathfloor(y.e / LOG_BASE);
  40011. // If y is a small integer use the 'exponentiation by squaring' algorithm.
  40012. if (e >= y.d.length - 1 && (k = yn < 0 ? -yn : yn) <= MAX_SAFE_INTEGER) {
  40013. r = intPow(Ctor, x, k, pr);
  40014. return y.s < 0 ? new Ctor(1).div(r) : finalise(r, pr, rm);
  40015. }
  40016. s = x.s;
  40017. // if x is negative
  40018. if (s < 0) {
  40019. // if y is not an integer
  40020. if (e < y.d.length - 1) return new Ctor(NaN);
  40021. // Result is positive if x is negative and the last digit of integer y is even.
  40022. if ((y.d[e] & 1) == 0) s = 1;
  40023. // if x.eq(-1)
  40024. if (x.e == 0 && x.d[0] == 1 && x.d.length == 1) {
  40025. x.s = s;
  40026. return x;
  40027. }
  40028. }
  40029. // Estimate result exponent.
  40030. // x^y = 10^e, where e = y * log10(x)
  40031. // log10(x) = log10(x_significand) + x_exponent
  40032. // log10(x_significand) = ln(x_significand) / ln(10)
  40033. k = mathpow(+x, yn);
  40034. e = k == 0 || !isFinite(k)
  40035. ? mathfloor(yn * (Math.log('0.' + digitsToString(x.d)) / Math.LN10 + x.e + 1))
  40036. : new Ctor(k + '').e;
  40037. // Exponent estimate may be incorrect e.g. x: 0.999999999999999999, y: 2.29, e: 0, r.e: -1.
  40038. // Overflow/underflow?
  40039. if (e > Ctor.maxE + 1 || e < Ctor.minE - 1) return new Ctor(e > 0 ? s / 0 : 0);
  40040. external = false;
  40041. Ctor.rounding = x.s = 1;
  40042. // Estimate the extra guard digits needed to ensure five correct rounding digits from
  40043. // naturalLogarithm(x). Example of failure without these extra digits (precision: 10):
  40044. // new Decimal(2.32456).pow('2087987436534566.46411')
  40045. // should be 1.162377823e+764914905173815, but is 1.162355823e+764914905173815
  40046. k = Math.min(12, (e + '').length);
  40047. // r = x^y = exp(y*ln(x))
  40048. r = naturalExponential(y.times(naturalLogarithm(x, pr + k)), pr);
  40049. // r may be Infinity, e.g. (0.9999999999999999).pow(-1e+40)
  40050. if (r.d) {
  40051. // Truncate to the required precision plus five rounding digits.
  40052. r = finalise(r, pr + 5, 1);
  40053. // If the rounding digits are [49]9999 or [50]0000 increase the precision by 10 and recalculate
  40054. // the result.
  40055. if (checkRoundingDigits(r.d, pr, rm)) {
  40056. e = pr + 10;
  40057. // Truncate to the increased precision plus five rounding digits.
  40058. r = finalise(naturalExponential(y.times(naturalLogarithm(x, e + k)), e), e + 5, 1);
  40059. // Check for 14 nines from the 2nd rounding digit (the first rounding digit may be 4 or 9).
  40060. if (+digitsToString(r.d).slice(pr + 1, pr + 15) + 1 == 1e14) {
  40061. r = finalise(r, pr + 1, 0);
  40062. }
  40063. }
  40064. }
  40065. r.s = s;
  40066. external = true;
  40067. Ctor.rounding = rm;
  40068. return finalise(r, pr, rm);
  40069. };
  40070. /*
  40071. * Return a string representing the value of this Decimal rounded to `sd` significant digits
  40072. * using rounding mode `rounding`.
  40073. *
  40074. * Return exponential notation if `sd` is less than the number of digits necessary to represent
  40075. * the integer part of the value in normal notation.
  40076. *
  40077. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  40078. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  40079. *
  40080. */
  40081. P.toPrecision = function (sd, rm) {
  40082. var str,
  40083. x = this,
  40084. Ctor = x.constructor;
  40085. if (sd === void 0) {
  40086. str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);
  40087. } else {
  40088. checkInt32(sd, 1, MAX_DIGITS);
  40089. if (rm === void 0) rm = Ctor.rounding;
  40090. else checkInt32(rm, 0, 8);
  40091. x = finalise(new Ctor(x), sd, rm);
  40092. str = finiteToString(x, sd <= x.e || x.e <= Ctor.toExpNeg, sd);
  40093. }
  40094. return x.isNeg() && !x.isZero() ? '-' + str : str;
  40095. };
  40096. /*
  40097. * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `sd`
  40098. * significant digits using rounding mode `rm`, or to `precision` and `rounding` respectively if
  40099. * omitted.
  40100. *
  40101. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  40102. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  40103. *
  40104. * 'toSD() digits out of range: {sd}'
  40105. * 'toSD() digits not an integer: {sd}'
  40106. * 'toSD() rounding mode not an integer: {rm}'
  40107. * 'toSD() rounding mode out of range: {rm}'
  40108. *
  40109. */
  40110. P.toSignificantDigits = P.toSD = function (sd, rm) {
  40111. var x = this,
  40112. Ctor = x.constructor;
  40113. if (sd === void 0) {
  40114. sd = Ctor.precision;
  40115. rm = Ctor.rounding;
  40116. } else {
  40117. checkInt32(sd, 1, MAX_DIGITS);
  40118. if (rm === void 0) rm = Ctor.rounding;
  40119. else checkInt32(rm, 0, 8);
  40120. }
  40121. return finalise(new Ctor(x), sd, rm);
  40122. };
  40123. /*
  40124. * Return a string representing the value of this Decimal.
  40125. *
  40126. * Return exponential notation if this Decimal has a positive exponent equal to or greater than
  40127. * `toExpPos`, or a negative exponent equal to or less than `toExpNeg`.
  40128. *
  40129. */
  40130. P.toString = function () {
  40131. var x = this,
  40132. Ctor = x.constructor,
  40133. str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);
  40134. return x.isNeg() && !x.isZero() ? '-' + str : str;
  40135. };
  40136. /*
  40137. * Return a new Decimal whose value is the value of this Decimal truncated to a whole number.
  40138. *
  40139. */
  40140. P.truncated = P.trunc = function () {
  40141. return finalise(new this.constructor(this), this.e + 1, 1);
  40142. };
  40143. /*
  40144. * Return a string representing the value of this Decimal.
  40145. * Unlike `toString`, negative zero will include the minus sign.
  40146. *
  40147. */
  40148. P.valueOf = P.toJSON = function () {
  40149. var x = this,
  40150. Ctor = x.constructor,
  40151. str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);
  40152. return x.isNeg() ? '-' + str : str;
  40153. };
  40154. /*
  40155. // Add aliases to match BigDecimal method names.
  40156. // P.add = P.plus;
  40157. P.subtract = P.minus;
  40158. P.multiply = P.times;
  40159. P.divide = P.div;
  40160. P.remainder = P.mod;
  40161. P.compareTo = P.cmp;
  40162. P.negate = P.neg;
  40163. */
  40164. // Helper functions for Decimal.prototype (P) and/or Decimal methods, and their callers.
  40165. /*
  40166. * digitsToString P.cubeRoot, P.logarithm, P.squareRoot, P.toFraction, P.toPower,
  40167. * finiteToString, naturalExponential, naturalLogarithm
  40168. * checkInt32 P.toDecimalPlaces, P.toExponential, P.toFixed, P.toNearest,
  40169. * P.toPrecision, P.toSignificantDigits, toStringBinary, random
  40170. * checkRoundingDigits P.logarithm, P.toPower, naturalExponential, naturalLogarithm
  40171. * convertBase toStringBinary, parseOther
  40172. * cos P.cos
  40173. * divide P.atanh, P.cubeRoot, P.dividedBy, P.dividedToIntegerBy,
  40174. * P.logarithm, P.modulo, P.squareRoot, P.tan, P.tanh, P.toFraction,
  40175. * P.toNearest, toStringBinary, naturalExponential, naturalLogarithm,
  40176. * taylorSeries, atan2, parseOther
  40177. * finalise P.absoluteValue, P.atan, P.atanh, P.ceil, P.cos, P.cosh,
  40178. * P.cubeRoot, P.dividedToIntegerBy, P.floor, P.logarithm, P.minus,
  40179. * P.modulo, P.negated, P.plus, P.round, P.sin, P.sinh, P.squareRoot,
  40180. * P.tan, P.times, P.toDecimalPlaces, P.toExponential, P.toFixed,
  40181. * P.toNearest, P.toPower, P.toPrecision, P.toSignificantDigits,
  40182. * P.truncated, divide, getLn10, getPi, naturalExponential,
  40183. * naturalLogarithm, ceil, floor, round, trunc
  40184. * finiteToString P.toExponential, P.toFixed, P.toPrecision, P.toString, P.valueOf,
  40185. * toStringBinary
  40186. * getBase10Exponent P.minus, P.plus, P.times, parseOther
  40187. * getLn10 P.logarithm, naturalLogarithm
  40188. * getPi P.acos, P.asin, P.atan, toLessThanHalfPi, atan2
  40189. * getPrecision P.precision, P.toFraction
  40190. * getZeroString digitsToString, finiteToString
  40191. * intPow P.toPower, parseOther
  40192. * isOdd toLessThanHalfPi
  40193. * maxOrMin max, min
  40194. * naturalExponential P.naturalExponential, P.toPower
  40195. * naturalLogarithm P.acosh, P.asinh, P.atanh, P.logarithm, P.naturalLogarithm,
  40196. * P.toPower, naturalExponential
  40197. * nonFiniteToString finiteToString, toStringBinary
  40198. * parseDecimal Decimal
  40199. * parseOther Decimal
  40200. * sin P.sin
  40201. * taylorSeries P.cosh, P.sinh, cos, sin
  40202. * toLessThanHalfPi P.cos, P.sin
  40203. * toStringBinary P.toBinary, P.toHexadecimal, P.toOctal
  40204. * truncate intPow
  40205. *
  40206. * Throws: P.logarithm, P.precision, P.toFraction, checkInt32, getLn10, getPi,
  40207. * naturalLogarithm, config, parseOther, random, Decimal
  40208. */
  40209. function digitsToString(d) {
  40210. var i, k, ws,
  40211. indexOfLastWord = d.length - 1,
  40212. str = '',
  40213. w = d[0];
  40214. if (indexOfLastWord > 0) {
  40215. str += w;
  40216. for (i = 1; i < indexOfLastWord; i++) {
  40217. ws = d[i] + '';
  40218. k = LOG_BASE - ws.length;
  40219. if (k) str += getZeroString(k);
  40220. str += ws;
  40221. }
  40222. w = d[i];
  40223. ws = w + '';
  40224. k = LOG_BASE - ws.length;
  40225. if (k) str += getZeroString(k);
  40226. } else if (w === 0) {
  40227. return '0';
  40228. }
  40229. // Remove trailing zeros of last w.
  40230. for (; w % 10 === 0;) w /= 10;
  40231. return str + w;
  40232. }
  40233. function checkInt32(i, min, max) {
  40234. if (i !== ~~i || i < min || i > max) {
  40235. throw Error(invalidArgument + i);
  40236. }
  40237. }
  40238. /*
  40239. * Check 5 rounding digits if `repeating` is null, 4 otherwise.
  40240. * `repeating == null` if caller is `log` or `pow`,
  40241. * `repeating != null` if caller is `naturalLogarithm` or `naturalExponential`.
  40242. */
  40243. function checkRoundingDigits(d, i, rm, repeating) {
  40244. var di, k, r, rd;
  40245. // Get the length of the first word of the array d.
  40246. for (k = d[0]; k >= 10; k /= 10) --i;
  40247. // Is the rounding digit in the first word of d?
  40248. if (--i < 0) {
  40249. i += LOG_BASE;
  40250. di = 0;
  40251. } else {
  40252. di = Math.ceil((i + 1) / LOG_BASE);
  40253. i %= LOG_BASE;
  40254. }
  40255. // i is the index (0 - 6) of the rounding digit.
  40256. // E.g. if within the word 3487563 the first rounding digit is 5,
  40257. // then i = 4, k = 1000, rd = 3487563 % 1000 = 563
  40258. k = mathpow(10, LOG_BASE - i);
  40259. rd = d[di] % k | 0;
  40260. if (repeating == null) {
  40261. if (i < 3) {
  40262. if (i == 0) rd = rd / 100 | 0;
  40263. else if (i == 1) rd = rd / 10 | 0;
  40264. r = rm < 4 && rd == 99999 || rm > 3 && rd == 49999 || rd == 50000 || rd == 0;
  40265. } else {
  40266. r = (rm < 4 && rd + 1 == k || rm > 3 && rd + 1 == k / 2) &&
  40267. (d[di + 1] / k / 100 | 0) == mathpow(10, i - 2) - 1 ||
  40268. (rd == k / 2 || rd == 0) && (d[di + 1] / k / 100 | 0) == 0;
  40269. }
  40270. } else {
  40271. if (i < 4) {
  40272. if (i == 0) rd = rd / 1000 | 0;
  40273. else if (i == 1) rd = rd / 100 | 0;
  40274. else if (i == 2) rd = rd / 10 | 0;
  40275. r = (repeating || rm < 4) && rd == 9999 || !repeating && rm > 3 && rd == 4999;
  40276. } else {
  40277. r = ((repeating || rm < 4) && rd + 1 == k ||
  40278. (!repeating && rm > 3) && rd + 1 == k / 2) &&
  40279. (d[di + 1] / k / 1000 | 0) == mathpow(10, i - 3) - 1;
  40280. }
  40281. }
  40282. return r;
  40283. }
  40284. // Convert string of `baseIn` to an array of numbers of `baseOut`.
  40285. // Eg. convertBase('255', 10, 16) returns [15, 15].
  40286. // Eg. convertBase('ff', 16, 10) returns [2, 5, 5].
  40287. function convertBase(str, baseIn, baseOut) {
  40288. var j,
  40289. arr = [0],
  40290. arrL,
  40291. i = 0,
  40292. strL = str.length;
  40293. for (; i < strL;) {
  40294. for (arrL = arr.length; arrL--;) arr[arrL] *= baseIn;
  40295. arr[0] += NUMERALS.indexOf(str.charAt(i++));
  40296. for (j = 0; j < arr.length; j++) {
  40297. if (arr[j] > baseOut - 1) {
  40298. if (arr[j + 1] === void 0) arr[j + 1] = 0;
  40299. arr[j + 1] += arr[j] / baseOut | 0;
  40300. arr[j] %= baseOut;
  40301. }
  40302. }
  40303. }
  40304. return arr.reverse();
  40305. }
  40306. /*
  40307. * cos(x) = 1 - x^2/2! + x^4/4! - ...
  40308. * |x| < pi/2
  40309. *
  40310. */
  40311. function cosine(Ctor, x) {
  40312. var k, y,
  40313. len = x.d.length;
  40314. // Argument reduction: cos(4x) = 8*(cos^4(x) - cos^2(x)) + 1
  40315. // i.e. cos(x) = 8*(cos^4(x/4) - cos^2(x/4)) + 1
  40316. // Estimate the optimum number of times to use the argument reduction.
  40317. if (len < 32) {
  40318. k = Math.ceil(len / 3);
  40319. y = Math.pow(4, -k).toString();
  40320. } else {
  40321. k = 16;
  40322. y = '2.3283064365386962890625e-10';
  40323. }
  40324. Ctor.precision += k;
  40325. x = taylorSeries(Ctor, 1, x.times(y), new Ctor(1));
  40326. // Reverse argument reduction
  40327. for (var i = k; i--;) {
  40328. var cos2x = x.times(x);
  40329. x = cos2x.times(cos2x).minus(cos2x).times(8).plus(1);
  40330. }
  40331. Ctor.precision -= k;
  40332. return x;
  40333. }
  40334. /*
  40335. * Perform division in the specified base.
  40336. */
  40337. var divide = (function () {
  40338. // Assumes non-zero x and k, and hence non-zero result.
  40339. function multiplyInteger(x, k, base) {
  40340. var temp,
  40341. carry = 0,
  40342. i = x.length;
  40343. for (x = x.slice(); i--;) {
  40344. temp = x[i] * k + carry;
  40345. x[i] = temp % base | 0;
  40346. carry = temp / base | 0;
  40347. }
  40348. if (carry) x.unshift(carry);
  40349. return x;
  40350. }
  40351. function compare(a, b, aL, bL) {
  40352. var i, r;
  40353. if (aL != bL) {
  40354. r = aL > bL ? 1 : -1;
  40355. } else {
  40356. for (i = r = 0; i < aL; i++) {
  40357. if (a[i] != b[i]) {
  40358. r = a[i] > b[i] ? 1 : -1;
  40359. break;
  40360. }
  40361. }
  40362. }
  40363. return r;
  40364. }
  40365. function subtract(a, b, aL, base) {
  40366. var i = 0;
  40367. // Subtract b from a.
  40368. for (; aL--;) {
  40369. a[aL] -= i;
  40370. i = a[aL] < b[aL] ? 1 : 0;
  40371. a[aL] = i * base + a[aL] - b[aL];
  40372. }
  40373. // Remove leading zeros.
  40374. for (; !a[0] && a.length > 1;) a.shift();
  40375. }
  40376. return function (x, y, pr, rm, dp, base) {
  40377. var cmp, e, i, k, logBase, more, prod, prodL, q, qd, rem, remL, rem0, sd, t, xi, xL, yd0,
  40378. yL, yz,
  40379. Ctor = x.constructor,
  40380. sign = x.s == y.s ? 1 : -1,
  40381. xd = x.d,
  40382. yd = y.d;
  40383. // Either NaN, Infinity or 0?
  40384. if (!xd || !xd[0] || !yd || !yd[0]) {
  40385. return new Ctor(// Return NaN if either NaN, or both Infinity or 0.
  40386. !x.s || !y.s || (xd ? yd && xd[0] == yd[0] : !yd) ? NaN :
  40387. // Return ±0 if x is 0 or y is ±Infinity, or return ±Infinity as y is 0.
  40388. xd && xd[0] == 0 || !yd ? sign * 0 : sign / 0);
  40389. }
  40390. if (base) {
  40391. logBase = 1;
  40392. e = x.e - y.e;
  40393. } else {
  40394. base = BASE;
  40395. logBase = LOG_BASE;
  40396. e = mathfloor(x.e / logBase) - mathfloor(y.e / logBase);
  40397. }
  40398. yL = yd.length;
  40399. xL = xd.length;
  40400. q = new Ctor(sign);
  40401. qd = q.d = [];
  40402. // Result exponent may be one less than e.
  40403. // The digit array of a Decimal from toStringBinary may have trailing zeros.
  40404. for (i = 0; yd[i] == (xd[i] || 0); i++);
  40405. if (yd[i] > (xd[i] || 0)) e--;
  40406. if (pr == null) {
  40407. sd = pr = Ctor.precision;
  40408. rm = Ctor.rounding;
  40409. } else if (dp) {
  40410. sd = pr + (x.e - y.e) + 1;
  40411. } else {
  40412. sd = pr;
  40413. }
  40414. if (sd < 0) {
  40415. qd.push(1);
  40416. more = true;
  40417. } else {
  40418. // Convert precision in number of base 10 digits to base 1e7 digits.
  40419. sd = sd / logBase + 2 | 0;
  40420. i = 0;
  40421. // divisor < 1e7
  40422. if (yL == 1) {
  40423. k = 0;
  40424. yd = yd[0];
  40425. sd++;
  40426. // k is the carry.
  40427. for (; (i < xL || k) && sd--; i++) {
  40428. t = k * base + (xd[i] || 0);
  40429. qd[i] = t / yd | 0;
  40430. k = t % yd | 0;
  40431. }
  40432. more = k || i < xL;
  40433. // divisor >= 1e7
  40434. } else {
  40435. // Normalise xd and yd so highest order digit of yd is >= base/2
  40436. k = base / (yd[0] + 1) | 0;
  40437. if (k > 1) {
  40438. yd = multiplyInteger(yd, k, base);
  40439. xd = multiplyInteger(xd, k, base);
  40440. yL = yd.length;
  40441. xL = xd.length;
  40442. }
  40443. xi = yL;
  40444. rem = xd.slice(0, yL);
  40445. remL = rem.length;
  40446. // Add zeros to make remainder as long as divisor.
  40447. for (; remL < yL;) rem[remL++] = 0;
  40448. yz = yd.slice();
  40449. yz.unshift(0);
  40450. yd0 = yd[0];
  40451. if (yd[1] >= base / 2) ++yd0;
  40452. do {
  40453. k = 0;
  40454. // Compare divisor and remainder.
  40455. cmp = compare(yd, rem, yL, remL);
  40456. // If divisor < remainder.
  40457. if (cmp < 0) {
  40458. // Calculate trial digit, k.
  40459. rem0 = rem[0];
  40460. if (yL != remL) rem0 = rem0 * base + (rem[1] || 0);
  40461. // k will be how many times the divisor goes into the current remainder.
  40462. k = rem0 / yd0 | 0;
  40463. // Algorithm:
  40464. // 1. product = divisor * trial digit (k)
  40465. // 2. if product > remainder: product -= divisor, k--
  40466. // 3. remainder -= product
  40467. // 4. if product was < remainder at 2:
  40468. // 5. compare new remainder and divisor
  40469. // 6. If remainder > divisor: remainder -= divisor, k++
  40470. if (k > 1) {
  40471. if (k >= base) k = base - 1;
  40472. // product = divisor * trial digit.
  40473. prod = multiplyInteger(yd, k, base);
  40474. prodL = prod.length;
  40475. remL = rem.length;
  40476. // Compare product and remainder.
  40477. cmp = compare(prod, rem, prodL, remL);
  40478. // product > remainder.
  40479. if (cmp == 1) {
  40480. k--;
  40481. // Subtract divisor from product.
  40482. subtract(prod, yL < prodL ? yz : yd, prodL, base);
  40483. }
  40484. } else {
  40485. // cmp is -1.
  40486. // If k is 0, there is no need to compare yd and rem again below, so change cmp to 1
  40487. // to avoid it. If k is 1 there is a need to compare yd and rem again below.
  40488. if (k == 0) cmp = k = 1;
  40489. prod = yd.slice();
  40490. }
  40491. prodL = prod.length;
  40492. if (prodL < remL) prod.unshift(0);
  40493. // Subtract product from remainder.
  40494. subtract(rem, prod, remL, base);
  40495. // If product was < previous remainder.
  40496. if (cmp == -1) {
  40497. remL = rem.length;
  40498. // Compare divisor and new remainder.
  40499. cmp = compare(yd, rem, yL, remL);
  40500. // If divisor < new remainder, subtract divisor from remainder.
  40501. if (cmp < 1) {
  40502. k++;
  40503. // Subtract divisor from remainder.
  40504. subtract(rem, yL < remL ? yz : yd, remL, base);
  40505. }
  40506. }
  40507. remL = rem.length;
  40508. } else if (cmp === 0) {
  40509. k++;
  40510. rem = [0];
  40511. } // if cmp === 1, k will be 0
  40512. // Add the next digit, k, to the result array.
  40513. qd[i++] = k;
  40514. // Update the remainder.
  40515. if (cmp && rem[0]) {
  40516. rem[remL++] = xd[xi] || 0;
  40517. } else {
  40518. rem = [xd[xi]];
  40519. remL = 1;
  40520. }
  40521. } while ((xi++ < xL || rem[0] !== void 0) && sd--);
  40522. more = rem[0] !== void 0;
  40523. }
  40524. // Leading zero?
  40525. if (!qd[0]) qd.shift();
  40526. }
  40527. // logBase is 1 when divide is being used for base conversion.
  40528. if (logBase == 1) {
  40529. q.e = e;
  40530. inexact = more;
  40531. } else {
  40532. // To calculate q.e, first get the number of digits of qd[0].
  40533. for (i = 1, k = qd[0]; k >= 10; k /= 10) i++;
  40534. q.e = i + e * logBase - 1;
  40535. finalise(q, dp ? pr + q.e + 1 : pr, rm, more);
  40536. }
  40537. return q;
  40538. };
  40539. })();
  40540. /*
  40541. * Round `x` to `sd` significant digits using rounding mode `rm`.
  40542. * Check for over/under-flow.
  40543. */
  40544. function finalise(x, sd, rm, isTruncated) {
  40545. var digits, i, j, k, rd, roundUp, w, xd, xdi,
  40546. Ctor = x.constructor;
  40547. // Don't round if sd is null or undefined.
  40548. out: if (sd != null) {
  40549. xd = x.d;
  40550. // Infinity/NaN.
  40551. if (!xd) return x;
  40552. // rd: the rounding digit, i.e. the digit after the digit that may be rounded up.
  40553. // w: the word of xd containing rd, a base 1e7 number.
  40554. // xdi: the index of w within xd.
  40555. // digits: the number of digits of w.
  40556. // i: what would be the index of rd within w if all the numbers were 7 digits long (i.e. if
  40557. // they had leading zeros)
  40558. // j: if > 0, the actual index of rd within w (if < 0, rd is a leading zero).
  40559. // Get the length of the first word of the digits array xd.
  40560. for (digits = 1, k = xd[0]; k >= 10; k /= 10) digits++;
  40561. i = sd - digits;
  40562. // Is the rounding digit in the first word of xd?
  40563. if (i < 0) {
  40564. i += LOG_BASE;
  40565. j = sd;
  40566. w = xd[xdi = 0];
  40567. // Get the rounding digit at index j of w.
  40568. rd = w / mathpow(10, digits - j - 1) % 10 | 0;
  40569. } else {
  40570. xdi = Math.ceil((i + 1) / LOG_BASE);
  40571. k = xd.length;
  40572. if (xdi >= k) {
  40573. if (isTruncated) {
  40574. // Needed by `naturalExponential`, `naturalLogarithm` and `squareRoot`.
  40575. for (; k++ <= xdi;) xd.push(0);
  40576. w = rd = 0;
  40577. digits = 1;
  40578. i %= LOG_BASE;
  40579. j = i - LOG_BASE + 1;
  40580. } else {
  40581. break out;
  40582. }
  40583. } else {
  40584. w = k = xd[xdi];
  40585. // Get the number of digits of w.
  40586. for (digits = 1; k >= 10; k /= 10) digits++;
  40587. // Get the index of rd within w.
  40588. i %= LOG_BASE;
  40589. // Get the index of rd within w, adjusted for leading zeros.
  40590. // The number of leading zeros of w is given by LOG_BASE - digits.
  40591. j = i - LOG_BASE + digits;
  40592. // Get the rounding digit at index j of w.
  40593. rd = j < 0 ? 0 : w / mathpow(10, digits - j - 1) % 10 | 0;
  40594. }
  40595. }
  40596. // Are there any non-zero digits after the rounding digit?
  40597. isTruncated = isTruncated || sd < 0 ||
  40598. xd[xdi + 1] !== void 0 || (j < 0 ? w : w % mathpow(10, digits - j - 1));
  40599. // The expression `w % mathpow(10, digits - j - 1)` returns all the digits of w to the right
  40600. // of the digit at (left-to-right) index j, e.g. if w is 908714 and j is 2, the expression
  40601. // will give 714.
  40602. roundUp = rm < 4
  40603. ? (rd || isTruncated) && (rm == 0 || rm == (x.s < 0 ? 3 : 2))
  40604. : rd > 5 || rd == 5 && (rm == 4 || isTruncated || rm == 6 &&
  40605. // Check whether the digit to the left of the rounding digit is odd.
  40606. ((i > 0 ? j > 0 ? w / mathpow(10, digits - j) : 0 : xd[xdi - 1]) % 10) & 1 ||
  40607. rm == (x.s < 0 ? 8 : 7));
  40608. if (sd < 1 || !xd[0]) {
  40609. xd.length = 0;
  40610. if (roundUp) {
  40611. // Convert sd to decimal places.
  40612. sd -= x.e + 1;
  40613. // 1, 0.1, 0.01, 0.001, 0.0001 etc.
  40614. xd[0] = mathpow(10, (LOG_BASE - sd % LOG_BASE) % LOG_BASE);
  40615. x.e = -sd || 0;
  40616. } else {
  40617. // Zero.
  40618. xd[0] = x.e = 0;
  40619. }
  40620. return x;
  40621. }
  40622. // Remove excess digits.
  40623. if (i == 0) {
  40624. xd.length = xdi;
  40625. k = 1;
  40626. xdi--;
  40627. } else {
  40628. xd.length = xdi + 1;
  40629. k = mathpow(10, LOG_BASE - i);
  40630. // E.g. 56700 becomes 56000 if 7 is the rounding digit.
  40631. // j > 0 means i > number of leading zeros of w.
  40632. xd[xdi] = j > 0 ? (w / mathpow(10, digits - j) % mathpow(10, j) | 0) * k : 0;
  40633. }
  40634. if (roundUp) {
  40635. for (;;) {
  40636. // Is the digit to be rounded up in the first word of xd?
  40637. if (xdi == 0) {
  40638. // i will be the length of xd[0] before k is added.
  40639. for (i = 1, j = xd[0]; j >= 10; j /= 10) i++;
  40640. j = xd[0] += k;
  40641. for (k = 1; j >= 10; j /= 10) k++;
  40642. // if i != k the length has increased.
  40643. if (i != k) {
  40644. x.e++;
  40645. if (xd[0] == BASE) xd[0] = 1;
  40646. }
  40647. break;
  40648. } else {
  40649. xd[xdi] += k;
  40650. if (xd[xdi] != BASE) break;
  40651. xd[xdi--] = 0;
  40652. k = 1;
  40653. }
  40654. }
  40655. }
  40656. // Remove trailing zeros.
  40657. for (i = xd.length; xd[--i] === 0;) xd.pop();
  40658. }
  40659. if (external) {
  40660. // Overflow?
  40661. if (x.e > Ctor.maxE) {
  40662. // Infinity.
  40663. x.d = null;
  40664. x.e = NaN;
  40665. // Underflow?
  40666. } else if (x.e < Ctor.minE) {
  40667. // Zero.
  40668. x.e = 0;
  40669. x.d = [0];
  40670. // Ctor.underflow = true;
  40671. } // else Ctor.underflow = false;
  40672. }
  40673. return x;
  40674. }
  40675. function finiteToString(x, isExp, sd) {
  40676. if (!x.isFinite()) return nonFiniteToString(x);
  40677. var k,
  40678. e = x.e,
  40679. str = digitsToString(x.d),
  40680. len = str.length;
  40681. if (isExp) {
  40682. if (sd && (k = sd - len) > 0) {
  40683. str = str.charAt(0) + '.' + str.slice(1) + getZeroString(k);
  40684. } else if (len > 1) {
  40685. str = str.charAt(0) + '.' + str.slice(1);
  40686. }
  40687. str = str + (x.e < 0 ? 'e' : 'e+') + x.e;
  40688. } else if (e < 0) {
  40689. str = '0.' + getZeroString(-e - 1) + str;
  40690. if (sd && (k = sd - len) > 0) str += getZeroString(k);
  40691. } else if (e >= len) {
  40692. str += getZeroString(e + 1 - len);
  40693. if (sd && (k = sd - e - 1) > 0) str = str + '.' + getZeroString(k);
  40694. } else {
  40695. if ((k = e + 1) < len) str = str.slice(0, k) + '.' + str.slice(k);
  40696. if (sd && (k = sd - len) > 0) {
  40697. if (e + 1 === len) str += '.';
  40698. str += getZeroString(k);
  40699. }
  40700. }
  40701. return str;
  40702. }
  40703. // Calculate the base 10 exponent from the base 1e7 exponent.
  40704. function getBase10Exponent(digits, e) {
  40705. var w = digits[0];
  40706. // Add the number of digits of the first word of the digits array.
  40707. for ( e *= LOG_BASE; w >= 10; w /= 10) e++;
  40708. return e;
  40709. }
  40710. function getLn10(Ctor, sd, pr) {
  40711. if (sd > LN10_PRECISION) {
  40712. // Reset global state in case the exception is caught.
  40713. external = true;
  40714. if (pr) Ctor.precision = pr;
  40715. throw Error(precisionLimitExceeded);
  40716. }
  40717. return finalise(new Ctor(LN10), sd, 1, true);
  40718. }
  40719. function getPi(Ctor, sd, rm) {
  40720. if (sd > PI_PRECISION) throw Error(precisionLimitExceeded);
  40721. return finalise(new Ctor(PI), sd, rm, true);
  40722. }
  40723. function getPrecision(digits) {
  40724. var w = digits.length - 1,
  40725. len = w * LOG_BASE + 1;
  40726. w = digits[w];
  40727. // If non-zero...
  40728. if (w) {
  40729. // Subtract the number of trailing zeros of the last word.
  40730. for (; w % 10 == 0; w /= 10) len--;
  40731. // Add the number of digits of the first word.
  40732. for (w = digits[0]; w >= 10; w /= 10) len++;
  40733. }
  40734. return len;
  40735. }
  40736. function getZeroString(k) {
  40737. var zs = '';
  40738. for (; k--;) zs += '0';
  40739. return zs;
  40740. }
  40741. /*
  40742. * Return a new Decimal whose value is the value of Decimal `x` to the power `n`, where `n` is an
  40743. * integer of type number.
  40744. *
  40745. * Implements 'exponentiation by squaring'. Called by `pow` and `parseOther`.
  40746. *
  40747. */
  40748. function intPow(Ctor, x, n, pr) {
  40749. var isTruncated,
  40750. r = new Ctor(1),
  40751. // Max n of 9007199254740991 takes 53 loop iterations.
  40752. // Maximum digits array length; leaves [28, 34] guard digits.
  40753. k = Math.ceil(pr / LOG_BASE + 4);
  40754. external = false;
  40755. for (;;) {
  40756. if (n % 2) {
  40757. r = r.times(x);
  40758. if (truncate(r.d, k)) isTruncated = true;
  40759. }
  40760. n = mathfloor(n / 2);
  40761. if (n === 0) {
  40762. // To ensure correct rounding when r.d is truncated, increment the last word if it is zero.
  40763. n = r.d.length - 1;
  40764. if (isTruncated && r.d[n] === 0) ++r.d[n];
  40765. break;
  40766. }
  40767. x = x.times(x);
  40768. truncate(x.d, k);
  40769. }
  40770. external = true;
  40771. return r;
  40772. }
  40773. function isOdd(n) {
  40774. return n.d[n.d.length - 1] & 1;
  40775. }
  40776. /*
  40777. * Handle `max` and `min`. `ltgt` is 'lt' or 'gt'.
  40778. */
  40779. function maxOrMin(Ctor, args, ltgt) {
  40780. var y,
  40781. x = new Ctor(args[0]),
  40782. i = 0;
  40783. for (; ++i < args.length;) {
  40784. y = new Ctor(args[i]);
  40785. if (!y.s) {
  40786. x = y;
  40787. break;
  40788. } else if (x[ltgt](y)) {
  40789. x = y;
  40790. }
  40791. }
  40792. return x;
  40793. }
  40794. /*
  40795. * Return a new Decimal whose value is the natural exponential of `x` rounded to `sd` significant
  40796. * digits.
  40797. *
  40798. * Taylor/Maclaurin series.
  40799. *
  40800. * exp(x) = x^0/0! + x^1/1! + x^2/2! + x^3/3! + ...
  40801. *
  40802. * Argument reduction:
  40803. * Repeat x = x / 32, k += 5, until |x| < 0.1
  40804. * exp(x) = exp(x / 2^k)^(2^k)
  40805. *
  40806. * Previously, the argument was initially reduced by
  40807. * exp(x) = exp(r) * 10^k where r = x - k * ln10, k = floor(x / ln10)
  40808. * to first put r in the range [0, ln10], before dividing by 32 until |x| < 0.1, but this was
  40809. * found to be slower than just dividing repeatedly by 32 as above.
  40810. *
  40811. * Max integer argument: exp('20723265836946413') = 6.3e+9000000000000000
  40812. * Min integer argument: exp('-20723265836946411') = 1.2e-9000000000000000
  40813. * (Math object integer min/max: Math.exp(709) = 8.2e+307, Math.exp(-745) = 5e-324)
  40814. *
  40815. * exp(Infinity) = Infinity
  40816. * exp(-Infinity) = 0
  40817. * exp(NaN) = NaN
  40818. * exp(±0) = 1
  40819. *
  40820. * exp(x) is non-terminating for any finite, non-zero x.
  40821. *
  40822. * The result will always be correctly rounded.
  40823. *
  40824. */
  40825. function naturalExponential(x, sd) {
  40826. var denominator, guard, j, pow, sum, t, wpr,
  40827. rep = 0,
  40828. i = 0,
  40829. k = 0,
  40830. Ctor = x.constructor,
  40831. rm = Ctor.rounding,
  40832. pr = Ctor.precision;
  40833. // 0/NaN/Infinity?
  40834. if (!x.d || !x.d[0] || x.e > 17) {
  40835. return new Ctor(x.d
  40836. ? !x.d[0] ? 1 : x.s < 0 ? 0 : 1 / 0
  40837. : x.s ? x.s < 0 ? 0 : x : 0 / 0);
  40838. }
  40839. if (sd == null) {
  40840. external = false;
  40841. wpr = pr;
  40842. } else {
  40843. wpr = sd;
  40844. }
  40845. t = new Ctor(0.03125);
  40846. // while abs(x) >= 0.1
  40847. while (x.e > -2) {
  40848. // x = x / 2^5
  40849. x = x.times(t);
  40850. k += 5;
  40851. }
  40852. // Use 2 * log10(2^k) + 5 (empirically derived) to estimate the increase in precision
  40853. // necessary to ensure the first 4 rounding digits are correct.
  40854. guard = Math.log(mathpow(2, k)) / Math.LN10 * 2 + 5 | 0;
  40855. wpr += guard;
  40856. denominator = pow = sum = new Ctor(1);
  40857. Ctor.precision = wpr;
  40858. for (;;) {
  40859. pow = finalise(pow.times(x), wpr, 1);
  40860. denominator = denominator.times(++i);
  40861. t = sum.plus(divide(pow, denominator, wpr, 1));
  40862. if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) {
  40863. j = k;
  40864. while (j--) sum = finalise(sum.times(sum), wpr, 1);
  40865. // Check to see if the first 4 rounding digits are [49]999.
  40866. // If so, repeat the summation with a higher precision, otherwise
  40867. // e.g. with precision: 18, rounding: 1
  40868. // exp(18.404272462595034083567793919843761) = 98372560.1229999999 (should be 98372560.123)
  40869. // `wpr - guard` is the index of first rounding digit.
  40870. if (sd == null) {
  40871. if (rep < 3 && checkRoundingDigits(sum.d, wpr - guard, rm, rep)) {
  40872. Ctor.precision = wpr += 10;
  40873. denominator = pow = t = new Ctor(1);
  40874. i = 0;
  40875. rep++;
  40876. } else {
  40877. return finalise(sum, Ctor.precision = pr, rm, external = true);
  40878. }
  40879. } else {
  40880. Ctor.precision = pr;
  40881. return sum;
  40882. }
  40883. }
  40884. sum = t;
  40885. }
  40886. }
  40887. /*
  40888. * Return a new Decimal whose value is the natural logarithm of `x` rounded to `sd` significant
  40889. * digits.
  40890. *
  40891. * ln(-n) = NaN
  40892. * ln(0) = -Infinity
  40893. * ln(-0) = -Infinity
  40894. * ln(1) = 0
  40895. * ln(Infinity) = Infinity
  40896. * ln(-Infinity) = NaN
  40897. * ln(NaN) = NaN
  40898. *
  40899. * ln(n) (n != 1) is non-terminating.
  40900. *
  40901. */
  40902. function naturalLogarithm(y, sd) {
  40903. var c, c0, denominator, e, numerator, rep, sum, t, wpr, x1, x2,
  40904. n = 1,
  40905. guard = 10,
  40906. x = y,
  40907. xd = x.d,
  40908. Ctor = x.constructor,
  40909. rm = Ctor.rounding,
  40910. pr = Ctor.precision;
  40911. // Is x negative or Infinity, NaN, 0 or 1?
  40912. if (x.s < 0 || !xd || !xd[0] || !x.e && xd[0] == 1 && xd.length == 1) {
  40913. return new Ctor(xd && !xd[0] ? -1 / 0 : x.s != 1 ? NaN : xd ? 0 : x);
  40914. }
  40915. if (sd == null) {
  40916. external = false;
  40917. wpr = pr;
  40918. } else {
  40919. wpr = sd;
  40920. }
  40921. Ctor.precision = wpr += guard;
  40922. c = digitsToString(xd);
  40923. c0 = c.charAt(0);
  40924. if (Math.abs(e = x.e) < 1.5e15) {
  40925. // Argument reduction.
  40926. // The series converges faster the closer the argument is to 1, so using
  40927. // ln(a^b) = b * ln(a), ln(a) = ln(a^b) / b
  40928. // multiply the argument by itself until the leading digits of the significand are 7, 8, 9,
  40929. // 10, 11, 12 or 13, recording the number of multiplications so the sum of the series can
  40930. // later be divided by this number, then separate out the power of 10 using
  40931. // ln(a*10^b) = ln(a) + b*ln(10).
  40932. // max n is 21 (gives 0.9, 1.0 or 1.1) (9e15 / 21 = 4.2e14).
  40933. //while (c0 < 9 && c0 != 1 || c0 == 1 && c.charAt(1) > 1) {
  40934. // max n is 6 (gives 0.7 - 1.3)
  40935. while (c0 < 7 && c0 != 1 || c0 == 1 && c.charAt(1) > 3) {
  40936. x = x.times(y);
  40937. c = digitsToString(x.d);
  40938. c0 = c.charAt(0);
  40939. n++;
  40940. }
  40941. e = x.e;
  40942. if (c0 > 1) {
  40943. x = new Ctor('0.' + c);
  40944. e++;
  40945. } else {
  40946. x = new Ctor(c0 + '.' + c.slice(1));
  40947. }
  40948. } else {
  40949. // The argument reduction method above may result in overflow if the argument y is a massive
  40950. // number with exponent >= 1500000000000000 (9e15 / 6 = 1.5e15), so instead recall this
  40951. // function using ln(x*10^e) = ln(x) + e*ln(10).
  40952. t = getLn10(Ctor, wpr + 2, pr).times(e + '');
  40953. x = naturalLogarithm(new Ctor(c0 + '.' + c.slice(1)), wpr - guard).plus(t);
  40954. Ctor.precision = pr;
  40955. return sd == null ? finalise(x, pr, rm, external = true) : x;
  40956. }
  40957. // x1 is x reduced to a value near 1.
  40958. x1 = x;
  40959. // Taylor series.
  40960. // ln(y) = ln((1 + x)/(1 - x)) = 2(x + x^3/3 + x^5/5 + x^7/7 + ...)
  40961. // where x = (y - 1)/(y + 1) (|x| < 1)
  40962. sum = numerator = x = divide(x.minus(1), x.plus(1), wpr, 1);
  40963. x2 = finalise(x.times(x), wpr, 1);
  40964. denominator = 3;
  40965. for (;;) {
  40966. numerator = finalise(numerator.times(x2), wpr, 1);
  40967. t = sum.plus(divide(numerator, new Ctor(denominator), wpr, 1));
  40968. if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) {
  40969. sum = sum.times(2);
  40970. // Reverse the argument reduction. Check that e is not 0 because, besides preventing an
  40971. // unnecessary calculation, -0 + 0 = +0 and to ensure correct rounding -0 needs to stay -0.
  40972. if (e !== 0) sum = sum.plus(getLn10(Ctor, wpr + 2, pr).times(e + ''));
  40973. sum = divide(sum, new Ctor(n), wpr, 1);
  40974. // Is rm > 3 and the first 4 rounding digits 4999, or rm < 4 (or the summation has
  40975. // been repeated previously) and the first 4 rounding digits 9999?
  40976. // If so, restart the summation with a higher precision, otherwise
  40977. // e.g. with precision: 12, rounding: 1
  40978. // ln(135520028.6126091714265381533) = 18.7246299999 when it should be 18.72463.
  40979. // `wpr - guard` is the index of first rounding digit.
  40980. if (sd == null) {
  40981. if (checkRoundingDigits(sum.d, wpr - guard, rm, rep)) {
  40982. Ctor.precision = wpr += guard;
  40983. t = numerator = x = divide(x1.minus(1), x1.plus(1), wpr, 1);
  40984. x2 = finalise(x.times(x), wpr, 1);
  40985. denominator = rep = 1;
  40986. } else {
  40987. return finalise(sum, Ctor.precision = pr, rm, external = true);
  40988. }
  40989. } else {
  40990. Ctor.precision = pr;
  40991. return sum;
  40992. }
  40993. }
  40994. sum = t;
  40995. denominator += 2;
  40996. }
  40997. }
  40998. // ±Infinity, NaN.
  40999. function nonFiniteToString(x) {
  41000. // Unsigned.
  41001. return String(x.s * x.s / 0);
  41002. }
  41003. /*
  41004. * Parse the value of a new Decimal `x` from string `str`.
  41005. */
  41006. function parseDecimal(x, str) {
  41007. var e, i, len;
  41008. // Decimal point?
  41009. if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');
  41010. // Exponential form?
  41011. if ((i = str.search(/e/i)) > 0) {
  41012. // Determine exponent.
  41013. if (e < 0) e = i;
  41014. e += +str.slice(i + 1);
  41015. str = str.substring(0, i);
  41016. } else if (e < 0) {
  41017. // Integer.
  41018. e = str.length;
  41019. }
  41020. // Determine leading zeros.
  41021. for (i = 0; str.charCodeAt(i) === 48; i++);
  41022. // Determine trailing zeros.
  41023. for (len = str.length; str.charCodeAt(len - 1) === 48; --len);
  41024. str = str.slice(i, len);
  41025. if (str) {
  41026. len -= i;
  41027. x.e = e = e - i - 1;
  41028. x.d = [];
  41029. // Transform base
  41030. // e is the base 10 exponent.
  41031. // i is where to slice str to get the first word of the digits array.
  41032. i = (e + 1) % LOG_BASE;
  41033. if (e < 0) i += LOG_BASE;
  41034. if (i < len) {
  41035. if (i) x.d.push(+str.slice(0, i));
  41036. for (len -= LOG_BASE; i < len;) x.d.push(+str.slice(i, i += LOG_BASE));
  41037. str = str.slice(i);
  41038. i = LOG_BASE - str.length;
  41039. } else {
  41040. i -= len;
  41041. }
  41042. for (; i--;) str += '0';
  41043. x.d.push(+str);
  41044. if (external) {
  41045. // Overflow?
  41046. if (x.e > x.constructor.maxE) {
  41047. // Infinity.
  41048. x.d = null;
  41049. x.e = NaN;
  41050. // Underflow?
  41051. } else if (x.e < x.constructor.minE) {
  41052. // Zero.
  41053. x.e = 0;
  41054. x.d = [0];
  41055. // x.constructor.underflow = true;
  41056. } // else x.constructor.underflow = false;
  41057. }
  41058. } else {
  41059. // Zero.
  41060. x.e = 0;
  41061. x.d = [0];
  41062. }
  41063. return x;
  41064. }
  41065. /*
  41066. * Parse the value of a new Decimal `x` from a string `str`, which is not a decimal value.
  41067. */
  41068. function parseOther(x, str) {
  41069. var base, Ctor, divisor, i, isFloat, len, p, xd, xe;
  41070. if (str === 'Infinity' || str === 'NaN') {
  41071. if (!+str) x.s = NaN;
  41072. x.e = NaN;
  41073. x.d = null;
  41074. return x;
  41075. }
  41076. if (isHex.test(str)) {
  41077. base = 16;
  41078. str = str.toLowerCase();
  41079. } else if (isBinary.test(str)) {
  41080. base = 2;
  41081. } else if (isOctal.test(str)) {
  41082. base = 8;
  41083. } else {
  41084. throw Error(invalidArgument + str);
  41085. }
  41086. // Is there a binary exponent part?
  41087. i = str.search(/p/i);
  41088. if (i > 0) {
  41089. p = +str.slice(i + 1);
  41090. str = str.substring(2, i);
  41091. } else {
  41092. str = str.slice(2);
  41093. }
  41094. // Convert `str` as an integer then divide the result by `base` raised to a power such that the
  41095. // fraction part will be restored.
  41096. i = str.indexOf('.');
  41097. isFloat = i >= 0;
  41098. Ctor = x.constructor;
  41099. if (isFloat) {
  41100. str = str.replace('.', '');
  41101. len = str.length;
  41102. i = len - i;
  41103. // log[10](16) = 1.2041... , log[10](88) = 1.9444....
  41104. divisor = intPow(Ctor, new Ctor(base), i, i * 2);
  41105. }
  41106. xd = convertBase(str, base, BASE);
  41107. xe = xd.length - 1;
  41108. // Remove trailing zeros.
  41109. for (i = xe; xd[i] === 0; --i) xd.pop();
  41110. if (i < 0) return new Ctor(x.s * 0);
  41111. x.e = getBase10Exponent(xd, xe);
  41112. x.d = xd;
  41113. external = false;
  41114. // At what precision to perform the division to ensure exact conversion?
  41115. // maxDecimalIntegerPartDigitCount = ceil(log[10](b) * otherBaseIntegerPartDigitCount)
  41116. // log[10](2) = 0.30103, log[10](8) = 0.90309, log[10](16) = 1.20412
  41117. // E.g. ceil(1.2 * 3) = 4, so up to 4 decimal digits are needed to represent 3 hex int digits.
  41118. // maxDecimalFractionPartDigitCount = {Hex:4|Oct:3|Bin:1} * otherBaseFractionPartDigitCount
  41119. // Therefore using 4 * the number of digits of str will always be enough.
  41120. if (isFloat) x = divide(x, divisor, len * 4);
  41121. // Multiply by the binary exponent part if present.
  41122. if (p) x = x.times(Math.abs(p) < 54 ? Math.pow(2, p) : Decimal.pow(2, p));
  41123. external = true;
  41124. return x;
  41125. }
  41126. /*
  41127. * sin(x) = x - x^3/3! + x^5/5! - ...
  41128. * |x| < pi/2
  41129. *
  41130. */
  41131. function sine(Ctor, x) {
  41132. var k,
  41133. len = x.d.length;
  41134. if (len < 3) return taylorSeries(Ctor, 2, x, x);
  41135. // Argument reduction: sin(5x) = 16*sin^5(x) - 20*sin^3(x) + 5*sin(x)
  41136. // i.e. sin(x) = 16*sin^5(x/5) - 20*sin^3(x/5) + 5*sin(x/5)
  41137. // and sin(x) = sin(x/5)(5 + sin^2(x/5)(16sin^2(x/5) - 20))
  41138. // Estimate the optimum number of times to use the argument reduction.
  41139. k = 1.4 * Math.sqrt(len);
  41140. k = k > 16 ? 16 : k | 0;
  41141. // Max k before Math.pow precision loss is 22
  41142. x = x.times(Math.pow(5, -k));
  41143. x = taylorSeries(Ctor, 2, x, x);
  41144. // Reverse argument reduction
  41145. var sin2_x,
  41146. d5 = new Ctor(5),
  41147. d16 = new Ctor(16),
  41148. d20 = new Ctor(20);
  41149. for (; k--;) {
  41150. sin2_x = x.times(x);
  41151. x = x.times(d5.plus(sin2_x.times(d16.times(sin2_x).minus(d20))));
  41152. }
  41153. return x;
  41154. }
  41155. // Calculate Taylor series for `cos`, `cosh`, `sin` and `sinh`.
  41156. function taylorSeries(Ctor, n, x, y, isHyperbolic) {
  41157. var j, t, u, x2,
  41158. i = 1,
  41159. pr = Ctor.precision,
  41160. k = Math.ceil(pr / LOG_BASE);
  41161. external = false;
  41162. x2 = x.times(x);
  41163. u = new Ctor(y);
  41164. for (;;) {
  41165. t = divide(u.times(x2), new Ctor(n++ * n++), pr, 1);
  41166. u = isHyperbolic ? y.plus(t) : y.minus(t);
  41167. y = divide(t.times(x2), new Ctor(n++ * n++), pr, 1);
  41168. t = u.plus(y);
  41169. if (t.d[k] !== void 0) {
  41170. for (j = k; t.d[j] === u.d[j] && j--;);
  41171. if (j == -1) break;
  41172. }
  41173. j = u;
  41174. u = y;
  41175. y = t;
  41176. t = j;
  41177. i++;
  41178. }
  41179. external = true;
  41180. t.d.length = k + 1;
  41181. return t;
  41182. }
  41183. // Return the absolute value of `x` reduced to less than or equal to half pi.
  41184. function toLessThanHalfPi(Ctor, x) {
  41185. var t,
  41186. isNeg = x.s < 0,
  41187. pi = getPi(Ctor, Ctor.precision, 1),
  41188. halfPi = pi.times(0.5);
  41189. x = x.abs();
  41190. if (x.lte(halfPi)) {
  41191. quadrant = isNeg ? 4 : 1;
  41192. return x;
  41193. }
  41194. t = x.divToInt(pi);
  41195. if (t.isZero()) {
  41196. quadrant = isNeg ? 3 : 2;
  41197. } else {
  41198. x = x.minus(t.times(pi));
  41199. // 0 <= x < pi
  41200. if (x.lte(halfPi)) {
  41201. quadrant = isOdd(t) ? (isNeg ? 2 : 3) : (isNeg ? 4 : 1);
  41202. return x;
  41203. }
  41204. quadrant = isOdd(t) ? (isNeg ? 1 : 4) : (isNeg ? 3 : 2);
  41205. }
  41206. return x.minus(pi).abs();
  41207. }
  41208. /*
  41209. * Return the value of Decimal `x` as a string in base `baseOut`.
  41210. *
  41211. * If the optional `sd` argument is present include a binary exponent suffix.
  41212. */
  41213. function toStringBinary(x, baseOut, sd, rm) {
  41214. var base, e, i, k, len, roundUp, str, xd, y,
  41215. Ctor = x.constructor,
  41216. isExp = sd !== void 0;
  41217. if (isExp) {
  41218. checkInt32(sd, 1, MAX_DIGITS);
  41219. if (rm === void 0) rm = Ctor.rounding;
  41220. else checkInt32(rm, 0, 8);
  41221. } else {
  41222. sd = Ctor.precision;
  41223. rm = Ctor.rounding;
  41224. }
  41225. if (!x.isFinite()) {
  41226. str = nonFiniteToString(x);
  41227. } else {
  41228. str = finiteToString(x);
  41229. i = str.indexOf('.');
  41230. // Use exponential notation according to `toExpPos` and `toExpNeg`? No, but if required:
  41231. // maxBinaryExponent = floor((decimalExponent + 1) * log[2](10))
  41232. // minBinaryExponent = floor(decimalExponent * log[2](10))
  41233. // log[2](10) = 3.321928094887362347870319429489390175864
  41234. if (isExp) {
  41235. base = 2;
  41236. if (baseOut == 16) {
  41237. sd = sd * 4 - 3;
  41238. } else if (baseOut == 8) {
  41239. sd = sd * 3 - 2;
  41240. }
  41241. } else {
  41242. base = baseOut;
  41243. }
  41244. // Convert the number as an integer then divide the result by its base raised to a power such
  41245. // that the fraction part will be restored.
  41246. // Non-integer.
  41247. if (i >= 0) {
  41248. str = str.replace('.', '');
  41249. y = new Ctor(1);
  41250. y.e = str.length - i;
  41251. y.d = convertBase(finiteToString(y), 10, base);
  41252. y.e = y.d.length;
  41253. }
  41254. xd = convertBase(str, 10, base);
  41255. e = len = xd.length;
  41256. // Remove trailing zeros.
  41257. for (; xd[--len] == 0;) xd.pop();
  41258. if (!xd[0]) {
  41259. str = isExp ? '0p+0' : '0';
  41260. } else {
  41261. if (i < 0) {
  41262. e--;
  41263. } else {
  41264. x = new Ctor(x);
  41265. x.d = xd;
  41266. x.e = e;
  41267. x = divide(x, y, sd, rm, 0, base);
  41268. xd = x.d;
  41269. e = x.e;
  41270. roundUp = inexact;
  41271. }
  41272. // The rounding digit, i.e. the digit after the digit that may be rounded up.
  41273. i = xd[sd];
  41274. k = base / 2;
  41275. roundUp = roundUp || xd[sd + 1] !== void 0;
  41276. roundUp = rm < 4
  41277. ? (i !== void 0 || roundUp) && (rm === 0 || rm === (x.s < 0 ? 3 : 2))
  41278. : i > k || i === k && (rm === 4 || roundUp || rm === 6 && xd[sd - 1] & 1 ||
  41279. rm === (x.s < 0 ? 8 : 7));
  41280. xd.length = sd;
  41281. if (roundUp) {
  41282. // Rounding up may mean the previous digit has to be rounded up and so on.
  41283. for (; ++xd[--sd] > base - 1;) {
  41284. xd[sd] = 0;
  41285. if (!sd) {
  41286. ++e;
  41287. xd.unshift(1);
  41288. }
  41289. }
  41290. }
  41291. // Determine trailing zeros.
  41292. for (len = xd.length; !xd[len - 1]; --len);
  41293. // E.g. [4, 11, 15] becomes 4bf.
  41294. for (i = 0, str = ''; i < len; i++) str += NUMERALS.charAt(xd[i]);
  41295. // Add binary exponent suffix?
  41296. if (isExp) {
  41297. if (len > 1) {
  41298. if (baseOut == 16 || baseOut == 8) {
  41299. i = baseOut == 16 ? 4 : 3;
  41300. for (--len; len % i; len++) str += '0';
  41301. xd = convertBase(str, base, baseOut);
  41302. for (len = xd.length; !xd[len - 1]; --len);
  41303. // xd[0] will always be be 1
  41304. for (i = 1, str = '1.'; i < len; i++) str += NUMERALS.charAt(xd[i]);
  41305. } else {
  41306. str = str.charAt(0) + '.' + str.slice(1);
  41307. }
  41308. }
  41309. str = str + (e < 0 ? 'p' : 'p+') + e;
  41310. } else if (e < 0) {
  41311. for (; ++e;) str = '0' + str;
  41312. str = '0.' + str;
  41313. } else {
  41314. if (++e > len) for (e -= len; e-- ;) str += '0';
  41315. else if (e < len) str = str.slice(0, e) + '.' + str.slice(e);
  41316. }
  41317. }
  41318. str = (baseOut == 16 ? '0x' : baseOut == 2 ? '0b' : baseOut == 8 ? '0o' : '') + str;
  41319. }
  41320. return x.s < 0 ? '-' + str : str;
  41321. }
  41322. // Does not strip trailing zeros.
  41323. function truncate(arr, len) {
  41324. if (arr.length > len) {
  41325. arr.length = len;
  41326. return true;
  41327. }
  41328. }
  41329. // Decimal methods
  41330. /*
  41331. * abs
  41332. * acos
  41333. * acosh
  41334. * add
  41335. * asin
  41336. * asinh
  41337. * atan
  41338. * atanh
  41339. * atan2
  41340. * cbrt
  41341. * ceil
  41342. * clone
  41343. * config
  41344. * cos
  41345. * cosh
  41346. * div
  41347. * exp
  41348. * floor
  41349. * hypot
  41350. * ln
  41351. * log
  41352. * log2
  41353. * log10
  41354. * max
  41355. * min
  41356. * mod
  41357. * mul
  41358. * pow
  41359. * random
  41360. * round
  41361. * set
  41362. * sign
  41363. * sin
  41364. * sinh
  41365. * sqrt
  41366. * sub
  41367. * tan
  41368. * tanh
  41369. * trunc
  41370. */
  41371. /*
  41372. * Return a new Decimal whose value is the absolute value of `x`.
  41373. *
  41374. * x {number|string|Decimal}
  41375. *
  41376. */
  41377. function abs(x) {
  41378. return new this(x).abs();
  41379. }
  41380. /*
  41381. * Return a new Decimal whose value is the arccosine in radians of `x`.
  41382. *
  41383. * x {number|string|Decimal}
  41384. *
  41385. */
  41386. function acos(x) {
  41387. return new this(x).acos();
  41388. }
  41389. /*
  41390. * Return a new Decimal whose value is the inverse of the hyperbolic cosine of `x`, rounded to
  41391. * `precision` significant digits using rounding mode `rounding`.
  41392. *
  41393. * x {number|string|Decimal} A value in radians.
  41394. *
  41395. */
  41396. function acosh(x) {
  41397. return new this(x).acosh();
  41398. }
  41399. /*
  41400. * Return a new Decimal whose value is the sum of `x` and `y`, rounded to `precision` significant
  41401. * digits using rounding mode `rounding`.
  41402. *
  41403. * x {number|string|Decimal}
  41404. * y {number|string|Decimal}
  41405. *
  41406. */
  41407. function add(x, y) {
  41408. return new this(x).plus(y);
  41409. }
  41410. /*
  41411. * Return a new Decimal whose value is the arcsine in radians of `x`, rounded to `precision`
  41412. * significant digits using rounding mode `rounding`.
  41413. *
  41414. * x {number|string|Decimal}
  41415. *
  41416. */
  41417. function asin(x) {
  41418. return new this(x).asin();
  41419. }
  41420. /*
  41421. * Return a new Decimal whose value is the inverse of the hyperbolic sine of `x`, rounded to
  41422. * `precision` significant digits using rounding mode `rounding`.
  41423. *
  41424. * x {number|string|Decimal} A value in radians.
  41425. *
  41426. */
  41427. function asinh(x) {
  41428. return new this(x).asinh();
  41429. }
  41430. /*
  41431. * Return a new Decimal whose value is the arctangent in radians of `x`, rounded to `precision`
  41432. * significant digits using rounding mode `rounding`.
  41433. *
  41434. * x {number|string|Decimal}
  41435. *
  41436. */
  41437. function atan(x) {
  41438. return new this(x).atan();
  41439. }
  41440. /*
  41441. * Return a new Decimal whose value is the inverse of the hyperbolic tangent of `x`, rounded to
  41442. * `precision` significant digits using rounding mode `rounding`.
  41443. *
  41444. * x {number|string|Decimal} A value in radians.
  41445. *
  41446. */
  41447. function atanh(x) {
  41448. return new this(x).atanh();
  41449. }
  41450. /*
  41451. * Return a new Decimal whose value is the arctangent in radians of `y/x` in the range -pi to pi
  41452. * (inclusive), rounded to `precision` significant digits using rounding mode `rounding`.
  41453. *
  41454. * Domain: [-Infinity, Infinity]
  41455. * Range: [-pi, pi]
  41456. *
  41457. * y {number|string|Decimal} The y-coordinate.
  41458. * x {number|string|Decimal} The x-coordinate.
  41459. *
  41460. * atan2(±0, -0) = ±pi
  41461. * atan2(±0, +0) = ±0
  41462. * atan2(±0, -x) = ±pi for x > 0
  41463. * atan2(±0, x) = ±0 for x > 0
  41464. * atan2(-y, ±0) = -pi/2 for y > 0
  41465. * atan2(y, ±0) = pi/2 for y > 0
  41466. * atan2(±y, -Infinity) = ±pi for finite y > 0
  41467. * atan2(±y, +Infinity) = ±0 for finite y > 0
  41468. * atan2(±Infinity, x) = ±pi/2 for finite x
  41469. * atan2(±Infinity, -Infinity) = ±3*pi/4
  41470. * atan2(±Infinity, +Infinity) = ±pi/4
  41471. * atan2(NaN, x) = NaN
  41472. * atan2(y, NaN) = NaN
  41473. *
  41474. */
  41475. function atan2(y, x) {
  41476. y = new this(y);
  41477. x = new this(x);
  41478. var r,
  41479. pr = this.precision,
  41480. rm = this.rounding,
  41481. wpr = pr + 4;
  41482. // Either NaN
  41483. if (!y.s || !x.s) {
  41484. r = new this(NaN);
  41485. // Both ±Infinity
  41486. } else if (!y.d && !x.d) {
  41487. r = getPi(this, wpr, 1).times(x.s > 0 ? 0.25 : 0.75);
  41488. r.s = y.s;
  41489. // x is ±Infinity or y is ±0
  41490. } else if (!x.d || y.isZero()) {
  41491. r = x.s < 0 ? getPi(this, pr, rm) : new this(0);
  41492. r.s = y.s;
  41493. // y is ±Infinity or x is ±0
  41494. } else if (!y.d || x.isZero()) {
  41495. r = getPi(this, wpr, 1).times(0.5);
  41496. r.s = y.s;
  41497. // Both non-zero and finite
  41498. } else if (x.s < 0) {
  41499. this.precision = wpr;
  41500. this.rounding = 1;
  41501. r = this.atan(divide(y, x, wpr, 1));
  41502. x = getPi(this, wpr, 1);
  41503. this.precision = pr;
  41504. this.rounding = rm;
  41505. r = y.s < 0 ? r.minus(x) : r.plus(x);
  41506. } else {
  41507. r = this.atan(divide(y, x, wpr, 1));
  41508. }
  41509. return r;
  41510. }
  41511. /*
  41512. * Return a new Decimal whose value is the cube root of `x`, rounded to `precision` significant
  41513. * digits using rounding mode `rounding`.
  41514. *
  41515. * x {number|string|Decimal}
  41516. *
  41517. */
  41518. function cbrt(x) {
  41519. return new this(x).cbrt();
  41520. }
  41521. /*
  41522. * Return a new Decimal whose value is `x` rounded to an integer using `ROUND_CEIL`.
  41523. *
  41524. * x {number|string|Decimal}
  41525. *
  41526. */
  41527. function ceil(x) {
  41528. return finalise(x = new this(x), x.e + 1, 2);
  41529. }
  41530. /*
  41531. * Configure global settings for a Decimal constructor.
  41532. *
  41533. * `obj` is an object with one or more of the following properties,
  41534. *
  41535. * precision {number}
  41536. * rounding {number}
  41537. * toExpNeg {number}
  41538. * toExpPos {number}
  41539. * maxE {number}
  41540. * minE {number}
  41541. * modulo {number}
  41542. * crypto {boolean|number}
  41543. * defaults {true}
  41544. *
  41545. * E.g. Decimal.config({ precision: 20, rounding: 4 })
  41546. *
  41547. */
  41548. function config(obj) {
  41549. if (!obj || typeof obj !== 'object') throw Error(decimalError + 'Object expected');
  41550. var i, p, v,
  41551. useDefaults = obj.defaults === true,
  41552. ps = [
  41553. 'precision', 1, MAX_DIGITS,
  41554. 'rounding', 0, 8,
  41555. 'toExpNeg', -EXP_LIMIT, 0,
  41556. 'toExpPos', 0, EXP_LIMIT,
  41557. 'maxE', 0, EXP_LIMIT,
  41558. 'minE', -EXP_LIMIT, 0,
  41559. 'modulo', 0, 9
  41560. ];
  41561. for (i = 0; i < ps.length; i += 3) {
  41562. if (p = ps[i], useDefaults) this[p] = DEFAULTS[p];
  41563. if ((v = obj[p]) !== void 0) {
  41564. if (mathfloor(v) === v && v >= ps[i + 1] && v <= ps[i + 2]) this[p] = v;
  41565. else throw Error(invalidArgument + p + ': ' + v);
  41566. }
  41567. }
  41568. if (p = 'crypto', useDefaults) this[p] = DEFAULTS[p];
  41569. if ((v = obj[p]) !== void 0) {
  41570. if (v === true || v === false || v === 0 || v === 1) {
  41571. if (v) {
  41572. if (typeof crypto != 'undefined' && crypto &&
  41573. (crypto.getRandomValues || crypto.randomBytes)) {
  41574. this[p] = true;
  41575. } else {
  41576. throw Error(cryptoUnavailable);
  41577. }
  41578. } else {
  41579. this[p] = false;
  41580. }
  41581. } else {
  41582. throw Error(invalidArgument + p + ': ' + v);
  41583. }
  41584. }
  41585. return this;
  41586. }
  41587. /*
  41588. * Return a new Decimal whose value is the cosine of `x`, rounded to `precision` significant
  41589. * digits using rounding mode `rounding`.
  41590. *
  41591. * x {number|string|Decimal} A value in radians.
  41592. *
  41593. */
  41594. function cos(x) {
  41595. return new this(x).cos();
  41596. }
  41597. /*
  41598. * Return a new Decimal whose value is the hyperbolic cosine of `x`, rounded to precision
  41599. * significant digits using rounding mode `rounding`.
  41600. *
  41601. * x {number|string|Decimal} A value in radians.
  41602. *
  41603. */
  41604. function cosh(x) {
  41605. return new this(x).cosh();
  41606. }
  41607. /*
  41608. * Create and return a Decimal constructor with the same configuration properties as this Decimal
  41609. * constructor.
  41610. *
  41611. */
  41612. function clone(obj) {
  41613. var i, p, ps;
  41614. /*
  41615. * The Decimal constructor and exported function.
  41616. * Return a new Decimal instance.
  41617. *
  41618. * v {number|string|Decimal} A numeric value.
  41619. *
  41620. */
  41621. function Decimal(v) {
  41622. var e, i, t,
  41623. x = this;
  41624. // Decimal called without new.
  41625. if (!(x instanceof Decimal)) return new Decimal(v);
  41626. // Retain a reference to this Decimal constructor, and shadow Decimal.prototype.constructor
  41627. // which points to Object.
  41628. x.constructor = Decimal;
  41629. // Duplicate.
  41630. if (v instanceof Decimal) {
  41631. x.s = v.s;
  41632. x.e = v.e;
  41633. x.d = (v = v.d) ? v.slice() : v;
  41634. return;
  41635. }
  41636. t = typeof v;
  41637. if (t === 'number') {
  41638. if (v === 0) {
  41639. x.s = 1 / v < 0 ? -1 : 1;
  41640. x.e = 0;
  41641. x.d = [0];
  41642. return;
  41643. }
  41644. if (v < 0) {
  41645. v = -v;
  41646. x.s = -1;
  41647. } else {
  41648. x.s = 1;
  41649. }
  41650. // Fast path for small integers.
  41651. if (v === ~~v && v < 1e7) {
  41652. for (e = 0, i = v; i >= 10; i /= 10) e++;
  41653. x.e = e;
  41654. x.d = [v];
  41655. return;
  41656. // Infinity, NaN.
  41657. } else if (v * 0 !== 0) {
  41658. if (!v) x.s = NaN;
  41659. x.e = NaN;
  41660. x.d = null;
  41661. return;
  41662. }
  41663. return parseDecimal(x, v.toString());
  41664. } else if (t !== 'string') {
  41665. throw Error(invalidArgument + v);
  41666. }
  41667. // Minus sign?
  41668. if (v.charCodeAt(0) === 45) {
  41669. v = v.slice(1);
  41670. x.s = -1;
  41671. } else {
  41672. x.s = 1;
  41673. }
  41674. return isDecimal.test(v) ? parseDecimal(x, v) : parseOther(x, v);
  41675. }
  41676. Decimal.prototype = P;
  41677. Decimal.ROUND_UP = 0;
  41678. Decimal.ROUND_DOWN = 1;
  41679. Decimal.ROUND_CEIL = 2;
  41680. Decimal.ROUND_FLOOR = 3;
  41681. Decimal.ROUND_HALF_UP = 4;
  41682. Decimal.ROUND_HALF_DOWN = 5;
  41683. Decimal.ROUND_HALF_EVEN = 6;
  41684. Decimal.ROUND_HALF_CEIL = 7;
  41685. Decimal.ROUND_HALF_FLOOR = 8;
  41686. Decimal.EUCLID = 9;
  41687. Decimal.config = Decimal.set = config;
  41688. Decimal.clone = clone;
  41689. Decimal.isDecimal = isDecimalInstance;
  41690. Decimal.abs = abs;
  41691. Decimal.acos = acos;
  41692. Decimal.acosh = acosh; // ES6
  41693. Decimal.add = add;
  41694. Decimal.asin = asin;
  41695. Decimal.asinh = asinh; // ES6
  41696. Decimal.atan = atan;
  41697. Decimal.atanh = atanh; // ES6
  41698. Decimal.atan2 = atan2;
  41699. Decimal.cbrt = cbrt; // ES6
  41700. Decimal.ceil = ceil;
  41701. Decimal.cos = cos;
  41702. Decimal.cosh = cosh; // ES6
  41703. Decimal.div = div;
  41704. Decimal.exp = exp;
  41705. Decimal.floor = floor;
  41706. Decimal.hypot = hypot; // ES6
  41707. Decimal.ln = ln;
  41708. Decimal.log = log;
  41709. Decimal.log10 = log10; // ES6
  41710. Decimal.log2 = log2; // ES6
  41711. Decimal.max = max;
  41712. Decimal.min = min;
  41713. Decimal.mod = mod;
  41714. Decimal.mul = mul;
  41715. Decimal.pow = pow;
  41716. Decimal.random = random;
  41717. Decimal.round = round;
  41718. Decimal.sign = sign; // ES6
  41719. Decimal.sin = sin;
  41720. Decimal.sinh = sinh; // ES6
  41721. Decimal.sqrt = sqrt;
  41722. Decimal.sub = sub;
  41723. Decimal.tan = tan;
  41724. Decimal.tanh = tanh; // ES6
  41725. Decimal.trunc = trunc; // ES6
  41726. if (obj === void 0) obj = {};
  41727. if (obj) {
  41728. if (obj.defaults !== true) {
  41729. ps = ['precision', 'rounding', 'toExpNeg', 'toExpPos', 'maxE', 'minE', 'modulo', 'crypto'];
  41730. for (i = 0; i < ps.length;) if (!obj.hasOwnProperty(p = ps[i++])) obj[p] = this[p];
  41731. }
  41732. }
  41733. Decimal.config(obj);
  41734. return Decimal;
  41735. }
  41736. /*
  41737. * Return a new Decimal whose value is `x` divided by `y`, rounded to `precision` significant
  41738. * digits using rounding mode `rounding`.
  41739. *
  41740. * x {number|string|Decimal}
  41741. * y {number|string|Decimal}
  41742. *
  41743. */
  41744. function div(x, y) {
  41745. return new this(x).div(y);
  41746. }
  41747. /*
  41748. * Return a new Decimal whose value is the natural exponential of `x`, rounded to `precision`
  41749. * significant digits using rounding mode `rounding`.
  41750. *
  41751. * x {number|string|Decimal} The power to which to raise the base of the natural log.
  41752. *
  41753. */
  41754. function exp(x) {
  41755. return new this(x).exp();
  41756. }
  41757. /*
  41758. * Return a new Decimal whose value is `x` round to an integer using `ROUND_FLOOR`.
  41759. *
  41760. * x {number|string|Decimal}
  41761. *
  41762. */
  41763. function floor(x) {
  41764. return finalise(x = new this(x), x.e + 1, 3);
  41765. }
  41766. /*
  41767. * Return a new Decimal whose value is the square root of the sum of the squares of the arguments,
  41768. * rounded to `precision` significant digits using rounding mode `rounding`.
  41769. *
  41770. * hypot(a, b, ...) = sqrt(a^2 + b^2 + ...)
  41771. *
  41772. */
  41773. function hypot() {
  41774. var i, n,
  41775. t = new this(0);
  41776. external = false;
  41777. for (i = 0; i < arguments.length;) {
  41778. n = new this(arguments[i++]);
  41779. if (!n.d) {
  41780. if (n.s) {
  41781. external = true;
  41782. return new this(1 / 0);
  41783. }
  41784. t = n;
  41785. } else if (t.d) {
  41786. t = t.plus(n.times(n));
  41787. }
  41788. }
  41789. external = true;
  41790. return t.sqrt();
  41791. }
  41792. /*
  41793. * Return true if object is a Decimal instance (where Decimal is any Decimal constructor),
  41794. * otherwise return false.
  41795. *
  41796. */
  41797. function isDecimalInstance(obj) {
  41798. return obj instanceof Decimal || obj && obj.name === '[object Decimal]' || false;
  41799. }
  41800. /*
  41801. * Return a new Decimal whose value is the natural logarithm of `x`, rounded to `precision`
  41802. * significant digits using rounding mode `rounding`.
  41803. *
  41804. * x {number|string|Decimal}
  41805. *
  41806. */
  41807. function ln(x) {
  41808. return new this(x).ln();
  41809. }
  41810. /*
  41811. * Return a new Decimal whose value is the log of `x` to the base `y`, or to base 10 if no base
  41812. * is specified, rounded to `precision` significant digits using rounding mode `rounding`.
  41813. *
  41814. * log[y](x)
  41815. *
  41816. * x {number|string|Decimal} The argument of the logarithm.
  41817. * y {number|string|Decimal} The base of the logarithm.
  41818. *
  41819. */
  41820. function log(x, y) {
  41821. return new this(x).log(y);
  41822. }
  41823. /*
  41824. * Return a new Decimal whose value is the base 2 logarithm of `x`, rounded to `precision`
  41825. * significant digits using rounding mode `rounding`.
  41826. *
  41827. * x {number|string|Decimal}
  41828. *
  41829. */
  41830. function log2(x) {
  41831. return new this(x).log(2);
  41832. }
  41833. /*
  41834. * Return a new Decimal whose value is the base 10 logarithm of `x`, rounded to `precision`
  41835. * significant digits using rounding mode `rounding`.
  41836. *
  41837. * x {number|string|Decimal}
  41838. *
  41839. */
  41840. function log10(x) {
  41841. return new this(x).log(10);
  41842. }
  41843. /*
  41844. * Return a new Decimal whose value is the maximum of the arguments.
  41845. *
  41846. * arguments {number|string|Decimal}
  41847. *
  41848. */
  41849. function max() {
  41850. return maxOrMin(this, arguments, 'lt');
  41851. }
  41852. /*
  41853. * Return a new Decimal whose value is the minimum of the arguments.
  41854. *
  41855. * arguments {number|string|Decimal}
  41856. *
  41857. */
  41858. function min() {
  41859. return maxOrMin(this, arguments, 'gt');
  41860. }
  41861. /*
  41862. * Return a new Decimal whose value is `x` modulo `y`, rounded to `precision` significant digits
  41863. * using rounding mode `rounding`.
  41864. *
  41865. * x {number|string|Decimal}
  41866. * y {number|string|Decimal}
  41867. *
  41868. */
  41869. function mod(x, y) {
  41870. return new this(x).mod(y);
  41871. }
  41872. /*
  41873. * Return a new Decimal whose value is `x` multiplied by `y`, rounded to `precision` significant
  41874. * digits using rounding mode `rounding`.
  41875. *
  41876. * x {number|string|Decimal}
  41877. * y {number|string|Decimal}
  41878. *
  41879. */
  41880. function mul(x, y) {
  41881. return new this(x).mul(y);
  41882. }
  41883. /*
  41884. * Return a new Decimal whose value is `x` raised to the power `y`, rounded to precision
  41885. * significant digits using rounding mode `rounding`.
  41886. *
  41887. * x {number|string|Decimal} The base.
  41888. * y {number|string|Decimal} The exponent.
  41889. *
  41890. */
  41891. function pow(x, y) {
  41892. return new this(x).pow(y);
  41893. }
  41894. /*
  41895. * Returns a new Decimal with a random value equal to or greater than 0 and less than 1, and with
  41896. * `sd`, or `Decimal.precision` if `sd` is omitted, significant digits (or less if trailing zeros
  41897. * are produced).
  41898. *
  41899. * [sd] {number} Significant digits. Integer, 0 to MAX_DIGITS inclusive.
  41900. *
  41901. */
  41902. function random(sd) {
  41903. var d, e, k, n,
  41904. i = 0,
  41905. r = new this(1),
  41906. rd = [];
  41907. if (sd === void 0) sd = this.precision;
  41908. else checkInt32(sd, 1, MAX_DIGITS);
  41909. k = Math.ceil(sd / LOG_BASE);
  41910. if (!this.crypto) {
  41911. for (; i < k;) rd[i++] = Math.random() * 1e7 | 0;
  41912. // Browsers supporting crypto.getRandomValues.
  41913. } else if (crypto.getRandomValues) {
  41914. d = crypto.getRandomValues(new Uint32Array(k));
  41915. for (; i < k;) {
  41916. n = d[i];
  41917. // 0 <= n < 4294967296
  41918. // Probability n >= 4.29e9, is 4967296 / 4294967296 = 0.00116 (1 in 865).
  41919. if (n >= 4.29e9) {
  41920. d[i] = crypto.getRandomValues(new Uint32Array(1))[0];
  41921. } else {
  41922. // 0 <= n <= 4289999999
  41923. // 0 <= (n % 1e7) <= 9999999
  41924. rd[i++] = n % 1e7;
  41925. }
  41926. }
  41927. // Node.js supporting crypto.randomBytes.
  41928. } else if (crypto.randomBytes) {
  41929. // buffer
  41930. d = crypto.randomBytes(k *= 4);
  41931. for (; i < k;) {
  41932. // 0 <= n < 2147483648
  41933. n = d[i] + (d[i + 1] << 8) + (d[i + 2] << 16) + ((d[i + 3] & 0x7f) << 24);
  41934. // Probability n >= 2.14e9, is 7483648 / 2147483648 = 0.0035 (1 in 286).
  41935. if (n >= 2.14e9) {
  41936. crypto.randomBytes(4).copy(d, i);
  41937. } else {
  41938. // 0 <= n <= 2139999999
  41939. // 0 <= (n % 1e7) <= 9999999
  41940. rd.push(n % 1e7);
  41941. i += 4;
  41942. }
  41943. }
  41944. i = k / 4;
  41945. } else {
  41946. throw Error(cryptoUnavailable);
  41947. }
  41948. k = rd[--i];
  41949. sd %= LOG_BASE;
  41950. // Convert trailing digits to zeros according to sd.
  41951. if (k && sd) {
  41952. n = mathpow(10, LOG_BASE - sd);
  41953. rd[i] = (k / n | 0) * n;
  41954. }
  41955. // Remove trailing words which are zero.
  41956. for (; rd[i] === 0; i--) rd.pop();
  41957. // Zero?
  41958. if (i < 0) {
  41959. e = 0;
  41960. rd = [0];
  41961. } else {
  41962. e = -1;
  41963. // Remove leading words which are zero and adjust exponent accordingly.
  41964. for (; rd[0] === 0; e -= LOG_BASE) rd.shift();
  41965. // Count the digits of the first word of rd to determine leading zeros.
  41966. for (k = 1, n = rd[0]; n >= 10; n /= 10) k++;
  41967. // Adjust the exponent for leading zeros of the first word of rd.
  41968. if (k < LOG_BASE) e -= LOG_BASE - k;
  41969. }
  41970. r.e = e;
  41971. r.d = rd;
  41972. return r;
  41973. }
  41974. /*
  41975. * Return a new Decimal whose value is `x` rounded to an integer using rounding mode `rounding`.
  41976. *
  41977. * To emulate `Math.round`, set rounding to 7 (ROUND_HALF_CEIL).
  41978. *
  41979. * x {number|string|Decimal}
  41980. *
  41981. */
  41982. function round(x) {
  41983. return finalise(x = new this(x), x.e + 1, this.rounding);
  41984. }
  41985. /*
  41986. * Return
  41987. * 1 if x > 0,
  41988. * -1 if x < 0,
  41989. * 0 if x is 0,
  41990. * -0 if x is -0,
  41991. * NaN otherwise
  41992. *
  41993. */
  41994. function sign(x) {
  41995. x = new this(x);
  41996. return x.d ? (x.d[0] ? x.s : 0 * x.s) : x.s || NaN;
  41997. }
  41998. /*
  41999. * Return a new Decimal whose value is the sine of `x`, rounded to `precision` significant digits
  42000. * using rounding mode `rounding`.
  42001. *
  42002. * x {number|string|Decimal} A value in radians.
  42003. *
  42004. */
  42005. function sin(x) {
  42006. return new this(x).sin();
  42007. }
  42008. /*
  42009. * Return a new Decimal whose value is the hyperbolic sine of `x`, rounded to `precision`
  42010. * significant digits using rounding mode `rounding`.
  42011. *
  42012. * x {number|string|Decimal} A value in radians.
  42013. *
  42014. */
  42015. function sinh(x) {
  42016. return new this(x).sinh();
  42017. }
  42018. /*
  42019. * Return a new Decimal whose value is the square root of `x`, rounded to `precision` significant
  42020. * digits using rounding mode `rounding`.
  42021. *
  42022. * x {number|string|Decimal}
  42023. *
  42024. */
  42025. function sqrt(x) {
  42026. return new this(x).sqrt();
  42027. }
  42028. /*
  42029. * Return a new Decimal whose value is `x` minus `y`, rounded to `precision` significant digits
  42030. * using rounding mode `rounding`.
  42031. *
  42032. * x {number|string|Decimal}
  42033. * y {number|string|Decimal}
  42034. *
  42035. */
  42036. function sub(x, y) {
  42037. return new this(x).sub(y);
  42038. }
  42039. /*
  42040. * Return a new Decimal whose value is the tangent of `x`, rounded to `precision` significant
  42041. * digits using rounding mode `rounding`.
  42042. *
  42043. * x {number|string|Decimal} A value in radians.
  42044. *
  42045. */
  42046. function tan(x) {
  42047. return new this(x).tan();
  42048. }
  42049. /*
  42050. * Return a new Decimal whose value is the hyperbolic tangent of `x`, rounded to `precision`
  42051. * significant digits using rounding mode `rounding`.
  42052. *
  42053. * x {number|string|Decimal} A value in radians.
  42054. *
  42055. */
  42056. function tanh(x) {
  42057. return new this(x).tanh();
  42058. }
  42059. /*
  42060. * Return a new Decimal whose value is `x` truncated to an integer.
  42061. *
  42062. * x {number|string|Decimal}
  42063. *
  42064. */
  42065. function trunc(x) {
  42066. return finalise(x = new this(x), x.e + 1, 1);
  42067. }
  42068. // Create and configure initial Decimal constructor.
  42069. Decimal = clone(DEFAULTS);
  42070. Decimal['default'] = Decimal.Decimal = Decimal;
  42071. // Create the internal constants from their string values.
  42072. LN10 = new Decimal(LN10);
  42073. PI = new Decimal(PI);
  42074. // Export.
  42075. // AMD.
  42076. if (true) {
  42077. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function () {
  42078. return Decimal;
  42079. }).call(exports, __webpack_require__, exports, module),
  42080. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  42081. // Node and other environments that support module.exports.
  42082. } else {}
  42083. })(this);
  42084. /***/ }),
  42085. /***/ "./node_modules/jquery/dist/jquery.js":
  42086. /*!********************************************!*\
  42087. !*** ./node_modules/jquery/dist/jquery.js ***!
  42088. \********************************************/
  42089. /*! no static exports found */
  42090. /***/ (function(module, exports, __webpack_require__) {
  42091. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  42092. * jQuery JavaScript Library v3.3.1
  42093. * https://jquery.com/
  42094. *
  42095. * Includes Sizzle.js
  42096. * https://sizzlejs.com/
  42097. *
  42098. * Copyright JS Foundation and other contributors
  42099. * Released under the MIT license
  42100. * https://jquery.org/license
  42101. *
  42102. * Date: 2018-01-20T17:24Z
  42103. */
  42104. ( function( global, factory ) {
  42105. "use strict";
  42106. if ( true && typeof module.exports === "object" ) {
  42107. // For CommonJS and CommonJS-like environments where a proper `window`
  42108. // is present, execute the factory and get jQuery.
  42109. // For environments that do not have a `window` with a `document`
  42110. // (such as Node.js), expose a factory as module.exports.
  42111. // This accentuates the need for the creation of a real `window`.
  42112. // e.g. var jQuery = require("jquery")(window);
  42113. // See ticket #14549 for more info.
  42114. module.exports = global.document ?
  42115. factory( global, true ) :
  42116. function( w ) {
  42117. if ( !w.document ) {
  42118. throw new Error( "jQuery requires a window with a document" );
  42119. }
  42120. return factory( w );
  42121. };
  42122. } else {
  42123. factory( global );
  42124. }
  42125. // Pass this if window is not defined yet
  42126. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  42127. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  42128. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  42129. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  42130. // enough that all such attempts are guarded in a try block.
  42131. "use strict";
  42132. var arr = [];
  42133. var document = window.document;
  42134. var getProto = Object.getPrototypeOf;
  42135. var slice = arr.slice;
  42136. var concat = arr.concat;
  42137. var push = arr.push;
  42138. var indexOf = arr.indexOf;
  42139. var class2type = {};
  42140. var toString = class2type.toString;
  42141. var hasOwn = class2type.hasOwnProperty;
  42142. var fnToString = hasOwn.toString;
  42143. var ObjectFunctionString = fnToString.call( Object );
  42144. var support = {};
  42145. var isFunction = function isFunction( obj ) {
  42146. // Support: Chrome <=57, Firefox <=52
  42147. // In some browsers, typeof returns "function" for HTML <object> elements
  42148. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  42149. // We don't want to classify *any* DOM node as a function.
  42150. return typeof obj === "function" && typeof obj.nodeType !== "number";
  42151. };
  42152. var isWindow = function isWindow( obj ) {
  42153. return obj != null && obj === obj.window;
  42154. };
  42155. var preservedScriptAttributes = {
  42156. type: true,
  42157. src: true,
  42158. noModule: true
  42159. };
  42160. function DOMEval( code, doc, node ) {
  42161. doc = doc || document;
  42162. var i,
  42163. script = doc.createElement( "script" );
  42164. script.text = code;
  42165. if ( node ) {
  42166. for ( i in preservedScriptAttributes ) {
  42167. if ( node[ i ] ) {
  42168. script[ i ] = node[ i ];
  42169. }
  42170. }
  42171. }
  42172. doc.head.appendChild( script ).parentNode.removeChild( script );
  42173. }
  42174. function toType( obj ) {
  42175. if ( obj == null ) {
  42176. return obj + "";
  42177. }
  42178. // Support: Android <=2.3 only (functionish RegExp)
  42179. return typeof obj === "object" || typeof obj === "function" ?
  42180. class2type[ toString.call( obj ) ] || "object" :
  42181. typeof obj;
  42182. }
  42183. /* global Symbol */
  42184. // Defining this global in .eslintrc.json would create a danger of using the global
  42185. // unguarded in another place, it seems safer to define global only for this module
  42186. var
  42187. version = "3.3.1",
  42188. // Define a local copy of jQuery
  42189. jQuery = function( selector, context ) {
  42190. // The jQuery object is actually just the init constructor 'enhanced'
  42191. // Need init if jQuery is called (just allow error to be thrown if not included)
  42192. return new jQuery.fn.init( selector, context );
  42193. },
  42194. // Support: Android <=4.0 only
  42195. // Make sure we trim BOM and NBSP
  42196. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  42197. jQuery.fn = jQuery.prototype = {
  42198. // The current version of jQuery being used
  42199. jquery: version,
  42200. constructor: jQuery,
  42201. // The default length of a jQuery object is 0
  42202. length: 0,
  42203. toArray: function() {
  42204. return slice.call( this );
  42205. },
  42206. // Get the Nth element in the matched element set OR
  42207. // Get the whole matched element set as a clean array
  42208. get: function( num ) {
  42209. // Return all the elements in a clean array
  42210. if ( num == null ) {
  42211. return slice.call( this );
  42212. }
  42213. // Return just the one element from the set
  42214. return num < 0 ? this[ num + this.length ] : this[ num ];
  42215. },
  42216. // Take an array of elements and push it onto the stack
  42217. // (returning the new matched element set)
  42218. pushStack: function( elems ) {
  42219. // Build a new jQuery matched element set
  42220. var ret = jQuery.merge( this.constructor(), elems );
  42221. // Add the old object onto the stack (as a reference)
  42222. ret.prevObject = this;
  42223. // Return the newly-formed element set
  42224. return ret;
  42225. },
  42226. // Execute a callback for every element in the matched set.
  42227. each: function( callback ) {
  42228. return jQuery.each( this, callback );
  42229. },
  42230. map: function( callback ) {
  42231. return this.pushStack( jQuery.map( this, function( elem, i ) {
  42232. return callback.call( elem, i, elem );
  42233. } ) );
  42234. },
  42235. slice: function() {
  42236. return this.pushStack( slice.apply( this, arguments ) );
  42237. },
  42238. first: function() {
  42239. return this.eq( 0 );
  42240. },
  42241. last: function() {
  42242. return this.eq( -1 );
  42243. },
  42244. eq: function( i ) {
  42245. var len = this.length,
  42246. j = +i + ( i < 0 ? len : 0 );
  42247. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  42248. },
  42249. end: function() {
  42250. return this.prevObject || this.constructor();
  42251. },
  42252. // For internal use only.
  42253. // Behaves like an Array's method, not like a jQuery method.
  42254. push: push,
  42255. sort: arr.sort,
  42256. splice: arr.splice
  42257. };
  42258. jQuery.extend = jQuery.fn.extend = function() {
  42259. var options, name, src, copy, copyIsArray, clone,
  42260. target = arguments[ 0 ] || {},
  42261. i = 1,
  42262. length = arguments.length,
  42263. deep = false;
  42264. // Handle a deep copy situation
  42265. if ( typeof target === "boolean" ) {
  42266. deep = target;
  42267. // Skip the boolean and the target
  42268. target = arguments[ i ] || {};
  42269. i++;
  42270. }
  42271. // Handle case when target is a string or something (possible in deep copy)
  42272. if ( typeof target !== "object" && !isFunction( target ) ) {
  42273. target = {};
  42274. }
  42275. // Extend jQuery itself if only one argument is passed
  42276. if ( i === length ) {
  42277. target = this;
  42278. i--;
  42279. }
  42280. for ( ; i < length; i++ ) {
  42281. // Only deal with non-null/undefined values
  42282. if ( ( options = arguments[ i ] ) != null ) {
  42283. // Extend the base object
  42284. for ( name in options ) {
  42285. src = target[ name ];
  42286. copy = options[ name ];
  42287. // Prevent never-ending loop
  42288. if ( target === copy ) {
  42289. continue;
  42290. }
  42291. // Recurse if we're merging plain objects or arrays
  42292. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  42293. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  42294. if ( copyIsArray ) {
  42295. copyIsArray = false;
  42296. clone = src && Array.isArray( src ) ? src : [];
  42297. } else {
  42298. clone = src && jQuery.isPlainObject( src ) ? src : {};
  42299. }
  42300. // Never move original objects, clone them
  42301. target[ name ] = jQuery.extend( deep, clone, copy );
  42302. // Don't bring in undefined values
  42303. } else if ( copy !== undefined ) {
  42304. target[ name ] = copy;
  42305. }
  42306. }
  42307. }
  42308. }
  42309. // Return the modified object
  42310. return target;
  42311. };
  42312. jQuery.extend( {
  42313. // Unique for each copy of jQuery on the page
  42314. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  42315. // Assume jQuery is ready without the ready module
  42316. isReady: true,
  42317. error: function( msg ) {
  42318. throw new Error( msg );
  42319. },
  42320. noop: function() {},
  42321. isPlainObject: function( obj ) {
  42322. var proto, Ctor;
  42323. // Detect obvious negatives
  42324. // Use toString instead of jQuery.type to catch host objects
  42325. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  42326. return false;
  42327. }
  42328. proto = getProto( obj );
  42329. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  42330. if ( !proto ) {
  42331. return true;
  42332. }
  42333. // Objects with prototype are plain iff they were constructed by a global Object function
  42334. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  42335. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  42336. },
  42337. isEmptyObject: function( obj ) {
  42338. /* eslint-disable no-unused-vars */
  42339. // See https://github.com/eslint/eslint/issues/6125
  42340. var name;
  42341. for ( name in obj ) {
  42342. return false;
  42343. }
  42344. return true;
  42345. },
  42346. // Evaluates a script in a global context
  42347. globalEval: function( code ) {
  42348. DOMEval( code );
  42349. },
  42350. each: function( obj, callback ) {
  42351. var length, i = 0;
  42352. if ( isArrayLike( obj ) ) {
  42353. length = obj.length;
  42354. for ( ; i < length; i++ ) {
  42355. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  42356. break;
  42357. }
  42358. }
  42359. } else {
  42360. for ( i in obj ) {
  42361. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  42362. break;
  42363. }
  42364. }
  42365. }
  42366. return obj;
  42367. },
  42368. // Support: Android <=4.0 only
  42369. trim: function( text ) {
  42370. return text == null ?
  42371. "" :
  42372. ( text + "" ).replace( rtrim, "" );
  42373. },
  42374. // results is for internal usage only
  42375. makeArray: function( arr, results ) {
  42376. var ret = results || [];
  42377. if ( arr != null ) {
  42378. if ( isArrayLike( Object( arr ) ) ) {
  42379. jQuery.merge( ret,
  42380. typeof arr === "string" ?
  42381. [ arr ] : arr
  42382. );
  42383. } else {
  42384. push.call( ret, arr );
  42385. }
  42386. }
  42387. return ret;
  42388. },
  42389. inArray: function( elem, arr, i ) {
  42390. return arr == null ? -1 : indexOf.call( arr, elem, i );
  42391. },
  42392. // Support: Android <=4.0 only, PhantomJS 1 only
  42393. // push.apply(_, arraylike) throws on ancient WebKit
  42394. merge: function( first, second ) {
  42395. var len = +second.length,
  42396. j = 0,
  42397. i = first.length;
  42398. for ( ; j < len; j++ ) {
  42399. first[ i++ ] = second[ j ];
  42400. }
  42401. first.length = i;
  42402. return first;
  42403. },
  42404. grep: function( elems, callback, invert ) {
  42405. var callbackInverse,
  42406. matches = [],
  42407. i = 0,
  42408. length = elems.length,
  42409. callbackExpect = !invert;
  42410. // Go through the array, only saving the items
  42411. // that pass the validator function
  42412. for ( ; i < length; i++ ) {
  42413. callbackInverse = !callback( elems[ i ], i );
  42414. if ( callbackInverse !== callbackExpect ) {
  42415. matches.push( elems[ i ] );
  42416. }
  42417. }
  42418. return matches;
  42419. },
  42420. // arg is for internal usage only
  42421. map: function( elems, callback, arg ) {
  42422. var length, value,
  42423. i = 0,
  42424. ret = [];
  42425. // Go through the array, translating each of the items to their new values
  42426. if ( isArrayLike( elems ) ) {
  42427. length = elems.length;
  42428. for ( ; i < length; i++ ) {
  42429. value = callback( elems[ i ], i, arg );
  42430. if ( value != null ) {
  42431. ret.push( value );
  42432. }
  42433. }
  42434. // Go through every key on the object,
  42435. } else {
  42436. for ( i in elems ) {
  42437. value = callback( elems[ i ], i, arg );
  42438. if ( value != null ) {
  42439. ret.push( value );
  42440. }
  42441. }
  42442. }
  42443. // Flatten any nested arrays
  42444. return concat.apply( [], ret );
  42445. },
  42446. // A global GUID counter for objects
  42447. guid: 1,
  42448. // jQuery.support is not used in Core but other projects attach their
  42449. // properties to it so it needs to exist.
  42450. support: support
  42451. } );
  42452. if ( typeof Symbol === "function" ) {
  42453. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  42454. }
  42455. // Populate the class2type map
  42456. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  42457. function( i, name ) {
  42458. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  42459. } );
  42460. function isArrayLike( obj ) {
  42461. // Support: real iOS 8.2 only (not reproducible in simulator)
  42462. // `in` check used to prevent JIT error (gh-2145)
  42463. // hasOwn isn't used here due to false negatives
  42464. // regarding Nodelist length in IE
  42465. var length = !!obj && "length" in obj && obj.length,
  42466. type = toType( obj );
  42467. if ( isFunction( obj ) || isWindow( obj ) ) {
  42468. return false;
  42469. }
  42470. return type === "array" || length === 0 ||
  42471. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  42472. }
  42473. var Sizzle =
  42474. /*!
  42475. * Sizzle CSS Selector Engine v2.3.3
  42476. * https://sizzlejs.com/
  42477. *
  42478. * Copyright jQuery Foundation and other contributors
  42479. * Released under the MIT license
  42480. * http://jquery.org/license
  42481. *
  42482. * Date: 2016-08-08
  42483. */
  42484. (function( window ) {
  42485. var i,
  42486. support,
  42487. Expr,
  42488. getText,
  42489. isXML,
  42490. tokenize,
  42491. compile,
  42492. select,
  42493. outermostContext,
  42494. sortInput,
  42495. hasDuplicate,
  42496. // Local document vars
  42497. setDocument,
  42498. document,
  42499. docElem,
  42500. documentIsHTML,
  42501. rbuggyQSA,
  42502. rbuggyMatches,
  42503. matches,
  42504. contains,
  42505. // Instance-specific data
  42506. expando = "sizzle" + 1 * new Date(),
  42507. preferredDoc = window.document,
  42508. dirruns = 0,
  42509. done = 0,
  42510. classCache = createCache(),
  42511. tokenCache = createCache(),
  42512. compilerCache = createCache(),
  42513. sortOrder = function( a, b ) {
  42514. if ( a === b ) {
  42515. hasDuplicate = true;
  42516. }
  42517. return 0;
  42518. },
  42519. // Instance methods
  42520. hasOwn = ({}).hasOwnProperty,
  42521. arr = [],
  42522. pop = arr.pop,
  42523. push_native = arr.push,
  42524. push = arr.push,
  42525. slice = arr.slice,
  42526. // Use a stripped-down indexOf as it's faster than native
  42527. // https://jsperf.com/thor-indexof-vs-for/5
  42528. indexOf = function( list, elem ) {
  42529. var i = 0,
  42530. len = list.length;
  42531. for ( ; i < len; i++ ) {
  42532. if ( list[i] === elem ) {
  42533. return i;
  42534. }
  42535. }
  42536. return -1;
  42537. },
  42538. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  42539. // Regular expressions
  42540. // http://www.w3.org/TR/css3-selectors/#whitespace
  42541. whitespace = "[\\x20\\t\\r\\n\\f]",
  42542. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  42543. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  42544. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  42545. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  42546. // Operator (capture 2)
  42547. "*([*^$|!~]?=)" + whitespace +
  42548. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  42549. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  42550. "*\\]",
  42551. pseudos = ":(" + identifier + ")(?:\\((" +
  42552. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  42553. // 1. quoted (capture 3; capture 4 or capture 5)
  42554. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  42555. // 2. simple (capture 6)
  42556. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  42557. // 3. anything else (capture 2)
  42558. ".*" +
  42559. ")\\)|)",
  42560. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  42561. rwhitespace = new RegExp( whitespace + "+", "g" ),
  42562. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  42563. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  42564. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  42565. rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
  42566. rpseudo = new RegExp( pseudos ),
  42567. ridentifier = new RegExp( "^" + identifier + "$" ),
  42568. matchExpr = {
  42569. "ID": new RegExp( "^#(" + identifier + ")" ),
  42570. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  42571. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  42572. "ATTR": new RegExp( "^" + attributes ),
  42573. "PSEUDO": new RegExp( "^" + pseudos ),
  42574. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  42575. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  42576. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  42577. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  42578. // For use in libraries implementing .is()
  42579. // We use this for POS matching in `select`
  42580. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  42581. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  42582. },
  42583. rinputs = /^(?:input|select|textarea|button)$/i,
  42584. rheader = /^h\d$/i,
  42585. rnative = /^[^{]+\{\s*\[native \w/,
  42586. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  42587. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  42588. rsibling = /[+~]/,
  42589. // CSS escapes
  42590. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  42591. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  42592. funescape = function( _, escaped, escapedWhitespace ) {
  42593. var high = "0x" + escaped - 0x10000;
  42594. // NaN means non-codepoint
  42595. // Support: Firefox<24
  42596. // Workaround erroneous numeric interpretation of +"0x"
  42597. return high !== high || escapedWhitespace ?
  42598. escaped :
  42599. high < 0 ?
  42600. // BMP codepoint
  42601. String.fromCharCode( high + 0x10000 ) :
  42602. // Supplemental Plane codepoint (surrogate pair)
  42603. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  42604. },
  42605. // CSS string/identifier serialization
  42606. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  42607. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  42608. fcssescape = function( ch, asCodePoint ) {
  42609. if ( asCodePoint ) {
  42610. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  42611. if ( ch === "\0" ) {
  42612. return "\uFFFD";
  42613. }
  42614. // Control characters and (dependent upon position) numbers get escaped as code points
  42615. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  42616. }
  42617. // Other potentially-special ASCII characters get backslash-escaped
  42618. return "\\" + ch;
  42619. },
  42620. // Used for iframes
  42621. // See setDocument()
  42622. // Removing the function wrapper causes a "Permission Denied"
  42623. // error in IE
  42624. unloadHandler = function() {
  42625. setDocument();
  42626. },
  42627. disabledAncestor = addCombinator(
  42628. function( elem ) {
  42629. return elem.disabled === true && ("form" in elem || "label" in elem);
  42630. },
  42631. { dir: "parentNode", next: "legend" }
  42632. );
  42633. // Optimize for push.apply( _, NodeList )
  42634. try {
  42635. push.apply(
  42636. (arr = slice.call( preferredDoc.childNodes )),
  42637. preferredDoc.childNodes
  42638. );
  42639. // Support: Android<4.0
  42640. // Detect silently failing push.apply
  42641. arr[ preferredDoc.childNodes.length ].nodeType;
  42642. } catch ( e ) {
  42643. push = { apply: arr.length ?
  42644. // Leverage slice if possible
  42645. function( target, els ) {
  42646. push_native.apply( target, slice.call(els) );
  42647. } :
  42648. // Support: IE<9
  42649. // Otherwise append directly
  42650. function( target, els ) {
  42651. var j = target.length,
  42652. i = 0;
  42653. // Can't trust NodeList.length
  42654. while ( (target[j++] = els[i++]) ) {}
  42655. target.length = j - 1;
  42656. }
  42657. };
  42658. }
  42659. function Sizzle( selector, context, results, seed ) {
  42660. var m, i, elem, nid, match, groups, newSelector,
  42661. newContext = context && context.ownerDocument,
  42662. // nodeType defaults to 9, since context defaults to document
  42663. nodeType = context ? context.nodeType : 9;
  42664. results = results || [];
  42665. // Return early from calls with invalid selector or context
  42666. if ( typeof selector !== "string" || !selector ||
  42667. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  42668. return results;
  42669. }
  42670. // Try to shortcut find operations (as opposed to filters) in HTML documents
  42671. if ( !seed ) {
  42672. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  42673. setDocument( context );
  42674. }
  42675. context = context || document;
  42676. if ( documentIsHTML ) {
  42677. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  42678. // (excepting DocumentFragment context, where the methods don't exist)
  42679. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  42680. // ID selector
  42681. if ( (m = match[1]) ) {
  42682. // Document context
  42683. if ( nodeType === 9 ) {
  42684. if ( (elem = context.getElementById( m )) ) {
  42685. // Support: IE, Opera, Webkit
  42686. // TODO: identify versions
  42687. // getElementById can match elements by name instead of ID
  42688. if ( elem.id === m ) {
  42689. results.push( elem );
  42690. return results;
  42691. }
  42692. } else {
  42693. return results;
  42694. }
  42695. // Element context
  42696. } else {
  42697. // Support: IE, Opera, Webkit
  42698. // TODO: identify versions
  42699. // getElementById can match elements by name instead of ID
  42700. if ( newContext && (elem = newContext.getElementById( m )) &&
  42701. contains( context, elem ) &&
  42702. elem.id === m ) {
  42703. results.push( elem );
  42704. return results;
  42705. }
  42706. }
  42707. // Type selector
  42708. } else if ( match[2] ) {
  42709. push.apply( results, context.getElementsByTagName( selector ) );
  42710. return results;
  42711. // Class selector
  42712. } else if ( (m = match[3]) && support.getElementsByClassName &&
  42713. context.getElementsByClassName ) {
  42714. push.apply( results, context.getElementsByClassName( m ) );
  42715. return results;
  42716. }
  42717. }
  42718. // Take advantage of querySelectorAll
  42719. if ( support.qsa &&
  42720. !compilerCache[ selector + " " ] &&
  42721. (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
  42722. if ( nodeType !== 1 ) {
  42723. newContext = context;
  42724. newSelector = selector;
  42725. // qSA looks outside Element context, which is not what we want
  42726. // Thanks to Andrew Dupont for this workaround technique
  42727. // Support: IE <=8
  42728. // Exclude object elements
  42729. } else if ( context.nodeName.toLowerCase() !== "object" ) {
  42730. // Capture the context ID, setting it first if necessary
  42731. if ( (nid = context.getAttribute( "id" )) ) {
  42732. nid = nid.replace( rcssescape, fcssescape );
  42733. } else {
  42734. context.setAttribute( "id", (nid = expando) );
  42735. }
  42736. // Prefix every selector in the list
  42737. groups = tokenize( selector );
  42738. i = groups.length;
  42739. while ( i-- ) {
  42740. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  42741. }
  42742. newSelector = groups.join( "," );
  42743. // Expand context for sibling selectors
  42744. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  42745. context;
  42746. }
  42747. if ( newSelector ) {
  42748. try {
  42749. push.apply( results,
  42750. newContext.querySelectorAll( newSelector )
  42751. );
  42752. return results;
  42753. } catch ( qsaError ) {
  42754. } finally {
  42755. if ( nid === expando ) {
  42756. context.removeAttribute( "id" );
  42757. }
  42758. }
  42759. }
  42760. }
  42761. }
  42762. }
  42763. // All others
  42764. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  42765. }
  42766. /**
  42767. * Create key-value caches of limited size
  42768. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  42769. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  42770. * deleting the oldest entry
  42771. */
  42772. function createCache() {
  42773. var keys = [];
  42774. function cache( key, value ) {
  42775. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  42776. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  42777. // Only keep the most recent entries
  42778. delete cache[ keys.shift() ];
  42779. }
  42780. return (cache[ key + " " ] = value);
  42781. }
  42782. return cache;
  42783. }
  42784. /**
  42785. * Mark a function for special use by Sizzle
  42786. * @param {Function} fn The function to mark
  42787. */
  42788. function markFunction( fn ) {
  42789. fn[ expando ] = true;
  42790. return fn;
  42791. }
  42792. /**
  42793. * Support testing using an element
  42794. * @param {Function} fn Passed the created element and returns a boolean result
  42795. */
  42796. function assert( fn ) {
  42797. var el = document.createElement("fieldset");
  42798. try {
  42799. return !!fn( el );
  42800. } catch (e) {
  42801. return false;
  42802. } finally {
  42803. // Remove from its parent by default
  42804. if ( el.parentNode ) {
  42805. el.parentNode.removeChild( el );
  42806. }
  42807. // release memory in IE
  42808. el = null;
  42809. }
  42810. }
  42811. /**
  42812. * Adds the same handler for all of the specified attrs
  42813. * @param {String} attrs Pipe-separated list of attributes
  42814. * @param {Function} handler The method that will be applied
  42815. */
  42816. function addHandle( attrs, handler ) {
  42817. var arr = attrs.split("|"),
  42818. i = arr.length;
  42819. while ( i-- ) {
  42820. Expr.attrHandle[ arr[i] ] = handler;
  42821. }
  42822. }
  42823. /**
  42824. * Checks document order of two siblings
  42825. * @param {Element} a
  42826. * @param {Element} b
  42827. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  42828. */
  42829. function siblingCheck( a, b ) {
  42830. var cur = b && a,
  42831. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  42832. a.sourceIndex - b.sourceIndex;
  42833. // Use IE sourceIndex if available on both nodes
  42834. if ( diff ) {
  42835. return diff;
  42836. }
  42837. // Check if b follows a
  42838. if ( cur ) {
  42839. while ( (cur = cur.nextSibling) ) {
  42840. if ( cur === b ) {
  42841. return -1;
  42842. }
  42843. }
  42844. }
  42845. return a ? 1 : -1;
  42846. }
  42847. /**
  42848. * Returns a function to use in pseudos for input types
  42849. * @param {String} type
  42850. */
  42851. function createInputPseudo( type ) {
  42852. return function( elem ) {
  42853. var name = elem.nodeName.toLowerCase();
  42854. return name === "input" && elem.type === type;
  42855. };
  42856. }
  42857. /**
  42858. * Returns a function to use in pseudos for buttons
  42859. * @param {String} type
  42860. */
  42861. function createButtonPseudo( type ) {
  42862. return function( elem ) {
  42863. var name = elem.nodeName.toLowerCase();
  42864. return (name === "input" || name === "button") && elem.type === type;
  42865. };
  42866. }
  42867. /**
  42868. * Returns a function to use in pseudos for :enabled/:disabled
  42869. * @param {Boolean} disabled true for :disabled; false for :enabled
  42870. */
  42871. function createDisabledPseudo( disabled ) {
  42872. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  42873. return function( elem ) {
  42874. // Only certain elements can match :enabled or :disabled
  42875. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  42876. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  42877. if ( "form" in elem ) {
  42878. // Check for inherited disabledness on relevant non-disabled elements:
  42879. // * listed form-associated elements in a disabled fieldset
  42880. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  42881. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  42882. // * option elements in a disabled optgroup
  42883. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  42884. // All such elements have a "form" property.
  42885. if ( elem.parentNode && elem.disabled === false ) {
  42886. // Option elements defer to a parent optgroup if present
  42887. if ( "label" in elem ) {
  42888. if ( "label" in elem.parentNode ) {
  42889. return elem.parentNode.disabled === disabled;
  42890. } else {
  42891. return elem.disabled === disabled;
  42892. }
  42893. }
  42894. // Support: IE 6 - 11
  42895. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  42896. return elem.isDisabled === disabled ||
  42897. // Where there is no isDisabled, check manually
  42898. /* jshint -W018 */
  42899. elem.isDisabled !== !disabled &&
  42900. disabledAncestor( elem ) === disabled;
  42901. }
  42902. return elem.disabled === disabled;
  42903. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  42904. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  42905. // even exist on them, let alone have a boolean value.
  42906. } else if ( "label" in elem ) {
  42907. return elem.disabled === disabled;
  42908. }
  42909. // Remaining elements are neither :enabled nor :disabled
  42910. return false;
  42911. };
  42912. }
  42913. /**
  42914. * Returns a function to use in pseudos for positionals
  42915. * @param {Function} fn
  42916. */
  42917. function createPositionalPseudo( fn ) {
  42918. return markFunction(function( argument ) {
  42919. argument = +argument;
  42920. return markFunction(function( seed, matches ) {
  42921. var j,
  42922. matchIndexes = fn( [], seed.length, argument ),
  42923. i = matchIndexes.length;
  42924. // Match elements found at the specified indexes
  42925. while ( i-- ) {
  42926. if ( seed[ (j = matchIndexes[i]) ] ) {
  42927. seed[j] = !(matches[j] = seed[j]);
  42928. }
  42929. }
  42930. });
  42931. });
  42932. }
  42933. /**
  42934. * Checks a node for validity as a Sizzle context
  42935. * @param {Element|Object=} context
  42936. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  42937. */
  42938. function testContext( context ) {
  42939. return context && typeof context.getElementsByTagName !== "undefined" && context;
  42940. }
  42941. // Expose support vars for convenience
  42942. support = Sizzle.support = {};
  42943. /**
  42944. * Detects XML nodes
  42945. * @param {Element|Object} elem An element or a document
  42946. * @returns {Boolean} True iff elem is a non-HTML XML node
  42947. */
  42948. isXML = Sizzle.isXML = function( elem ) {
  42949. // documentElement is verified for cases where it doesn't yet exist
  42950. // (such as loading iframes in IE - #4833)
  42951. var documentElement = elem && (elem.ownerDocument || elem).documentElement;
  42952. return documentElement ? documentElement.nodeName !== "HTML" : false;
  42953. };
  42954. /**
  42955. * Sets document-related variables once based on the current document
  42956. * @param {Element|Object} [doc] An element or document object to use to set the document
  42957. * @returns {Object} Returns the current document
  42958. */
  42959. setDocument = Sizzle.setDocument = function( node ) {
  42960. var hasCompare, subWindow,
  42961. doc = node ? node.ownerDocument || node : preferredDoc;
  42962. // Return early if doc is invalid or already selected
  42963. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  42964. return document;
  42965. }
  42966. // Update global variables
  42967. document = doc;
  42968. docElem = document.documentElement;
  42969. documentIsHTML = !isXML( document );
  42970. // Support: IE 9-11, Edge
  42971. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  42972. if ( preferredDoc !== document &&
  42973. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  42974. // Support: IE 11, Edge
  42975. if ( subWindow.addEventListener ) {
  42976. subWindow.addEventListener( "unload", unloadHandler, false );
  42977. // Support: IE 9 - 10 only
  42978. } else if ( subWindow.attachEvent ) {
  42979. subWindow.attachEvent( "onunload", unloadHandler );
  42980. }
  42981. }
  42982. /* Attributes
  42983. ---------------------------------------------------------------------- */
  42984. // Support: IE<8
  42985. // Verify that getAttribute really returns attributes and not properties
  42986. // (excepting IE8 booleans)
  42987. support.attributes = assert(function( el ) {
  42988. el.className = "i";
  42989. return !el.getAttribute("className");
  42990. });
  42991. /* getElement(s)By*
  42992. ---------------------------------------------------------------------- */
  42993. // Check if getElementsByTagName("*") returns only elements
  42994. support.getElementsByTagName = assert(function( el ) {
  42995. el.appendChild( document.createComment("") );
  42996. return !el.getElementsByTagName("*").length;
  42997. });
  42998. // Support: IE<9
  42999. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  43000. // Support: IE<10
  43001. // Check if getElementById returns elements by name
  43002. // The broken getElementById methods don't pick up programmatically-set names,
  43003. // so use a roundabout getElementsByName test
  43004. support.getById = assert(function( el ) {
  43005. docElem.appendChild( el ).id = expando;
  43006. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  43007. });
  43008. // ID filter and find
  43009. if ( support.getById ) {
  43010. Expr.filter["ID"] = function( id ) {
  43011. var attrId = id.replace( runescape, funescape );
  43012. return function( elem ) {
  43013. return elem.getAttribute("id") === attrId;
  43014. };
  43015. };
  43016. Expr.find["ID"] = function( id, context ) {
  43017. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  43018. var elem = context.getElementById( id );
  43019. return elem ? [ elem ] : [];
  43020. }
  43021. };
  43022. } else {
  43023. Expr.filter["ID"] = function( id ) {
  43024. var attrId = id.replace( runescape, funescape );
  43025. return function( elem ) {
  43026. var node = typeof elem.getAttributeNode !== "undefined" &&
  43027. elem.getAttributeNode("id");
  43028. return node && node.value === attrId;
  43029. };
  43030. };
  43031. // Support: IE 6 - 7 only
  43032. // getElementById is not reliable as a find shortcut
  43033. Expr.find["ID"] = function( id, context ) {
  43034. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  43035. var node, i, elems,
  43036. elem = context.getElementById( id );
  43037. if ( elem ) {
  43038. // Verify the id attribute
  43039. node = elem.getAttributeNode("id");
  43040. if ( node && node.value === id ) {
  43041. return [ elem ];
  43042. }
  43043. // Fall back on getElementsByName
  43044. elems = context.getElementsByName( id );
  43045. i = 0;
  43046. while ( (elem = elems[i++]) ) {
  43047. node = elem.getAttributeNode("id");
  43048. if ( node && node.value === id ) {
  43049. return [ elem ];
  43050. }
  43051. }
  43052. }
  43053. return [];
  43054. }
  43055. };
  43056. }
  43057. // Tag
  43058. Expr.find["TAG"] = support.getElementsByTagName ?
  43059. function( tag, context ) {
  43060. if ( typeof context.getElementsByTagName !== "undefined" ) {
  43061. return context.getElementsByTagName( tag );
  43062. // DocumentFragment nodes don't have gEBTN
  43063. } else if ( support.qsa ) {
  43064. return context.querySelectorAll( tag );
  43065. }
  43066. } :
  43067. function( tag, context ) {
  43068. var elem,
  43069. tmp = [],
  43070. i = 0,
  43071. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  43072. results = context.getElementsByTagName( tag );
  43073. // Filter out possible comments
  43074. if ( tag === "*" ) {
  43075. while ( (elem = results[i++]) ) {
  43076. if ( elem.nodeType === 1 ) {
  43077. tmp.push( elem );
  43078. }
  43079. }
  43080. return tmp;
  43081. }
  43082. return results;
  43083. };
  43084. // Class
  43085. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  43086. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  43087. return context.getElementsByClassName( className );
  43088. }
  43089. };
  43090. /* QSA/matchesSelector
  43091. ---------------------------------------------------------------------- */
  43092. // QSA and matchesSelector support
  43093. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  43094. rbuggyMatches = [];
  43095. // qSa(:focus) reports false when true (Chrome 21)
  43096. // We allow this because of a bug in IE8/9 that throws an error
  43097. // whenever `document.activeElement` is accessed on an iframe
  43098. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  43099. // See https://bugs.jquery.com/ticket/13378
  43100. rbuggyQSA = [];
  43101. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  43102. // Build QSA regex
  43103. // Regex strategy adopted from Diego Perini
  43104. assert(function( el ) {
  43105. // Select is set to empty string on purpose
  43106. // This is to test IE's treatment of not explicitly
  43107. // setting a boolean content attribute,
  43108. // since its presence should be enough
  43109. // https://bugs.jquery.com/ticket/12359
  43110. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  43111. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  43112. "<option selected=''></option></select>";
  43113. // Support: IE8, Opera 11-12.16
  43114. // Nothing should be selected when empty strings follow ^= or $= or *=
  43115. // The test attribute must be unknown in Opera but "safe" for WinRT
  43116. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  43117. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  43118. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  43119. }
  43120. // Support: IE8
  43121. // Boolean attributes and "value" are not treated correctly
  43122. if ( !el.querySelectorAll("[selected]").length ) {
  43123. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  43124. }
  43125. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  43126. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  43127. rbuggyQSA.push("~=");
  43128. }
  43129. // Webkit/Opera - :checked should return selected option elements
  43130. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  43131. // IE8 throws error here and will not see later tests
  43132. if ( !el.querySelectorAll(":checked").length ) {
  43133. rbuggyQSA.push(":checked");
  43134. }
  43135. // Support: Safari 8+, iOS 8+
  43136. // https://bugs.webkit.org/show_bug.cgi?id=136851
  43137. // In-page `selector#id sibling-combinator selector` fails
  43138. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  43139. rbuggyQSA.push(".#.+[+~]");
  43140. }
  43141. });
  43142. assert(function( el ) {
  43143. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  43144. "<select disabled='disabled'><option/></select>";
  43145. // Support: Windows 8 Native Apps
  43146. // The type and name attributes are restricted during .innerHTML assignment
  43147. var input = document.createElement("input");
  43148. input.setAttribute( "type", "hidden" );
  43149. el.appendChild( input ).setAttribute( "name", "D" );
  43150. // Support: IE8
  43151. // Enforce case-sensitivity of name attribute
  43152. if ( el.querySelectorAll("[name=d]").length ) {
  43153. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  43154. }
  43155. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  43156. // IE8 throws error here and will not see later tests
  43157. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  43158. rbuggyQSA.push( ":enabled", ":disabled" );
  43159. }
  43160. // Support: IE9-11+
  43161. // IE's :disabled selector does not pick up the children of disabled fieldsets
  43162. docElem.appendChild( el ).disabled = true;
  43163. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  43164. rbuggyQSA.push( ":enabled", ":disabled" );
  43165. }
  43166. // Opera 10-11 does not throw on post-comma invalid pseudos
  43167. el.querySelectorAll("*,:x");
  43168. rbuggyQSA.push(",.*:");
  43169. });
  43170. }
  43171. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  43172. docElem.webkitMatchesSelector ||
  43173. docElem.mozMatchesSelector ||
  43174. docElem.oMatchesSelector ||
  43175. docElem.msMatchesSelector) )) ) {
  43176. assert(function( el ) {
  43177. // Check to see if it's possible to do matchesSelector
  43178. // on a disconnected node (IE 9)
  43179. support.disconnectedMatch = matches.call( el, "*" );
  43180. // This should fail with an exception
  43181. // Gecko does not error, returns false instead
  43182. matches.call( el, "[s!='']:x" );
  43183. rbuggyMatches.push( "!=", pseudos );
  43184. });
  43185. }
  43186. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  43187. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  43188. /* Contains
  43189. ---------------------------------------------------------------------- */
  43190. hasCompare = rnative.test( docElem.compareDocumentPosition );
  43191. // Element contains another
  43192. // Purposefully self-exclusive
  43193. // As in, an element does not contain itself
  43194. contains = hasCompare || rnative.test( docElem.contains ) ?
  43195. function( a, b ) {
  43196. var adown = a.nodeType === 9 ? a.documentElement : a,
  43197. bup = b && b.parentNode;
  43198. return a === bup || !!( bup && bup.nodeType === 1 && (
  43199. adown.contains ?
  43200. adown.contains( bup ) :
  43201. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  43202. ));
  43203. } :
  43204. function( a, b ) {
  43205. if ( b ) {
  43206. while ( (b = b.parentNode) ) {
  43207. if ( b === a ) {
  43208. return true;
  43209. }
  43210. }
  43211. }
  43212. return false;
  43213. };
  43214. /* Sorting
  43215. ---------------------------------------------------------------------- */
  43216. // Document order sorting
  43217. sortOrder = hasCompare ?
  43218. function( a, b ) {
  43219. // Flag for duplicate removal
  43220. if ( a === b ) {
  43221. hasDuplicate = true;
  43222. return 0;
  43223. }
  43224. // Sort on method existence if only one input has compareDocumentPosition
  43225. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  43226. if ( compare ) {
  43227. return compare;
  43228. }
  43229. // Calculate position if both inputs belong to the same document
  43230. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  43231. a.compareDocumentPosition( b ) :
  43232. // Otherwise we know they are disconnected
  43233. 1;
  43234. // Disconnected nodes
  43235. if ( compare & 1 ||
  43236. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  43237. // Choose the first element that is related to our preferred document
  43238. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  43239. return -1;
  43240. }
  43241. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  43242. return 1;
  43243. }
  43244. // Maintain original order
  43245. return sortInput ?
  43246. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  43247. 0;
  43248. }
  43249. return compare & 4 ? -1 : 1;
  43250. } :
  43251. function( a, b ) {
  43252. // Exit early if the nodes are identical
  43253. if ( a === b ) {
  43254. hasDuplicate = true;
  43255. return 0;
  43256. }
  43257. var cur,
  43258. i = 0,
  43259. aup = a.parentNode,
  43260. bup = b.parentNode,
  43261. ap = [ a ],
  43262. bp = [ b ];
  43263. // Parentless nodes are either documents or disconnected
  43264. if ( !aup || !bup ) {
  43265. return a === document ? -1 :
  43266. b === document ? 1 :
  43267. aup ? -1 :
  43268. bup ? 1 :
  43269. sortInput ?
  43270. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  43271. 0;
  43272. // If the nodes are siblings, we can do a quick check
  43273. } else if ( aup === bup ) {
  43274. return siblingCheck( a, b );
  43275. }
  43276. // Otherwise we need full lists of their ancestors for comparison
  43277. cur = a;
  43278. while ( (cur = cur.parentNode) ) {
  43279. ap.unshift( cur );
  43280. }
  43281. cur = b;
  43282. while ( (cur = cur.parentNode) ) {
  43283. bp.unshift( cur );
  43284. }
  43285. // Walk down the tree looking for a discrepancy
  43286. while ( ap[i] === bp[i] ) {
  43287. i++;
  43288. }
  43289. return i ?
  43290. // Do a sibling check if the nodes have a common ancestor
  43291. siblingCheck( ap[i], bp[i] ) :
  43292. // Otherwise nodes in our document sort first
  43293. ap[i] === preferredDoc ? -1 :
  43294. bp[i] === preferredDoc ? 1 :
  43295. 0;
  43296. };
  43297. return document;
  43298. };
  43299. Sizzle.matches = function( expr, elements ) {
  43300. return Sizzle( expr, null, null, elements );
  43301. };
  43302. Sizzle.matchesSelector = function( elem, expr ) {
  43303. // Set document vars if needed
  43304. if ( ( elem.ownerDocument || elem ) !== document ) {
  43305. setDocument( elem );
  43306. }
  43307. // Make sure that attribute selectors are quoted
  43308. expr = expr.replace( rattributeQuotes, "='$1']" );
  43309. if ( support.matchesSelector && documentIsHTML &&
  43310. !compilerCache[ expr + " " ] &&
  43311. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  43312. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  43313. try {
  43314. var ret = matches.call( elem, expr );
  43315. // IE 9's matchesSelector returns false on disconnected nodes
  43316. if ( ret || support.disconnectedMatch ||
  43317. // As well, disconnected nodes are said to be in a document
  43318. // fragment in IE 9
  43319. elem.document && elem.document.nodeType !== 11 ) {
  43320. return ret;
  43321. }
  43322. } catch (e) {}
  43323. }
  43324. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  43325. };
  43326. Sizzle.contains = function( context, elem ) {
  43327. // Set document vars if needed
  43328. if ( ( context.ownerDocument || context ) !== document ) {
  43329. setDocument( context );
  43330. }
  43331. return contains( context, elem );
  43332. };
  43333. Sizzle.attr = function( elem, name ) {
  43334. // Set document vars if needed
  43335. if ( ( elem.ownerDocument || elem ) !== document ) {
  43336. setDocument( elem );
  43337. }
  43338. var fn = Expr.attrHandle[ name.toLowerCase() ],
  43339. // Don't get fooled by Object.prototype properties (jQuery #13807)
  43340. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  43341. fn( elem, name, !documentIsHTML ) :
  43342. undefined;
  43343. return val !== undefined ?
  43344. val :
  43345. support.attributes || !documentIsHTML ?
  43346. elem.getAttribute( name ) :
  43347. (val = elem.getAttributeNode(name)) && val.specified ?
  43348. val.value :
  43349. null;
  43350. };
  43351. Sizzle.escape = function( sel ) {
  43352. return (sel + "").replace( rcssescape, fcssescape );
  43353. };
  43354. Sizzle.error = function( msg ) {
  43355. throw new Error( "Syntax error, unrecognized expression: " + msg );
  43356. };
  43357. /**
  43358. * Document sorting and removing duplicates
  43359. * @param {ArrayLike} results
  43360. */
  43361. Sizzle.uniqueSort = function( results ) {
  43362. var elem,
  43363. duplicates = [],
  43364. j = 0,
  43365. i = 0;
  43366. // Unless we *know* we can detect duplicates, assume their presence
  43367. hasDuplicate = !support.detectDuplicates;
  43368. sortInput = !support.sortStable && results.slice( 0 );
  43369. results.sort( sortOrder );
  43370. if ( hasDuplicate ) {
  43371. while ( (elem = results[i++]) ) {
  43372. if ( elem === results[ i ] ) {
  43373. j = duplicates.push( i );
  43374. }
  43375. }
  43376. while ( j-- ) {
  43377. results.splice( duplicates[ j ], 1 );
  43378. }
  43379. }
  43380. // Clear input after sorting to release objects
  43381. // See https://github.com/jquery/sizzle/pull/225
  43382. sortInput = null;
  43383. return results;
  43384. };
  43385. /**
  43386. * Utility function for retrieving the text value of an array of DOM nodes
  43387. * @param {Array|Element} elem
  43388. */
  43389. getText = Sizzle.getText = function( elem ) {
  43390. var node,
  43391. ret = "",
  43392. i = 0,
  43393. nodeType = elem.nodeType;
  43394. if ( !nodeType ) {
  43395. // If no nodeType, this is expected to be an array
  43396. while ( (node = elem[i++]) ) {
  43397. // Do not traverse comment nodes
  43398. ret += getText( node );
  43399. }
  43400. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  43401. // Use textContent for elements
  43402. // innerText usage removed for consistency of new lines (jQuery #11153)
  43403. if ( typeof elem.textContent === "string" ) {
  43404. return elem.textContent;
  43405. } else {
  43406. // Traverse its children
  43407. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  43408. ret += getText( elem );
  43409. }
  43410. }
  43411. } else if ( nodeType === 3 || nodeType === 4 ) {
  43412. return elem.nodeValue;
  43413. }
  43414. // Do not include comment or processing instruction nodes
  43415. return ret;
  43416. };
  43417. Expr = Sizzle.selectors = {
  43418. // Can be adjusted by the user
  43419. cacheLength: 50,
  43420. createPseudo: markFunction,
  43421. match: matchExpr,
  43422. attrHandle: {},
  43423. find: {},
  43424. relative: {
  43425. ">": { dir: "parentNode", first: true },
  43426. " ": { dir: "parentNode" },
  43427. "+": { dir: "previousSibling", first: true },
  43428. "~": { dir: "previousSibling" }
  43429. },
  43430. preFilter: {
  43431. "ATTR": function( match ) {
  43432. match[1] = match[1].replace( runescape, funescape );
  43433. // Move the given value to match[3] whether quoted or unquoted
  43434. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  43435. if ( match[2] === "~=" ) {
  43436. match[3] = " " + match[3] + " ";
  43437. }
  43438. return match.slice( 0, 4 );
  43439. },
  43440. "CHILD": function( match ) {
  43441. /* matches from matchExpr["CHILD"]
  43442. 1 type (only|nth|...)
  43443. 2 what (child|of-type)
  43444. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  43445. 4 xn-component of xn+y argument ([+-]?\d*n|)
  43446. 5 sign of xn-component
  43447. 6 x of xn-component
  43448. 7 sign of y-component
  43449. 8 y of y-component
  43450. */
  43451. match[1] = match[1].toLowerCase();
  43452. if ( match[1].slice( 0, 3 ) === "nth" ) {
  43453. // nth-* requires argument
  43454. if ( !match[3] ) {
  43455. Sizzle.error( match[0] );
  43456. }
  43457. // numeric x and y parameters for Expr.filter.CHILD
  43458. // remember that false/true cast respectively to 0/1
  43459. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  43460. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  43461. // other types prohibit arguments
  43462. } else if ( match[3] ) {
  43463. Sizzle.error( match[0] );
  43464. }
  43465. return match;
  43466. },
  43467. "PSEUDO": function( match ) {
  43468. var excess,
  43469. unquoted = !match[6] && match[2];
  43470. if ( matchExpr["CHILD"].test( match[0] ) ) {
  43471. return null;
  43472. }
  43473. // Accept quoted arguments as-is
  43474. if ( match[3] ) {
  43475. match[2] = match[4] || match[5] || "";
  43476. // Strip excess characters from unquoted arguments
  43477. } else if ( unquoted && rpseudo.test( unquoted ) &&
  43478. // Get excess from tokenize (recursively)
  43479. (excess = tokenize( unquoted, true )) &&
  43480. // advance to the next closing parenthesis
  43481. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  43482. // excess is a negative index
  43483. match[0] = match[0].slice( 0, excess );
  43484. match[2] = unquoted.slice( 0, excess );
  43485. }
  43486. // Return only captures needed by the pseudo filter method (type and argument)
  43487. return match.slice( 0, 3 );
  43488. }
  43489. },
  43490. filter: {
  43491. "TAG": function( nodeNameSelector ) {
  43492. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  43493. return nodeNameSelector === "*" ?
  43494. function() { return true; } :
  43495. function( elem ) {
  43496. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  43497. };
  43498. },
  43499. "CLASS": function( className ) {
  43500. var pattern = classCache[ className + " " ];
  43501. return pattern ||
  43502. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  43503. classCache( className, function( elem ) {
  43504. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  43505. });
  43506. },
  43507. "ATTR": function( name, operator, check ) {
  43508. return function( elem ) {
  43509. var result = Sizzle.attr( elem, name );
  43510. if ( result == null ) {
  43511. return operator === "!=";
  43512. }
  43513. if ( !operator ) {
  43514. return true;
  43515. }
  43516. result += "";
  43517. return operator === "=" ? result === check :
  43518. operator === "!=" ? result !== check :
  43519. operator === "^=" ? check && result.indexOf( check ) === 0 :
  43520. operator === "*=" ? check && result.indexOf( check ) > -1 :
  43521. operator === "$=" ? check && result.slice( -check.length ) === check :
  43522. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  43523. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  43524. false;
  43525. };
  43526. },
  43527. "CHILD": function( type, what, argument, first, last ) {
  43528. var simple = type.slice( 0, 3 ) !== "nth",
  43529. forward = type.slice( -4 ) !== "last",
  43530. ofType = what === "of-type";
  43531. return first === 1 && last === 0 ?
  43532. // Shortcut for :nth-*(n)
  43533. function( elem ) {
  43534. return !!elem.parentNode;
  43535. } :
  43536. function( elem, context, xml ) {
  43537. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  43538. dir = simple !== forward ? "nextSibling" : "previousSibling",
  43539. parent = elem.parentNode,
  43540. name = ofType && elem.nodeName.toLowerCase(),
  43541. useCache = !xml && !ofType,
  43542. diff = false;
  43543. if ( parent ) {
  43544. // :(first|last|only)-(child|of-type)
  43545. if ( simple ) {
  43546. while ( dir ) {
  43547. node = elem;
  43548. while ( (node = node[ dir ]) ) {
  43549. if ( ofType ?
  43550. node.nodeName.toLowerCase() === name :
  43551. node.nodeType === 1 ) {
  43552. return false;
  43553. }
  43554. }
  43555. // Reverse direction for :only-* (if we haven't yet done so)
  43556. start = dir = type === "only" && !start && "nextSibling";
  43557. }
  43558. return true;
  43559. }
  43560. start = [ forward ? parent.firstChild : parent.lastChild ];
  43561. // non-xml :nth-child(...) stores cache data on `parent`
  43562. if ( forward && useCache ) {
  43563. // Seek `elem` from a previously-cached index
  43564. // ...in a gzip-friendly way
  43565. node = parent;
  43566. outerCache = node[ expando ] || (node[ expando ] = {});
  43567. // Support: IE <9 only
  43568. // Defend against cloned attroperties (jQuery gh-1709)
  43569. uniqueCache = outerCache[ node.uniqueID ] ||
  43570. (outerCache[ node.uniqueID ] = {});
  43571. cache = uniqueCache[ type ] || [];
  43572. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  43573. diff = nodeIndex && cache[ 2 ];
  43574. node = nodeIndex && parent.childNodes[ nodeIndex ];
  43575. while ( (node = ++nodeIndex && node && node[ dir ] ||
  43576. // Fallback to seeking `elem` from the start
  43577. (diff = nodeIndex = 0) || start.pop()) ) {
  43578. // When found, cache indexes on `parent` and break
  43579. if ( node.nodeType === 1 && ++diff && node === elem ) {
  43580. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  43581. break;
  43582. }
  43583. }
  43584. } else {
  43585. // Use previously-cached element index if available
  43586. if ( useCache ) {
  43587. // ...in a gzip-friendly way
  43588. node = elem;
  43589. outerCache = node[ expando ] || (node[ expando ] = {});
  43590. // Support: IE <9 only
  43591. // Defend against cloned attroperties (jQuery gh-1709)
  43592. uniqueCache = outerCache[ node.uniqueID ] ||
  43593. (outerCache[ node.uniqueID ] = {});
  43594. cache = uniqueCache[ type ] || [];
  43595. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  43596. diff = nodeIndex;
  43597. }
  43598. // xml :nth-child(...)
  43599. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  43600. if ( diff === false ) {
  43601. // Use the same loop as above to seek `elem` from the start
  43602. while ( (node = ++nodeIndex && node && node[ dir ] ||
  43603. (diff = nodeIndex = 0) || start.pop()) ) {
  43604. if ( ( ofType ?
  43605. node.nodeName.toLowerCase() === name :
  43606. node.nodeType === 1 ) &&
  43607. ++diff ) {
  43608. // Cache the index of each encountered element
  43609. if ( useCache ) {
  43610. outerCache = node[ expando ] || (node[ expando ] = {});
  43611. // Support: IE <9 only
  43612. // Defend against cloned attroperties (jQuery gh-1709)
  43613. uniqueCache = outerCache[ node.uniqueID ] ||
  43614. (outerCache[ node.uniqueID ] = {});
  43615. uniqueCache[ type ] = [ dirruns, diff ];
  43616. }
  43617. if ( node === elem ) {
  43618. break;
  43619. }
  43620. }
  43621. }
  43622. }
  43623. }
  43624. // Incorporate the offset, then check against cycle size
  43625. diff -= last;
  43626. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  43627. }
  43628. };
  43629. },
  43630. "PSEUDO": function( pseudo, argument ) {
  43631. // pseudo-class names are case-insensitive
  43632. // http://www.w3.org/TR/selectors/#pseudo-classes
  43633. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  43634. // Remember that setFilters inherits from pseudos
  43635. var args,
  43636. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  43637. Sizzle.error( "unsupported pseudo: " + pseudo );
  43638. // The user may use createPseudo to indicate that
  43639. // arguments are needed to create the filter function
  43640. // just as Sizzle does
  43641. if ( fn[ expando ] ) {
  43642. return fn( argument );
  43643. }
  43644. // But maintain support for old signatures
  43645. if ( fn.length > 1 ) {
  43646. args = [ pseudo, pseudo, "", argument ];
  43647. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  43648. markFunction(function( seed, matches ) {
  43649. var idx,
  43650. matched = fn( seed, argument ),
  43651. i = matched.length;
  43652. while ( i-- ) {
  43653. idx = indexOf( seed, matched[i] );
  43654. seed[ idx ] = !( matches[ idx ] = matched[i] );
  43655. }
  43656. }) :
  43657. function( elem ) {
  43658. return fn( elem, 0, args );
  43659. };
  43660. }
  43661. return fn;
  43662. }
  43663. },
  43664. pseudos: {
  43665. // Potentially complex pseudos
  43666. "not": markFunction(function( selector ) {
  43667. // Trim the selector passed to compile
  43668. // to avoid treating leading and trailing
  43669. // spaces as combinators
  43670. var input = [],
  43671. results = [],
  43672. matcher = compile( selector.replace( rtrim, "$1" ) );
  43673. return matcher[ expando ] ?
  43674. markFunction(function( seed, matches, context, xml ) {
  43675. var elem,
  43676. unmatched = matcher( seed, null, xml, [] ),
  43677. i = seed.length;
  43678. // Match elements unmatched by `matcher`
  43679. while ( i-- ) {
  43680. if ( (elem = unmatched[i]) ) {
  43681. seed[i] = !(matches[i] = elem);
  43682. }
  43683. }
  43684. }) :
  43685. function( elem, context, xml ) {
  43686. input[0] = elem;
  43687. matcher( input, null, xml, results );
  43688. // Don't keep the element (issue #299)
  43689. input[0] = null;
  43690. return !results.pop();
  43691. };
  43692. }),
  43693. "has": markFunction(function( selector ) {
  43694. return function( elem ) {
  43695. return Sizzle( selector, elem ).length > 0;
  43696. };
  43697. }),
  43698. "contains": markFunction(function( text ) {
  43699. text = text.replace( runescape, funescape );
  43700. return function( elem ) {
  43701. return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
  43702. };
  43703. }),
  43704. // "Whether an element is represented by a :lang() selector
  43705. // is based solely on the element's language value
  43706. // being equal to the identifier C,
  43707. // or beginning with the identifier C immediately followed by "-".
  43708. // The matching of C against the element's language value is performed case-insensitively.
  43709. // The identifier C does not have to be a valid language name."
  43710. // http://www.w3.org/TR/selectors/#lang-pseudo
  43711. "lang": markFunction( function( lang ) {
  43712. // lang value must be a valid identifier
  43713. if ( !ridentifier.test(lang || "") ) {
  43714. Sizzle.error( "unsupported lang: " + lang );
  43715. }
  43716. lang = lang.replace( runescape, funescape ).toLowerCase();
  43717. return function( elem ) {
  43718. var elemLang;
  43719. do {
  43720. if ( (elemLang = documentIsHTML ?
  43721. elem.lang :
  43722. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  43723. elemLang = elemLang.toLowerCase();
  43724. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  43725. }
  43726. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  43727. return false;
  43728. };
  43729. }),
  43730. // Miscellaneous
  43731. "target": function( elem ) {
  43732. var hash = window.location && window.location.hash;
  43733. return hash && hash.slice( 1 ) === elem.id;
  43734. },
  43735. "root": function( elem ) {
  43736. return elem === docElem;
  43737. },
  43738. "focus": function( elem ) {
  43739. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  43740. },
  43741. // Boolean properties
  43742. "enabled": createDisabledPseudo( false ),
  43743. "disabled": createDisabledPseudo( true ),
  43744. "checked": function( elem ) {
  43745. // In CSS3, :checked should return both checked and selected elements
  43746. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  43747. var nodeName = elem.nodeName.toLowerCase();
  43748. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  43749. },
  43750. "selected": function( elem ) {
  43751. // Accessing this property makes selected-by-default
  43752. // options in Safari work properly
  43753. if ( elem.parentNode ) {
  43754. elem.parentNode.selectedIndex;
  43755. }
  43756. return elem.selected === true;
  43757. },
  43758. // Contents
  43759. "empty": function( elem ) {
  43760. // http://www.w3.org/TR/selectors/#empty-pseudo
  43761. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  43762. // but not by others (comment: 8; processing instruction: 7; etc.)
  43763. // nodeType < 6 works because attributes (2) do not appear as children
  43764. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  43765. if ( elem.nodeType < 6 ) {
  43766. return false;
  43767. }
  43768. }
  43769. return true;
  43770. },
  43771. "parent": function( elem ) {
  43772. return !Expr.pseudos["empty"]( elem );
  43773. },
  43774. // Element/input types
  43775. "header": function( elem ) {
  43776. return rheader.test( elem.nodeName );
  43777. },
  43778. "input": function( elem ) {
  43779. return rinputs.test( elem.nodeName );
  43780. },
  43781. "button": function( elem ) {
  43782. var name = elem.nodeName.toLowerCase();
  43783. return name === "input" && elem.type === "button" || name === "button";
  43784. },
  43785. "text": function( elem ) {
  43786. var attr;
  43787. return elem.nodeName.toLowerCase() === "input" &&
  43788. elem.type === "text" &&
  43789. // Support: IE<8
  43790. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  43791. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  43792. },
  43793. // Position-in-collection
  43794. "first": createPositionalPseudo(function() {
  43795. return [ 0 ];
  43796. }),
  43797. "last": createPositionalPseudo(function( matchIndexes, length ) {
  43798. return [ length - 1 ];
  43799. }),
  43800. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  43801. return [ argument < 0 ? argument + length : argument ];
  43802. }),
  43803. "even": createPositionalPseudo(function( matchIndexes, length ) {
  43804. var i = 0;
  43805. for ( ; i < length; i += 2 ) {
  43806. matchIndexes.push( i );
  43807. }
  43808. return matchIndexes;
  43809. }),
  43810. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  43811. var i = 1;
  43812. for ( ; i < length; i += 2 ) {
  43813. matchIndexes.push( i );
  43814. }
  43815. return matchIndexes;
  43816. }),
  43817. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  43818. var i = argument < 0 ? argument + length : argument;
  43819. for ( ; --i >= 0; ) {
  43820. matchIndexes.push( i );
  43821. }
  43822. return matchIndexes;
  43823. }),
  43824. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  43825. var i = argument < 0 ? argument + length : argument;
  43826. for ( ; ++i < length; ) {
  43827. matchIndexes.push( i );
  43828. }
  43829. return matchIndexes;
  43830. })
  43831. }
  43832. };
  43833. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  43834. // Add button/input type pseudos
  43835. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  43836. Expr.pseudos[ i ] = createInputPseudo( i );
  43837. }
  43838. for ( i in { submit: true, reset: true } ) {
  43839. Expr.pseudos[ i ] = createButtonPseudo( i );
  43840. }
  43841. // Easy API for creating new setFilters
  43842. function setFilters() {}
  43843. setFilters.prototype = Expr.filters = Expr.pseudos;
  43844. Expr.setFilters = new setFilters();
  43845. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  43846. var matched, match, tokens, type,
  43847. soFar, groups, preFilters,
  43848. cached = tokenCache[ selector + " " ];
  43849. if ( cached ) {
  43850. return parseOnly ? 0 : cached.slice( 0 );
  43851. }
  43852. soFar = selector;
  43853. groups = [];
  43854. preFilters = Expr.preFilter;
  43855. while ( soFar ) {
  43856. // Comma and first run
  43857. if ( !matched || (match = rcomma.exec( soFar )) ) {
  43858. if ( match ) {
  43859. // Don't consume trailing commas as valid
  43860. soFar = soFar.slice( match[0].length ) || soFar;
  43861. }
  43862. groups.push( (tokens = []) );
  43863. }
  43864. matched = false;
  43865. // Combinators
  43866. if ( (match = rcombinators.exec( soFar )) ) {
  43867. matched = match.shift();
  43868. tokens.push({
  43869. value: matched,
  43870. // Cast descendant combinators to space
  43871. type: match[0].replace( rtrim, " " )
  43872. });
  43873. soFar = soFar.slice( matched.length );
  43874. }
  43875. // Filters
  43876. for ( type in Expr.filter ) {
  43877. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  43878. (match = preFilters[ type ]( match ))) ) {
  43879. matched = match.shift();
  43880. tokens.push({
  43881. value: matched,
  43882. type: type,
  43883. matches: match
  43884. });
  43885. soFar = soFar.slice( matched.length );
  43886. }
  43887. }
  43888. if ( !matched ) {
  43889. break;
  43890. }
  43891. }
  43892. // Return the length of the invalid excess
  43893. // if we're just parsing
  43894. // Otherwise, throw an error or return tokens
  43895. return parseOnly ?
  43896. soFar.length :
  43897. soFar ?
  43898. Sizzle.error( selector ) :
  43899. // Cache the tokens
  43900. tokenCache( selector, groups ).slice( 0 );
  43901. };
  43902. function toSelector( tokens ) {
  43903. var i = 0,
  43904. len = tokens.length,
  43905. selector = "";
  43906. for ( ; i < len; i++ ) {
  43907. selector += tokens[i].value;
  43908. }
  43909. return selector;
  43910. }
  43911. function addCombinator( matcher, combinator, base ) {
  43912. var dir = combinator.dir,
  43913. skip = combinator.next,
  43914. key = skip || dir,
  43915. checkNonElements = base && key === "parentNode",
  43916. doneName = done++;
  43917. return combinator.first ?
  43918. // Check against closest ancestor/preceding element
  43919. function( elem, context, xml ) {
  43920. while ( (elem = elem[ dir ]) ) {
  43921. if ( elem.nodeType === 1 || checkNonElements ) {
  43922. return matcher( elem, context, xml );
  43923. }
  43924. }
  43925. return false;
  43926. } :
  43927. // Check against all ancestor/preceding elements
  43928. function( elem, context, xml ) {
  43929. var oldCache, uniqueCache, outerCache,
  43930. newCache = [ dirruns, doneName ];
  43931. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  43932. if ( xml ) {
  43933. while ( (elem = elem[ dir ]) ) {
  43934. if ( elem.nodeType === 1 || checkNonElements ) {
  43935. if ( matcher( elem, context, xml ) ) {
  43936. return true;
  43937. }
  43938. }
  43939. }
  43940. } else {
  43941. while ( (elem = elem[ dir ]) ) {
  43942. if ( elem.nodeType === 1 || checkNonElements ) {
  43943. outerCache = elem[ expando ] || (elem[ expando ] = {});
  43944. // Support: IE <9 only
  43945. // Defend against cloned attroperties (jQuery gh-1709)
  43946. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  43947. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  43948. elem = elem[ dir ] || elem;
  43949. } else if ( (oldCache = uniqueCache[ key ]) &&
  43950. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  43951. // Assign to newCache so results back-propagate to previous elements
  43952. return (newCache[ 2 ] = oldCache[ 2 ]);
  43953. } else {
  43954. // Reuse newcache so results back-propagate to previous elements
  43955. uniqueCache[ key ] = newCache;
  43956. // A match means we're done; a fail means we have to keep checking
  43957. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  43958. return true;
  43959. }
  43960. }
  43961. }
  43962. }
  43963. }
  43964. return false;
  43965. };
  43966. }
  43967. function elementMatcher( matchers ) {
  43968. return matchers.length > 1 ?
  43969. function( elem, context, xml ) {
  43970. var i = matchers.length;
  43971. while ( i-- ) {
  43972. if ( !matchers[i]( elem, context, xml ) ) {
  43973. return false;
  43974. }
  43975. }
  43976. return true;
  43977. } :
  43978. matchers[0];
  43979. }
  43980. function multipleContexts( selector, contexts, results ) {
  43981. var i = 0,
  43982. len = contexts.length;
  43983. for ( ; i < len; i++ ) {
  43984. Sizzle( selector, contexts[i], results );
  43985. }
  43986. return results;
  43987. }
  43988. function condense( unmatched, map, filter, context, xml ) {
  43989. var elem,
  43990. newUnmatched = [],
  43991. i = 0,
  43992. len = unmatched.length,
  43993. mapped = map != null;
  43994. for ( ; i < len; i++ ) {
  43995. if ( (elem = unmatched[i]) ) {
  43996. if ( !filter || filter( elem, context, xml ) ) {
  43997. newUnmatched.push( elem );
  43998. if ( mapped ) {
  43999. map.push( i );
  44000. }
  44001. }
  44002. }
  44003. }
  44004. return newUnmatched;
  44005. }
  44006. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  44007. if ( postFilter && !postFilter[ expando ] ) {
  44008. postFilter = setMatcher( postFilter );
  44009. }
  44010. if ( postFinder && !postFinder[ expando ] ) {
  44011. postFinder = setMatcher( postFinder, postSelector );
  44012. }
  44013. return markFunction(function( seed, results, context, xml ) {
  44014. var temp, i, elem,
  44015. preMap = [],
  44016. postMap = [],
  44017. preexisting = results.length,
  44018. // Get initial elements from seed or context
  44019. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  44020. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  44021. matcherIn = preFilter && ( seed || !selector ) ?
  44022. condense( elems, preMap, preFilter, context, xml ) :
  44023. elems,
  44024. matcherOut = matcher ?
  44025. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  44026. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  44027. // ...intermediate processing is necessary
  44028. [] :
  44029. // ...otherwise use results directly
  44030. results :
  44031. matcherIn;
  44032. // Find primary matches
  44033. if ( matcher ) {
  44034. matcher( matcherIn, matcherOut, context, xml );
  44035. }
  44036. // Apply postFilter
  44037. if ( postFilter ) {
  44038. temp = condense( matcherOut, postMap );
  44039. postFilter( temp, [], context, xml );
  44040. // Un-match failing elements by moving them back to matcherIn
  44041. i = temp.length;
  44042. while ( i-- ) {
  44043. if ( (elem = temp[i]) ) {
  44044. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  44045. }
  44046. }
  44047. }
  44048. if ( seed ) {
  44049. if ( postFinder || preFilter ) {
  44050. if ( postFinder ) {
  44051. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  44052. temp = [];
  44053. i = matcherOut.length;
  44054. while ( i-- ) {
  44055. if ( (elem = matcherOut[i]) ) {
  44056. // Restore matcherIn since elem is not yet a final match
  44057. temp.push( (matcherIn[i] = elem) );
  44058. }
  44059. }
  44060. postFinder( null, (matcherOut = []), temp, xml );
  44061. }
  44062. // Move matched elements from seed to results to keep them synchronized
  44063. i = matcherOut.length;
  44064. while ( i-- ) {
  44065. if ( (elem = matcherOut[i]) &&
  44066. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  44067. seed[temp] = !(results[temp] = elem);
  44068. }
  44069. }
  44070. }
  44071. // Add elements to results, through postFinder if defined
  44072. } else {
  44073. matcherOut = condense(
  44074. matcherOut === results ?
  44075. matcherOut.splice( preexisting, matcherOut.length ) :
  44076. matcherOut
  44077. );
  44078. if ( postFinder ) {
  44079. postFinder( null, results, matcherOut, xml );
  44080. } else {
  44081. push.apply( results, matcherOut );
  44082. }
  44083. }
  44084. });
  44085. }
  44086. function matcherFromTokens( tokens ) {
  44087. var checkContext, matcher, j,
  44088. len = tokens.length,
  44089. leadingRelative = Expr.relative[ tokens[0].type ],
  44090. implicitRelative = leadingRelative || Expr.relative[" "],
  44091. i = leadingRelative ? 1 : 0,
  44092. // The foundational matcher ensures that elements are reachable from top-level context(s)
  44093. matchContext = addCombinator( function( elem ) {
  44094. return elem === checkContext;
  44095. }, implicitRelative, true ),
  44096. matchAnyContext = addCombinator( function( elem ) {
  44097. return indexOf( checkContext, elem ) > -1;
  44098. }, implicitRelative, true ),
  44099. matchers = [ function( elem, context, xml ) {
  44100. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  44101. (checkContext = context).nodeType ?
  44102. matchContext( elem, context, xml ) :
  44103. matchAnyContext( elem, context, xml ) );
  44104. // Avoid hanging onto element (issue #299)
  44105. checkContext = null;
  44106. return ret;
  44107. } ];
  44108. for ( ; i < len; i++ ) {
  44109. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  44110. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  44111. } else {
  44112. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  44113. // Return special upon seeing a positional matcher
  44114. if ( matcher[ expando ] ) {
  44115. // Find the next relative operator (if any) for proper handling
  44116. j = ++i;
  44117. for ( ; j < len; j++ ) {
  44118. if ( Expr.relative[ tokens[j].type ] ) {
  44119. break;
  44120. }
  44121. }
  44122. return setMatcher(
  44123. i > 1 && elementMatcher( matchers ),
  44124. i > 1 && toSelector(
  44125. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  44126. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  44127. ).replace( rtrim, "$1" ),
  44128. matcher,
  44129. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  44130. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  44131. j < len && toSelector( tokens )
  44132. );
  44133. }
  44134. matchers.push( matcher );
  44135. }
  44136. }
  44137. return elementMatcher( matchers );
  44138. }
  44139. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  44140. var bySet = setMatchers.length > 0,
  44141. byElement = elementMatchers.length > 0,
  44142. superMatcher = function( seed, context, xml, results, outermost ) {
  44143. var elem, j, matcher,
  44144. matchedCount = 0,
  44145. i = "0",
  44146. unmatched = seed && [],
  44147. setMatched = [],
  44148. contextBackup = outermostContext,
  44149. // We must always have either seed elements or outermost context
  44150. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  44151. // Use integer dirruns iff this is the outermost matcher
  44152. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  44153. len = elems.length;
  44154. if ( outermost ) {
  44155. outermostContext = context === document || context || outermost;
  44156. }
  44157. // Add elements passing elementMatchers directly to results
  44158. // Support: IE<9, Safari
  44159. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  44160. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  44161. if ( byElement && elem ) {
  44162. j = 0;
  44163. if ( !context && elem.ownerDocument !== document ) {
  44164. setDocument( elem );
  44165. xml = !documentIsHTML;
  44166. }
  44167. while ( (matcher = elementMatchers[j++]) ) {
  44168. if ( matcher( elem, context || document, xml) ) {
  44169. results.push( elem );
  44170. break;
  44171. }
  44172. }
  44173. if ( outermost ) {
  44174. dirruns = dirrunsUnique;
  44175. }
  44176. }
  44177. // Track unmatched elements for set filters
  44178. if ( bySet ) {
  44179. // They will have gone through all possible matchers
  44180. if ( (elem = !matcher && elem) ) {
  44181. matchedCount--;
  44182. }
  44183. // Lengthen the array for every element, matched or not
  44184. if ( seed ) {
  44185. unmatched.push( elem );
  44186. }
  44187. }
  44188. }
  44189. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  44190. // makes the latter nonnegative.
  44191. matchedCount += i;
  44192. // Apply set filters to unmatched elements
  44193. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  44194. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  44195. // no element matchers and no seed.
  44196. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  44197. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  44198. // numerically zero.
  44199. if ( bySet && i !== matchedCount ) {
  44200. j = 0;
  44201. while ( (matcher = setMatchers[j++]) ) {
  44202. matcher( unmatched, setMatched, context, xml );
  44203. }
  44204. if ( seed ) {
  44205. // Reintegrate element matches to eliminate the need for sorting
  44206. if ( matchedCount > 0 ) {
  44207. while ( i-- ) {
  44208. if ( !(unmatched[i] || setMatched[i]) ) {
  44209. setMatched[i] = pop.call( results );
  44210. }
  44211. }
  44212. }
  44213. // Discard index placeholder values to get only actual matches
  44214. setMatched = condense( setMatched );
  44215. }
  44216. // Add matches to results
  44217. push.apply( results, setMatched );
  44218. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  44219. if ( outermost && !seed && setMatched.length > 0 &&
  44220. ( matchedCount + setMatchers.length ) > 1 ) {
  44221. Sizzle.uniqueSort( results );
  44222. }
  44223. }
  44224. // Override manipulation of globals by nested matchers
  44225. if ( outermost ) {
  44226. dirruns = dirrunsUnique;
  44227. outermostContext = contextBackup;
  44228. }
  44229. return unmatched;
  44230. };
  44231. return bySet ?
  44232. markFunction( superMatcher ) :
  44233. superMatcher;
  44234. }
  44235. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  44236. var i,
  44237. setMatchers = [],
  44238. elementMatchers = [],
  44239. cached = compilerCache[ selector + " " ];
  44240. if ( !cached ) {
  44241. // Generate a function of recursive functions that can be used to check each element
  44242. if ( !match ) {
  44243. match = tokenize( selector );
  44244. }
  44245. i = match.length;
  44246. while ( i-- ) {
  44247. cached = matcherFromTokens( match[i] );
  44248. if ( cached[ expando ] ) {
  44249. setMatchers.push( cached );
  44250. } else {
  44251. elementMatchers.push( cached );
  44252. }
  44253. }
  44254. // Cache the compiled function
  44255. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  44256. // Save selector and tokenization
  44257. cached.selector = selector;
  44258. }
  44259. return cached;
  44260. };
  44261. /**
  44262. * A low-level selection function that works with Sizzle's compiled
  44263. * selector functions
  44264. * @param {String|Function} selector A selector or a pre-compiled
  44265. * selector function built with Sizzle.compile
  44266. * @param {Element} context
  44267. * @param {Array} [results]
  44268. * @param {Array} [seed] A set of elements to match against
  44269. */
  44270. select = Sizzle.select = function( selector, context, results, seed ) {
  44271. var i, tokens, token, type, find,
  44272. compiled = typeof selector === "function" && selector,
  44273. match = !seed && tokenize( (selector = compiled.selector || selector) );
  44274. results = results || [];
  44275. // Try to minimize operations if there is only one selector in the list and no seed
  44276. // (the latter of which guarantees us context)
  44277. if ( match.length === 1 ) {
  44278. // Reduce context if the leading compound selector is an ID
  44279. tokens = match[0] = match[0].slice( 0 );
  44280. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  44281. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  44282. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  44283. if ( !context ) {
  44284. return results;
  44285. // Precompiled matchers will still verify ancestry, so step up a level
  44286. } else if ( compiled ) {
  44287. context = context.parentNode;
  44288. }
  44289. selector = selector.slice( tokens.shift().value.length );
  44290. }
  44291. // Fetch a seed set for right-to-left matching
  44292. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  44293. while ( i-- ) {
  44294. token = tokens[i];
  44295. // Abort if we hit a combinator
  44296. if ( Expr.relative[ (type = token.type) ] ) {
  44297. break;
  44298. }
  44299. if ( (find = Expr.find[ type ]) ) {
  44300. // Search, expanding context for leading sibling combinators
  44301. if ( (seed = find(
  44302. token.matches[0].replace( runescape, funescape ),
  44303. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  44304. )) ) {
  44305. // If seed is empty or no tokens remain, we can return early
  44306. tokens.splice( i, 1 );
  44307. selector = seed.length && toSelector( tokens );
  44308. if ( !selector ) {
  44309. push.apply( results, seed );
  44310. return results;
  44311. }
  44312. break;
  44313. }
  44314. }
  44315. }
  44316. }
  44317. // Compile and execute a filtering function if one is not provided
  44318. // Provide `match` to avoid retokenization if we modified the selector above
  44319. ( compiled || compile( selector, match ) )(
  44320. seed,
  44321. context,
  44322. !documentIsHTML,
  44323. results,
  44324. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  44325. );
  44326. return results;
  44327. };
  44328. // One-time assignments
  44329. // Sort stability
  44330. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  44331. // Support: Chrome 14-35+
  44332. // Always assume duplicates if they aren't passed to the comparison function
  44333. support.detectDuplicates = !!hasDuplicate;
  44334. // Initialize against the default document
  44335. setDocument();
  44336. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  44337. // Detached nodes confoundingly follow *each other*
  44338. support.sortDetached = assert(function( el ) {
  44339. // Should return 1, but returns 4 (following)
  44340. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  44341. });
  44342. // Support: IE<8
  44343. // Prevent attribute/property "interpolation"
  44344. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  44345. if ( !assert(function( el ) {
  44346. el.innerHTML = "<a href='#'></a>";
  44347. return el.firstChild.getAttribute("href") === "#" ;
  44348. }) ) {
  44349. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  44350. if ( !isXML ) {
  44351. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  44352. }
  44353. });
  44354. }
  44355. // Support: IE<9
  44356. // Use defaultValue in place of getAttribute("value")
  44357. if ( !support.attributes || !assert(function( el ) {
  44358. el.innerHTML = "<input/>";
  44359. el.firstChild.setAttribute( "value", "" );
  44360. return el.firstChild.getAttribute( "value" ) === "";
  44361. }) ) {
  44362. addHandle( "value", function( elem, name, isXML ) {
  44363. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  44364. return elem.defaultValue;
  44365. }
  44366. });
  44367. }
  44368. // Support: IE<9
  44369. // Use getAttributeNode to fetch booleans when getAttribute lies
  44370. if ( !assert(function( el ) {
  44371. return el.getAttribute("disabled") == null;
  44372. }) ) {
  44373. addHandle( booleans, function( elem, name, isXML ) {
  44374. var val;
  44375. if ( !isXML ) {
  44376. return elem[ name ] === true ? name.toLowerCase() :
  44377. (val = elem.getAttributeNode( name )) && val.specified ?
  44378. val.value :
  44379. null;
  44380. }
  44381. });
  44382. }
  44383. return Sizzle;
  44384. })( window );
  44385. jQuery.find = Sizzle;
  44386. jQuery.expr = Sizzle.selectors;
  44387. // Deprecated
  44388. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  44389. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  44390. jQuery.text = Sizzle.getText;
  44391. jQuery.isXMLDoc = Sizzle.isXML;
  44392. jQuery.contains = Sizzle.contains;
  44393. jQuery.escapeSelector = Sizzle.escape;
  44394. var dir = function( elem, dir, until ) {
  44395. var matched = [],
  44396. truncate = until !== undefined;
  44397. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  44398. if ( elem.nodeType === 1 ) {
  44399. if ( truncate && jQuery( elem ).is( until ) ) {
  44400. break;
  44401. }
  44402. matched.push( elem );
  44403. }
  44404. }
  44405. return matched;
  44406. };
  44407. var siblings = function( n, elem ) {
  44408. var matched = [];
  44409. for ( ; n; n = n.nextSibling ) {
  44410. if ( n.nodeType === 1 && n !== elem ) {
  44411. matched.push( n );
  44412. }
  44413. }
  44414. return matched;
  44415. };
  44416. var rneedsContext = jQuery.expr.match.needsContext;
  44417. function nodeName( elem, name ) {
  44418. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  44419. };
  44420. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  44421. // Implement the identical functionality for filter and not
  44422. function winnow( elements, qualifier, not ) {
  44423. if ( isFunction( qualifier ) ) {
  44424. return jQuery.grep( elements, function( elem, i ) {
  44425. return !!qualifier.call( elem, i, elem ) !== not;
  44426. } );
  44427. }
  44428. // Single element
  44429. if ( qualifier.nodeType ) {
  44430. return jQuery.grep( elements, function( elem ) {
  44431. return ( elem === qualifier ) !== not;
  44432. } );
  44433. }
  44434. // Arraylike of elements (jQuery, arguments, Array)
  44435. if ( typeof qualifier !== "string" ) {
  44436. return jQuery.grep( elements, function( elem ) {
  44437. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  44438. } );
  44439. }
  44440. // Filtered directly for both simple and complex selectors
  44441. return jQuery.filter( qualifier, elements, not );
  44442. }
  44443. jQuery.filter = function( expr, elems, not ) {
  44444. var elem = elems[ 0 ];
  44445. if ( not ) {
  44446. expr = ":not(" + expr + ")";
  44447. }
  44448. if ( elems.length === 1 && elem.nodeType === 1 ) {
  44449. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  44450. }
  44451. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  44452. return elem.nodeType === 1;
  44453. } ) );
  44454. };
  44455. jQuery.fn.extend( {
  44456. find: function( selector ) {
  44457. var i, ret,
  44458. len = this.length,
  44459. self = this;
  44460. if ( typeof selector !== "string" ) {
  44461. return this.pushStack( jQuery( selector ).filter( function() {
  44462. for ( i = 0; i < len; i++ ) {
  44463. if ( jQuery.contains( self[ i ], this ) ) {
  44464. return true;
  44465. }
  44466. }
  44467. } ) );
  44468. }
  44469. ret = this.pushStack( [] );
  44470. for ( i = 0; i < len; i++ ) {
  44471. jQuery.find( selector, self[ i ], ret );
  44472. }
  44473. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  44474. },
  44475. filter: function( selector ) {
  44476. return this.pushStack( winnow( this, selector || [], false ) );
  44477. },
  44478. not: function( selector ) {
  44479. return this.pushStack( winnow( this, selector || [], true ) );
  44480. },
  44481. is: function( selector ) {
  44482. return !!winnow(
  44483. this,
  44484. // If this is a positional/relative selector, check membership in the returned set
  44485. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  44486. typeof selector === "string" && rneedsContext.test( selector ) ?
  44487. jQuery( selector ) :
  44488. selector || [],
  44489. false
  44490. ).length;
  44491. }
  44492. } );
  44493. // Initialize a jQuery object
  44494. // A central reference to the root jQuery(document)
  44495. var rootjQuery,
  44496. // A simple way to check for HTML strings
  44497. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  44498. // Strict HTML recognition (#11290: must start with <)
  44499. // Shortcut simple #id case for speed
  44500. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  44501. init = jQuery.fn.init = function( selector, context, root ) {
  44502. var match, elem;
  44503. // HANDLE: $(""), $(null), $(undefined), $(false)
  44504. if ( !selector ) {
  44505. return this;
  44506. }
  44507. // Method init() accepts an alternate rootjQuery
  44508. // so migrate can support jQuery.sub (gh-2101)
  44509. root = root || rootjQuery;
  44510. // Handle HTML strings
  44511. if ( typeof selector === "string" ) {
  44512. if ( selector[ 0 ] === "<" &&
  44513. selector[ selector.length - 1 ] === ">" &&
  44514. selector.length >= 3 ) {
  44515. // Assume that strings that start and end with <> are HTML and skip the regex check
  44516. match = [ null, selector, null ];
  44517. } else {
  44518. match = rquickExpr.exec( selector );
  44519. }
  44520. // Match html or make sure no context is specified for #id
  44521. if ( match && ( match[ 1 ] || !context ) ) {
  44522. // HANDLE: $(html) -> $(array)
  44523. if ( match[ 1 ] ) {
  44524. context = context instanceof jQuery ? context[ 0 ] : context;
  44525. // Option to run scripts is true for back-compat
  44526. // Intentionally let the error be thrown if parseHTML is not present
  44527. jQuery.merge( this, jQuery.parseHTML(
  44528. match[ 1 ],
  44529. context && context.nodeType ? context.ownerDocument || context : document,
  44530. true
  44531. ) );
  44532. // HANDLE: $(html, props)
  44533. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  44534. for ( match in context ) {
  44535. // Properties of context are called as methods if possible
  44536. if ( isFunction( this[ match ] ) ) {
  44537. this[ match ]( context[ match ] );
  44538. // ...and otherwise set as attributes
  44539. } else {
  44540. this.attr( match, context[ match ] );
  44541. }
  44542. }
  44543. }
  44544. return this;
  44545. // HANDLE: $(#id)
  44546. } else {
  44547. elem = document.getElementById( match[ 2 ] );
  44548. if ( elem ) {
  44549. // Inject the element directly into the jQuery object
  44550. this[ 0 ] = elem;
  44551. this.length = 1;
  44552. }
  44553. return this;
  44554. }
  44555. // HANDLE: $(expr, $(...))
  44556. } else if ( !context || context.jquery ) {
  44557. return ( context || root ).find( selector );
  44558. // HANDLE: $(expr, context)
  44559. // (which is just equivalent to: $(context).find(expr)
  44560. } else {
  44561. return this.constructor( context ).find( selector );
  44562. }
  44563. // HANDLE: $(DOMElement)
  44564. } else if ( selector.nodeType ) {
  44565. this[ 0 ] = selector;
  44566. this.length = 1;
  44567. return this;
  44568. // HANDLE: $(function)
  44569. // Shortcut for document ready
  44570. } else if ( isFunction( selector ) ) {
  44571. return root.ready !== undefined ?
  44572. root.ready( selector ) :
  44573. // Execute immediately if ready is not present
  44574. selector( jQuery );
  44575. }
  44576. return jQuery.makeArray( selector, this );
  44577. };
  44578. // Give the init function the jQuery prototype for later instantiation
  44579. init.prototype = jQuery.fn;
  44580. // Initialize central reference
  44581. rootjQuery = jQuery( document );
  44582. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  44583. // Methods guaranteed to produce a unique set when starting from a unique set
  44584. guaranteedUnique = {
  44585. children: true,
  44586. contents: true,
  44587. next: true,
  44588. prev: true
  44589. };
  44590. jQuery.fn.extend( {
  44591. has: function( target ) {
  44592. var targets = jQuery( target, this ),
  44593. l = targets.length;
  44594. return this.filter( function() {
  44595. var i = 0;
  44596. for ( ; i < l; i++ ) {
  44597. if ( jQuery.contains( this, targets[ i ] ) ) {
  44598. return true;
  44599. }
  44600. }
  44601. } );
  44602. },
  44603. closest: function( selectors, context ) {
  44604. var cur,
  44605. i = 0,
  44606. l = this.length,
  44607. matched = [],
  44608. targets = typeof selectors !== "string" && jQuery( selectors );
  44609. // Positional selectors never match, since there's no _selection_ context
  44610. if ( !rneedsContext.test( selectors ) ) {
  44611. for ( ; i < l; i++ ) {
  44612. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  44613. // Always skip document fragments
  44614. if ( cur.nodeType < 11 && ( targets ?
  44615. targets.index( cur ) > -1 :
  44616. // Don't pass non-elements to Sizzle
  44617. cur.nodeType === 1 &&
  44618. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  44619. matched.push( cur );
  44620. break;
  44621. }
  44622. }
  44623. }
  44624. }
  44625. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  44626. },
  44627. // Determine the position of an element within the set
  44628. index: function( elem ) {
  44629. // No argument, return index in parent
  44630. if ( !elem ) {
  44631. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  44632. }
  44633. // Index in selector
  44634. if ( typeof elem === "string" ) {
  44635. return indexOf.call( jQuery( elem ), this[ 0 ] );
  44636. }
  44637. // Locate the position of the desired element
  44638. return indexOf.call( this,
  44639. // If it receives a jQuery object, the first element is used
  44640. elem.jquery ? elem[ 0 ] : elem
  44641. );
  44642. },
  44643. add: function( selector, context ) {
  44644. return this.pushStack(
  44645. jQuery.uniqueSort(
  44646. jQuery.merge( this.get(), jQuery( selector, context ) )
  44647. )
  44648. );
  44649. },
  44650. addBack: function( selector ) {
  44651. return this.add( selector == null ?
  44652. this.prevObject : this.prevObject.filter( selector )
  44653. );
  44654. }
  44655. } );
  44656. function sibling( cur, dir ) {
  44657. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  44658. return cur;
  44659. }
  44660. jQuery.each( {
  44661. parent: function( elem ) {
  44662. var parent = elem.parentNode;
  44663. return parent && parent.nodeType !== 11 ? parent : null;
  44664. },
  44665. parents: function( elem ) {
  44666. return dir( elem, "parentNode" );
  44667. },
  44668. parentsUntil: function( elem, i, until ) {
  44669. return dir( elem, "parentNode", until );
  44670. },
  44671. next: function( elem ) {
  44672. return sibling( elem, "nextSibling" );
  44673. },
  44674. prev: function( elem ) {
  44675. return sibling( elem, "previousSibling" );
  44676. },
  44677. nextAll: function( elem ) {
  44678. return dir( elem, "nextSibling" );
  44679. },
  44680. prevAll: function( elem ) {
  44681. return dir( elem, "previousSibling" );
  44682. },
  44683. nextUntil: function( elem, i, until ) {
  44684. return dir( elem, "nextSibling", until );
  44685. },
  44686. prevUntil: function( elem, i, until ) {
  44687. return dir( elem, "previousSibling", until );
  44688. },
  44689. siblings: function( elem ) {
  44690. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  44691. },
  44692. children: function( elem ) {
  44693. return siblings( elem.firstChild );
  44694. },
  44695. contents: function( elem ) {
  44696. if ( nodeName( elem, "iframe" ) ) {
  44697. return elem.contentDocument;
  44698. }
  44699. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  44700. // Treat the template element as a regular one in browsers that
  44701. // don't support it.
  44702. if ( nodeName( elem, "template" ) ) {
  44703. elem = elem.content || elem;
  44704. }
  44705. return jQuery.merge( [], elem.childNodes );
  44706. }
  44707. }, function( name, fn ) {
  44708. jQuery.fn[ name ] = function( until, selector ) {
  44709. var matched = jQuery.map( this, fn, until );
  44710. if ( name.slice( -5 ) !== "Until" ) {
  44711. selector = until;
  44712. }
  44713. if ( selector && typeof selector === "string" ) {
  44714. matched = jQuery.filter( selector, matched );
  44715. }
  44716. if ( this.length > 1 ) {
  44717. // Remove duplicates
  44718. if ( !guaranteedUnique[ name ] ) {
  44719. jQuery.uniqueSort( matched );
  44720. }
  44721. // Reverse order for parents* and prev-derivatives
  44722. if ( rparentsprev.test( name ) ) {
  44723. matched.reverse();
  44724. }
  44725. }
  44726. return this.pushStack( matched );
  44727. };
  44728. } );
  44729. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  44730. // Convert String-formatted options into Object-formatted ones
  44731. function createOptions( options ) {
  44732. var object = {};
  44733. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  44734. object[ flag ] = true;
  44735. } );
  44736. return object;
  44737. }
  44738. /*
  44739. * Create a callback list using the following parameters:
  44740. *
  44741. * options: an optional list of space-separated options that will change how
  44742. * the callback list behaves or a more traditional option object
  44743. *
  44744. * By default a callback list will act like an event callback list and can be
  44745. * "fired" multiple times.
  44746. *
  44747. * Possible options:
  44748. *
  44749. * once: will ensure the callback list can only be fired once (like a Deferred)
  44750. *
  44751. * memory: will keep track of previous values and will call any callback added
  44752. * after the list has been fired right away with the latest "memorized"
  44753. * values (like a Deferred)
  44754. *
  44755. * unique: will ensure a callback can only be added once (no duplicate in the list)
  44756. *
  44757. * stopOnFalse: interrupt callings when a callback returns false
  44758. *
  44759. */
  44760. jQuery.Callbacks = function( options ) {
  44761. // Convert options from String-formatted to Object-formatted if needed
  44762. // (we check in cache first)
  44763. options = typeof options === "string" ?
  44764. createOptions( options ) :
  44765. jQuery.extend( {}, options );
  44766. var // Flag to know if list is currently firing
  44767. firing,
  44768. // Last fire value for non-forgettable lists
  44769. memory,
  44770. // Flag to know if list was already fired
  44771. fired,
  44772. // Flag to prevent firing
  44773. locked,
  44774. // Actual callback list
  44775. list = [],
  44776. // Queue of execution data for repeatable lists
  44777. queue = [],
  44778. // Index of currently firing callback (modified by add/remove as needed)
  44779. firingIndex = -1,
  44780. // Fire callbacks
  44781. fire = function() {
  44782. // Enforce single-firing
  44783. locked = locked || options.once;
  44784. // Execute callbacks for all pending executions,
  44785. // respecting firingIndex overrides and runtime changes
  44786. fired = firing = true;
  44787. for ( ; queue.length; firingIndex = -1 ) {
  44788. memory = queue.shift();
  44789. while ( ++firingIndex < list.length ) {
  44790. // Run callback and check for early termination
  44791. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  44792. options.stopOnFalse ) {
  44793. // Jump to end and forget the data so .add doesn't re-fire
  44794. firingIndex = list.length;
  44795. memory = false;
  44796. }
  44797. }
  44798. }
  44799. // Forget the data if we're done with it
  44800. if ( !options.memory ) {
  44801. memory = false;
  44802. }
  44803. firing = false;
  44804. // Clean up if we're done firing for good
  44805. if ( locked ) {
  44806. // Keep an empty list if we have data for future add calls
  44807. if ( memory ) {
  44808. list = [];
  44809. // Otherwise, this object is spent
  44810. } else {
  44811. list = "";
  44812. }
  44813. }
  44814. },
  44815. // Actual Callbacks object
  44816. self = {
  44817. // Add a callback or a collection of callbacks to the list
  44818. add: function() {
  44819. if ( list ) {
  44820. // If we have memory from a past run, we should fire after adding
  44821. if ( memory && !firing ) {
  44822. firingIndex = list.length - 1;
  44823. queue.push( memory );
  44824. }
  44825. ( function add( args ) {
  44826. jQuery.each( args, function( _, arg ) {
  44827. if ( isFunction( arg ) ) {
  44828. if ( !options.unique || !self.has( arg ) ) {
  44829. list.push( arg );
  44830. }
  44831. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  44832. // Inspect recursively
  44833. add( arg );
  44834. }
  44835. } );
  44836. } )( arguments );
  44837. if ( memory && !firing ) {
  44838. fire();
  44839. }
  44840. }
  44841. return this;
  44842. },
  44843. // Remove a callback from the list
  44844. remove: function() {
  44845. jQuery.each( arguments, function( _, arg ) {
  44846. var index;
  44847. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  44848. list.splice( index, 1 );
  44849. // Handle firing indexes
  44850. if ( index <= firingIndex ) {
  44851. firingIndex--;
  44852. }
  44853. }
  44854. } );
  44855. return this;
  44856. },
  44857. // Check if a given callback is in the list.
  44858. // If no argument is given, return whether or not list has callbacks attached.
  44859. has: function( fn ) {
  44860. return fn ?
  44861. jQuery.inArray( fn, list ) > -1 :
  44862. list.length > 0;
  44863. },
  44864. // Remove all callbacks from the list
  44865. empty: function() {
  44866. if ( list ) {
  44867. list = [];
  44868. }
  44869. return this;
  44870. },
  44871. // Disable .fire and .add
  44872. // Abort any current/pending executions
  44873. // Clear all callbacks and values
  44874. disable: function() {
  44875. locked = queue = [];
  44876. list = memory = "";
  44877. return this;
  44878. },
  44879. disabled: function() {
  44880. return !list;
  44881. },
  44882. // Disable .fire
  44883. // Also disable .add unless we have memory (since it would have no effect)
  44884. // Abort any pending executions
  44885. lock: function() {
  44886. locked = queue = [];
  44887. if ( !memory && !firing ) {
  44888. list = memory = "";
  44889. }
  44890. return this;
  44891. },
  44892. locked: function() {
  44893. return !!locked;
  44894. },
  44895. // Call all callbacks with the given context and arguments
  44896. fireWith: function( context, args ) {
  44897. if ( !locked ) {
  44898. args = args || [];
  44899. args = [ context, args.slice ? args.slice() : args ];
  44900. queue.push( args );
  44901. if ( !firing ) {
  44902. fire();
  44903. }
  44904. }
  44905. return this;
  44906. },
  44907. // Call all the callbacks with the given arguments
  44908. fire: function() {
  44909. self.fireWith( this, arguments );
  44910. return this;
  44911. },
  44912. // To know if the callbacks have already been called at least once
  44913. fired: function() {
  44914. return !!fired;
  44915. }
  44916. };
  44917. return self;
  44918. };
  44919. function Identity( v ) {
  44920. return v;
  44921. }
  44922. function Thrower( ex ) {
  44923. throw ex;
  44924. }
  44925. function adoptValue( value, resolve, reject, noValue ) {
  44926. var method;
  44927. try {
  44928. // Check for promise aspect first to privilege synchronous behavior
  44929. if ( value && isFunction( ( method = value.promise ) ) ) {
  44930. method.call( value ).done( resolve ).fail( reject );
  44931. // Other thenables
  44932. } else if ( value && isFunction( ( method = value.then ) ) ) {
  44933. method.call( value, resolve, reject );
  44934. // Other non-thenables
  44935. } else {
  44936. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  44937. // * false: [ value ].slice( 0 ) => resolve( value )
  44938. // * true: [ value ].slice( 1 ) => resolve()
  44939. resolve.apply( undefined, [ value ].slice( noValue ) );
  44940. }
  44941. // For Promises/A+, convert exceptions into rejections
  44942. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  44943. // Deferred#then to conditionally suppress rejection.
  44944. } catch ( value ) {
  44945. // Support: Android 4.0 only
  44946. // Strict mode functions invoked without .call/.apply get global-object context
  44947. reject.apply( undefined, [ value ] );
  44948. }
  44949. }
  44950. jQuery.extend( {
  44951. Deferred: function( func ) {
  44952. var tuples = [
  44953. // action, add listener, callbacks,
  44954. // ... .then handlers, argument index, [final state]
  44955. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  44956. jQuery.Callbacks( "memory" ), 2 ],
  44957. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  44958. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  44959. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  44960. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  44961. ],
  44962. state = "pending",
  44963. promise = {
  44964. state: function() {
  44965. return state;
  44966. },
  44967. always: function() {
  44968. deferred.done( arguments ).fail( arguments );
  44969. return this;
  44970. },
  44971. "catch": function( fn ) {
  44972. return promise.then( null, fn );
  44973. },
  44974. // Keep pipe for back-compat
  44975. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  44976. var fns = arguments;
  44977. return jQuery.Deferred( function( newDefer ) {
  44978. jQuery.each( tuples, function( i, tuple ) {
  44979. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  44980. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  44981. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  44982. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  44983. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  44984. deferred[ tuple[ 1 ] ]( function() {
  44985. var returned = fn && fn.apply( this, arguments );
  44986. if ( returned && isFunction( returned.promise ) ) {
  44987. returned.promise()
  44988. .progress( newDefer.notify )
  44989. .done( newDefer.resolve )
  44990. .fail( newDefer.reject );
  44991. } else {
  44992. newDefer[ tuple[ 0 ] + "With" ](
  44993. this,
  44994. fn ? [ returned ] : arguments
  44995. );
  44996. }
  44997. } );
  44998. } );
  44999. fns = null;
  45000. } ).promise();
  45001. },
  45002. then: function( onFulfilled, onRejected, onProgress ) {
  45003. var maxDepth = 0;
  45004. function resolve( depth, deferred, handler, special ) {
  45005. return function() {
  45006. var that = this,
  45007. args = arguments,
  45008. mightThrow = function() {
  45009. var returned, then;
  45010. // Support: Promises/A+ section 2.3.3.3.3
  45011. // https://promisesaplus.com/#point-59
  45012. // Ignore double-resolution attempts
  45013. if ( depth < maxDepth ) {
  45014. return;
  45015. }
  45016. returned = handler.apply( that, args );
  45017. // Support: Promises/A+ section 2.3.1
  45018. // https://promisesaplus.com/#point-48
  45019. if ( returned === deferred.promise() ) {
  45020. throw new TypeError( "Thenable self-resolution" );
  45021. }
  45022. // Support: Promises/A+ sections 2.3.3.1, 3.5
  45023. // https://promisesaplus.com/#point-54
  45024. // https://promisesaplus.com/#point-75
  45025. // Retrieve `then` only once
  45026. then = returned &&
  45027. // Support: Promises/A+ section 2.3.4
  45028. // https://promisesaplus.com/#point-64
  45029. // Only check objects and functions for thenability
  45030. ( typeof returned === "object" ||
  45031. typeof returned === "function" ) &&
  45032. returned.then;
  45033. // Handle a returned thenable
  45034. if ( isFunction( then ) ) {
  45035. // Special processors (notify) just wait for resolution
  45036. if ( special ) {
  45037. then.call(
  45038. returned,
  45039. resolve( maxDepth, deferred, Identity, special ),
  45040. resolve( maxDepth, deferred, Thrower, special )
  45041. );
  45042. // Normal processors (resolve) also hook into progress
  45043. } else {
  45044. // ...and disregard older resolution values
  45045. maxDepth++;
  45046. then.call(
  45047. returned,
  45048. resolve( maxDepth, deferred, Identity, special ),
  45049. resolve( maxDepth, deferred, Thrower, special ),
  45050. resolve( maxDepth, deferred, Identity,
  45051. deferred.notifyWith )
  45052. );
  45053. }
  45054. // Handle all other returned values
  45055. } else {
  45056. // Only substitute handlers pass on context
  45057. // and multiple values (non-spec behavior)
  45058. if ( handler !== Identity ) {
  45059. that = undefined;
  45060. args = [ returned ];
  45061. }
  45062. // Process the value(s)
  45063. // Default process is resolve
  45064. ( special || deferred.resolveWith )( that, args );
  45065. }
  45066. },
  45067. // Only normal processors (resolve) catch and reject exceptions
  45068. process = special ?
  45069. mightThrow :
  45070. function() {
  45071. try {
  45072. mightThrow();
  45073. } catch ( e ) {
  45074. if ( jQuery.Deferred.exceptionHook ) {
  45075. jQuery.Deferred.exceptionHook( e,
  45076. process.stackTrace );
  45077. }
  45078. // Support: Promises/A+ section 2.3.3.3.4.1
  45079. // https://promisesaplus.com/#point-61
  45080. // Ignore post-resolution exceptions
  45081. if ( depth + 1 >= maxDepth ) {
  45082. // Only substitute handlers pass on context
  45083. // and multiple values (non-spec behavior)
  45084. if ( handler !== Thrower ) {
  45085. that = undefined;
  45086. args = [ e ];
  45087. }
  45088. deferred.rejectWith( that, args );
  45089. }
  45090. }
  45091. };
  45092. // Support: Promises/A+ section 2.3.3.3.1
  45093. // https://promisesaplus.com/#point-57
  45094. // Re-resolve promises immediately to dodge false rejection from
  45095. // subsequent errors
  45096. if ( depth ) {
  45097. process();
  45098. } else {
  45099. // Call an optional hook to record the stack, in case of exception
  45100. // since it's otherwise lost when execution goes async
  45101. if ( jQuery.Deferred.getStackHook ) {
  45102. process.stackTrace = jQuery.Deferred.getStackHook();
  45103. }
  45104. window.setTimeout( process );
  45105. }
  45106. };
  45107. }
  45108. return jQuery.Deferred( function( newDefer ) {
  45109. // progress_handlers.add( ... )
  45110. tuples[ 0 ][ 3 ].add(
  45111. resolve(
  45112. 0,
  45113. newDefer,
  45114. isFunction( onProgress ) ?
  45115. onProgress :
  45116. Identity,
  45117. newDefer.notifyWith
  45118. )
  45119. );
  45120. // fulfilled_handlers.add( ... )
  45121. tuples[ 1 ][ 3 ].add(
  45122. resolve(
  45123. 0,
  45124. newDefer,
  45125. isFunction( onFulfilled ) ?
  45126. onFulfilled :
  45127. Identity
  45128. )
  45129. );
  45130. // rejected_handlers.add( ... )
  45131. tuples[ 2 ][ 3 ].add(
  45132. resolve(
  45133. 0,
  45134. newDefer,
  45135. isFunction( onRejected ) ?
  45136. onRejected :
  45137. Thrower
  45138. )
  45139. );
  45140. } ).promise();
  45141. },
  45142. // Get a promise for this deferred
  45143. // If obj is provided, the promise aspect is added to the object
  45144. promise: function( obj ) {
  45145. return obj != null ? jQuery.extend( obj, promise ) : promise;
  45146. }
  45147. },
  45148. deferred = {};
  45149. // Add list-specific methods
  45150. jQuery.each( tuples, function( i, tuple ) {
  45151. var list = tuple[ 2 ],
  45152. stateString = tuple[ 5 ];
  45153. // promise.progress = list.add
  45154. // promise.done = list.add
  45155. // promise.fail = list.add
  45156. promise[ tuple[ 1 ] ] = list.add;
  45157. // Handle state
  45158. if ( stateString ) {
  45159. list.add(
  45160. function() {
  45161. // state = "resolved" (i.e., fulfilled)
  45162. // state = "rejected"
  45163. state = stateString;
  45164. },
  45165. // rejected_callbacks.disable
  45166. // fulfilled_callbacks.disable
  45167. tuples[ 3 - i ][ 2 ].disable,
  45168. // rejected_handlers.disable
  45169. // fulfilled_handlers.disable
  45170. tuples[ 3 - i ][ 3 ].disable,
  45171. // progress_callbacks.lock
  45172. tuples[ 0 ][ 2 ].lock,
  45173. // progress_handlers.lock
  45174. tuples[ 0 ][ 3 ].lock
  45175. );
  45176. }
  45177. // progress_handlers.fire
  45178. // fulfilled_handlers.fire
  45179. // rejected_handlers.fire
  45180. list.add( tuple[ 3 ].fire );
  45181. // deferred.notify = function() { deferred.notifyWith(...) }
  45182. // deferred.resolve = function() { deferred.resolveWith(...) }
  45183. // deferred.reject = function() { deferred.rejectWith(...) }
  45184. deferred[ tuple[ 0 ] ] = function() {
  45185. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  45186. return this;
  45187. };
  45188. // deferred.notifyWith = list.fireWith
  45189. // deferred.resolveWith = list.fireWith
  45190. // deferred.rejectWith = list.fireWith
  45191. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  45192. } );
  45193. // Make the deferred a promise
  45194. promise.promise( deferred );
  45195. // Call given func if any
  45196. if ( func ) {
  45197. func.call( deferred, deferred );
  45198. }
  45199. // All done!
  45200. return deferred;
  45201. },
  45202. // Deferred helper
  45203. when: function( singleValue ) {
  45204. var
  45205. // count of uncompleted subordinates
  45206. remaining = arguments.length,
  45207. // count of unprocessed arguments
  45208. i = remaining,
  45209. // subordinate fulfillment data
  45210. resolveContexts = Array( i ),
  45211. resolveValues = slice.call( arguments ),
  45212. // the master Deferred
  45213. master = jQuery.Deferred(),
  45214. // subordinate callback factory
  45215. updateFunc = function( i ) {
  45216. return function( value ) {
  45217. resolveContexts[ i ] = this;
  45218. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  45219. if ( !( --remaining ) ) {
  45220. master.resolveWith( resolveContexts, resolveValues );
  45221. }
  45222. };
  45223. };
  45224. // Single- and empty arguments are adopted like Promise.resolve
  45225. if ( remaining <= 1 ) {
  45226. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  45227. !remaining );
  45228. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  45229. if ( master.state() === "pending" ||
  45230. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  45231. return master.then();
  45232. }
  45233. }
  45234. // Multiple arguments are aggregated like Promise.all array elements
  45235. while ( i-- ) {
  45236. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  45237. }
  45238. return master.promise();
  45239. }
  45240. } );
  45241. // These usually indicate a programmer mistake during development,
  45242. // warn about them ASAP rather than swallowing them by default.
  45243. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  45244. jQuery.Deferred.exceptionHook = function( error, stack ) {
  45245. // Support: IE 8 - 9 only
  45246. // Console exists when dev tools are open, which can happen at any time
  45247. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  45248. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  45249. }
  45250. };
  45251. jQuery.readyException = function( error ) {
  45252. window.setTimeout( function() {
  45253. throw error;
  45254. } );
  45255. };
  45256. // The deferred used on DOM ready
  45257. var readyList = jQuery.Deferred();
  45258. jQuery.fn.ready = function( fn ) {
  45259. readyList
  45260. .then( fn )
  45261. // Wrap jQuery.readyException in a function so that the lookup
  45262. // happens at the time of error handling instead of callback
  45263. // registration.
  45264. .catch( function( error ) {
  45265. jQuery.readyException( error );
  45266. } );
  45267. return this;
  45268. };
  45269. jQuery.extend( {
  45270. // Is the DOM ready to be used? Set to true once it occurs.
  45271. isReady: false,
  45272. // A counter to track how many items to wait for before
  45273. // the ready event fires. See #6781
  45274. readyWait: 1,
  45275. // Handle when the DOM is ready
  45276. ready: function( wait ) {
  45277. // Abort if there are pending holds or we're already ready
  45278. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  45279. return;
  45280. }
  45281. // Remember that the DOM is ready
  45282. jQuery.isReady = true;
  45283. // If a normal DOM Ready event fired, decrement, and wait if need be
  45284. if ( wait !== true && --jQuery.readyWait > 0 ) {
  45285. return;
  45286. }
  45287. // If there are functions bound, to execute
  45288. readyList.resolveWith( document, [ jQuery ] );
  45289. }
  45290. } );
  45291. jQuery.ready.then = readyList.then;
  45292. // The ready event handler and self cleanup method
  45293. function completed() {
  45294. document.removeEventListener( "DOMContentLoaded", completed );
  45295. window.removeEventListener( "load", completed );
  45296. jQuery.ready();
  45297. }
  45298. // Catch cases where $(document).ready() is called
  45299. // after the browser event has already occurred.
  45300. // Support: IE <=9 - 10 only
  45301. // Older IE sometimes signals "interactive" too soon
  45302. if ( document.readyState === "complete" ||
  45303. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  45304. // Handle it asynchronously to allow scripts the opportunity to delay ready
  45305. window.setTimeout( jQuery.ready );
  45306. } else {
  45307. // Use the handy event callback
  45308. document.addEventListener( "DOMContentLoaded", completed );
  45309. // A fallback to window.onload, that will always work
  45310. window.addEventListener( "load", completed );
  45311. }
  45312. // Multifunctional method to get and set values of a collection
  45313. // The value/s can optionally be executed if it's a function
  45314. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  45315. var i = 0,
  45316. len = elems.length,
  45317. bulk = key == null;
  45318. // Sets many values
  45319. if ( toType( key ) === "object" ) {
  45320. chainable = true;
  45321. for ( i in key ) {
  45322. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  45323. }
  45324. // Sets one value
  45325. } else if ( value !== undefined ) {
  45326. chainable = true;
  45327. if ( !isFunction( value ) ) {
  45328. raw = true;
  45329. }
  45330. if ( bulk ) {
  45331. // Bulk operations run against the entire set
  45332. if ( raw ) {
  45333. fn.call( elems, value );
  45334. fn = null;
  45335. // ...except when executing function values
  45336. } else {
  45337. bulk = fn;
  45338. fn = function( elem, key, value ) {
  45339. return bulk.call( jQuery( elem ), value );
  45340. };
  45341. }
  45342. }
  45343. if ( fn ) {
  45344. for ( ; i < len; i++ ) {
  45345. fn(
  45346. elems[ i ], key, raw ?
  45347. value :
  45348. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  45349. );
  45350. }
  45351. }
  45352. }
  45353. if ( chainable ) {
  45354. return elems;
  45355. }
  45356. // Gets
  45357. if ( bulk ) {
  45358. return fn.call( elems );
  45359. }
  45360. return len ? fn( elems[ 0 ], key ) : emptyGet;
  45361. };
  45362. // Matches dashed string for camelizing
  45363. var rmsPrefix = /^-ms-/,
  45364. rdashAlpha = /-([a-z])/g;
  45365. // Used by camelCase as callback to replace()
  45366. function fcamelCase( all, letter ) {
  45367. return letter.toUpperCase();
  45368. }
  45369. // Convert dashed to camelCase; used by the css and data modules
  45370. // Support: IE <=9 - 11, Edge 12 - 15
  45371. // Microsoft forgot to hump their vendor prefix (#9572)
  45372. function camelCase( string ) {
  45373. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  45374. }
  45375. var acceptData = function( owner ) {
  45376. // Accepts only:
  45377. // - Node
  45378. // - Node.ELEMENT_NODE
  45379. // - Node.DOCUMENT_NODE
  45380. // - Object
  45381. // - Any
  45382. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  45383. };
  45384. function Data() {
  45385. this.expando = jQuery.expando + Data.uid++;
  45386. }
  45387. Data.uid = 1;
  45388. Data.prototype = {
  45389. cache: function( owner ) {
  45390. // Check if the owner object already has a cache
  45391. var value = owner[ this.expando ];
  45392. // If not, create one
  45393. if ( !value ) {
  45394. value = {};
  45395. // We can accept data for non-element nodes in modern browsers,
  45396. // but we should not, see #8335.
  45397. // Always return an empty object.
  45398. if ( acceptData( owner ) ) {
  45399. // If it is a node unlikely to be stringify-ed or looped over
  45400. // use plain assignment
  45401. if ( owner.nodeType ) {
  45402. owner[ this.expando ] = value;
  45403. // Otherwise secure it in a non-enumerable property
  45404. // configurable must be true to allow the property to be
  45405. // deleted when data is removed
  45406. } else {
  45407. Object.defineProperty( owner, this.expando, {
  45408. value: value,
  45409. configurable: true
  45410. } );
  45411. }
  45412. }
  45413. }
  45414. return value;
  45415. },
  45416. set: function( owner, data, value ) {
  45417. var prop,
  45418. cache = this.cache( owner );
  45419. // Handle: [ owner, key, value ] args
  45420. // Always use camelCase key (gh-2257)
  45421. if ( typeof data === "string" ) {
  45422. cache[ camelCase( data ) ] = value;
  45423. // Handle: [ owner, { properties } ] args
  45424. } else {
  45425. // Copy the properties one-by-one to the cache object
  45426. for ( prop in data ) {
  45427. cache[ camelCase( prop ) ] = data[ prop ];
  45428. }
  45429. }
  45430. return cache;
  45431. },
  45432. get: function( owner, key ) {
  45433. return key === undefined ?
  45434. this.cache( owner ) :
  45435. // Always use camelCase key (gh-2257)
  45436. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  45437. },
  45438. access: function( owner, key, value ) {
  45439. // In cases where either:
  45440. //
  45441. // 1. No key was specified
  45442. // 2. A string key was specified, but no value provided
  45443. //
  45444. // Take the "read" path and allow the get method to determine
  45445. // which value to return, respectively either:
  45446. //
  45447. // 1. The entire cache object
  45448. // 2. The data stored at the key
  45449. //
  45450. if ( key === undefined ||
  45451. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  45452. return this.get( owner, key );
  45453. }
  45454. // When the key is not a string, or both a key and value
  45455. // are specified, set or extend (existing objects) with either:
  45456. //
  45457. // 1. An object of properties
  45458. // 2. A key and value
  45459. //
  45460. this.set( owner, key, value );
  45461. // Since the "set" path can have two possible entry points
  45462. // return the expected data based on which path was taken[*]
  45463. return value !== undefined ? value : key;
  45464. },
  45465. remove: function( owner, key ) {
  45466. var i,
  45467. cache = owner[ this.expando ];
  45468. if ( cache === undefined ) {
  45469. return;
  45470. }
  45471. if ( key !== undefined ) {
  45472. // Support array or space separated string of keys
  45473. if ( Array.isArray( key ) ) {
  45474. // If key is an array of keys...
  45475. // We always set camelCase keys, so remove that.
  45476. key = key.map( camelCase );
  45477. } else {
  45478. key = camelCase( key );
  45479. // If a key with the spaces exists, use it.
  45480. // Otherwise, create an array by matching non-whitespace
  45481. key = key in cache ?
  45482. [ key ] :
  45483. ( key.match( rnothtmlwhite ) || [] );
  45484. }
  45485. i = key.length;
  45486. while ( i-- ) {
  45487. delete cache[ key[ i ] ];
  45488. }
  45489. }
  45490. // Remove the expando if there's no more data
  45491. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  45492. // Support: Chrome <=35 - 45
  45493. // Webkit & Blink performance suffers when deleting properties
  45494. // from DOM nodes, so set to undefined instead
  45495. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  45496. if ( owner.nodeType ) {
  45497. owner[ this.expando ] = undefined;
  45498. } else {
  45499. delete owner[ this.expando ];
  45500. }
  45501. }
  45502. },
  45503. hasData: function( owner ) {
  45504. var cache = owner[ this.expando ];
  45505. return cache !== undefined && !jQuery.isEmptyObject( cache );
  45506. }
  45507. };
  45508. var dataPriv = new Data();
  45509. var dataUser = new Data();
  45510. // Implementation Summary
  45511. //
  45512. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  45513. // 2. Improve the module's maintainability by reducing the storage
  45514. // paths to a single mechanism.
  45515. // 3. Use the same single mechanism to support "private" and "user" data.
  45516. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  45517. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  45518. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  45519. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  45520. rmultiDash = /[A-Z]/g;
  45521. function getData( data ) {
  45522. if ( data === "true" ) {
  45523. return true;
  45524. }
  45525. if ( data === "false" ) {
  45526. return false;
  45527. }
  45528. if ( data === "null" ) {
  45529. return null;
  45530. }
  45531. // Only convert to a number if it doesn't change the string
  45532. if ( data === +data + "" ) {
  45533. return +data;
  45534. }
  45535. if ( rbrace.test( data ) ) {
  45536. return JSON.parse( data );
  45537. }
  45538. return data;
  45539. }
  45540. function dataAttr( elem, key, data ) {
  45541. var name;
  45542. // If nothing was found internally, try to fetch any
  45543. // data from the HTML5 data-* attribute
  45544. if ( data === undefined && elem.nodeType === 1 ) {
  45545. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  45546. data = elem.getAttribute( name );
  45547. if ( typeof data === "string" ) {
  45548. try {
  45549. data = getData( data );
  45550. } catch ( e ) {}
  45551. // Make sure we set the data so it isn't changed later
  45552. dataUser.set( elem, key, data );
  45553. } else {
  45554. data = undefined;
  45555. }
  45556. }
  45557. return data;
  45558. }
  45559. jQuery.extend( {
  45560. hasData: function( elem ) {
  45561. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  45562. },
  45563. data: function( elem, name, data ) {
  45564. return dataUser.access( elem, name, data );
  45565. },
  45566. removeData: function( elem, name ) {
  45567. dataUser.remove( elem, name );
  45568. },
  45569. // TODO: Now that all calls to _data and _removeData have been replaced
  45570. // with direct calls to dataPriv methods, these can be deprecated.
  45571. _data: function( elem, name, data ) {
  45572. return dataPriv.access( elem, name, data );
  45573. },
  45574. _removeData: function( elem, name ) {
  45575. dataPriv.remove( elem, name );
  45576. }
  45577. } );
  45578. jQuery.fn.extend( {
  45579. data: function( key, value ) {
  45580. var i, name, data,
  45581. elem = this[ 0 ],
  45582. attrs = elem && elem.attributes;
  45583. // Gets all values
  45584. if ( key === undefined ) {
  45585. if ( this.length ) {
  45586. data = dataUser.get( elem );
  45587. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  45588. i = attrs.length;
  45589. while ( i-- ) {
  45590. // Support: IE 11 only
  45591. // The attrs elements can be null (#14894)
  45592. if ( attrs[ i ] ) {
  45593. name = attrs[ i ].name;
  45594. if ( name.indexOf( "data-" ) === 0 ) {
  45595. name = camelCase( name.slice( 5 ) );
  45596. dataAttr( elem, name, data[ name ] );
  45597. }
  45598. }
  45599. }
  45600. dataPriv.set( elem, "hasDataAttrs", true );
  45601. }
  45602. }
  45603. return data;
  45604. }
  45605. // Sets multiple values
  45606. if ( typeof key === "object" ) {
  45607. return this.each( function() {
  45608. dataUser.set( this, key );
  45609. } );
  45610. }
  45611. return access( this, function( value ) {
  45612. var data;
  45613. // The calling jQuery object (element matches) is not empty
  45614. // (and therefore has an element appears at this[ 0 ]) and the
  45615. // `value` parameter was not undefined. An empty jQuery object
  45616. // will result in `undefined` for elem = this[ 0 ] which will
  45617. // throw an exception if an attempt to read a data cache is made.
  45618. if ( elem && value === undefined ) {
  45619. // Attempt to get data from the cache
  45620. // The key will always be camelCased in Data
  45621. data = dataUser.get( elem, key );
  45622. if ( data !== undefined ) {
  45623. return data;
  45624. }
  45625. // Attempt to "discover" the data in
  45626. // HTML5 custom data-* attrs
  45627. data = dataAttr( elem, key );
  45628. if ( data !== undefined ) {
  45629. return data;
  45630. }
  45631. // We tried really hard, but the data doesn't exist.
  45632. return;
  45633. }
  45634. // Set the data...
  45635. this.each( function() {
  45636. // We always store the camelCased key
  45637. dataUser.set( this, key, value );
  45638. } );
  45639. }, null, value, arguments.length > 1, null, true );
  45640. },
  45641. removeData: function( key ) {
  45642. return this.each( function() {
  45643. dataUser.remove( this, key );
  45644. } );
  45645. }
  45646. } );
  45647. jQuery.extend( {
  45648. queue: function( elem, type, data ) {
  45649. var queue;
  45650. if ( elem ) {
  45651. type = ( type || "fx" ) + "queue";
  45652. queue = dataPriv.get( elem, type );
  45653. // Speed up dequeue by getting out quickly if this is just a lookup
  45654. if ( data ) {
  45655. if ( !queue || Array.isArray( data ) ) {
  45656. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  45657. } else {
  45658. queue.push( data );
  45659. }
  45660. }
  45661. return queue || [];
  45662. }
  45663. },
  45664. dequeue: function( elem, type ) {
  45665. type = type || "fx";
  45666. var queue = jQuery.queue( elem, type ),
  45667. startLength = queue.length,
  45668. fn = queue.shift(),
  45669. hooks = jQuery._queueHooks( elem, type ),
  45670. next = function() {
  45671. jQuery.dequeue( elem, type );
  45672. };
  45673. // If the fx queue is dequeued, always remove the progress sentinel
  45674. if ( fn === "inprogress" ) {
  45675. fn = queue.shift();
  45676. startLength--;
  45677. }
  45678. if ( fn ) {
  45679. // Add a progress sentinel to prevent the fx queue from being
  45680. // automatically dequeued
  45681. if ( type === "fx" ) {
  45682. queue.unshift( "inprogress" );
  45683. }
  45684. // Clear up the last queue stop function
  45685. delete hooks.stop;
  45686. fn.call( elem, next, hooks );
  45687. }
  45688. if ( !startLength && hooks ) {
  45689. hooks.empty.fire();
  45690. }
  45691. },
  45692. // Not public - generate a queueHooks object, or return the current one
  45693. _queueHooks: function( elem, type ) {
  45694. var key = type + "queueHooks";
  45695. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  45696. empty: jQuery.Callbacks( "once memory" ).add( function() {
  45697. dataPriv.remove( elem, [ type + "queue", key ] );
  45698. } )
  45699. } );
  45700. }
  45701. } );
  45702. jQuery.fn.extend( {
  45703. queue: function( type, data ) {
  45704. var setter = 2;
  45705. if ( typeof type !== "string" ) {
  45706. data = type;
  45707. type = "fx";
  45708. setter--;
  45709. }
  45710. if ( arguments.length < setter ) {
  45711. return jQuery.queue( this[ 0 ], type );
  45712. }
  45713. return data === undefined ?
  45714. this :
  45715. this.each( function() {
  45716. var queue = jQuery.queue( this, type, data );
  45717. // Ensure a hooks for this queue
  45718. jQuery._queueHooks( this, type );
  45719. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  45720. jQuery.dequeue( this, type );
  45721. }
  45722. } );
  45723. },
  45724. dequeue: function( type ) {
  45725. return this.each( function() {
  45726. jQuery.dequeue( this, type );
  45727. } );
  45728. },
  45729. clearQueue: function( type ) {
  45730. return this.queue( type || "fx", [] );
  45731. },
  45732. // Get a promise resolved when queues of a certain type
  45733. // are emptied (fx is the type by default)
  45734. promise: function( type, obj ) {
  45735. var tmp,
  45736. count = 1,
  45737. defer = jQuery.Deferred(),
  45738. elements = this,
  45739. i = this.length,
  45740. resolve = function() {
  45741. if ( !( --count ) ) {
  45742. defer.resolveWith( elements, [ elements ] );
  45743. }
  45744. };
  45745. if ( typeof type !== "string" ) {
  45746. obj = type;
  45747. type = undefined;
  45748. }
  45749. type = type || "fx";
  45750. while ( i-- ) {
  45751. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  45752. if ( tmp && tmp.empty ) {
  45753. count++;
  45754. tmp.empty.add( resolve );
  45755. }
  45756. }
  45757. resolve();
  45758. return defer.promise( obj );
  45759. }
  45760. } );
  45761. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  45762. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  45763. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  45764. var isHiddenWithinTree = function( elem, el ) {
  45765. // isHiddenWithinTree might be called from jQuery#filter function;
  45766. // in that case, element will be second argument
  45767. elem = el || elem;
  45768. // Inline style trumps all
  45769. return elem.style.display === "none" ||
  45770. elem.style.display === "" &&
  45771. // Otherwise, check computed style
  45772. // Support: Firefox <=43 - 45
  45773. // Disconnected elements can have computed display: none, so first confirm that elem is
  45774. // in the document.
  45775. jQuery.contains( elem.ownerDocument, elem ) &&
  45776. jQuery.css( elem, "display" ) === "none";
  45777. };
  45778. var swap = function( elem, options, callback, args ) {
  45779. var ret, name,
  45780. old = {};
  45781. // Remember the old values, and insert the new ones
  45782. for ( name in options ) {
  45783. old[ name ] = elem.style[ name ];
  45784. elem.style[ name ] = options[ name ];
  45785. }
  45786. ret = callback.apply( elem, args || [] );
  45787. // Revert the old values
  45788. for ( name in options ) {
  45789. elem.style[ name ] = old[ name ];
  45790. }
  45791. return ret;
  45792. };
  45793. function adjustCSS( elem, prop, valueParts, tween ) {
  45794. var adjusted, scale,
  45795. maxIterations = 20,
  45796. currentValue = tween ?
  45797. function() {
  45798. return tween.cur();
  45799. } :
  45800. function() {
  45801. return jQuery.css( elem, prop, "" );
  45802. },
  45803. initial = currentValue(),
  45804. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  45805. // Starting value computation is required for potential unit mismatches
  45806. initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  45807. rcssNum.exec( jQuery.css( elem, prop ) );
  45808. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  45809. // Support: Firefox <=54
  45810. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  45811. initial = initial / 2;
  45812. // Trust units reported by jQuery.css
  45813. unit = unit || initialInUnit[ 3 ];
  45814. // Iteratively approximate from a nonzero starting point
  45815. initialInUnit = +initial || 1;
  45816. while ( maxIterations-- ) {
  45817. // Evaluate and update our best guess (doubling guesses that zero out).
  45818. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  45819. jQuery.style( elem, prop, initialInUnit + unit );
  45820. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  45821. maxIterations = 0;
  45822. }
  45823. initialInUnit = initialInUnit / scale;
  45824. }
  45825. initialInUnit = initialInUnit * 2;
  45826. jQuery.style( elem, prop, initialInUnit + unit );
  45827. // Make sure we update the tween properties later on
  45828. valueParts = valueParts || [];
  45829. }
  45830. if ( valueParts ) {
  45831. initialInUnit = +initialInUnit || +initial || 0;
  45832. // Apply relative offset (+=/-=) if specified
  45833. adjusted = valueParts[ 1 ] ?
  45834. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  45835. +valueParts[ 2 ];
  45836. if ( tween ) {
  45837. tween.unit = unit;
  45838. tween.start = initialInUnit;
  45839. tween.end = adjusted;
  45840. }
  45841. }
  45842. return adjusted;
  45843. }
  45844. var defaultDisplayMap = {};
  45845. function getDefaultDisplay( elem ) {
  45846. var temp,
  45847. doc = elem.ownerDocument,
  45848. nodeName = elem.nodeName,
  45849. display = defaultDisplayMap[ nodeName ];
  45850. if ( display ) {
  45851. return display;
  45852. }
  45853. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  45854. display = jQuery.css( temp, "display" );
  45855. temp.parentNode.removeChild( temp );
  45856. if ( display === "none" ) {
  45857. display = "block";
  45858. }
  45859. defaultDisplayMap[ nodeName ] = display;
  45860. return display;
  45861. }
  45862. function showHide( elements, show ) {
  45863. var display, elem,
  45864. values = [],
  45865. index = 0,
  45866. length = elements.length;
  45867. // Determine new display value for elements that need to change
  45868. for ( ; index < length; index++ ) {
  45869. elem = elements[ index ];
  45870. if ( !elem.style ) {
  45871. continue;
  45872. }
  45873. display = elem.style.display;
  45874. if ( show ) {
  45875. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  45876. // check is required in this first loop unless we have a nonempty display value (either
  45877. // inline or about-to-be-restored)
  45878. if ( display === "none" ) {
  45879. values[ index ] = dataPriv.get( elem, "display" ) || null;
  45880. if ( !values[ index ] ) {
  45881. elem.style.display = "";
  45882. }
  45883. }
  45884. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  45885. values[ index ] = getDefaultDisplay( elem );
  45886. }
  45887. } else {
  45888. if ( display !== "none" ) {
  45889. values[ index ] = "none";
  45890. // Remember what we're overwriting
  45891. dataPriv.set( elem, "display", display );
  45892. }
  45893. }
  45894. }
  45895. // Set the display of the elements in a second loop to avoid constant reflow
  45896. for ( index = 0; index < length; index++ ) {
  45897. if ( values[ index ] != null ) {
  45898. elements[ index ].style.display = values[ index ];
  45899. }
  45900. }
  45901. return elements;
  45902. }
  45903. jQuery.fn.extend( {
  45904. show: function() {
  45905. return showHide( this, true );
  45906. },
  45907. hide: function() {
  45908. return showHide( this );
  45909. },
  45910. toggle: function( state ) {
  45911. if ( typeof state === "boolean" ) {
  45912. return state ? this.show() : this.hide();
  45913. }
  45914. return this.each( function() {
  45915. if ( isHiddenWithinTree( this ) ) {
  45916. jQuery( this ).show();
  45917. } else {
  45918. jQuery( this ).hide();
  45919. }
  45920. } );
  45921. }
  45922. } );
  45923. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  45924. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]+)/i );
  45925. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  45926. // We have to close these tags to support XHTML (#13200)
  45927. var wrapMap = {
  45928. // Support: IE <=9 only
  45929. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  45930. // XHTML parsers do not magically insert elements in the
  45931. // same way that tag soup parsers do. So we cannot shorten
  45932. // this by omitting <tbody> or other required elements.
  45933. thead: [ 1, "<table>", "</table>" ],
  45934. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  45935. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  45936. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  45937. _default: [ 0, "", "" ]
  45938. };
  45939. // Support: IE <=9 only
  45940. wrapMap.optgroup = wrapMap.option;
  45941. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  45942. wrapMap.th = wrapMap.td;
  45943. function getAll( context, tag ) {
  45944. // Support: IE <=9 - 11 only
  45945. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  45946. var ret;
  45947. if ( typeof context.getElementsByTagName !== "undefined" ) {
  45948. ret = context.getElementsByTagName( tag || "*" );
  45949. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  45950. ret = context.querySelectorAll( tag || "*" );
  45951. } else {
  45952. ret = [];
  45953. }
  45954. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  45955. return jQuery.merge( [ context ], ret );
  45956. }
  45957. return ret;
  45958. }
  45959. // Mark scripts as having already been evaluated
  45960. function setGlobalEval( elems, refElements ) {
  45961. var i = 0,
  45962. l = elems.length;
  45963. for ( ; i < l; i++ ) {
  45964. dataPriv.set(
  45965. elems[ i ],
  45966. "globalEval",
  45967. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  45968. );
  45969. }
  45970. }
  45971. var rhtml = /<|&#?\w+;/;
  45972. function buildFragment( elems, context, scripts, selection, ignored ) {
  45973. var elem, tmp, tag, wrap, contains, j,
  45974. fragment = context.createDocumentFragment(),
  45975. nodes = [],
  45976. i = 0,
  45977. l = elems.length;
  45978. for ( ; i < l; i++ ) {
  45979. elem = elems[ i ];
  45980. if ( elem || elem === 0 ) {
  45981. // Add nodes directly
  45982. if ( toType( elem ) === "object" ) {
  45983. // Support: Android <=4.0 only, PhantomJS 1 only
  45984. // push.apply(_, arraylike) throws on ancient WebKit
  45985. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  45986. // Convert non-html into a text node
  45987. } else if ( !rhtml.test( elem ) ) {
  45988. nodes.push( context.createTextNode( elem ) );
  45989. // Convert html into DOM nodes
  45990. } else {
  45991. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  45992. // Deserialize a standard representation
  45993. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  45994. wrap = wrapMap[ tag ] || wrapMap._default;
  45995. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  45996. // Descend through wrappers to the right content
  45997. j = wrap[ 0 ];
  45998. while ( j-- ) {
  45999. tmp = tmp.lastChild;
  46000. }
  46001. // Support: Android <=4.0 only, PhantomJS 1 only
  46002. // push.apply(_, arraylike) throws on ancient WebKit
  46003. jQuery.merge( nodes, tmp.childNodes );
  46004. // Remember the top-level container
  46005. tmp = fragment.firstChild;
  46006. // Ensure the created nodes are orphaned (#12392)
  46007. tmp.textContent = "";
  46008. }
  46009. }
  46010. }
  46011. // Remove wrapper from fragment
  46012. fragment.textContent = "";
  46013. i = 0;
  46014. while ( ( elem = nodes[ i++ ] ) ) {
  46015. // Skip elements already in the context collection (trac-4087)
  46016. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  46017. if ( ignored ) {
  46018. ignored.push( elem );
  46019. }
  46020. continue;
  46021. }
  46022. contains = jQuery.contains( elem.ownerDocument, elem );
  46023. // Append to fragment
  46024. tmp = getAll( fragment.appendChild( elem ), "script" );
  46025. // Preserve script evaluation history
  46026. if ( contains ) {
  46027. setGlobalEval( tmp );
  46028. }
  46029. // Capture executables
  46030. if ( scripts ) {
  46031. j = 0;
  46032. while ( ( elem = tmp[ j++ ] ) ) {
  46033. if ( rscriptType.test( elem.type || "" ) ) {
  46034. scripts.push( elem );
  46035. }
  46036. }
  46037. }
  46038. }
  46039. return fragment;
  46040. }
  46041. ( function() {
  46042. var fragment = document.createDocumentFragment(),
  46043. div = fragment.appendChild( document.createElement( "div" ) ),
  46044. input = document.createElement( "input" );
  46045. // Support: Android 4.0 - 4.3 only
  46046. // Check state lost if the name is set (#11217)
  46047. // Support: Windows Web Apps (WWA)
  46048. // `name` and `type` must use .setAttribute for WWA (#14901)
  46049. input.setAttribute( "type", "radio" );
  46050. input.setAttribute( "checked", "checked" );
  46051. input.setAttribute( "name", "t" );
  46052. div.appendChild( input );
  46053. // Support: Android <=4.1 only
  46054. // Older WebKit doesn't clone checked state correctly in fragments
  46055. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  46056. // Support: IE <=11 only
  46057. // Make sure textarea (and checkbox) defaultValue is properly cloned
  46058. div.innerHTML = "<textarea>x</textarea>";
  46059. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  46060. } )();
  46061. var documentElement = document.documentElement;
  46062. var
  46063. rkeyEvent = /^key/,
  46064. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  46065. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  46066. function returnTrue() {
  46067. return true;
  46068. }
  46069. function returnFalse() {
  46070. return false;
  46071. }
  46072. // Support: IE <=9 only
  46073. // See #13393 for more info
  46074. function safeActiveElement() {
  46075. try {
  46076. return document.activeElement;
  46077. } catch ( err ) { }
  46078. }
  46079. function on( elem, types, selector, data, fn, one ) {
  46080. var origFn, type;
  46081. // Types can be a map of types/handlers
  46082. if ( typeof types === "object" ) {
  46083. // ( types-Object, selector, data )
  46084. if ( typeof selector !== "string" ) {
  46085. // ( types-Object, data )
  46086. data = data || selector;
  46087. selector = undefined;
  46088. }
  46089. for ( type in types ) {
  46090. on( elem, type, selector, data, types[ type ], one );
  46091. }
  46092. return elem;
  46093. }
  46094. if ( data == null && fn == null ) {
  46095. // ( types, fn )
  46096. fn = selector;
  46097. data = selector = undefined;
  46098. } else if ( fn == null ) {
  46099. if ( typeof selector === "string" ) {
  46100. // ( types, selector, fn )
  46101. fn = data;
  46102. data = undefined;
  46103. } else {
  46104. // ( types, data, fn )
  46105. fn = data;
  46106. data = selector;
  46107. selector = undefined;
  46108. }
  46109. }
  46110. if ( fn === false ) {
  46111. fn = returnFalse;
  46112. } else if ( !fn ) {
  46113. return elem;
  46114. }
  46115. if ( one === 1 ) {
  46116. origFn = fn;
  46117. fn = function( event ) {
  46118. // Can use an empty set, since event contains the info
  46119. jQuery().off( event );
  46120. return origFn.apply( this, arguments );
  46121. };
  46122. // Use same guid so caller can remove using origFn
  46123. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  46124. }
  46125. return elem.each( function() {
  46126. jQuery.event.add( this, types, fn, data, selector );
  46127. } );
  46128. }
  46129. /*
  46130. * Helper functions for managing events -- not part of the public interface.
  46131. * Props to Dean Edwards' addEvent library for many of the ideas.
  46132. */
  46133. jQuery.event = {
  46134. global: {},
  46135. add: function( elem, types, handler, data, selector ) {
  46136. var handleObjIn, eventHandle, tmp,
  46137. events, t, handleObj,
  46138. special, handlers, type, namespaces, origType,
  46139. elemData = dataPriv.get( elem );
  46140. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  46141. if ( !elemData ) {
  46142. return;
  46143. }
  46144. // Caller can pass in an object of custom data in lieu of the handler
  46145. if ( handler.handler ) {
  46146. handleObjIn = handler;
  46147. handler = handleObjIn.handler;
  46148. selector = handleObjIn.selector;
  46149. }
  46150. // Ensure that invalid selectors throw exceptions at attach time
  46151. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  46152. if ( selector ) {
  46153. jQuery.find.matchesSelector( documentElement, selector );
  46154. }
  46155. // Make sure that the handler has a unique ID, used to find/remove it later
  46156. if ( !handler.guid ) {
  46157. handler.guid = jQuery.guid++;
  46158. }
  46159. // Init the element's event structure and main handler, if this is the first
  46160. if ( !( events = elemData.events ) ) {
  46161. events = elemData.events = {};
  46162. }
  46163. if ( !( eventHandle = elemData.handle ) ) {
  46164. eventHandle = elemData.handle = function( e ) {
  46165. // Discard the second event of a jQuery.event.trigger() and
  46166. // when an event is called after a page has unloaded
  46167. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  46168. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  46169. };
  46170. }
  46171. // Handle multiple events separated by a space
  46172. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  46173. t = types.length;
  46174. while ( t-- ) {
  46175. tmp = rtypenamespace.exec( types[ t ] ) || [];
  46176. type = origType = tmp[ 1 ];
  46177. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  46178. // There *must* be a type, no attaching namespace-only handlers
  46179. if ( !type ) {
  46180. continue;
  46181. }
  46182. // If event changes its type, use the special event handlers for the changed type
  46183. special = jQuery.event.special[ type ] || {};
  46184. // If selector defined, determine special event api type, otherwise given type
  46185. type = ( selector ? special.delegateType : special.bindType ) || type;
  46186. // Update special based on newly reset type
  46187. special = jQuery.event.special[ type ] || {};
  46188. // handleObj is passed to all event handlers
  46189. handleObj = jQuery.extend( {
  46190. type: type,
  46191. origType: origType,
  46192. data: data,
  46193. handler: handler,
  46194. guid: handler.guid,
  46195. selector: selector,
  46196. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  46197. namespace: namespaces.join( "." )
  46198. }, handleObjIn );
  46199. // Init the event handler queue if we're the first
  46200. if ( !( handlers = events[ type ] ) ) {
  46201. handlers = events[ type ] = [];
  46202. handlers.delegateCount = 0;
  46203. // Only use addEventListener if the special events handler returns false
  46204. if ( !special.setup ||
  46205. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  46206. if ( elem.addEventListener ) {
  46207. elem.addEventListener( type, eventHandle );
  46208. }
  46209. }
  46210. }
  46211. if ( special.add ) {
  46212. special.add.call( elem, handleObj );
  46213. if ( !handleObj.handler.guid ) {
  46214. handleObj.handler.guid = handler.guid;
  46215. }
  46216. }
  46217. // Add to the element's handler list, delegates in front
  46218. if ( selector ) {
  46219. handlers.splice( handlers.delegateCount++, 0, handleObj );
  46220. } else {
  46221. handlers.push( handleObj );
  46222. }
  46223. // Keep track of which events have ever been used, for event optimization
  46224. jQuery.event.global[ type ] = true;
  46225. }
  46226. },
  46227. // Detach an event or set of events from an element
  46228. remove: function( elem, types, handler, selector, mappedTypes ) {
  46229. var j, origCount, tmp,
  46230. events, t, handleObj,
  46231. special, handlers, type, namespaces, origType,
  46232. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  46233. if ( !elemData || !( events = elemData.events ) ) {
  46234. return;
  46235. }
  46236. // Once for each type.namespace in types; type may be omitted
  46237. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  46238. t = types.length;
  46239. while ( t-- ) {
  46240. tmp = rtypenamespace.exec( types[ t ] ) || [];
  46241. type = origType = tmp[ 1 ];
  46242. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  46243. // Unbind all events (on this namespace, if provided) for the element
  46244. if ( !type ) {
  46245. for ( type in events ) {
  46246. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  46247. }
  46248. continue;
  46249. }
  46250. special = jQuery.event.special[ type ] || {};
  46251. type = ( selector ? special.delegateType : special.bindType ) || type;
  46252. handlers = events[ type ] || [];
  46253. tmp = tmp[ 2 ] &&
  46254. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  46255. // Remove matching events
  46256. origCount = j = handlers.length;
  46257. while ( j-- ) {
  46258. handleObj = handlers[ j ];
  46259. if ( ( mappedTypes || origType === handleObj.origType ) &&
  46260. ( !handler || handler.guid === handleObj.guid ) &&
  46261. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  46262. ( !selector || selector === handleObj.selector ||
  46263. selector === "**" && handleObj.selector ) ) {
  46264. handlers.splice( j, 1 );
  46265. if ( handleObj.selector ) {
  46266. handlers.delegateCount--;
  46267. }
  46268. if ( special.remove ) {
  46269. special.remove.call( elem, handleObj );
  46270. }
  46271. }
  46272. }
  46273. // Remove generic event handler if we removed something and no more handlers exist
  46274. // (avoids potential for endless recursion during removal of special event handlers)
  46275. if ( origCount && !handlers.length ) {
  46276. if ( !special.teardown ||
  46277. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  46278. jQuery.removeEvent( elem, type, elemData.handle );
  46279. }
  46280. delete events[ type ];
  46281. }
  46282. }
  46283. // Remove data and the expando if it's no longer used
  46284. if ( jQuery.isEmptyObject( events ) ) {
  46285. dataPriv.remove( elem, "handle events" );
  46286. }
  46287. },
  46288. dispatch: function( nativeEvent ) {
  46289. // Make a writable jQuery.Event from the native event object
  46290. var event = jQuery.event.fix( nativeEvent );
  46291. var i, j, ret, matched, handleObj, handlerQueue,
  46292. args = new Array( arguments.length ),
  46293. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  46294. special = jQuery.event.special[ event.type ] || {};
  46295. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  46296. args[ 0 ] = event;
  46297. for ( i = 1; i < arguments.length; i++ ) {
  46298. args[ i ] = arguments[ i ];
  46299. }
  46300. event.delegateTarget = this;
  46301. // Call the preDispatch hook for the mapped type, and let it bail if desired
  46302. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  46303. return;
  46304. }
  46305. // Determine handlers
  46306. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  46307. // Run delegates first; they may want to stop propagation beneath us
  46308. i = 0;
  46309. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  46310. event.currentTarget = matched.elem;
  46311. j = 0;
  46312. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  46313. !event.isImmediatePropagationStopped() ) {
  46314. // Triggered event must either 1) have no namespace, or 2) have namespace(s)
  46315. // a subset or equal to those in the bound event (both can have no namespace).
  46316. if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) {
  46317. event.handleObj = handleObj;
  46318. event.data = handleObj.data;
  46319. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  46320. handleObj.handler ).apply( matched.elem, args );
  46321. if ( ret !== undefined ) {
  46322. if ( ( event.result = ret ) === false ) {
  46323. event.preventDefault();
  46324. event.stopPropagation();
  46325. }
  46326. }
  46327. }
  46328. }
  46329. }
  46330. // Call the postDispatch hook for the mapped type
  46331. if ( special.postDispatch ) {
  46332. special.postDispatch.call( this, event );
  46333. }
  46334. return event.result;
  46335. },
  46336. handlers: function( event, handlers ) {
  46337. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  46338. handlerQueue = [],
  46339. delegateCount = handlers.delegateCount,
  46340. cur = event.target;
  46341. // Find delegate handlers
  46342. if ( delegateCount &&
  46343. // Support: IE <=9
  46344. // Black-hole SVG <use> instance trees (trac-13180)
  46345. cur.nodeType &&
  46346. // Support: Firefox <=42
  46347. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  46348. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  46349. // Support: IE 11 only
  46350. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  46351. !( event.type === "click" && event.button >= 1 ) ) {
  46352. for ( ; cur !== this; cur = cur.parentNode || this ) {
  46353. // Don't check non-elements (#13208)
  46354. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  46355. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  46356. matchedHandlers = [];
  46357. matchedSelectors = {};
  46358. for ( i = 0; i < delegateCount; i++ ) {
  46359. handleObj = handlers[ i ];
  46360. // Don't conflict with Object.prototype properties (#13203)
  46361. sel = handleObj.selector + " ";
  46362. if ( matchedSelectors[ sel ] === undefined ) {
  46363. matchedSelectors[ sel ] = handleObj.needsContext ?
  46364. jQuery( sel, this ).index( cur ) > -1 :
  46365. jQuery.find( sel, this, null, [ cur ] ).length;
  46366. }
  46367. if ( matchedSelectors[ sel ] ) {
  46368. matchedHandlers.push( handleObj );
  46369. }
  46370. }
  46371. if ( matchedHandlers.length ) {
  46372. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  46373. }
  46374. }
  46375. }
  46376. }
  46377. // Add the remaining (directly-bound) handlers
  46378. cur = this;
  46379. if ( delegateCount < handlers.length ) {
  46380. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  46381. }
  46382. return handlerQueue;
  46383. },
  46384. addProp: function( name, hook ) {
  46385. Object.defineProperty( jQuery.Event.prototype, name, {
  46386. enumerable: true,
  46387. configurable: true,
  46388. get: isFunction( hook ) ?
  46389. function() {
  46390. if ( this.originalEvent ) {
  46391. return hook( this.originalEvent );
  46392. }
  46393. } :
  46394. function() {
  46395. if ( this.originalEvent ) {
  46396. return this.originalEvent[ name ];
  46397. }
  46398. },
  46399. set: function( value ) {
  46400. Object.defineProperty( this, name, {
  46401. enumerable: true,
  46402. configurable: true,
  46403. writable: true,
  46404. value: value
  46405. } );
  46406. }
  46407. } );
  46408. },
  46409. fix: function( originalEvent ) {
  46410. return originalEvent[ jQuery.expando ] ?
  46411. originalEvent :
  46412. new jQuery.Event( originalEvent );
  46413. },
  46414. special: {
  46415. load: {
  46416. // Prevent triggered image.load events from bubbling to window.load
  46417. noBubble: true
  46418. },
  46419. focus: {
  46420. // Fire native event if possible so blur/focus sequence is correct
  46421. trigger: function() {
  46422. if ( this !== safeActiveElement() && this.focus ) {
  46423. this.focus();
  46424. return false;
  46425. }
  46426. },
  46427. delegateType: "focusin"
  46428. },
  46429. blur: {
  46430. trigger: function() {
  46431. if ( this === safeActiveElement() && this.blur ) {
  46432. this.blur();
  46433. return false;
  46434. }
  46435. },
  46436. delegateType: "focusout"
  46437. },
  46438. click: {
  46439. // For checkbox, fire native event so checked state will be right
  46440. trigger: function() {
  46441. if ( this.type === "checkbox" && this.click && nodeName( this, "input" ) ) {
  46442. this.click();
  46443. return false;
  46444. }
  46445. },
  46446. // For cross-browser consistency, don't fire native .click() on links
  46447. _default: function( event ) {
  46448. return nodeName( event.target, "a" );
  46449. }
  46450. },
  46451. beforeunload: {
  46452. postDispatch: function( event ) {
  46453. // Support: Firefox 20+
  46454. // Firefox doesn't alert if the returnValue field is not set.
  46455. if ( event.result !== undefined && event.originalEvent ) {
  46456. event.originalEvent.returnValue = event.result;
  46457. }
  46458. }
  46459. }
  46460. }
  46461. };
  46462. jQuery.removeEvent = function( elem, type, handle ) {
  46463. // This "if" is needed for plain objects
  46464. if ( elem.removeEventListener ) {
  46465. elem.removeEventListener( type, handle );
  46466. }
  46467. };
  46468. jQuery.Event = function( src, props ) {
  46469. // Allow instantiation without the 'new' keyword
  46470. if ( !( this instanceof jQuery.Event ) ) {
  46471. return new jQuery.Event( src, props );
  46472. }
  46473. // Event object
  46474. if ( src && src.type ) {
  46475. this.originalEvent = src;
  46476. this.type = src.type;
  46477. // Events bubbling up the document may have been marked as prevented
  46478. // by a handler lower down the tree; reflect the correct value.
  46479. this.isDefaultPrevented = src.defaultPrevented ||
  46480. src.defaultPrevented === undefined &&
  46481. // Support: Android <=2.3 only
  46482. src.returnValue === false ?
  46483. returnTrue :
  46484. returnFalse;
  46485. // Create target properties
  46486. // Support: Safari <=6 - 7 only
  46487. // Target should not be a text node (#504, #13143)
  46488. this.target = ( src.target && src.target.nodeType === 3 ) ?
  46489. src.target.parentNode :
  46490. src.target;
  46491. this.currentTarget = src.currentTarget;
  46492. this.relatedTarget = src.relatedTarget;
  46493. // Event type
  46494. } else {
  46495. this.type = src;
  46496. }
  46497. // Put explicitly provided properties onto the event object
  46498. if ( props ) {
  46499. jQuery.extend( this, props );
  46500. }
  46501. // Create a timestamp if incoming event doesn't have one
  46502. this.timeStamp = src && src.timeStamp || Date.now();
  46503. // Mark it as fixed
  46504. this[ jQuery.expando ] = true;
  46505. };
  46506. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  46507. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  46508. jQuery.Event.prototype = {
  46509. constructor: jQuery.Event,
  46510. isDefaultPrevented: returnFalse,
  46511. isPropagationStopped: returnFalse,
  46512. isImmediatePropagationStopped: returnFalse,
  46513. isSimulated: false,
  46514. preventDefault: function() {
  46515. var e = this.originalEvent;
  46516. this.isDefaultPrevented = returnTrue;
  46517. if ( e && !this.isSimulated ) {
  46518. e.preventDefault();
  46519. }
  46520. },
  46521. stopPropagation: function() {
  46522. var e = this.originalEvent;
  46523. this.isPropagationStopped = returnTrue;
  46524. if ( e && !this.isSimulated ) {
  46525. e.stopPropagation();
  46526. }
  46527. },
  46528. stopImmediatePropagation: function() {
  46529. var e = this.originalEvent;
  46530. this.isImmediatePropagationStopped = returnTrue;
  46531. if ( e && !this.isSimulated ) {
  46532. e.stopImmediatePropagation();
  46533. }
  46534. this.stopPropagation();
  46535. }
  46536. };
  46537. // Includes all common event props including KeyEvent and MouseEvent specific props
  46538. jQuery.each( {
  46539. altKey: true,
  46540. bubbles: true,
  46541. cancelable: true,
  46542. changedTouches: true,
  46543. ctrlKey: true,
  46544. detail: true,
  46545. eventPhase: true,
  46546. metaKey: true,
  46547. pageX: true,
  46548. pageY: true,
  46549. shiftKey: true,
  46550. view: true,
  46551. "char": true,
  46552. charCode: true,
  46553. key: true,
  46554. keyCode: true,
  46555. button: true,
  46556. buttons: true,
  46557. clientX: true,
  46558. clientY: true,
  46559. offsetX: true,
  46560. offsetY: true,
  46561. pointerId: true,
  46562. pointerType: true,
  46563. screenX: true,
  46564. screenY: true,
  46565. targetTouches: true,
  46566. toElement: true,
  46567. touches: true,
  46568. which: function( event ) {
  46569. var button = event.button;
  46570. // Add which for key events
  46571. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  46572. return event.charCode != null ? event.charCode : event.keyCode;
  46573. }
  46574. // Add which for click: 1 === left; 2 === middle; 3 === right
  46575. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  46576. if ( button & 1 ) {
  46577. return 1;
  46578. }
  46579. if ( button & 2 ) {
  46580. return 3;
  46581. }
  46582. if ( button & 4 ) {
  46583. return 2;
  46584. }
  46585. return 0;
  46586. }
  46587. return event.which;
  46588. }
  46589. }, jQuery.event.addProp );
  46590. // Create mouseenter/leave events using mouseover/out and event-time checks
  46591. // so that event delegation works in jQuery.
  46592. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  46593. //
  46594. // Support: Safari 7 only
  46595. // Safari sends mouseenter too often; see:
  46596. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  46597. // for the description of the bug (it existed in older Chrome versions as well).
  46598. jQuery.each( {
  46599. mouseenter: "mouseover",
  46600. mouseleave: "mouseout",
  46601. pointerenter: "pointerover",
  46602. pointerleave: "pointerout"
  46603. }, function( orig, fix ) {
  46604. jQuery.event.special[ orig ] = {
  46605. delegateType: fix,
  46606. bindType: fix,
  46607. handle: function( event ) {
  46608. var ret,
  46609. target = this,
  46610. related = event.relatedTarget,
  46611. handleObj = event.handleObj;
  46612. // For mouseenter/leave call the handler if related is outside the target.
  46613. // NB: No relatedTarget if the mouse left/entered the browser window
  46614. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  46615. event.type = handleObj.origType;
  46616. ret = handleObj.handler.apply( this, arguments );
  46617. event.type = fix;
  46618. }
  46619. return ret;
  46620. }
  46621. };
  46622. } );
  46623. jQuery.fn.extend( {
  46624. on: function( types, selector, data, fn ) {
  46625. return on( this, types, selector, data, fn );
  46626. },
  46627. one: function( types, selector, data, fn ) {
  46628. return on( this, types, selector, data, fn, 1 );
  46629. },
  46630. off: function( types, selector, fn ) {
  46631. var handleObj, type;
  46632. if ( types && types.preventDefault && types.handleObj ) {
  46633. // ( event ) dispatched jQuery.Event
  46634. handleObj = types.handleObj;
  46635. jQuery( types.delegateTarget ).off(
  46636. handleObj.namespace ?
  46637. handleObj.origType + "." + handleObj.namespace :
  46638. handleObj.origType,
  46639. handleObj.selector,
  46640. handleObj.handler
  46641. );
  46642. return this;
  46643. }
  46644. if ( typeof types === "object" ) {
  46645. // ( types-object [, selector] )
  46646. for ( type in types ) {
  46647. this.off( type, selector, types[ type ] );
  46648. }
  46649. return this;
  46650. }
  46651. if ( selector === false || typeof selector === "function" ) {
  46652. // ( types [, fn] )
  46653. fn = selector;
  46654. selector = undefined;
  46655. }
  46656. if ( fn === false ) {
  46657. fn = returnFalse;
  46658. }
  46659. return this.each( function() {
  46660. jQuery.event.remove( this, types, fn, selector );
  46661. } );
  46662. }
  46663. } );
  46664. var
  46665. /* eslint-disable max-len */
  46666. // See https://github.com/eslint/eslint/issues/3229
  46667. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  46668. /* eslint-enable */
  46669. // Support: IE <=10 - 11, Edge 12 - 13 only
  46670. // In IE/Edge using regex groups here causes severe slowdowns.
  46671. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  46672. rnoInnerhtml = /<script|<style|<link/i,
  46673. // checked="checked" or checked
  46674. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  46675. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  46676. // Prefer a tbody over its parent table for containing new rows
  46677. function manipulationTarget( elem, content ) {
  46678. if ( nodeName( elem, "table" ) &&
  46679. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  46680. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  46681. }
  46682. return elem;
  46683. }
  46684. // Replace/restore the type attribute of script elements for safe DOM manipulation
  46685. function disableScript( elem ) {
  46686. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  46687. return elem;
  46688. }
  46689. function restoreScript( elem ) {
  46690. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  46691. elem.type = elem.type.slice( 5 );
  46692. } else {
  46693. elem.removeAttribute( "type" );
  46694. }
  46695. return elem;
  46696. }
  46697. function cloneCopyEvent( src, dest ) {
  46698. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  46699. if ( dest.nodeType !== 1 ) {
  46700. return;
  46701. }
  46702. // 1. Copy private data: events, handlers, etc.
  46703. if ( dataPriv.hasData( src ) ) {
  46704. pdataOld = dataPriv.access( src );
  46705. pdataCur = dataPriv.set( dest, pdataOld );
  46706. events = pdataOld.events;
  46707. if ( events ) {
  46708. delete pdataCur.handle;
  46709. pdataCur.events = {};
  46710. for ( type in events ) {
  46711. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  46712. jQuery.event.add( dest, type, events[ type ][ i ] );
  46713. }
  46714. }
  46715. }
  46716. }
  46717. // 2. Copy user data
  46718. if ( dataUser.hasData( src ) ) {
  46719. udataOld = dataUser.access( src );
  46720. udataCur = jQuery.extend( {}, udataOld );
  46721. dataUser.set( dest, udataCur );
  46722. }
  46723. }
  46724. // Fix IE bugs, see support tests
  46725. function fixInput( src, dest ) {
  46726. var nodeName = dest.nodeName.toLowerCase();
  46727. // Fails to persist the checked state of a cloned checkbox or radio button.
  46728. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  46729. dest.checked = src.checked;
  46730. // Fails to return the selected option to the default selected state when cloning options
  46731. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  46732. dest.defaultValue = src.defaultValue;
  46733. }
  46734. }
  46735. function domManip( collection, args, callback, ignored ) {
  46736. // Flatten any nested arrays
  46737. args = concat.apply( [], args );
  46738. var fragment, first, scripts, hasScripts, node, doc,
  46739. i = 0,
  46740. l = collection.length,
  46741. iNoClone = l - 1,
  46742. value = args[ 0 ],
  46743. valueIsFunction = isFunction( value );
  46744. // We can't cloneNode fragments that contain checked, in WebKit
  46745. if ( valueIsFunction ||
  46746. ( l > 1 && typeof value === "string" &&
  46747. !support.checkClone && rchecked.test( value ) ) ) {
  46748. return collection.each( function( index ) {
  46749. var self = collection.eq( index );
  46750. if ( valueIsFunction ) {
  46751. args[ 0 ] = value.call( this, index, self.html() );
  46752. }
  46753. domManip( self, args, callback, ignored );
  46754. } );
  46755. }
  46756. if ( l ) {
  46757. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  46758. first = fragment.firstChild;
  46759. if ( fragment.childNodes.length === 1 ) {
  46760. fragment = first;
  46761. }
  46762. // Require either new content or an interest in ignored elements to invoke the callback
  46763. if ( first || ignored ) {
  46764. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  46765. hasScripts = scripts.length;
  46766. // Use the original fragment for the last item
  46767. // instead of the first because it can end up
  46768. // being emptied incorrectly in certain situations (#8070).
  46769. for ( ; i < l; i++ ) {
  46770. node = fragment;
  46771. if ( i !== iNoClone ) {
  46772. node = jQuery.clone( node, true, true );
  46773. // Keep references to cloned scripts for later restoration
  46774. if ( hasScripts ) {
  46775. // Support: Android <=4.0 only, PhantomJS 1 only
  46776. // push.apply(_, arraylike) throws on ancient WebKit
  46777. jQuery.merge( scripts, getAll( node, "script" ) );
  46778. }
  46779. }
  46780. callback.call( collection[ i ], node, i );
  46781. }
  46782. if ( hasScripts ) {
  46783. doc = scripts[ scripts.length - 1 ].ownerDocument;
  46784. // Reenable scripts
  46785. jQuery.map( scripts, restoreScript );
  46786. // Evaluate executable scripts on first document insertion
  46787. for ( i = 0; i < hasScripts; i++ ) {
  46788. node = scripts[ i ];
  46789. if ( rscriptType.test( node.type || "" ) &&
  46790. !dataPriv.access( node, "globalEval" ) &&
  46791. jQuery.contains( doc, node ) ) {
  46792. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  46793. // Optional AJAX dependency, but won't run scripts if not present
  46794. if ( jQuery._evalUrl ) {
  46795. jQuery._evalUrl( node.src );
  46796. }
  46797. } else {
  46798. DOMEval( node.textContent.replace( rcleanScript, "" ), doc, node );
  46799. }
  46800. }
  46801. }
  46802. }
  46803. }
  46804. }
  46805. return collection;
  46806. }
  46807. function remove( elem, selector, keepData ) {
  46808. var node,
  46809. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  46810. i = 0;
  46811. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  46812. if ( !keepData && node.nodeType === 1 ) {
  46813. jQuery.cleanData( getAll( node ) );
  46814. }
  46815. if ( node.parentNode ) {
  46816. if ( keepData && jQuery.contains( node.ownerDocument, node ) ) {
  46817. setGlobalEval( getAll( node, "script" ) );
  46818. }
  46819. node.parentNode.removeChild( node );
  46820. }
  46821. }
  46822. return elem;
  46823. }
  46824. jQuery.extend( {
  46825. htmlPrefilter: function( html ) {
  46826. return html.replace( rxhtmlTag, "<$1></$2>" );
  46827. },
  46828. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  46829. var i, l, srcElements, destElements,
  46830. clone = elem.cloneNode( true ),
  46831. inPage = jQuery.contains( elem.ownerDocument, elem );
  46832. // Fix IE cloning issues
  46833. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  46834. !jQuery.isXMLDoc( elem ) ) {
  46835. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  46836. destElements = getAll( clone );
  46837. srcElements = getAll( elem );
  46838. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  46839. fixInput( srcElements[ i ], destElements[ i ] );
  46840. }
  46841. }
  46842. // Copy the events from the original to the clone
  46843. if ( dataAndEvents ) {
  46844. if ( deepDataAndEvents ) {
  46845. srcElements = srcElements || getAll( elem );
  46846. destElements = destElements || getAll( clone );
  46847. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  46848. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  46849. }
  46850. } else {
  46851. cloneCopyEvent( elem, clone );
  46852. }
  46853. }
  46854. // Preserve script evaluation history
  46855. destElements = getAll( clone, "script" );
  46856. if ( destElements.length > 0 ) {
  46857. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  46858. }
  46859. // Return the cloned set
  46860. return clone;
  46861. },
  46862. cleanData: function( elems ) {
  46863. var data, elem, type,
  46864. special = jQuery.event.special,
  46865. i = 0;
  46866. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  46867. if ( acceptData( elem ) ) {
  46868. if ( ( data = elem[ dataPriv.expando ] ) ) {
  46869. if ( data.events ) {
  46870. for ( type in data.events ) {
  46871. if ( special[ type ] ) {
  46872. jQuery.event.remove( elem, type );
  46873. // This is a shortcut to avoid jQuery.event.remove's overhead
  46874. } else {
  46875. jQuery.removeEvent( elem, type, data.handle );
  46876. }
  46877. }
  46878. }
  46879. // Support: Chrome <=35 - 45+
  46880. // Assign undefined instead of using delete, see Data#remove
  46881. elem[ dataPriv.expando ] = undefined;
  46882. }
  46883. if ( elem[ dataUser.expando ] ) {
  46884. // Support: Chrome <=35 - 45+
  46885. // Assign undefined instead of using delete, see Data#remove
  46886. elem[ dataUser.expando ] = undefined;
  46887. }
  46888. }
  46889. }
  46890. }
  46891. } );
  46892. jQuery.fn.extend( {
  46893. detach: function( selector ) {
  46894. return remove( this, selector, true );
  46895. },
  46896. remove: function( selector ) {
  46897. return remove( this, selector );
  46898. },
  46899. text: function( value ) {
  46900. return access( this, function( value ) {
  46901. return value === undefined ?
  46902. jQuery.text( this ) :
  46903. this.empty().each( function() {
  46904. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  46905. this.textContent = value;
  46906. }
  46907. } );
  46908. }, null, value, arguments.length );
  46909. },
  46910. append: function() {
  46911. return domManip( this, arguments, function( elem ) {
  46912. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  46913. var target = manipulationTarget( this, elem );
  46914. target.appendChild( elem );
  46915. }
  46916. } );
  46917. },
  46918. prepend: function() {
  46919. return domManip( this, arguments, function( elem ) {
  46920. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  46921. var target = manipulationTarget( this, elem );
  46922. target.insertBefore( elem, target.firstChild );
  46923. }
  46924. } );
  46925. },
  46926. before: function() {
  46927. return domManip( this, arguments, function( elem ) {
  46928. if ( this.parentNode ) {
  46929. this.parentNode.insertBefore( elem, this );
  46930. }
  46931. } );
  46932. },
  46933. after: function() {
  46934. return domManip( this, arguments, function( elem ) {
  46935. if ( this.parentNode ) {
  46936. this.parentNode.insertBefore( elem, this.nextSibling );
  46937. }
  46938. } );
  46939. },
  46940. empty: function() {
  46941. var elem,
  46942. i = 0;
  46943. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  46944. if ( elem.nodeType === 1 ) {
  46945. // Prevent memory leaks
  46946. jQuery.cleanData( getAll( elem, false ) );
  46947. // Remove any remaining nodes
  46948. elem.textContent = "";
  46949. }
  46950. }
  46951. return this;
  46952. },
  46953. clone: function( dataAndEvents, deepDataAndEvents ) {
  46954. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  46955. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  46956. return this.map( function() {
  46957. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  46958. } );
  46959. },
  46960. html: function( value ) {
  46961. return access( this, function( value ) {
  46962. var elem = this[ 0 ] || {},
  46963. i = 0,
  46964. l = this.length;
  46965. if ( value === undefined && elem.nodeType === 1 ) {
  46966. return elem.innerHTML;
  46967. }
  46968. // See if we can take a shortcut and just use innerHTML
  46969. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  46970. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  46971. value = jQuery.htmlPrefilter( value );
  46972. try {
  46973. for ( ; i < l; i++ ) {
  46974. elem = this[ i ] || {};
  46975. // Remove element nodes and prevent memory leaks
  46976. if ( elem.nodeType === 1 ) {
  46977. jQuery.cleanData( getAll( elem, false ) );
  46978. elem.innerHTML = value;
  46979. }
  46980. }
  46981. elem = 0;
  46982. // If using innerHTML throws an exception, use the fallback method
  46983. } catch ( e ) {}
  46984. }
  46985. if ( elem ) {
  46986. this.empty().append( value );
  46987. }
  46988. }, null, value, arguments.length );
  46989. },
  46990. replaceWith: function() {
  46991. var ignored = [];
  46992. // Make the changes, replacing each non-ignored context element with the new content
  46993. return domManip( this, arguments, function( elem ) {
  46994. var parent = this.parentNode;
  46995. if ( jQuery.inArray( this, ignored ) < 0 ) {
  46996. jQuery.cleanData( getAll( this ) );
  46997. if ( parent ) {
  46998. parent.replaceChild( elem, this );
  46999. }
  47000. }
  47001. // Force callback invocation
  47002. }, ignored );
  47003. }
  47004. } );
  47005. jQuery.each( {
  47006. appendTo: "append",
  47007. prependTo: "prepend",
  47008. insertBefore: "before",
  47009. insertAfter: "after",
  47010. replaceAll: "replaceWith"
  47011. }, function( name, original ) {
  47012. jQuery.fn[ name ] = function( selector ) {
  47013. var elems,
  47014. ret = [],
  47015. insert = jQuery( selector ),
  47016. last = insert.length - 1,
  47017. i = 0;
  47018. for ( ; i <= last; i++ ) {
  47019. elems = i === last ? this : this.clone( true );
  47020. jQuery( insert[ i ] )[ original ]( elems );
  47021. // Support: Android <=4.0 only, PhantomJS 1 only
  47022. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  47023. push.apply( ret, elems.get() );
  47024. }
  47025. return this.pushStack( ret );
  47026. };
  47027. } );
  47028. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  47029. var getStyles = function( elem ) {
  47030. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  47031. // IE throws on elements created in popups
  47032. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  47033. var view = elem.ownerDocument.defaultView;
  47034. if ( !view || !view.opener ) {
  47035. view = window;
  47036. }
  47037. return view.getComputedStyle( elem );
  47038. };
  47039. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  47040. ( function() {
  47041. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  47042. // so they're executed at the same time to save the second computation.
  47043. function computeStyleTests() {
  47044. // This is a singleton, we need to execute it only once
  47045. if ( !div ) {
  47046. return;
  47047. }
  47048. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  47049. "margin-top:1px;padding:0;border:0";
  47050. div.style.cssText =
  47051. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  47052. "margin:auto;border:1px;padding:1px;" +
  47053. "width:60%;top:1%";
  47054. documentElement.appendChild( container ).appendChild( div );
  47055. var divStyle = window.getComputedStyle( div );
  47056. pixelPositionVal = divStyle.top !== "1%";
  47057. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  47058. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  47059. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  47060. // Some styles come back with percentage values, even though they shouldn't
  47061. div.style.right = "60%";
  47062. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  47063. // Support: IE 9 - 11 only
  47064. // Detect misreporting of content dimensions for box-sizing:border-box elements
  47065. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  47066. // Support: IE 9 only
  47067. // Detect overflow:scroll screwiness (gh-3699)
  47068. div.style.position = "absolute";
  47069. scrollboxSizeVal = div.offsetWidth === 36 || "absolute";
  47070. documentElement.removeChild( container );
  47071. // Nullify the div so it wouldn't be stored in the memory and
  47072. // it will also be a sign that checks already performed
  47073. div = null;
  47074. }
  47075. function roundPixelMeasures( measure ) {
  47076. return Math.round( parseFloat( measure ) );
  47077. }
  47078. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  47079. reliableMarginLeftVal,
  47080. container = document.createElement( "div" ),
  47081. div = document.createElement( "div" );
  47082. // Finish early in limited (non-browser) environments
  47083. if ( !div.style ) {
  47084. return;
  47085. }
  47086. // Support: IE <=9 - 11 only
  47087. // Style of cloned element affects source element cloned (#8908)
  47088. div.style.backgroundClip = "content-box";
  47089. div.cloneNode( true ).style.backgroundClip = "";
  47090. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  47091. jQuery.extend( support, {
  47092. boxSizingReliable: function() {
  47093. computeStyleTests();
  47094. return boxSizingReliableVal;
  47095. },
  47096. pixelBoxStyles: function() {
  47097. computeStyleTests();
  47098. return pixelBoxStylesVal;
  47099. },
  47100. pixelPosition: function() {
  47101. computeStyleTests();
  47102. return pixelPositionVal;
  47103. },
  47104. reliableMarginLeft: function() {
  47105. computeStyleTests();
  47106. return reliableMarginLeftVal;
  47107. },
  47108. scrollboxSize: function() {
  47109. computeStyleTests();
  47110. return scrollboxSizeVal;
  47111. }
  47112. } );
  47113. } )();
  47114. function curCSS( elem, name, computed ) {
  47115. var width, minWidth, maxWidth, ret,
  47116. // Support: Firefox 51+
  47117. // Retrieving style before computed somehow
  47118. // fixes an issue with getting wrong values
  47119. // on detached elements
  47120. style = elem.style;
  47121. computed = computed || getStyles( elem );
  47122. // getPropertyValue is needed for:
  47123. // .css('filter') (IE 9 only, #12537)
  47124. // .css('--customProperty) (#3144)
  47125. if ( computed ) {
  47126. ret = computed.getPropertyValue( name ) || computed[ name ];
  47127. if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
  47128. ret = jQuery.style( elem, name );
  47129. }
  47130. // A tribute to the "awesome hack by Dean Edwards"
  47131. // Android Browser returns percentage for some values,
  47132. // but width seems to be reliably pixels.
  47133. // This is against the CSSOM draft spec:
  47134. // https://drafts.csswg.org/cssom/#resolved-values
  47135. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  47136. // Remember the original values
  47137. width = style.width;
  47138. minWidth = style.minWidth;
  47139. maxWidth = style.maxWidth;
  47140. // Put in the new values to get a computed value out
  47141. style.minWidth = style.maxWidth = style.width = ret;
  47142. ret = computed.width;
  47143. // Revert the changed values
  47144. style.width = width;
  47145. style.minWidth = minWidth;
  47146. style.maxWidth = maxWidth;
  47147. }
  47148. }
  47149. return ret !== undefined ?
  47150. // Support: IE <=9 - 11 only
  47151. // IE returns zIndex value as an integer.
  47152. ret + "" :
  47153. ret;
  47154. }
  47155. function addGetHookIf( conditionFn, hookFn ) {
  47156. // Define the hook, we'll check on the first run if it's really needed.
  47157. return {
  47158. get: function() {
  47159. if ( conditionFn() ) {
  47160. // Hook not needed (or it's not possible to use it due
  47161. // to missing dependency), remove it.
  47162. delete this.get;
  47163. return;
  47164. }
  47165. // Hook needed; redefine it so that the support test is not executed again.
  47166. return ( this.get = hookFn ).apply( this, arguments );
  47167. }
  47168. };
  47169. }
  47170. var
  47171. // Swappable if display is none or starts with table
  47172. // except "table", "table-cell", or "table-caption"
  47173. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  47174. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  47175. rcustomProp = /^--/,
  47176. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  47177. cssNormalTransform = {
  47178. letterSpacing: "0",
  47179. fontWeight: "400"
  47180. },
  47181. cssPrefixes = [ "Webkit", "Moz", "ms" ],
  47182. emptyStyle = document.createElement( "div" ).style;
  47183. // Return a css property mapped to a potentially vendor prefixed property
  47184. function vendorPropName( name ) {
  47185. // Shortcut for names that are not vendor prefixed
  47186. if ( name in emptyStyle ) {
  47187. return name;
  47188. }
  47189. // Check for vendor prefixed names
  47190. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  47191. i = cssPrefixes.length;
  47192. while ( i-- ) {
  47193. name = cssPrefixes[ i ] + capName;
  47194. if ( name in emptyStyle ) {
  47195. return name;
  47196. }
  47197. }
  47198. }
  47199. // Return a property mapped along what jQuery.cssProps suggests or to
  47200. // a vendor prefixed property.
  47201. function finalPropName( name ) {
  47202. var ret = jQuery.cssProps[ name ];
  47203. if ( !ret ) {
  47204. ret = jQuery.cssProps[ name ] = vendorPropName( name ) || name;
  47205. }
  47206. return ret;
  47207. }
  47208. function setPositiveNumber( elem, value, subtract ) {
  47209. // Any relative (+/-) values have already been
  47210. // normalized at this point
  47211. var matches = rcssNum.exec( value );
  47212. return matches ?
  47213. // Guard against undefined "subtract", e.g., when used as in cssHooks
  47214. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  47215. value;
  47216. }
  47217. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  47218. var i = dimension === "width" ? 1 : 0,
  47219. extra = 0,
  47220. delta = 0;
  47221. // Adjustment may not be necessary
  47222. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  47223. return 0;
  47224. }
  47225. for ( ; i < 4; i += 2 ) {
  47226. // Both box models exclude margin
  47227. if ( box === "margin" ) {
  47228. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  47229. }
  47230. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  47231. if ( !isBorderBox ) {
  47232. // Add padding
  47233. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  47234. // For "border" or "margin", add border
  47235. if ( box !== "padding" ) {
  47236. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  47237. // But still keep track of it otherwise
  47238. } else {
  47239. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  47240. }
  47241. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  47242. // "padding" or "margin"
  47243. } else {
  47244. // For "content", subtract padding
  47245. if ( box === "content" ) {
  47246. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  47247. }
  47248. // For "content" or "padding", subtract border
  47249. if ( box !== "margin" ) {
  47250. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  47251. }
  47252. }
  47253. }
  47254. // Account for positive content-box scroll gutter when requested by providing computedVal
  47255. if ( !isBorderBox && computedVal >= 0 ) {
  47256. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  47257. // Assuming integer scroll gutter, subtract the rest and round down
  47258. delta += Math.max( 0, Math.ceil(
  47259. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  47260. computedVal -
  47261. delta -
  47262. extra -
  47263. 0.5
  47264. ) );
  47265. }
  47266. return delta;
  47267. }
  47268. function getWidthOrHeight( elem, dimension, extra ) {
  47269. // Start with computed style
  47270. var styles = getStyles( elem ),
  47271. val = curCSS( elem, dimension, styles ),
  47272. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  47273. valueIsBorderBox = isBorderBox;
  47274. // Support: Firefox <=54
  47275. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  47276. if ( rnumnonpx.test( val ) ) {
  47277. if ( !extra ) {
  47278. return val;
  47279. }
  47280. val = "auto";
  47281. }
  47282. // Check for style in case a browser which returns unreliable values
  47283. // for getComputedStyle silently falls back to the reliable elem.style
  47284. valueIsBorderBox = valueIsBorderBox &&
  47285. ( support.boxSizingReliable() || val === elem.style[ dimension ] );
  47286. // Fall back to offsetWidth/offsetHeight when value is "auto"
  47287. // This happens for inline elements with no explicit setting (gh-3571)
  47288. // Support: Android <=4.1 - 4.3 only
  47289. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  47290. if ( val === "auto" ||
  47291. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) {
  47292. val = elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ];
  47293. // offsetWidth/offsetHeight provide border-box values
  47294. valueIsBorderBox = true;
  47295. }
  47296. // Normalize "" and auto
  47297. val = parseFloat( val ) || 0;
  47298. // Adjust for the element's box model
  47299. return ( val +
  47300. boxModelAdjustment(
  47301. elem,
  47302. dimension,
  47303. extra || ( isBorderBox ? "border" : "content" ),
  47304. valueIsBorderBox,
  47305. styles,
  47306. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  47307. val
  47308. )
  47309. ) + "px";
  47310. }
  47311. jQuery.extend( {
  47312. // Add in style property hooks for overriding the default
  47313. // behavior of getting and setting a style property
  47314. cssHooks: {
  47315. opacity: {
  47316. get: function( elem, computed ) {
  47317. if ( computed ) {
  47318. // We should always get a number back from opacity
  47319. var ret = curCSS( elem, "opacity" );
  47320. return ret === "" ? "1" : ret;
  47321. }
  47322. }
  47323. }
  47324. },
  47325. // Don't automatically add "px" to these possibly-unitless properties
  47326. cssNumber: {
  47327. "animationIterationCount": true,
  47328. "columnCount": true,
  47329. "fillOpacity": true,
  47330. "flexGrow": true,
  47331. "flexShrink": true,
  47332. "fontWeight": true,
  47333. "lineHeight": true,
  47334. "opacity": true,
  47335. "order": true,
  47336. "orphans": true,
  47337. "widows": true,
  47338. "zIndex": true,
  47339. "zoom": true
  47340. },
  47341. // Add in properties whose names you wish to fix before
  47342. // setting or getting the value
  47343. cssProps: {},
  47344. // Get and set the style property on a DOM Node
  47345. style: function( elem, name, value, extra ) {
  47346. // Don't set styles on text and comment nodes
  47347. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  47348. return;
  47349. }
  47350. // Make sure that we're working with the right name
  47351. var ret, type, hooks,
  47352. origName = camelCase( name ),
  47353. isCustomProp = rcustomProp.test( name ),
  47354. style = elem.style;
  47355. // Make sure that we're working with the right name. We don't
  47356. // want to query the value if it is a CSS custom property
  47357. // since they are user-defined.
  47358. if ( !isCustomProp ) {
  47359. name = finalPropName( origName );
  47360. }
  47361. // Gets hook for the prefixed version, then unprefixed version
  47362. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  47363. // Check if we're setting a value
  47364. if ( value !== undefined ) {
  47365. type = typeof value;
  47366. // Convert "+=" or "-=" to relative numbers (#7345)
  47367. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  47368. value = adjustCSS( elem, name, ret );
  47369. // Fixes bug #9237
  47370. type = "number";
  47371. }
  47372. // Make sure that null and NaN values aren't set (#7116)
  47373. if ( value == null || value !== value ) {
  47374. return;
  47375. }
  47376. // If a number was passed in, add the unit (except for certain CSS properties)
  47377. if ( type === "number" ) {
  47378. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  47379. }
  47380. // background-* props affect original clone's values
  47381. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  47382. style[ name ] = "inherit";
  47383. }
  47384. // If a hook was provided, use that value, otherwise just set the specified value
  47385. if ( !hooks || !( "set" in hooks ) ||
  47386. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  47387. if ( isCustomProp ) {
  47388. style.setProperty( name, value );
  47389. } else {
  47390. style[ name ] = value;
  47391. }
  47392. }
  47393. } else {
  47394. // If a hook was provided get the non-computed value from there
  47395. if ( hooks && "get" in hooks &&
  47396. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  47397. return ret;
  47398. }
  47399. // Otherwise just get the value from the style object
  47400. return style[ name ];
  47401. }
  47402. },
  47403. css: function( elem, name, extra, styles ) {
  47404. var val, num, hooks,
  47405. origName = camelCase( name ),
  47406. isCustomProp = rcustomProp.test( name );
  47407. // Make sure that we're working with the right name. We don't
  47408. // want to modify the value if it is a CSS custom property
  47409. // since they are user-defined.
  47410. if ( !isCustomProp ) {
  47411. name = finalPropName( origName );
  47412. }
  47413. // Try prefixed name followed by the unprefixed name
  47414. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  47415. // If a hook was provided get the computed value from there
  47416. if ( hooks && "get" in hooks ) {
  47417. val = hooks.get( elem, true, extra );
  47418. }
  47419. // Otherwise, if a way to get the computed value exists, use that
  47420. if ( val === undefined ) {
  47421. val = curCSS( elem, name, styles );
  47422. }
  47423. // Convert "normal" to computed value
  47424. if ( val === "normal" && name in cssNormalTransform ) {
  47425. val = cssNormalTransform[ name ];
  47426. }
  47427. // Make numeric if forced or a qualifier was provided and val looks numeric
  47428. if ( extra === "" || extra ) {
  47429. num = parseFloat( val );
  47430. return extra === true || isFinite( num ) ? num || 0 : val;
  47431. }
  47432. return val;
  47433. }
  47434. } );
  47435. jQuery.each( [ "height", "width" ], function( i, dimension ) {
  47436. jQuery.cssHooks[ dimension ] = {
  47437. get: function( elem, computed, extra ) {
  47438. if ( computed ) {
  47439. // Certain elements can have dimension info if we invisibly show them
  47440. // but it must have a current display style that would benefit
  47441. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  47442. // Support: Safari 8+
  47443. // Table columns in Safari have non-zero offsetWidth & zero
  47444. // getBoundingClientRect().width unless display is changed.
  47445. // Support: IE <=11 only
  47446. // Running getBoundingClientRect on a disconnected node
  47447. // in IE throws an error.
  47448. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  47449. swap( elem, cssShow, function() {
  47450. return getWidthOrHeight( elem, dimension, extra );
  47451. } ) :
  47452. getWidthOrHeight( elem, dimension, extra );
  47453. }
  47454. },
  47455. set: function( elem, value, extra ) {
  47456. var matches,
  47457. styles = getStyles( elem ),
  47458. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  47459. subtract = extra && boxModelAdjustment(
  47460. elem,
  47461. dimension,
  47462. extra,
  47463. isBorderBox,
  47464. styles
  47465. );
  47466. // Account for unreliable border-box dimensions by comparing offset* to computed and
  47467. // faking a content-box to get border and padding (gh-3699)
  47468. if ( isBorderBox && support.scrollboxSize() === styles.position ) {
  47469. subtract -= Math.ceil(
  47470. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  47471. parseFloat( styles[ dimension ] ) -
  47472. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  47473. 0.5
  47474. );
  47475. }
  47476. // Convert to pixels if value adjustment is needed
  47477. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  47478. ( matches[ 3 ] || "px" ) !== "px" ) {
  47479. elem.style[ dimension ] = value;
  47480. value = jQuery.css( elem, dimension );
  47481. }
  47482. return setPositiveNumber( elem, value, subtract );
  47483. }
  47484. };
  47485. } );
  47486. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  47487. function( elem, computed ) {
  47488. if ( computed ) {
  47489. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  47490. elem.getBoundingClientRect().left -
  47491. swap( elem, { marginLeft: 0 }, function() {
  47492. return elem.getBoundingClientRect().left;
  47493. } )
  47494. ) + "px";
  47495. }
  47496. }
  47497. );
  47498. // These hooks are used by animate to expand properties
  47499. jQuery.each( {
  47500. margin: "",
  47501. padding: "",
  47502. border: "Width"
  47503. }, function( prefix, suffix ) {
  47504. jQuery.cssHooks[ prefix + suffix ] = {
  47505. expand: function( value ) {
  47506. var i = 0,
  47507. expanded = {},
  47508. // Assumes a single number if not a string
  47509. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  47510. for ( ; i < 4; i++ ) {
  47511. expanded[ prefix + cssExpand[ i ] + suffix ] =
  47512. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  47513. }
  47514. return expanded;
  47515. }
  47516. };
  47517. if ( prefix !== "margin" ) {
  47518. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  47519. }
  47520. } );
  47521. jQuery.fn.extend( {
  47522. css: function( name, value ) {
  47523. return access( this, function( elem, name, value ) {
  47524. var styles, len,
  47525. map = {},
  47526. i = 0;
  47527. if ( Array.isArray( name ) ) {
  47528. styles = getStyles( elem );
  47529. len = name.length;
  47530. for ( ; i < len; i++ ) {
  47531. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  47532. }
  47533. return map;
  47534. }
  47535. return value !== undefined ?
  47536. jQuery.style( elem, name, value ) :
  47537. jQuery.css( elem, name );
  47538. }, name, value, arguments.length > 1 );
  47539. }
  47540. } );
  47541. function Tween( elem, options, prop, end, easing ) {
  47542. return new Tween.prototype.init( elem, options, prop, end, easing );
  47543. }
  47544. jQuery.Tween = Tween;
  47545. Tween.prototype = {
  47546. constructor: Tween,
  47547. init: function( elem, options, prop, end, easing, unit ) {
  47548. this.elem = elem;
  47549. this.prop = prop;
  47550. this.easing = easing || jQuery.easing._default;
  47551. this.options = options;
  47552. this.start = this.now = this.cur();
  47553. this.end = end;
  47554. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  47555. },
  47556. cur: function() {
  47557. var hooks = Tween.propHooks[ this.prop ];
  47558. return hooks && hooks.get ?
  47559. hooks.get( this ) :
  47560. Tween.propHooks._default.get( this );
  47561. },
  47562. run: function( percent ) {
  47563. var eased,
  47564. hooks = Tween.propHooks[ this.prop ];
  47565. if ( this.options.duration ) {
  47566. this.pos = eased = jQuery.easing[ this.easing ](
  47567. percent, this.options.duration * percent, 0, 1, this.options.duration
  47568. );
  47569. } else {
  47570. this.pos = eased = percent;
  47571. }
  47572. this.now = ( this.end - this.start ) * eased + this.start;
  47573. if ( this.options.step ) {
  47574. this.options.step.call( this.elem, this.now, this );
  47575. }
  47576. if ( hooks && hooks.set ) {
  47577. hooks.set( this );
  47578. } else {
  47579. Tween.propHooks._default.set( this );
  47580. }
  47581. return this;
  47582. }
  47583. };
  47584. Tween.prototype.init.prototype = Tween.prototype;
  47585. Tween.propHooks = {
  47586. _default: {
  47587. get: function( tween ) {
  47588. var result;
  47589. // Use a property on the element directly when it is not a DOM element,
  47590. // or when there is no matching style property that exists.
  47591. if ( tween.elem.nodeType !== 1 ||
  47592. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  47593. return tween.elem[ tween.prop ];
  47594. }
  47595. // Passing an empty string as a 3rd parameter to .css will automatically
  47596. // attempt a parseFloat and fallback to a string if the parse fails.
  47597. // Simple values such as "10px" are parsed to Float;
  47598. // complex values such as "rotate(1rad)" are returned as-is.
  47599. result = jQuery.css( tween.elem, tween.prop, "" );
  47600. // Empty strings, null, undefined and "auto" are converted to 0.
  47601. return !result || result === "auto" ? 0 : result;
  47602. },
  47603. set: function( tween ) {
  47604. // Use step hook for back compat.
  47605. // Use cssHook if its there.
  47606. // Use .style if available and use plain properties where available.
  47607. if ( jQuery.fx.step[ tween.prop ] ) {
  47608. jQuery.fx.step[ tween.prop ]( tween );
  47609. } else if ( tween.elem.nodeType === 1 &&
  47610. ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null ||
  47611. jQuery.cssHooks[ tween.prop ] ) ) {
  47612. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  47613. } else {
  47614. tween.elem[ tween.prop ] = tween.now;
  47615. }
  47616. }
  47617. }
  47618. };
  47619. // Support: IE <=9 only
  47620. // Panic based approach to setting things on disconnected nodes
  47621. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  47622. set: function( tween ) {
  47623. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  47624. tween.elem[ tween.prop ] = tween.now;
  47625. }
  47626. }
  47627. };
  47628. jQuery.easing = {
  47629. linear: function( p ) {
  47630. return p;
  47631. },
  47632. swing: function( p ) {
  47633. return 0.5 - Math.cos( p * Math.PI ) / 2;
  47634. },
  47635. _default: "swing"
  47636. };
  47637. jQuery.fx = Tween.prototype.init;
  47638. // Back compat <1.8 extension point
  47639. jQuery.fx.step = {};
  47640. var
  47641. fxNow, inProgress,
  47642. rfxtypes = /^(?:toggle|show|hide)$/,
  47643. rrun = /queueHooks$/;
  47644. function schedule() {
  47645. if ( inProgress ) {
  47646. if ( document.hidden === false && window.requestAnimationFrame ) {
  47647. window.requestAnimationFrame( schedule );
  47648. } else {
  47649. window.setTimeout( schedule, jQuery.fx.interval );
  47650. }
  47651. jQuery.fx.tick();
  47652. }
  47653. }
  47654. // Animations created synchronously will run synchronously
  47655. function createFxNow() {
  47656. window.setTimeout( function() {
  47657. fxNow = undefined;
  47658. } );
  47659. return ( fxNow = Date.now() );
  47660. }
  47661. // Generate parameters to create a standard animation
  47662. function genFx( type, includeWidth ) {
  47663. var which,
  47664. i = 0,
  47665. attrs = { height: type };
  47666. // If we include width, step value is 1 to do all cssExpand values,
  47667. // otherwise step value is 2 to skip over Left and Right
  47668. includeWidth = includeWidth ? 1 : 0;
  47669. for ( ; i < 4; i += 2 - includeWidth ) {
  47670. which = cssExpand[ i ];
  47671. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  47672. }
  47673. if ( includeWidth ) {
  47674. attrs.opacity = attrs.width = type;
  47675. }
  47676. return attrs;
  47677. }
  47678. function createTween( value, prop, animation ) {
  47679. var tween,
  47680. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  47681. index = 0,
  47682. length = collection.length;
  47683. for ( ; index < length; index++ ) {
  47684. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  47685. // We're done with this property
  47686. return tween;
  47687. }
  47688. }
  47689. }
  47690. function defaultPrefilter( elem, props, opts ) {
  47691. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  47692. isBox = "width" in props || "height" in props,
  47693. anim = this,
  47694. orig = {},
  47695. style = elem.style,
  47696. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  47697. dataShow = dataPriv.get( elem, "fxshow" );
  47698. // Queue-skipping animations hijack the fx hooks
  47699. if ( !opts.queue ) {
  47700. hooks = jQuery._queueHooks( elem, "fx" );
  47701. if ( hooks.unqueued == null ) {
  47702. hooks.unqueued = 0;
  47703. oldfire = hooks.empty.fire;
  47704. hooks.empty.fire = function() {
  47705. if ( !hooks.unqueued ) {
  47706. oldfire();
  47707. }
  47708. };
  47709. }
  47710. hooks.unqueued++;
  47711. anim.always( function() {
  47712. // Ensure the complete handler is called before this completes
  47713. anim.always( function() {
  47714. hooks.unqueued--;
  47715. if ( !jQuery.queue( elem, "fx" ).length ) {
  47716. hooks.empty.fire();
  47717. }
  47718. } );
  47719. } );
  47720. }
  47721. // Detect show/hide animations
  47722. for ( prop in props ) {
  47723. value = props[ prop ];
  47724. if ( rfxtypes.test( value ) ) {
  47725. delete props[ prop ];
  47726. toggle = toggle || value === "toggle";
  47727. if ( value === ( hidden ? "hide" : "show" ) ) {
  47728. // Pretend to be hidden if this is a "show" and
  47729. // there is still data from a stopped show/hide
  47730. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  47731. hidden = true;
  47732. // Ignore all other no-op show/hide data
  47733. } else {
  47734. continue;
  47735. }
  47736. }
  47737. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  47738. }
  47739. }
  47740. // Bail out if this is a no-op like .hide().hide()
  47741. propTween = !jQuery.isEmptyObject( props );
  47742. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  47743. return;
  47744. }
  47745. // Restrict "overflow" and "display" styles during box animations
  47746. if ( isBox && elem.nodeType === 1 ) {
  47747. // Support: IE <=9 - 11, Edge 12 - 15
  47748. // Record all 3 overflow attributes because IE does not infer the shorthand
  47749. // from identically-valued overflowX and overflowY and Edge just mirrors
  47750. // the overflowX value there.
  47751. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  47752. // Identify a display type, preferring old show/hide data over the CSS cascade
  47753. restoreDisplay = dataShow && dataShow.display;
  47754. if ( restoreDisplay == null ) {
  47755. restoreDisplay = dataPriv.get( elem, "display" );
  47756. }
  47757. display = jQuery.css( elem, "display" );
  47758. if ( display === "none" ) {
  47759. if ( restoreDisplay ) {
  47760. display = restoreDisplay;
  47761. } else {
  47762. // Get nonempty value(s) by temporarily forcing visibility
  47763. showHide( [ elem ], true );
  47764. restoreDisplay = elem.style.display || restoreDisplay;
  47765. display = jQuery.css( elem, "display" );
  47766. showHide( [ elem ] );
  47767. }
  47768. }
  47769. // Animate inline elements as inline-block
  47770. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  47771. if ( jQuery.css( elem, "float" ) === "none" ) {
  47772. // Restore the original display value at the end of pure show/hide animations
  47773. if ( !propTween ) {
  47774. anim.done( function() {
  47775. style.display = restoreDisplay;
  47776. } );
  47777. if ( restoreDisplay == null ) {
  47778. display = style.display;
  47779. restoreDisplay = display === "none" ? "" : display;
  47780. }
  47781. }
  47782. style.display = "inline-block";
  47783. }
  47784. }
  47785. }
  47786. if ( opts.overflow ) {
  47787. style.overflow = "hidden";
  47788. anim.always( function() {
  47789. style.overflow = opts.overflow[ 0 ];
  47790. style.overflowX = opts.overflow[ 1 ];
  47791. style.overflowY = opts.overflow[ 2 ];
  47792. } );
  47793. }
  47794. // Implement show/hide animations
  47795. propTween = false;
  47796. for ( prop in orig ) {
  47797. // General show/hide setup for this element animation
  47798. if ( !propTween ) {
  47799. if ( dataShow ) {
  47800. if ( "hidden" in dataShow ) {
  47801. hidden = dataShow.hidden;
  47802. }
  47803. } else {
  47804. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  47805. }
  47806. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  47807. if ( toggle ) {
  47808. dataShow.hidden = !hidden;
  47809. }
  47810. // Show elements before animating them
  47811. if ( hidden ) {
  47812. showHide( [ elem ], true );
  47813. }
  47814. /* eslint-disable no-loop-func */
  47815. anim.done( function() {
  47816. /* eslint-enable no-loop-func */
  47817. // The final step of a "hide" animation is actually hiding the element
  47818. if ( !hidden ) {
  47819. showHide( [ elem ] );
  47820. }
  47821. dataPriv.remove( elem, "fxshow" );
  47822. for ( prop in orig ) {
  47823. jQuery.style( elem, prop, orig[ prop ] );
  47824. }
  47825. } );
  47826. }
  47827. // Per-property setup
  47828. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  47829. if ( !( prop in dataShow ) ) {
  47830. dataShow[ prop ] = propTween.start;
  47831. if ( hidden ) {
  47832. propTween.end = propTween.start;
  47833. propTween.start = 0;
  47834. }
  47835. }
  47836. }
  47837. }
  47838. function propFilter( props, specialEasing ) {
  47839. var index, name, easing, value, hooks;
  47840. // camelCase, specialEasing and expand cssHook pass
  47841. for ( index in props ) {
  47842. name = camelCase( index );
  47843. easing = specialEasing[ name ];
  47844. value = props[ index ];
  47845. if ( Array.isArray( value ) ) {
  47846. easing = value[ 1 ];
  47847. value = props[ index ] = value[ 0 ];
  47848. }
  47849. if ( index !== name ) {
  47850. props[ name ] = value;
  47851. delete props[ index ];
  47852. }
  47853. hooks = jQuery.cssHooks[ name ];
  47854. if ( hooks && "expand" in hooks ) {
  47855. value = hooks.expand( value );
  47856. delete props[ name ];
  47857. // Not quite $.extend, this won't overwrite existing keys.
  47858. // Reusing 'index' because we have the correct "name"
  47859. for ( index in value ) {
  47860. if ( !( index in props ) ) {
  47861. props[ index ] = value[ index ];
  47862. specialEasing[ index ] = easing;
  47863. }
  47864. }
  47865. } else {
  47866. specialEasing[ name ] = easing;
  47867. }
  47868. }
  47869. }
  47870. function Animation( elem, properties, options ) {
  47871. var result,
  47872. stopped,
  47873. index = 0,
  47874. length = Animation.prefilters.length,
  47875. deferred = jQuery.Deferred().always( function() {
  47876. // Don't match elem in the :animated selector
  47877. delete tick.elem;
  47878. } ),
  47879. tick = function() {
  47880. if ( stopped ) {
  47881. return false;
  47882. }
  47883. var currentTime = fxNow || createFxNow(),
  47884. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  47885. // Support: Android 2.3 only
  47886. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  47887. temp = remaining / animation.duration || 0,
  47888. percent = 1 - temp,
  47889. index = 0,
  47890. length = animation.tweens.length;
  47891. for ( ; index < length; index++ ) {
  47892. animation.tweens[ index ].run( percent );
  47893. }
  47894. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  47895. // If there's more to do, yield
  47896. if ( percent < 1 && length ) {
  47897. return remaining;
  47898. }
  47899. // If this was an empty animation, synthesize a final progress notification
  47900. if ( !length ) {
  47901. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  47902. }
  47903. // Resolve the animation and report its conclusion
  47904. deferred.resolveWith( elem, [ animation ] );
  47905. return false;
  47906. },
  47907. animation = deferred.promise( {
  47908. elem: elem,
  47909. props: jQuery.extend( {}, properties ),
  47910. opts: jQuery.extend( true, {
  47911. specialEasing: {},
  47912. easing: jQuery.easing._default
  47913. }, options ),
  47914. originalProperties: properties,
  47915. originalOptions: options,
  47916. startTime: fxNow || createFxNow(),
  47917. duration: options.duration,
  47918. tweens: [],
  47919. createTween: function( prop, end ) {
  47920. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  47921. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  47922. animation.tweens.push( tween );
  47923. return tween;
  47924. },
  47925. stop: function( gotoEnd ) {
  47926. var index = 0,
  47927. // If we are going to the end, we want to run all the tweens
  47928. // otherwise we skip this part
  47929. length = gotoEnd ? animation.tweens.length : 0;
  47930. if ( stopped ) {
  47931. return this;
  47932. }
  47933. stopped = true;
  47934. for ( ; index < length; index++ ) {
  47935. animation.tweens[ index ].run( 1 );
  47936. }
  47937. // Resolve when we played the last frame; otherwise, reject
  47938. if ( gotoEnd ) {
  47939. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  47940. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  47941. } else {
  47942. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  47943. }
  47944. return this;
  47945. }
  47946. } ),
  47947. props = animation.props;
  47948. propFilter( props, animation.opts.specialEasing );
  47949. for ( ; index < length; index++ ) {
  47950. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  47951. if ( result ) {
  47952. if ( isFunction( result.stop ) ) {
  47953. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  47954. result.stop.bind( result );
  47955. }
  47956. return result;
  47957. }
  47958. }
  47959. jQuery.map( props, createTween, animation );
  47960. if ( isFunction( animation.opts.start ) ) {
  47961. animation.opts.start.call( elem, animation );
  47962. }
  47963. // Attach callbacks from options
  47964. animation
  47965. .progress( animation.opts.progress )
  47966. .done( animation.opts.done, animation.opts.complete )
  47967. .fail( animation.opts.fail )
  47968. .always( animation.opts.always );
  47969. jQuery.fx.timer(
  47970. jQuery.extend( tick, {
  47971. elem: elem,
  47972. anim: animation,
  47973. queue: animation.opts.queue
  47974. } )
  47975. );
  47976. return animation;
  47977. }
  47978. jQuery.Animation = jQuery.extend( Animation, {
  47979. tweeners: {
  47980. "*": [ function( prop, value ) {
  47981. var tween = this.createTween( prop, value );
  47982. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  47983. return tween;
  47984. } ]
  47985. },
  47986. tweener: function( props, callback ) {
  47987. if ( isFunction( props ) ) {
  47988. callback = props;
  47989. props = [ "*" ];
  47990. } else {
  47991. props = props.match( rnothtmlwhite );
  47992. }
  47993. var prop,
  47994. index = 0,
  47995. length = props.length;
  47996. for ( ; index < length; index++ ) {
  47997. prop = props[ index ];
  47998. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  47999. Animation.tweeners[ prop ].unshift( callback );
  48000. }
  48001. },
  48002. prefilters: [ defaultPrefilter ],
  48003. prefilter: function( callback, prepend ) {
  48004. if ( prepend ) {
  48005. Animation.prefilters.unshift( callback );
  48006. } else {
  48007. Animation.prefilters.push( callback );
  48008. }
  48009. }
  48010. } );
  48011. jQuery.speed = function( speed, easing, fn ) {
  48012. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  48013. complete: fn || !fn && easing ||
  48014. isFunction( speed ) && speed,
  48015. duration: speed,
  48016. easing: fn && easing || easing && !isFunction( easing ) && easing
  48017. };
  48018. // Go to the end state if fx are off
  48019. if ( jQuery.fx.off ) {
  48020. opt.duration = 0;
  48021. } else {
  48022. if ( typeof opt.duration !== "number" ) {
  48023. if ( opt.duration in jQuery.fx.speeds ) {
  48024. opt.duration = jQuery.fx.speeds[ opt.duration ];
  48025. } else {
  48026. opt.duration = jQuery.fx.speeds._default;
  48027. }
  48028. }
  48029. }
  48030. // Normalize opt.queue - true/undefined/null -> "fx"
  48031. if ( opt.queue == null || opt.queue === true ) {
  48032. opt.queue = "fx";
  48033. }
  48034. // Queueing
  48035. opt.old = opt.complete;
  48036. opt.complete = function() {
  48037. if ( isFunction( opt.old ) ) {
  48038. opt.old.call( this );
  48039. }
  48040. if ( opt.queue ) {
  48041. jQuery.dequeue( this, opt.queue );
  48042. }
  48043. };
  48044. return opt;
  48045. };
  48046. jQuery.fn.extend( {
  48047. fadeTo: function( speed, to, easing, callback ) {
  48048. // Show any hidden elements after setting opacity to 0
  48049. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  48050. // Animate to the value specified
  48051. .end().animate( { opacity: to }, speed, easing, callback );
  48052. },
  48053. animate: function( prop, speed, easing, callback ) {
  48054. var empty = jQuery.isEmptyObject( prop ),
  48055. optall = jQuery.speed( speed, easing, callback ),
  48056. doAnimation = function() {
  48057. // Operate on a copy of prop so per-property easing won't be lost
  48058. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  48059. // Empty animations, or finishing resolves immediately
  48060. if ( empty || dataPriv.get( this, "finish" ) ) {
  48061. anim.stop( true );
  48062. }
  48063. };
  48064. doAnimation.finish = doAnimation;
  48065. return empty || optall.queue === false ?
  48066. this.each( doAnimation ) :
  48067. this.queue( optall.queue, doAnimation );
  48068. },
  48069. stop: function( type, clearQueue, gotoEnd ) {
  48070. var stopQueue = function( hooks ) {
  48071. var stop = hooks.stop;
  48072. delete hooks.stop;
  48073. stop( gotoEnd );
  48074. };
  48075. if ( typeof type !== "string" ) {
  48076. gotoEnd = clearQueue;
  48077. clearQueue = type;
  48078. type = undefined;
  48079. }
  48080. if ( clearQueue && type !== false ) {
  48081. this.queue( type || "fx", [] );
  48082. }
  48083. return this.each( function() {
  48084. var dequeue = true,
  48085. index = type != null && type + "queueHooks",
  48086. timers = jQuery.timers,
  48087. data = dataPriv.get( this );
  48088. if ( index ) {
  48089. if ( data[ index ] && data[ index ].stop ) {
  48090. stopQueue( data[ index ] );
  48091. }
  48092. } else {
  48093. for ( index in data ) {
  48094. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  48095. stopQueue( data[ index ] );
  48096. }
  48097. }
  48098. }
  48099. for ( index = timers.length; index--; ) {
  48100. if ( timers[ index ].elem === this &&
  48101. ( type == null || timers[ index ].queue === type ) ) {
  48102. timers[ index ].anim.stop( gotoEnd );
  48103. dequeue = false;
  48104. timers.splice( index, 1 );
  48105. }
  48106. }
  48107. // Start the next in the queue if the last step wasn't forced.
  48108. // Timers currently will call their complete callbacks, which
  48109. // will dequeue but only if they were gotoEnd.
  48110. if ( dequeue || !gotoEnd ) {
  48111. jQuery.dequeue( this, type );
  48112. }
  48113. } );
  48114. },
  48115. finish: function( type ) {
  48116. if ( type !== false ) {
  48117. type = type || "fx";
  48118. }
  48119. return this.each( function() {
  48120. var index,
  48121. data = dataPriv.get( this ),
  48122. queue = data[ type + "queue" ],
  48123. hooks = data[ type + "queueHooks" ],
  48124. timers = jQuery.timers,
  48125. length = queue ? queue.length : 0;
  48126. // Enable finishing flag on private data
  48127. data.finish = true;
  48128. // Empty the queue first
  48129. jQuery.queue( this, type, [] );
  48130. if ( hooks && hooks.stop ) {
  48131. hooks.stop.call( this, true );
  48132. }
  48133. // Look for any active animations, and finish them
  48134. for ( index = timers.length; index--; ) {
  48135. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  48136. timers[ index ].anim.stop( true );
  48137. timers.splice( index, 1 );
  48138. }
  48139. }
  48140. // Look for any animations in the old queue and finish them
  48141. for ( index = 0; index < length; index++ ) {
  48142. if ( queue[ index ] && queue[ index ].finish ) {
  48143. queue[ index ].finish.call( this );
  48144. }
  48145. }
  48146. // Turn off finishing flag
  48147. delete data.finish;
  48148. } );
  48149. }
  48150. } );
  48151. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  48152. var cssFn = jQuery.fn[ name ];
  48153. jQuery.fn[ name ] = function( speed, easing, callback ) {
  48154. return speed == null || typeof speed === "boolean" ?
  48155. cssFn.apply( this, arguments ) :
  48156. this.animate( genFx( name, true ), speed, easing, callback );
  48157. };
  48158. } );
  48159. // Generate shortcuts for custom animations
  48160. jQuery.each( {
  48161. slideDown: genFx( "show" ),
  48162. slideUp: genFx( "hide" ),
  48163. slideToggle: genFx( "toggle" ),
  48164. fadeIn: { opacity: "show" },
  48165. fadeOut: { opacity: "hide" },
  48166. fadeToggle: { opacity: "toggle" }
  48167. }, function( name, props ) {
  48168. jQuery.fn[ name ] = function( speed, easing, callback ) {
  48169. return this.animate( props, speed, easing, callback );
  48170. };
  48171. } );
  48172. jQuery.timers = [];
  48173. jQuery.fx.tick = function() {
  48174. var timer,
  48175. i = 0,
  48176. timers = jQuery.timers;
  48177. fxNow = Date.now();
  48178. for ( ; i < timers.length; i++ ) {
  48179. timer = timers[ i ];
  48180. // Run the timer and safely remove it when done (allowing for external removal)
  48181. if ( !timer() && timers[ i ] === timer ) {
  48182. timers.splice( i--, 1 );
  48183. }
  48184. }
  48185. if ( !timers.length ) {
  48186. jQuery.fx.stop();
  48187. }
  48188. fxNow = undefined;
  48189. };
  48190. jQuery.fx.timer = function( timer ) {
  48191. jQuery.timers.push( timer );
  48192. jQuery.fx.start();
  48193. };
  48194. jQuery.fx.interval = 13;
  48195. jQuery.fx.start = function() {
  48196. if ( inProgress ) {
  48197. return;
  48198. }
  48199. inProgress = true;
  48200. schedule();
  48201. };
  48202. jQuery.fx.stop = function() {
  48203. inProgress = null;
  48204. };
  48205. jQuery.fx.speeds = {
  48206. slow: 600,
  48207. fast: 200,
  48208. // Default speed
  48209. _default: 400
  48210. };
  48211. // Based off of the plugin by Clint Helfers, with permission.
  48212. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  48213. jQuery.fn.delay = function( time, type ) {
  48214. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  48215. type = type || "fx";
  48216. return this.queue( type, function( next, hooks ) {
  48217. var timeout = window.setTimeout( next, time );
  48218. hooks.stop = function() {
  48219. window.clearTimeout( timeout );
  48220. };
  48221. } );
  48222. };
  48223. ( function() {
  48224. var input = document.createElement( "input" ),
  48225. select = document.createElement( "select" ),
  48226. opt = select.appendChild( document.createElement( "option" ) );
  48227. input.type = "checkbox";
  48228. // Support: Android <=4.3 only
  48229. // Default value for a checkbox should be "on"
  48230. support.checkOn = input.value !== "";
  48231. // Support: IE <=11 only
  48232. // Must access selectedIndex to make default options select
  48233. support.optSelected = opt.selected;
  48234. // Support: IE <=11 only
  48235. // An input loses its value after becoming a radio
  48236. input = document.createElement( "input" );
  48237. input.value = "t";
  48238. input.type = "radio";
  48239. support.radioValue = input.value === "t";
  48240. } )();
  48241. var boolHook,
  48242. attrHandle = jQuery.expr.attrHandle;
  48243. jQuery.fn.extend( {
  48244. attr: function( name, value ) {
  48245. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  48246. },
  48247. removeAttr: function( name ) {
  48248. return this.each( function() {
  48249. jQuery.removeAttr( this, name );
  48250. } );
  48251. }
  48252. } );
  48253. jQuery.extend( {
  48254. attr: function( elem, name, value ) {
  48255. var ret, hooks,
  48256. nType = elem.nodeType;
  48257. // Don't get/set attributes on text, comment and attribute nodes
  48258. if ( nType === 3 || nType === 8 || nType === 2 ) {
  48259. return;
  48260. }
  48261. // Fallback to prop when attributes are not supported
  48262. if ( typeof elem.getAttribute === "undefined" ) {
  48263. return jQuery.prop( elem, name, value );
  48264. }
  48265. // Attribute hooks are determined by the lowercase version
  48266. // Grab necessary hook if one is defined
  48267. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  48268. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  48269. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  48270. }
  48271. if ( value !== undefined ) {
  48272. if ( value === null ) {
  48273. jQuery.removeAttr( elem, name );
  48274. return;
  48275. }
  48276. if ( hooks && "set" in hooks &&
  48277. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  48278. return ret;
  48279. }
  48280. elem.setAttribute( name, value + "" );
  48281. return value;
  48282. }
  48283. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  48284. return ret;
  48285. }
  48286. ret = jQuery.find.attr( elem, name );
  48287. // Non-existent attributes return null, we normalize to undefined
  48288. return ret == null ? undefined : ret;
  48289. },
  48290. attrHooks: {
  48291. type: {
  48292. set: function( elem, value ) {
  48293. if ( !support.radioValue && value === "radio" &&
  48294. nodeName( elem, "input" ) ) {
  48295. var val = elem.value;
  48296. elem.setAttribute( "type", value );
  48297. if ( val ) {
  48298. elem.value = val;
  48299. }
  48300. return value;
  48301. }
  48302. }
  48303. }
  48304. },
  48305. removeAttr: function( elem, value ) {
  48306. var name,
  48307. i = 0,
  48308. // Attribute names can contain non-HTML whitespace characters
  48309. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  48310. attrNames = value && value.match( rnothtmlwhite );
  48311. if ( attrNames && elem.nodeType === 1 ) {
  48312. while ( ( name = attrNames[ i++ ] ) ) {
  48313. elem.removeAttribute( name );
  48314. }
  48315. }
  48316. }
  48317. } );
  48318. // Hooks for boolean attributes
  48319. boolHook = {
  48320. set: function( elem, value, name ) {
  48321. if ( value === false ) {
  48322. // Remove boolean attributes when set to false
  48323. jQuery.removeAttr( elem, name );
  48324. } else {
  48325. elem.setAttribute( name, name );
  48326. }
  48327. return name;
  48328. }
  48329. };
  48330. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  48331. var getter = attrHandle[ name ] || jQuery.find.attr;
  48332. attrHandle[ name ] = function( elem, name, isXML ) {
  48333. var ret, handle,
  48334. lowercaseName = name.toLowerCase();
  48335. if ( !isXML ) {
  48336. // Avoid an infinite loop by temporarily removing this function from the getter
  48337. handle = attrHandle[ lowercaseName ];
  48338. attrHandle[ lowercaseName ] = ret;
  48339. ret = getter( elem, name, isXML ) != null ?
  48340. lowercaseName :
  48341. null;
  48342. attrHandle[ lowercaseName ] = handle;
  48343. }
  48344. return ret;
  48345. };
  48346. } );
  48347. var rfocusable = /^(?:input|select|textarea|button)$/i,
  48348. rclickable = /^(?:a|area)$/i;
  48349. jQuery.fn.extend( {
  48350. prop: function( name, value ) {
  48351. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  48352. },
  48353. removeProp: function( name ) {
  48354. return this.each( function() {
  48355. delete this[ jQuery.propFix[ name ] || name ];
  48356. } );
  48357. }
  48358. } );
  48359. jQuery.extend( {
  48360. prop: function( elem, name, value ) {
  48361. var ret, hooks,
  48362. nType = elem.nodeType;
  48363. // Don't get/set properties on text, comment and attribute nodes
  48364. if ( nType === 3 || nType === 8 || nType === 2 ) {
  48365. return;
  48366. }
  48367. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  48368. // Fix name and attach hooks
  48369. name = jQuery.propFix[ name ] || name;
  48370. hooks = jQuery.propHooks[ name ];
  48371. }
  48372. if ( value !== undefined ) {
  48373. if ( hooks && "set" in hooks &&
  48374. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  48375. return ret;
  48376. }
  48377. return ( elem[ name ] = value );
  48378. }
  48379. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  48380. return ret;
  48381. }
  48382. return elem[ name ];
  48383. },
  48384. propHooks: {
  48385. tabIndex: {
  48386. get: function( elem ) {
  48387. // Support: IE <=9 - 11 only
  48388. // elem.tabIndex doesn't always return the
  48389. // correct value when it hasn't been explicitly set
  48390. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  48391. // Use proper attribute retrieval(#12072)
  48392. var tabindex = jQuery.find.attr( elem, "tabindex" );
  48393. if ( tabindex ) {
  48394. return parseInt( tabindex, 10 );
  48395. }
  48396. if (
  48397. rfocusable.test( elem.nodeName ) ||
  48398. rclickable.test( elem.nodeName ) &&
  48399. elem.href
  48400. ) {
  48401. return 0;
  48402. }
  48403. return -1;
  48404. }
  48405. }
  48406. },
  48407. propFix: {
  48408. "for": "htmlFor",
  48409. "class": "className"
  48410. }
  48411. } );
  48412. // Support: IE <=11 only
  48413. // Accessing the selectedIndex property
  48414. // forces the browser to respect setting selected
  48415. // on the option
  48416. // The getter ensures a default option is selected
  48417. // when in an optgroup
  48418. // eslint rule "no-unused-expressions" is disabled for this code
  48419. // since it considers such accessions noop
  48420. if ( !support.optSelected ) {
  48421. jQuery.propHooks.selected = {
  48422. get: function( elem ) {
  48423. /* eslint no-unused-expressions: "off" */
  48424. var parent = elem.parentNode;
  48425. if ( parent && parent.parentNode ) {
  48426. parent.parentNode.selectedIndex;
  48427. }
  48428. return null;
  48429. },
  48430. set: function( elem ) {
  48431. /* eslint no-unused-expressions: "off" */
  48432. var parent = elem.parentNode;
  48433. if ( parent ) {
  48434. parent.selectedIndex;
  48435. if ( parent.parentNode ) {
  48436. parent.parentNode.selectedIndex;
  48437. }
  48438. }
  48439. }
  48440. };
  48441. }
  48442. jQuery.each( [
  48443. "tabIndex",
  48444. "readOnly",
  48445. "maxLength",
  48446. "cellSpacing",
  48447. "cellPadding",
  48448. "rowSpan",
  48449. "colSpan",
  48450. "useMap",
  48451. "frameBorder",
  48452. "contentEditable"
  48453. ], function() {
  48454. jQuery.propFix[ this.toLowerCase() ] = this;
  48455. } );
  48456. // Strip and collapse whitespace according to HTML spec
  48457. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  48458. function stripAndCollapse( value ) {
  48459. var tokens = value.match( rnothtmlwhite ) || [];
  48460. return tokens.join( " " );
  48461. }
  48462. function getClass( elem ) {
  48463. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  48464. }
  48465. function classesToArray( value ) {
  48466. if ( Array.isArray( value ) ) {
  48467. return value;
  48468. }
  48469. if ( typeof value === "string" ) {
  48470. return value.match( rnothtmlwhite ) || [];
  48471. }
  48472. return [];
  48473. }
  48474. jQuery.fn.extend( {
  48475. addClass: function( value ) {
  48476. var classes, elem, cur, curValue, clazz, j, finalValue,
  48477. i = 0;
  48478. if ( isFunction( value ) ) {
  48479. return this.each( function( j ) {
  48480. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  48481. } );
  48482. }
  48483. classes = classesToArray( value );
  48484. if ( classes.length ) {
  48485. while ( ( elem = this[ i++ ] ) ) {
  48486. curValue = getClass( elem );
  48487. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  48488. if ( cur ) {
  48489. j = 0;
  48490. while ( ( clazz = classes[ j++ ] ) ) {
  48491. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  48492. cur += clazz + " ";
  48493. }
  48494. }
  48495. // Only assign if different to avoid unneeded rendering.
  48496. finalValue = stripAndCollapse( cur );
  48497. if ( curValue !== finalValue ) {
  48498. elem.setAttribute( "class", finalValue );
  48499. }
  48500. }
  48501. }
  48502. }
  48503. return this;
  48504. },
  48505. removeClass: function( value ) {
  48506. var classes, elem, cur, curValue, clazz, j, finalValue,
  48507. i = 0;
  48508. if ( isFunction( value ) ) {
  48509. return this.each( function( j ) {
  48510. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  48511. } );
  48512. }
  48513. if ( !arguments.length ) {
  48514. return this.attr( "class", "" );
  48515. }
  48516. classes = classesToArray( value );
  48517. if ( classes.length ) {
  48518. while ( ( elem = this[ i++ ] ) ) {
  48519. curValue = getClass( elem );
  48520. // This expression is here for better compressibility (see addClass)
  48521. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  48522. if ( cur ) {
  48523. j = 0;
  48524. while ( ( clazz = classes[ j++ ] ) ) {
  48525. // Remove *all* instances
  48526. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  48527. cur = cur.replace( " " + clazz + " ", " " );
  48528. }
  48529. }
  48530. // Only assign if different to avoid unneeded rendering.
  48531. finalValue = stripAndCollapse( cur );
  48532. if ( curValue !== finalValue ) {
  48533. elem.setAttribute( "class", finalValue );
  48534. }
  48535. }
  48536. }
  48537. }
  48538. return this;
  48539. },
  48540. toggleClass: function( value, stateVal ) {
  48541. var type = typeof value,
  48542. isValidValue = type === "string" || Array.isArray( value );
  48543. if ( typeof stateVal === "boolean" && isValidValue ) {
  48544. return stateVal ? this.addClass( value ) : this.removeClass( value );
  48545. }
  48546. if ( isFunction( value ) ) {
  48547. return this.each( function( i ) {
  48548. jQuery( this ).toggleClass(
  48549. value.call( this, i, getClass( this ), stateVal ),
  48550. stateVal
  48551. );
  48552. } );
  48553. }
  48554. return this.each( function() {
  48555. var className, i, self, classNames;
  48556. if ( isValidValue ) {
  48557. // Toggle individual class names
  48558. i = 0;
  48559. self = jQuery( this );
  48560. classNames = classesToArray( value );
  48561. while ( ( className = classNames[ i++ ] ) ) {
  48562. // Check each className given, space separated list
  48563. if ( self.hasClass( className ) ) {
  48564. self.removeClass( className );
  48565. } else {
  48566. self.addClass( className );
  48567. }
  48568. }
  48569. // Toggle whole class name
  48570. } else if ( value === undefined || type === "boolean" ) {
  48571. className = getClass( this );
  48572. if ( className ) {
  48573. // Store className if set
  48574. dataPriv.set( this, "__className__", className );
  48575. }
  48576. // If the element has a class name or if we're passed `false`,
  48577. // then remove the whole classname (if there was one, the above saved it).
  48578. // Otherwise bring back whatever was previously saved (if anything),
  48579. // falling back to the empty string if nothing was stored.
  48580. if ( this.setAttribute ) {
  48581. this.setAttribute( "class",
  48582. className || value === false ?
  48583. "" :
  48584. dataPriv.get( this, "__className__" ) || ""
  48585. );
  48586. }
  48587. }
  48588. } );
  48589. },
  48590. hasClass: function( selector ) {
  48591. var className, elem,
  48592. i = 0;
  48593. className = " " + selector + " ";
  48594. while ( ( elem = this[ i++ ] ) ) {
  48595. if ( elem.nodeType === 1 &&
  48596. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  48597. return true;
  48598. }
  48599. }
  48600. return false;
  48601. }
  48602. } );
  48603. var rreturn = /\r/g;
  48604. jQuery.fn.extend( {
  48605. val: function( value ) {
  48606. var hooks, ret, valueIsFunction,
  48607. elem = this[ 0 ];
  48608. if ( !arguments.length ) {
  48609. if ( elem ) {
  48610. hooks = jQuery.valHooks[ elem.type ] ||
  48611. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  48612. if ( hooks &&
  48613. "get" in hooks &&
  48614. ( ret = hooks.get( elem, "value" ) ) !== undefined
  48615. ) {
  48616. return ret;
  48617. }
  48618. ret = elem.value;
  48619. // Handle most common string cases
  48620. if ( typeof ret === "string" ) {
  48621. return ret.replace( rreturn, "" );
  48622. }
  48623. // Handle cases where value is null/undef or number
  48624. return ret == null ? "" : ret;
  48625. }
  48626. return;
  48627. }
  48628. valueIsFunction = isFunction( value );
  48629. return this.each( function( i ) {
  48630. var val;
  48631. if ( this.nodeType !== 1 ) {
  48632. return;
  48633. }
  48634. if ( valueIsFunction ) {
  48635. val = value.call( this, i, jQuery( this ).val() );
  48636. } else {
  48637. val = value;
  48638. }
  48639. // Treat null/undefined as ""; convert numbers to string
  48640. if ( val == null ) {
  48641. val = "";
  48642. } else if ( typeof val === "number" ) {
  48643. val += "";
  48644. } else if ( Array.isArray( val ) ) {
  48645. val = jQuery.map( val, function( value ) {
  48646. return value == null ? "" : value + "";
  48647. } );
  48648. }
  48649. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  48650. // If set returns undefined, fall back to normal setting
  48651. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  48652. this.value = val;
  48653. }
  48654. } );
  48655. }
  48656. } );
  48657. jQuery.extend( {
  48658. valHooks: {
  48659. option: {
  48660. get: function( elem ) {
  48661. var val = jQuery.find.attr( elem, "value" );
  48662. return val != null ?
  48663. val :
  48664. // Support: IE <=10 - 11 only
  48665. // option.text throws exceptions (#14686, #14858)
  48666. // Strip and collapse whitespace
  48667. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  48668. stripAndCollapse( jQuery.text( elem ) );
  48669. }
  48670. },
  48671. select: {
  48672. get: function( elem ) {
  48673. var value, option, i,
  48674. options = elem.options,
  48675. index = elem.selectedIndex,
  48676. one = elem.type === "select-one",
  48677. values = one ? null : [],
  48678. max = one ? index + 1 : options.length;
  48679. if ( index < 0 ) {
  48680. i = max;
  48681. } else {
  48682. i = one ? index : 0;
  48683. }
  48684. // Loop through all the selected options
  48685. for ( ; i < max; i++ ) {
  48686. option = options[ i ];
  48687. // Support: IE <=9 only
  48688. // IE8-9 doesn't update selected after form reset (#2551)
  48689. if ( ( option.selected || i === index ) &&
  48690. // Don't return options that are disabled or in a disabled optgroup
  48691. !option.disabled &&
  48692. ( !option.parentNode.disabled ||
  48693. !nodeName( option.parentNode, "optgroup" ) ) ) {
  48694. // Get the specific value for the option
  48695. value = jQuery( option ).val();
  48696. // We don't need an array for one selects
  48697. if ( one ) {
  48698. return value;
  48699. }
  48700. // Multi-Selects return an array
  48701. values.push( value );
  48702. }
  48703. }
  48704. return values;
  48705. },
  48706. set: function( elem, value ) {
  48707. var optionSet, option,
  48708. options = elem.options,
  48709. values = jQuery.makeArray( value ),
  48710. i = options.length;
  48711. while ( i-- ) {
  48712. option = options[ i ];
  48713. /* eslint-disable no-cond-assign */
  48714. if ( option.selected =
  48715. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  48716. ) {
  48717. optionSet = true;
  48718. }
  48719. /* eslint-enable no-cond-assign */
  48720. }
  48721. // Force browsers to behave consistently when non-matching value is set
  48722. if ( !optionSet ) {
  48723. elem.selectedIndex = -1;
  48724. }
  48725. return values;
  48726. }
  48727. }
  48728. }
  48729. } );
  48730. // Radios and checkboxes getter/setter
  48731. jQuery.each( [ "radio", "checkbox" ], function() {
  48732. jQuery.valHooks[ this ] = {
  48733. set: function( elem, value ) {
  48734. if ( Array.isArray( value ) ) {
  48735. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  48736. }
  48737. }
  48738. };
  48739. if ( !support.checkOn ) {
  48740. jQuery.valHooks[ this ].get = function( elem ) {
  48741. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  48742. };
  48743. }
  48744. } );
  48745. // Return jQuery for attributes-only inclusion
  48746. support.focusin = "onfocusin" in window;
  48747. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  48748. stopPropagationCallback = function( e ) {
  48749. e.stopPropagation();
  48750. };
  48751. jQuery.extend( jQuery.event, {
  48752. trigger: function( event, data, elem, onlyHandlers ) {
  48753. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  48754. eventPath = [ elem || document ],
  48755. type = hasOwn.call( event, "type" ) ? event.type : event,
  48756. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  48757. cur = lastElement = tmp = elem = elem || document;
  48758. // Don't do events on text and comment nodes
  48759. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  48760. return;
  48761. }
  48762. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  48763. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  48764. return;
  48765. }
  48766. if ( type.indexOf( "." ) > -1 ) {
  48767. // Namespaced trigger; create a regexp to match event type in handle()
  48768. namespaces = type.split( "." );
  48769. type = namespaces.shift();
  48770. namespaces.sort();
  48771. }
  48772. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  48773. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  48774. event = event[ jQuery.expando ] ?
  48775. event :
  48776. new jQuery.Event( type, typeof event === "object" && event );
  48777. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  48778. event.isTrigger = onlyHandlers ? 2 : 3;
  48779. event.namespace = namespaces.join( "." );
  48780. event.rnamespace = event.namespace ?
  48781. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  48782. null;
  48783. // Clean up the event in case it is being reused
  48784. event.result = undefined;
  48785. if ( !event.target ) {
  48786. event.target = elem;
  48787. }
  48788. // Clone any incoming data and prepend the event, creating the handler arg list
  48789. data = data == null ?
  48790. [ event ] :
  48791. jQuery.makeArray( data, [ event ] );
  48792. // Allow special events to draw outside the lines
  48793. special = jQuery.event.special[ type ] || {};
  48794. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  48795. return;
  48796. }
  48797. // Determine event propagation path in advance, per W3C events spec (#9951)
  48798. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  48799. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  48800. bubbleType = special.delegateType || type;
  48801. if ( !rfocusMorph.test( bubbleType + type ) ) {
  48802. cur = cur.parentNode;
  48803. }
  48804. for ( ; cur; cur = cur.parentNode ) {
  48805. eventPath.push( cur );
  48806. tmp = cur;
  48807. }
  48808. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  48809. if ( tmp === ( elem.ownerDocument || document ) ) {
  48810. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  48811. }
  48812. }
  48813. // Fire handlers on the event path
  48814. i = 0;
  48815. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  48816. lastElement = cur;
  48817. event.type = i > 1 ?
  48818. bubbleType :
  48819. special.bindType || type;
  48820. // jQuery handler
  48821. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  48822. dataPriv.get( cur, "handle" );
  48823. if ( handle ) {
  48824. handle.apply( cur, data );
  48825. }
  48826. // Native handler
  48827. handle = ontype && cur[ ontype ];
  48828. if ( handle && handle.apply && acceptData( cur ) ) {
  48829. event.result = handle.apply( cur, data );
  48830. if ( event.result === false ) {
  48831. event.preventDefault();
  48832. }
  48833. }
  48834. }
  48835. event.type = type;
  48836. // If nobody prevented the default action, do it now
  48837. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  48838. if ( ( !special._default ||
  48839. special._default.apply( eventPath.pop(), data ) === false ) &&
  48840. acceptData( elem ) ) {
  48841. // Call a native DOM method on the target with the same name as the event.
  48842. // Don't do default actions on window, that's where global variables be (#6170)
  48843. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  48844. // Don't re-trigger an onFOO event when we call its FOO() method
  48845. tmp = elem[ ontype ];
  48846. if ( tmp ) {
  48847. elem[ ontype ] = null;
  48848. }
  48849. // Prevent re-triggering of the same event, since we already bubbled it above
  48850. jQuery.event.triggered = type;
  48851. if ( event.isPropagationStopped() ) {
  48852. lastElement.addEventListener( type, stopPropagationCallback );
  48853. }
  48854. elem[ type ]();
  48855. if ( event.isPropagationStopped() ) {
  48856. lastElement.removeEventListener( type, stopPropagationCallback );
  48857. }
  48858. jQuery.event.triggered = undefined;
  48859. if ( tmp ) {
  48860. elem[ ontype ] = tmp;
  48861. }
  48862. }
  48863. }
  48864. }
  48865. return event.result;
  48866. },
  48867. // Piggyback on a donor event to simulate a different one
  48868. // Used only for `focus(in | out)` events
  48869. simulate: function( type, elem, event ) {
  48870. var e = jQuery.extend(
  48871. new jQuery.Event(),
  48872. event,
  48873. {
  48874. type: type,
  48875. isSimulated: true
  48876. }
  48877. );
  48878. jQuery.event.trigger( e, null, elem );
  48879. }
  48880. } );
  48881. jQuery.fn.extend( {
  48882. trigger: function( type, data ) {
  48883. return this.each( function() {
  48884. jQuery.event.trigger( type, data, this );
  48885. } );
  48886. },
  48887. triggerHandler: function( type, data ) {
  48888. var elem = this[ 0 ];
  48889. if ( elem ) {
  48890. return jQuery.event.trigger( type, data, elem, true );
  48891. }
  48892. }
  48893. } );
  48894. // Support: Firefox <=44
  48895. // Firefox doesn't have focus(in | out) events
  48896. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  48897. //
  48898. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  48899. // focus(in | out) events fire after focus & blur events,
  48900. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  48901. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  48902. if ( !support.focusin ) {
  48903. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  48904. // Attach a single capturing handler on the document while someone wants focusin/focusout
  48905. var handler = function( event ) {
  48906. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  48907. };
  48908. jQuery.event.special[ fix ] = {
  48909. setup: function() {
  48910. var doc = this.ownerDocument || this,
  48911. attaches = dataPriv.access( doc, fix );
  48912. if ( !attaches ) {
  48913. doc.addEventListener( orig, handler, true );
  48914. }
  48915. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  48916. },
  48917. teardown: function() {
  48918. var doc = this.ownerDocument || this,
  48919. attaches = dataPriv.access( doc, fix ) - 1;
  48920. if ( !attaches ) {
  48921. doc.removeEventListener( orig, handler, true );
  48922. dataPriv.remove( doc, fix );
  48923. } else {
  48924. dataPriv.access( doc, fix, attaches );
  48925. }
  48926. }
  48927. };
  48928. } );
  48929. }
  48930. var location = window.location;
  48931. var nonce = Date.now();
  48932. var rquery = ( /\?/ );
  48933. // Cross-browser xml parsing
  48934. jQuery.parseXML = function( data ) {
  48935. var xml;
  48936. if ( !data || typeof data !== "string" ) {
  48937. return null;
  48938. }
  48939. // Support: IE 9 - 11 only
  48940. // IE throws on parseFromString with invalid input.
  48941. try {
  48942. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  48943. } catch ( e ) {
  48944. xml = undefined;
  48945. }
  48946. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  48947. jQuery.error( "Invalid XML: " + data );
  48948. }
  48949. return xml;
  48950. };
  48951. var
  48952. rbracket = /\[\]$/,
  48953. rCRLF = /\r?\n/g,
  48954. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  48955. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  48956. function buildParams( prefix, obj, traditional, add ) {
  48957. var name;
  48958. if ( Array.isArray( obj ) ) {
  48959. // Serialize array item.
  48960. jQuery.each( obj, function( i, v ) {
  48961. if ( traditional || rbracket.test( prefix ) ) {
  48962. // Treat each array item as a scalar.
  48963. add( prefix, v );
  48964. } else {
  48965. // Item is non-scalar (array or object), encode its numeric index.
  48966. buildParams(
  48967. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  48968. v,
  48969. traditional,
  48970. add
  48971. );
  48972. }
  48973. } );
  48974. } else if ( !traditional && toType( obj ) === "object" ) {
  48975. // Serialize object item.
  48976. for ( name in obj ) {
  48977. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  48978. }
  48979. } else {
  48980. // Serialize scalar item.
  48981. add( prefix, obj );
  48982. }
  48983. }
  48984. // Serialize an array of form elements or a set of
  48985. // key/values into a query string
  48986. jQuery.param = function( a, traditional ) {
  48987. var prefix,
  48988. s = [],
  48989. add = function( key, valueOrFunction ) {
  48990. // If value is a function, invoke it and use its return value
  48991. var value = isFunction( valueOrFunction ) ?
  48992. valueOrFunction() :
  48993. valueOrFunction;
  48994. s[ s.length ] = encodeURIComponent( key ) + "=" +
  48995. encodeURIComponent( value == null ? "" : value );
  48996. };
  48997. // If an array was passed in, assume that it is an array of form elements.
  48998. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  48999. // Serialize the form elements
  49000. jQuery.each( a, function() {
  49001. add( this.name, this.value );
  49002. } );
  49003. } else {
  49004. // If traditional, encode the "old" way (the way 1.3.2 or older
  49005. // did it), otherwise encode params recursively.
  49006. for ( prefix in a ) {
  49007. buildParams( prefix, a[ prefix ], traditional, add );
  49008. }
  49009. }
  49010. // Return the resulting serialization
  49011. return s.join( "&" );
  49012. };
  49013. jQuery.fn.extend( {
  49014. serialize: function() {
  49015. return jQuery.param( this.serializeArray() );
  49016. },
  49017. serializeArray: function() {
  49018. return this.map( function() {
  49019. // Can add propHook for "elements" to filter or add form elements
  49020. var elements = jQuery.prop( this, "elements" );
  49021. return elements ? jQuery.makeArray( elements ) : this;
  49022. } )
  49023. .filter( function() {
  49024. var type = this.type;
  49025. // Use .is( ":disabled" ) so that fieldset[disabled] works
  49026. return this.name && !jQuery( this ).is( ":disabled" ) &&
  49027. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  49028. ( this.checked || !rcheckableType.test( type ) );
  49029. } )
  49030. .map( function( i, elem ) {
  49031. var val = jQuery( this ).val();
  49032. if ( val == null ) {
  49033. return null;
  49034. }
  49035. if ( Array.isArray( val ) ) {
  49036. return jQuery.map( val, function( val ) {
  49037. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  49038. } );
  49039. }
  49040. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  49041. } ).get();
  49042. }
  49043. } );
  49044. var
  49045. r20 = /%20/g,
  49046. rhash = /#.*$/,
  49047. rantiCache = /([?&])_=[^&]*/,
  49048. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  49049. // #7653, #8125, #8152: local protocol detection
  49050. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  49051. rnoContent = /^(?:GET|HEAD)$/,
  49052. rprotocol = /^\/\//,
  49053. /* Prefilters
  49054. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  49055. * 2) These are called:
  49056. * - BEFORE asking for a transport
  49057. * - AFTER param serialization (s.data is a string if s.processData is true)
  49058. * 3) key is the dataType
  49059. * 4) the catchall symbol "*" can be used
  49060. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  49061. */
  49062. prefilters = {},
  49063. /* Transports bindings
  49064. * 1) key is the dataType
  49065. * 2) the catchall symbol "*" can be used
  49066. * 3) selection will start with transport dataType and THEN go to "*" if needed
  49067. */
  49068. transports = {},
  49069. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  49070. allTypes = "*/".concat( "*" ),
  49071. // Anchor tag for parsing the document origin
  49072. originAnchor = document.createElement( "a" );
  49073. originAnchor.href = location.href;
  49074. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  49075. function addToPrefiltersOrTransports( structure ) {
  49076. // dataTypeExpression is optional and defaults to "*"
  49077. return function( dataTypeExpression, func ) {
  49078. if ( typeof dataTypeExpression !== "string" ) {
  49079. func = dataTypeExpression;
  49080. dataTypeExpression = "*";
  49081. }
  49082. var dataType,
  49083. i = 0,
  49084. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  49085. if ( isFunction( func ) ) {
  49086. // For each dataType in the dataTypeExpression
  49087. while ( ( dataType = dataTypes[ i++ ] ) ) {
  49088. // Prepend if requested
  49089. if ( dataType[ 0 ] === "+" ) {
  49090. dataType = dataType.slice( 1 ) || "*";
  49091. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  49092. // Otherwise append
  49093. } else {
  49094. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  49095. }
  49096. }
  49097. }
  49098. };
  49099. }
  49100. // Base inspection function for prefilters and transports
  49101. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  49102. var inspected = {},
  49103. seekingTransport = ( structure === transports );
  49104. function inspect( dataType ) {
  49105. var selected;
  49106. inspected[ dataType ] = true;
  49107. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  49108. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  49109. if ( typeof dataTypeOrTransport === "string" &&
  49110. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  49111. options.dataTypes.unshift( dataTypeOrTransport );
  49112. inspect( dataTypeOrTransport );
  49113. return false;
  49114. } else if ( seekingTransport ) {
  49115. return !( selected = dataTypeOrTransport );
  49116. }
  49117. } );
  49118. return selected;
  49119. }
  49120. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  49121. }
  49122. // A special extend for ajax options
  49123. // that takes "flat" options (not to be deep extended)
  49124. // Fixes #9887
  49125. function ajaxExtend( target, src ) {
  49126. var key, deep,
  49127. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  49128. for ( key in src ) {
  49129. if ( src[ key ] !== undefined ) {
  49130. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  49131. }
  49132. }
  49133. if ( deep ) {
  49134. jQuery.extend( true, target, deep );
  49135. }
  49136. return target;
  49137. }
  49138. /* Handles responses to an ajax request:
  49139. * - finds the right dataType (mediates between content-type and expected dataType)
  49140. * - returns the corresponding response
  49141. */
  49142. function ajaxHandleResponses( s, jqXHR, responses ) {
  49143. var ct, type, finalDataType, firstDataType,
  49144. contents = s.contents,
  49145. dataTypes = s.dataTypes;
  49146. // Remove auto dataType and get content-type in the process
  49147. while ( dataTypes[ 0 ] === "*" ) {
  49148. dataTypes.shift();
  49149. if ( ct === undefined ) {
  49150. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  49151. }
  49152. }
  49153. // Check if we're dealing with a known content-type
  49154. if ( ct ) {
  49155. for ( type in contents ) {
  49156. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  49157. dataTypes.unshift( type );
  49158. break;
  49159. }
  49160. }
  49161. }
  49162. // Check to see if we have a response for the expected dataType
  49163. if ( dataTypes[ 0 ] in responses ) {
  49164. finalDataType = dataTypes[ 0 ];
  49165. } else {
  49166. // Try convertible dataTypes
  49167. for ( type in responses ) {
  49168. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  49169. finalDataType = type;
  49170. break;
  49171. }
  49172. if ( !firstDataType ) {
  49173. firstDataType = type;
  49174. }
  49175. }
  49176. // Or just use first one
  49177. finalDataType = finalDataType || firstDataType;
  49178. }
  49179. // If we found a dataType
  49180. // We add the dataType to the list if needed
  49181. // and return the corresponding response
  49182. if ( finalDataType ) {
  49183. if ( finalDataType !== dataTypes[ 0 ] ) {
  49184. dataTypes.unshift( finalDataType );
  49185. }
  49186. return responses[ finalDataType ];
  49187. }
  49188. }
  49189. /* Chain conversions given the request and the original response
  49190. * Also sets the responseXXX fields on the jqXHR instance
  49191. */
  49192. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  49193. var conv2, current, conv, tmp, prev,
  49194. converters = {},
  49195. // Work with a copy of dataTypes in case we need to modify it for conversion
  49196. dataTypes = s.dataTypes.slice();
  49197. // Create converters map with lowercased keys
  49198. if ( dataTypes[ 1 ] ) {
  49199. for ( conv in s.converters ) {
  49200. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  49201. }
  49202. }
  49203. current = dataTypes.shift();
  49204. // Convert to each sequential dataType
  49205. while ( current ) {
  49206. if ( s.responseFields[ current ] ) {
  49207. jqXHR[ s.responseFields[ current ] ] = response;
  49208. }
  49209. // Apply the dataFilter if provided
  49210. if ( !prev && isSuccess && s.dataFilter ) {
  49211. response = s.dataFilter( response, s.dataType );
  49212. }
  49213. prev = current;
  49214. current = dataTypes.shift();
  49215. if ( current ) {
  49216. // There's only work to do if current dataType is non-auto
  49217. if ( current === "*" ) {
  49218. current = prev;
  49219. // Convert response if prev dataType is non-auto and differs from current
  49220. } else if ( prev !== "*" && prev !== current ) {
  49221. // Seek a direct converter
  49222. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  49223. // If none found, seek a pair
  49224. if ( !conv ) {
  49225. for ( conv2 in converters ) {
  49226. // If conv2 outputs current
  49227. tmp = conv2.split( " " );
  49228. if ( tmp[ 1 ] === current ) {
  49229. // If prev can be converted to accepted input
  49230. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  49231. converters[ "* " + tmp[ 0 ] ];
  49232. if ( conv ) {
  49233. // Condense equivalence converters
  49234. if ( conv === true ) {
  49235. conv = converters[ conv2 ];
  49236. // Otherwise, insert the intermediate dataType
  49237. } else if ( converters[ conv2 ] !== true ) {
  49238. current = tmp[ 0 ];
  49239. dataTypes.unshift( tmp[ 1 ] );
  49240. }
  49241. break;
  49242. }
  49243. }
  49244. }
  49245. }
  49246. // Apply converter (if not an equivalence)
  49247. if ( conv !== true ) {
  49248. // Unless errors are allowed to bubble, catch and return them
  49249. if ( conv && s.throws ) {
  49250. response = conv( response );
  49251. } else {
  49252. try {
  49253. response = conv( response );
  49254. } catch ( e ) {
  49255. return {
  49256. state: "parsererror",
  49257. error: conv ? e : "No conversion from " + prev + " to " + current
  49258. };
  49259. }
  49260. }
  49261. }
  49262. }
  49263. }
  49264. }
  49265. return { state: "success", data: response };
  49266. }
  49267. jQuery.extend( {
  49268. // Counter for holding the number of active queries
  49269. active: 0,
  49270. // Last-Modified header cache for next request
  49271. lastModified: {},
  49272. etag: {},
  49273. ajaxSettings: {
  49274. url: location.href,
  49275. type: "GET",
  49276. isLocal: rlocalProtocol.test( location.protocol ),
  49277. global: true,
  49278. processData: true,
  49279. async: true,
  49280. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  49281. /*
  49282. timeout: 0,
  49283. data: null,
  49284. dataType: null,
  49285. username: null,
  49286. password: null,
  49287. cache: null,
  49288. throws: false,
  49289. traditional: false,
  49290. headers: {},
  49291. */
  49292. accepts: {
  49293. "*": allTypes,
  49294. text: "text/plain",
  49295. html: "text/html",
  49296. xml: "application/xml, text/xml",
  49297. json: "application/json, text/javascript"
  49298. },
  49299. contents: {
  49300. xml: /\bxml\b/,
  49301. html: /\bhtml/,
  49302. json: /\bjson\b/
  49303. },
  49304. responseFields: {
  49305. xml: "responseXML",
  49306. text: "responseText",
  49307. json: "responseJSON"
  49308. },
  49309. // Data converters
  49310. // Keys separate source (or catchall "*") and destination types with a single space
  49311. converters: {
  49312. // Convert anything to text
  49313. "* text": String,
  49314. // Text to html (true = no transformation)
  49315. "text html": true,
  49316. // Evaluate text as a json expression
  49317. "text json": JSON.parse,
  49318. // Parse text as xml
  49319. "text xml": jQuery.parseXML
  49320. },
  49321. // For options that shouldn't be deep extended:
  49322. // you can add your own custom options here if
  49323. // and when you create one that shouldn't be
  49324. // deep extended (see ajaxExtend)
  49325. flatOptions: {
  49326. url: true,
  49327. context: true
  49328. }
  49329. },
  49330. // Creates a full fledged settings object into target
  49331. // with both ajaxSettings and settings fields.
  49332. // If target is omitted, writes into ajaxSettings.
  49333. ajaxSetup: function( target, settings ) {
  49334. return settings ?
  49335. // Building a settings object
  49336. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  49337. // Extending ajaxSettings
  49338. ajaxExtend( jQuery.ajaxSettings, target );
  49339. },
  49340. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  49341. ajaxTransport: addToPrefiltersOrTransports( transports ),
  49342. // Main method
  49343. ajax: function( url, options ) {
  49344. // If url is an object, simulate pre-1.5 signature
  49345. if ( typeof url === "object" ) {
  49346. options = url;
  49347. url = undefined;
  49348. }
  49349. // Force options to be an object
  49350. options = options || {};
  49351. var transport,
  49352. // URL without anti-cache param
  49353. cacheURL,
  49354. // Response headers
  49355. responseHeadersString,
  49356. responseHeaders,
  49357. // timeout handle
  49358. timeoutTimer,
  49359. // Url cleanup var
  49360. urlAnchor,
  49361. // Request state (becomes false upon send and true upon completion)
  49362. completed,
  49363. // To know if global events are to be dispatched
  49364. fireGlobals,
  49365. // Loop variable
  49366. i,
  49367. // uncached part of the url
  49368. uncached,
  49369. // Create the final options object
  49370. s = jQuery.ajaxSetup( {}, options ),
  49371. // Callbacks context
  49372. callbackContext = s.context || s,
  49373. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  49374. globalEventContext = s.context &&
  49375. ( callbackContext.nodeType || callbackContext.jquery ) ?
  49376. jQuery( callbackContext ) :
  49377. jQuery.event,
  49378. // Deferreds
  49379. deferred = jQuery.Deferred(),
  49380. completeDeferred = jQuery.Callbacks( "once memory" ),
  49381. // Status-dependent callbacks
  49382. statusCode = s.statusCode || {},
  49383. // Headers (they are sent all at once)
  49384. requestHeaders = {},
  49385. requestHeadersNames = {},
  49386. // Default abort message
  49387. strAbort = "canceled",
  49388. // Fake xhr
  49389. jqXHR = {
  49390. readyState: 0,
  49391. // Builds headers hashtable if needed
  49392. getResponseHeader: function( key ) {
  49393. var match;
  49394. if ( completed ) {
  49395. if ( !responseHeaders ) {
  49396. responseHeaders = {};
  49397. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  49398. responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ];
  49399. }
  49400. }
  49401. match = responseHeaders[ key.toLowerCase() ];
  49402. }
  49403. return match == null ? null : match;
  49404. },
  49405. // Raw string
  49406. getAllResponseHeaders: function() {
  49407. return completed ? responseHeadersString : null;
  49408. },
  49409. // Caches the header
  49410. setRequestHeader: function( name, value ) {
  49411. if ( completed == null ) {
  49412. name = requestHeadersNames[ name.toLowerCase() ] =
  49413. requestHeadersNames[ name.toLowerCase() ] || name;
  49414. requestHeaders[ name ] = value;
  49415. }
  49416. return this;
  49417. },
  49418. // Overrides response content-type header
  49419. overrideMimeType: function( type ) {
  49420. if ( completed == null ) {
  49421. s.mimeType = type;
  49422. }
  49423. return this;
  49424. },
  49425. // Status-dependent callbacks
  49426. statusCode: function( map ) {
  49427. var code;
  49428. if ( map ) {
  49429. if ( completed ) {
  49430. // Execute the appropriate callbacks
  49431. jqXHR.always( map[ jqXHR.status ] );
  49432. } else {
  49433. // Lazy-add the new callbacks in a way that preserves old ones
  49434. for ( code in map ) {
  49435. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  49436. }
  49437. }
  49438. }
  49439. return this;
  49440. },
  49441. // Cancel the request
  49442. abort: function( statusText ) {
  49443. var finalText = statusText || strAbort;
  49444. if ( transport ) {
  49445. transport.abort( finalText );
  49446. }
  49447. done( 0, finalText );
  49448. return this;
  49449. }
  49450. };
  49451. // Attach deferreds
  49452. deferred.promise( jqXHR );
  49453. // Add protocol if not provided (prefilters might expect it)
  49454. // Handle falsy url in the settings object (#10093: consistency with old signature)
  49455. // We also use the url parameter if available
  49456. s.url = ( ( url || s.url || location.href ) + "" )
  49457. .replace( rprotocol, location.protocol + "//" );
  49458. // Alias method option to type as per ticket #12004
  49459. s.type = options.method || options.type || s.method || s.type;
  49460. // Extract dataTypes list
  49461. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  49462. // A cross-domain request is in order when the origin doesn't match the current origin.
  49463. if ( s.crossDomain == null ) {
  49464. urlAnchor = document.createElement( "a" );
  49465. // Support: IE <=8 - 11, Edge 12 - 15
  49466. // IE throws exception on accessing the href property if url is malformed,
  49467. // e.g. http://example.com:80x/
  49468. try {
  49469. urlAnchor.href = s.url;
  49470. // Support: IE <=8 - 11 only
  49471. // Anchor's host property isn't correctly set when s.url is relative
  49472. urlAnchor.href = urlAnchor.href;
  49473. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  49474. urlAnchor.protocol + "//" + urlAnchor.host;
  49475. } catch ( e ) {
  49476. // If there is an error parsing the URL, assume it is crossDomain,
  49477. // it can be rejected by the transport if it is invalid
  49478. s.crossDomain = true;
  49479. }
  49480. }
  49481. // Convert data if not already a string
  49482. if ( s.data && s.processData && typeof s.data !== "string" ) {
  49483. s.data = jQuery.param( s.data, s.traditional );
  49484. }
  49485. // Apply prefilters
  49486. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  49487. // If request was aborted inside a prefilter, stop there
  49488. if ( completed ) {
  49489. return jqXHR;
  49490. }
  49491. // We can fire global events as of now if asked to
  49492. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  49493. fireGlobals = jQuery.event && s.global;
  49494. // Watch for a new set of requests
  49495. if ( fireGlobals && jQuery.active++ === 0 ) {
  49496. jQuery.event.trigger( "ajaxStart" );
  49497. }
  49498. // Uppercase the type
  49499. s.type = s.type.toUpperCase();
  49500. // Determine if request has content
  49501. s.hasContent = !rnoContent.test( s.type );
  49502. // Save the URL in case we're toying with the If-Modified-Since
  49503. // and/or If-None-Match header later on
  49504. // Remove hash to simplify url manipulation
  49505. cacheURL = s.url.replace( rhash, "" );
  49506. // More options handling for requests with no content
  49507. if ( !s.hasContent ) {
  49508. // Remember the hash so we can put it back
  49509. uncached = s.url.slice( cacheURL.length );
  49510. // If data is available and should be processed, append data to url
  49511. if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
  49512. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  49513. // #9682: remove data so that it's not used in an eventual retry
  49514. delete s.data;
  49515. }
  49516. // Add or update anti-cache param if needed
  49517. if ( s.cache === false ) {
  49518. cacheURL = cacheURL.replace( rantiCache, "$1" );
  49519. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  49520. }
  49521. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  49522. s.url = cacheURL + uncached;
  49523. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  49524. } else if ( s.data && s.processData &&
  49525. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  49526. s.data = s.data.replace( r20, "+" );
  49527. }
  49528. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  49529. if ( s.ifModified ) {
  49530. if ( jQuery.lastModified[ cacheURL ] ) {
  49531. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  49532. }
  49533. if ( jQuery.etag[ cacheURL ] ) {
  49534. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  49535. }
  49536. }
  49537. // Set the correct header, if data is being sent
  49538. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  49539. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  49540. }
  49541. // Set the Accepts header for the server, depending on the dataType
  49542. jqXHR.setRequestHeader(
  49543. "Accept",
  49544. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  49545. s.accepts[ s.dataTypes[ 0 ] ] +
  49546. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  49547. s.accepts[ "*" ]
  49548. );
  49549. // Check for headers option
  49550. for ( i in s.headers ) {
  49551. jqXHR.setRequestHeader( i, s.headers[ i ] );
  49552. }
  49553. // Allow custom headers/mimetypes and early abort
  49554. if ( s.beforeSend &&
  49555. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  49556. // Abort if not done already and return
  49557. return jqXHR.abort();
  49558. }
  49559. // Aborting is no longer a cancellation
  49560. strAbort = "abort";
  49561. // Install callbacks on deferreds
  49562. completeDeferred.add( s.complete );
  49563. jqXHR.done( s.success );
  49564. jqXHR.fail( s.error );
  49565. // Get transport
  49566. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  49567. // If no transport, we auto-abort
  49568. if ( !transport ) {
  49569. done( -1, "No Transport" );
  49570. } else {
  49571. jqXHR.readyState = 1;
  49572. // Send global event
  49573. if ( fireGlobals ) {
  49574. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  49575. }
  49576. // If request was aborted inside ajaxSend, stop there
  49577. if ( completed ) {
  49578. return jqXHR;
  49579. }
  49580. // Timeout
  49581. if ( s.async && s.timeout > 0 ) {
  49582. timeoutTimer = window.setTimeout( function() {
  49583. jqXHR.abort( "timeout" );
  49584. }, s.timeout );
  49585. }
  49586. try {
  49587. completed = false;
  49588. transport.send( requestHeaders, done );
  49589. } catch ( e ) {
  49590. // Rethrow post-completion exceptions
  49591. if ( completed ) {
  49592. throw e;
  49593. }
  49594. // Propagate others as results
  49595. done( -1, e );
  49596. }
  49597. }
  49598. // Callback for when everything is done
  49599. function done( status, nativeStatusText, responses, headers ) {
  49600. var isSuccess, success, error, response, modified,
  49601. statusText = nativeStatusText;
  49602. // Ignore repeat invocations
  49603. if ( completed ) {
  49604. return;
  49605. }
  49606. completed = true;
  49607. // Clear timeout if it exists
  49608. if ( timeoutTimer ) {
  49609. window.clearTimeout( timeoutTimer );
  49610. }
  49611. // Dereference transport for early garbage collection
  49612. // (no matter how long the jqXHR object will be used)
  49613. transport = undefined;
  49614. // Cache response headers
  49615. responseHeadersString = headers || "";
  49616. // Set readyState
  49617. jqXHR.readyState = status > 0 ? 4 : 0;
  49618. // Determine if successful
  49619. isSuccess = status >= 200 && status < 300 || status === 304;
  49620. // Get response data
  49621. if ( responses ) {
  49622. response = ajaxHandleResponses( s, jqXHR, responses );
  49623. }
  49624. // Convert no matter what (that way responseXXX fields are always set)
  49625. response = ajaxConvert( s, response, jqXHR, isSuccess );
  49626. // If successful, handle type chaining
  49627. if ( isSuccess ) {
  49628. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  49629. if ( s.ifModified ) {
  49630. modified = jqXHR.getResponseHeader( "Last-Modified" );
  49631. if ( modified ) {
  49632. jQuery.lastModified[ cacheURL ] = modified;
  49633. }
  49634. modified = jqXHR.getResponseHeader( "etag" );
  49635. if ( modified ) {
  49636. jQuery.etag[ cacheURL ] = modified;
  49637. }
  49638. }
  49639. // if no content
  49640. if ( status === 204 || s.type === "HEAD" ) {
  49641. statusText = "nocontent";
  49642. // if not modified
  49643. } else if ( status === 304 ) {
  49644. statusText = "notmodified";
  49645. // If we have data, let's convert it
  49646. } else {
  49647. statusText = response.state;
  49648. success = response.data;
  49649. error = response.error;
  49650. isSuccess = !error;
  49651. }
  49652. } else {
  49653. // Extract error from statusText and normalize for non-aborts
  49654. error = statusText;
  49655. if ( status || !statusText ) {
  49656. statusText = "error";
  49657. if ( status < 0 ) {
  49658. status = 0;
  49659. }
  49660. }
  49661. }
  49662. // Set data for the fake xhr object
  49663. jqXHR.status = status;
  49664. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  49665. // Success/Error
  49666. if ( isSuccess ) {
  49667. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  49668. } else {
  49669. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  49670. }
  49671. // Status-dependent callbacks
  49672. jqXHR.statusCode( statusCode );
  49673. statusCode = undefined;
  49674. if ( fireGlobals ) {
  49675. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  49676. [ jqXHR, s, isSuccess ? success : error ] );
  49677. }
  49678. // Complete
  49679. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  49680. if ( fireGlobals ) {
  49681. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  49682. // Handle the global AJAX counter
  49683. if ( !( --jQuery.active ) ) {
  49684. jQuery.event.trigger( "ajaxStop" );
  49685. }
  49686. }
  49687. }
  49688. return jqXHR;
  49689. },
  49690. getJSON: function( url, data, callback ) {
  49691. return jQuery.get( url, data, callback, "json" );
  49692. },
  49693. getScript: function( url, callback ) {
  49694. return jQuery.get( url, undefined, callback, "script" );
  49695. }
  49696. } );
  49697. jQuery.each( [ "get", "post" ], function( i, method ) {
  49698. jQuery[ method ] = function( url, data, callback, type ) {
  49699. // Shift arguments if data argument was omitted
  49700. if ( isFunction( data ) ) {
  49701. type = type || callback;
  49702. callback = data;
  49703. data = undefined;
  49704. }
  49705. // The url can be an options object (which then must have .url)
  49706. return jQuery.ajax( jQuery.extend( {
  49707. url: url,
  49708. type: method,
  49709. dataType: type,
  49710. data: data,
  49711. success: callback
  49712. }, jQuery.isPlainObject( url ) && url ) );
  49713. };
  49714. } );
  49715. jQuery._evalUrl = function( url ) {
  49716. return jQuery.ajax( {
  49717. url: url,
  49718. // Make this explicit, since user can override this through ajaxSetup (#11264)
  49719. type: "GET",
  49720. dataType: "script",
  49721. cache: true,
  49722. async: false,
  49723. global: false,
  49724. "throws": true
  49725. } );
  49726. };
  49727. jQuery.fn.extend( {
  49728. wrapAll: function( html ) {
  49729. var wrap;
  49730. if ( this[ 0 ] ) {
  49731. if ( isFunction( html ) ) {
  49732. html = html.call( this[ 0 ] );
  49733. }
  49734. // The elements to wrap the target around
  49735. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  49736. if ( this[ 0 ].parentNode ) {
  49737. wrap.insertBefore( this[ 0 ] );
  49738. }
  49739. wrap.map( function() {
  49740. var elem = this;
  49741. while ( elem.firstElementChild ) {
  49742. elem = elem.firstElementChild;
  49743. }
  49744. return elem;
  49745. } ).append( this );
  49746. }
  49747. return this;
  49748. },
  49749. wrapInner: function( html ) {
  49750. if ( isFunction( html ) ) {
  49751. return this.each( function( i ) {
  49752. jQuery( this ).wrapInner( html.call( this, i ) );
  49753. } );
  49754. }
  49755. return this.each( function() {
  49756. var self = jQuery( this ),
  49757. contents = self.contents();
  49758. if ( contents.length ) {
  49759. contents.wrapAll( html );
  49760. } else {
  49761. self.append( html );
  49762. }
  49763. } );
  49764. },
  49765. wrap: function( html ) {
  49766. var htmlIsFunction = isFunction( html );
  49767. return this.each( function( i ) {
  49768. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  49769. } );
  49770. },
  49771. unwrap: function( selector ) {
  49772. this.parent( selector ).not( "body" ).each( function() {
  49773. jQuery( this ).replaceWith( this.childNodes );
  49774. } );
  49775. return this;
  49776. }
  49777. } );
  49778. jQuery.expr.pseudos.hidden = function( elem ) {
  49779. return !jQuery.expr.pseudos.visible( elem );
  49780. };
  49781. jQuery.expr.pseudos.visible = function( elem ) {
  49782. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  49783. };
  49784. jQuery.ajaxSettings.xhr = function() {
  49785. try {
  49786. return new window.XMLHttpRequest();
  49787. } catch ( e ) {}
  49788. };
  49789. var xhrSuccessStatus = {
  49790. // File protocol always yields status code 0, assume 200
  49791. 0: 200,
  49792. // Support: IE <=9 only
  49793. // #1450: sometimes IE returns 1223 when it should be 204
  49794. 1223: 204
  49795. },
  49796. xhrSupported = jQuery.ajaxSettings.xhr();
  49797. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  49798. support.ajax = xhrSupported = !!xhrSupported;
  49799. jQuery.ajaxTransport( function( options ) {
  49800. var callback, errorCallback;
  49801. // Cross domain only allowed if supported through XMLHttpRequest
  49802. if ( support.cors || xhrSupported && !options.crossDomain ) {
  49803. return {
  49804. send: function( headers, complete ) {
  49805. var i,
  49806. xhr = options.xhr();
  49807. xhr.open(
  49808. options.type,
  49809. options.url,
  49810. options.async,
  49811. options.username,
  49812. options.password
  49813. );
  49814. // Apply custom fields if provided
  49815. if ( options.xhrFields ) {
  49816. for ( i in options.xhrFields ) {
  49817. xhr[ i ] = options.xhrFields[ i ];
  49818. }
  49819. }
  49820. // Override mime type if needed
  49821. if ( options.mimeType && xhr.overrideMimeType ) {
  49822. xhr.overrideMimeType( options.mimeType );
  49823. }
  49824. // X-Requested-With header
  49825. // For cross-domain requests, seeing as conditions for a preflight are
  49826. // akin to a jigsaw puzzle, we simply never set it to be sure.
  49827. // (it can always be set on a per-request basis or even using ajaxSetup)
  49828. // For same-domain requests, won't change header if already provided.
  49829. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  49830. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  49831. }
  49832. // Set headers
  49833. for ( i in headers ) {
  49834. xhr.setRequestHeader( i, headers[ i ] );
  49835. }
  49836. // Callback
  49837. callback = function( type ) {
  49838. return function() {
  49839. if ( callback ) {
  49840. callback = errorCallback = xhr.onload =
  49841. xhr.onerror = xhr.onabort = xhr.ontimeout =
  49842. xhr.onreadystatechange = null;
  49843. if ( type === "abort" ) {
  49844. xhr.abort();
  49845. } else if ( type === "error" ) {
  49846. // Support: IE <=9 only
  49847. // On a manual native abort, IE9 throws
  49848. // errors on any property access that is not readyState
  49849. if ( typeof xhr.status !== "number" ) {
  49850. complete( 0, "error" );
  49851. } else {
  49852. complete(
  49853. // File: protocol always yields status 0; see #8605, #14207
  49854. xhr.status,
  49855. xhr.statusText
  49856. );
  49857. }
  49858. } else {
  49859. complete(
  49860. xhrSuccessStatus[ xhr.status ] || xhr.status,
  49861. xhr.statusText,
  49862. // Support: IE <=9 only
  49863. // IE9 has no XHR2 but throws on binary (trac-11426)
  49864. // For XHR2 non-text, let the caller handle it (gh-2498)
  49865. ( xhr.responseType || "text" ) !== "text" ||
  49866. typeof xhr.responseText !== "string" ?
  49867. { binary: xhr.response } :
  49868. { text: xhr.responseText },
  49869. xhr.getAllResponseHeaders()
  49870. );
  49871. }
  49872. }
  49873. };
  49874. };
  49875. // Listen to events
  49876. xhr.onload = callback();
  49877. errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
  49878. // Support: IE 9 only
  49879. // Use onreadystatechange to replace onabort
  49880. // to handle uncaught aborts
  49881. if ( xhr.onabort !== undefined ) {
  49882. xhr.onabort = errorCallback;
  49883. } else {
  49884. xhr.onreadystatechange = function() {
  49885. // Check readyState before timeout as it changes
  49886. if ( xhr.readyState === 4 ) {
  49887. // Allow onerror to be called first,
  49888. // but that will not handle a native abort
  49889. // Also, save errorCallback to a variable
  49890. // as xhr.onerror cannot be accessed
  49891. window.setTimeout( function() {
  49892. if ( callback ) {
  49893. errorCallback();
  49894. }
  49895. } );
  49896. }
  49897. };
  49898. }
  49899. // Create the abort callback
  49900. callback = callback( "abort" );
  49901. try {
  49902. // Do send the request (this may raise an exception)
  49903. xhr.send( options.hasContent && options.data || null );
  49904. } catch ( e ) {
  49905. // #14683: Only rethrow if this hasn't been notified as an error yet
  49906. if ( callback ) {
  49907. throw e;
  49908. }
  49909. }
  49910. },
  49911. abort: function() {
  49912. if ( callback ) {
  49913. callback();
  49914. }
  49915. }
  49916. };
  49917. }
  49918. } );
  49919. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  49920. jQuery.ajaxPrefilter( function( s ) {
  49921. if ( s.crossDomain ) {
  49922. s.contents.script = false;
  49923. }
  49924. } );
  49925. // Install script dataType
  49926. jQuery.ajaxSetup( {
  49927. accepts: {
  49928. script: "text/javascript, application/javascript, " +
  49929. "application/ecmascript, application/x-ecmascript"
  49930. },
  49931. contents: {
  49932. script: /\b(?:java|ecma)script\b/
  49933. },
  49934. converters: {
  49935. "text script": function( text ) {
  49936. jQuery.globalEval( text );
  49937. return text;
  49938. }
  49939. }
  49940. } );
  49941. // Handle cache's special case and crossDomain
  49942. jQuery.ajaxPrefilter( "script", function( s ) {
  49943. if ( s.cache === undefined ) {
  49944. s.cache = false;
  49945. }
  49946. if ( s.crossDomain ) {
  49947. s.type = "GET";
  49948. }
  49949. } );
  49950. // Bind script tag hack transport
  49951. jQuery.ajaxTransport( "script", function( s ) {
  49952. // This transport only deals with cross domain requests
  49953. if ( s.crossDomain ) {
  49954. var script, callback;
  49955. return {
  49956. send: function( _, complete ) {
  49957. script = jQuery( "<script>" ).prop( {
  49958. charset: s.scriptCharset,
  49959. src: s.url
  49960. } ).on(
  49961. "load error",
  49962. callback = function( evt ) {
  49963. script.remove();
  49964. callback = null;
  49965. if ( evt ) {
  49966. complete( evt.type === "error" ? 404 : 200, evt.type );
  49967. }
  49968. }
  49969. );
  49970. // Use native DOM manipulation to avoid our domManip AJAX trickery
  49971. document.head.appendChild( script[ 0 ] );
  49972. },
  49973. abort: function() {
  49974. if ( callback ) {
  49975. callback();
  49976. }
  49977. }
  49978. };
  49979. }
  49980. } );
  49981. var oldCallbacks = [],
  49982. rjsonp = /(=)\?(?=&|$)|\?\?/;
  49983. // Default jsonp settings
  49984. jQuery.ajaxSetup( {
  49985. jsonp: "callback",
  49986. jsonpCallback: function() {
  49987. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  49988. this[ callback ] = true;
  49989. return callback;
  49990. }
  49991. } );
  49992. // Detect, normalize options and install callbacks for jsonp requests
  49993. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  49994. var callbackName, overwritten, responseContainer,
  49995. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  49996. "url" :
  49997. typeof s.data === "string" &&
  49998. ( s.contentType || "" )
  49999. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  50000. rjsonp.test( s.data ) && "data"
  50001. );
  50002. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  50003. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  50004. // Get callback name, remembering preexisting value associated with it
  50005. callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
  50006. s.jsonpCallback() :
  50007. s.jsonpCallback;
  50008. // Insert callback into url or form data
  50009. if ( jsonProp ) {
  50010. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  50011. } else if ( s.jsonp !== false ) {
  50012. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  50013. }
  50014. // Use data converter to retrieve json after script execution
  50015. s.converters[ "script json" ] = function() {
  50016. if ( !responseContainer ) {
  50017. jQuery.error( callbackName + " was not called" );
  50018. }
  50019. return responseContainer[ 0 ];
  50020. };
  50021. // Force json dataType
  50022. s.dataTypes[ 0 ] = "json";
  50023. // Install callback
  50024. overwritten = window[ callbackName ];
  50025. window[ callbackName ] = function() {
  50026. responseContainer = arguments;
  50027. };
  50028. // Clean-up function (fires after converters)
  50029. jqXHR.always( function() {
  50030. // If previous value didn't exist - remove it
  50031. if ( overwritten === undefined ) {
  50032. jQuery( window ).removeProp( callbackName );
  50033. // Otherwise restore preexisting value
  50034. } else {
  50035. window[ callbackName ] = overwritten;
  50036. }
  50037. // Save back as free
  50038. if ( s[ callbackName ] ) {
  50039. // Make sure that re-using the options doesn't screw things around
  50040. s.jsonpCallback = originalSettings.jsonpCallback;
  50041. // Save the callback name for future use
  50042. oldCallbacks.push( callbackName );
  50043. }
  50044. // Call if it was a function and we have a response
  50045. if ( responseContainer && isFunction( overwritten ) ) {
  50046. overwritten( responseContainer[ 0 ] );
  50047. }
  50048. responseContainer = overwritten = undefined;
  50049. } );
  50050. // Delegate to script
  50051. return "script";
  50052. }
  50053. } );
  50054. // Support: Safari 8 only
  50055. // In Safari 8 documents created via document.implementation.createHTMLDocument
  50056. // collapse sibling forms: the second one becomes a child of the first one.
  50057. // Because of that, this security measure has to be disabled in Safari 8.
  50058. // https://bugs.webkit.org/show_bug.cgi?id=137337
  50059. support.createHTMLDocument = ( function() {
  50060. var body = document.implementation.createHTMLDocument( "" ).body;
  50061. body.innerHTML = "<form></form><form></form>";
  50062. return body.childNodes.length === 2;
  50063. } )();
  50064. // Argument "data" should be string of html
  50065. // context (optional): If specified, the fragment will be created in this context,
  50066. // defaults to document
  50067. // keepScripts (optional): If true, will include scripts passed in the html string
  50068. jQuery.parseHTML = function( data, context, keepScripts ) {
  50069. if ( typeof data !== "string" ) {
  50070. return [];
  50071. }
  50072. if ( typeof context === "boolean" ) {
  50073. keepScripts = context;
  50074. context = false;
  50075. }
  50076. var base, parsed, scripts;
  50077. if ( !context ) {
  50078. // Stop scripts or inline event handlers from being executed immediately
  50079. // by using document.implementation
  50080. if ( support.createHTMLDocument ) {
  50081. context = document.implementation.createHTMLDocument( "" );
  50082. // Set the base href for the created document
  50083. // so any parsed elements with URLs
  50084. // are based on the document's URL (gh-2965)
  50085. base = context.createElement( "base" );
  50086. base.href = document.location.href;
  50087. context.head.appendChild( base );
  50088. } else {
  50089. context = document;
  50090. }
  50091. }
  50092. parsed = rsingleTag.exec( data );
  50093. scripts = !keepScripts && [];
  50094. // Single tag
  50095. if ( parsed ) {
  50096. return [ context.createElement( parsed[ 1 ] ) ];
  50097. }
  50098. parsed = buildFragment( [ data ], context, scripts );
  50099. if ( scripts && scripts.length ) {
  50100. jQuery( scripts ).remove();
  50101. }
  50102. return jQuery.merge( [], parsed.childNodes );
  50103. };
  50104. /**
  50105. * Load a url into a page
  50106. */
  50107. jQuery.fn.load = function( url, params, callback ) {
  50108. var selector, type, response,
  50109. self = this,
  50110. off = url.indexOf( " " );
  50111. if ( off > -1 ) {
  50112. selector = stripAndCollapse( url.slice( off ) );
  50113. url = url.slice( 0, off );
  50114. }
  50115. // If it's a function
  50116. if ( isFunction( params ) ) {
  50117. // We assume that it's the callback
  50118. callback = params;
  50119. params = undefined;
  50120. // Otherwise, build a param string
  50121. } else if ( params && typeof params === "object" ) {
  50122. type = "POST";
  50123. }
  50124. // If we have elements to modify, make the request
  50125. if ( self.length > 0 ) {
  50126. jQuery.ajax( {
  50127. url: url,
  50128. // If "type" variable is undefined, then "GET" method will be used.
  50129. // Make value of this field explicit since
  50130. // user can override it through ajaxSetup method
  50131. type: type || "GET",
  50132. dataType: "html",
  50133. data: params
  50134. } ).done( function( responseText ) {
  50135. // Save response for use in complete callback
  50136. response = arguments;
  50137. self.html( selector ?
  50138. // If a selector was specified, locate the right elements in a dummy div
  50139. // Exclude scripts to avoid IE 'Permission Denied' errors
  50140. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  50141. // Otherwise use the full result
  50142. responseText );
  50143. // If the request succeeds, this function gets "data", "status", "jqXHR"
  50144. // but they are ignored because response was set above.
  50145. // If it fails, this function gets "jqXHR", "status", "error"
  50146. } ).always( callback && function( jqXHR, status ) {
  50147. self.each( function() {
  50148. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  50149. } );
  50150. } );
  50151. }
  50152. return this;
  50153. };
  50154. // Attach a bunch of functions for handling common AJAX events
  50155. jQuery.each( [
  50156. "ajaxStart",
  50157. "ajaxStop",
  50158. "ajaxComplete",
  50159. "ajaxError",
  50160. "ajaxSuccess",
  50161. "ajaxSend"
  50162. ], function( i, type ) {
  50163. jQuery.fn[ type ] = function( fn ) {
  50164. return this.on( type, fn );
  50165. };
  50166. } );
  50167. jQuery.expr.pseudos.animated = function( elem ) {
  50168. return jQuery.grep( jQuery.timers, function( fn ) {
  50169. return elem === fn.elem;
  50170. } ).length;
  50171. };
  50172. jQuery.offset = {
  50173. setOffset: function( elem, options, i ) {
  50174. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  50175. position = jQuery.css( elem, "position" ),
  50176. curElem = jQuery( elem ),
  50177. props = {};
  50178. // Set position first, in-case top/left are set even on static elem
  50179. if ( position === "static" ) {
  50180. elem.style.position = "relative";
  50181. }
  50182. curOffset = curElem.offset();
  50183. curCSSTop = jQuery.css( elem, "top" );
  50184. curCSSLeft = jQuery.css( elem, "left" );
  50185. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  50186. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  50187. // Need to be able to calculate position if either
  50188. // top or left is auto and position is either absolute or fixed
  50189. if ( calculatePosition ) {
  50190. curPosition = curElem.position();
  50191. curTop = curPosition.top;
  50192. curLeft = curPosition.left;
  50193. } else {
  50194. curTop = parseFloat( curCSSTop ) || 0;
  50195. curLeft = parseFloat( curCSSLeft ) || 0;
  50196. }
  50197. if ( isFunction( options ) ) {
  50198. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  50199. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  50200. }
  50201. if ( options.top != null ) {
  50202. props.top = ( options.top - curOffset.top ) + curTop;
  50203. }
  50204. if ( options.left != null ) {
  50205. props.left = ( options.left - curOffset.left ) + curLeft;
  50206. }
  50207. if ( "using" in options ) {
  50208. options.using.call( elem, props );
  50209. } else {
  50210. curElem.css( props );
  50211. }
  50212. }
  50213. };
  50214. jQuery.fn.extend( {
  50215. // offset() relates an element's border box to the document origin
  50216. offset: function( options ) {
  50217. // Preserve chaining for setter
  50218. if ( arguments.length ) {
  50219. return options === undefined ?
  50220. this :
  50221. this.each( function( i ) {
  50222. jQuery.offset.setOffset( this, options, i );
  50223. } );
  50224. }
  50225. var rect, win,
  50226. elem = this[ 0 ];
  50227. if ( !elem ) {
  50228. return;
  50229. }
  50230. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  50231. // Support: IE <=11 only
  50232. // Running getBoundingClientRect on a
  50233. // disconnected node in IE throws an error
  50234. if ( !elem.getClientRects().length ) {
  50235. return { top: 0, left: 0 };
  50236. }
  50237. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  50238. rect = elem.getBoundingClientRect();
  50239. win = elem.ownerDocument.defaultView;
  50240. return {
  50241. top: rect.top + win.pageYOffset,
  50242. left: rect.left + win.pageXOffset
  50243. };
  50244. },
  50245. // position() relates an element's margin box to its offset parent's padding box
  50246. // This corresponds to the behavior of CSS absolute positioning
  50247. position: function() {
  50248. if ( !this[ 0 ] ) {
  50249. return;
  50250. }
  50251. var offsetParent, offset, doc,
  50252. elem = this[ 0 ],
  50253. parentOffset = { top: 0, left: 0 };
  50254. // position:fixed elements are offset from the viewport, which itself always has zero offset
  50255. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  50256. // Assume position:fixed implies availability of getBoundingClientRect
  50257. offset = elem.getBoundingClientRect();
  50258. } else {
  50259. offset = this.offset();
  50260. // Account for the *real* offset parent, which can be the document or its root element
  50261. // when a statically positioned element is identified
  50262. doc = elem.ownerDocument;
  50263. offsetParent = elem.offsetParent || doc.documentElement;
  50264. while ( offsetParent &&
  50265. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  50266. jQuery.css( offsetParent, "position" ) === "static" ) {
  50267. offsetParent = offsetParent.parentNode;
  50268. }
  50269. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  50270. // Incorporate borders into its offset, since they are outside its content origin
  50271. parentOffset = jQuery( offsetParent ).offset();
  50272. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  50273. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  50274. }
  50275. }
  50276. // Subtract parent offsets and element margins
  50277. return {
  50278. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  50279. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  50280. };
  50281. },
  50282. // This method will return documentElement in the following cases:
  50283. // 1) For the element inside the iframe without offsetParent, this method will return
  50284. // documentElement of the parent window
  50285. // 2) For the hidden or detached element
  50286. // 3) For body or html element, i.e. in case of the html node - it will return itself
  50287. //
  50288. // but those exceptions were never presented as a real life use-cases
  50289. // and might be considered as more preferable results.
  50290. //
  50291. // This logic, however, is not guaranteed and can change at any point in the future
  50292. offsetParent: function() {
  50293. return this.map( function() {
  50294. var offsetParent = this.offsetParent;
  50295. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  50296. offsetParent = offsetParent.offsetParent;
  50297. }
  50298. return offsetParent || documentElement;
  50299. } );
  50300. }
  50301. } );
  50302. // Create scrollLeft and scrollTop methods
  50303. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  50304. var top = "pageYOffset" === prop;
  50305. jQuery.fn[ method ] = function( val ) {
  50306. return access( this, function( elem, method, val ) {
  50307. // Coalesce documents and windows
  50308. var win;
  50309. if ( isWindow( elem ) ) {
  50310. win = elem;
  50311. } else if ( elem.nodeType === 9 ) {
  50312. win = elem.defaultView;
  50313. }
  50314. if ( val === undefined ) {
  50315. return win ? win[ prop ] : elem[ method ];
  50316. }
  50317. if ( win ) {
  50318. win.scrollTo(
  50319. !top ? val : win.pageXOffset,
  50320. top ? val : win.pageYOffset
  50321. );
  50322. } else {
  50323. elem[ method ] = val;
  50324. }
  50325. }, method, val, arguments.length );
  50326. };
  50327. } );
  50328. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  50329. // Add the top/left cssHooks using jQuery.fn.position
  50330. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  50331. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  50332. // getComputedStyle returns percent when specified for top/left/bottom/right;
  50333. // rather than make the css module depend on the offset module, just check for it here
  50334. jQuery.each( [ "top", "left" ], function( i, prop ) {
  50335. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  50336. function( elem, computed ) {
  50337. if ( computed ) {
  50338. computed = curCSS( elem, prop );
  50339. // If curCSS returns percentage, fallback to offset
  50340. return rnumnonpx.test( computed ) ?
  50341. jQuery( elem ).position()[ prop ] + "px" :
  50342. computed;
  50343. }
  50344. }
  50345. );
  50346. } );
  50347. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  50348. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  50349. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  50350. function( defaultExtra, funcName ) {
  50351. // Margin is only for outerHeight, outerWidth
  50352. jQuery.fn[ funcName ] = function( margin, value ) {
  50353. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  50354. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  50355. return access( this, function( elem, type, value ) {
  50356. var doc;
  50357. if ( isWindow( elem ) ) {
  50358. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  50359. return funcName.indexOf( "outer" ) === 0 ?
  50360. elem[ "inner" + name ] :
  50361. elem.document.documentElement[ "client" + name ];
  50362. }
  50363. // Get document width or height
  50364. if ( elem.nodeType === 9 ) {
  50365. doc = elem.documentElement;
  50366. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  50367. // whichever is greatest
  50368. return Math.max(
  50369. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  50370. elem.body[ "offset" + name ], doc[ "offset" + name ],
  50371. doc[ "client" + name ]
  50372. );
  50373. }
  50374. return value === undefined ?
  50375. // Get width or height on the element, requesting but not forcing parseFloat
  50376. jQuery.css( elem, type, extra ) :
  50377. // Set width or height on the element
  50378. jQuery.style( elem, type, value, extra );
  50379. }, type, chainable ? margin : undefined, chainable );
  50380. };
  50381. } );
  50382. } );
  50383. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  50384. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  50385. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  50386. function( i, name ) {
  50387. // Handle event binding
  50388. jQuery.fn[ name ] = function( data, fn ) {
  50389. return arguments.length > 0 ?
  50390. this.on( name, null, data, fn ) :
  50391. this.trigger( name );
  50392. };
  50393. } );
  50394. jQuery.fn.extend( {
  50395. hover: function( fnOver, fnOut ) {
  50396. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  50397. }
  50398. } );
  50399. jQuery.fn.extend( {
  50400. bind: function( types, data, fn ) {
  50401. return this.on( types, null, data, fn );
  50402. },
  50403. unbind: function( types, fn ) {
  50404. return this.off( types, null, fn );
  50405. },
  50406. delegate: function( selector, types, data, fn ) {
  50407. return this.on( types, selector, data, fn );
  50408. },
  50409. undelegate: function( selector, types, fn ) {
  50410. // ( namespace ) or ( selector, types [, fn] )
  50411. return arguments.length === 1 ?
  50412. this.off( selector, "**" ) :
  50413. this.off( types, selector || "**", fn );
  50414. }
  50415. } );
  50416. // Bind a function to a context, optionally partially applying any
  50417. // arguments.
  50418. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  50419. // However, it is not slated for removal any time soon
  50420. jQuery.proxy = function( fn, context ) {
  50421. var tmp, args, proxy;
  50422. if ( typeof context === "string" ) {
  50423. tmp = fn[ context ];
  50424. context = fn;
  50425. fn = tmp;
  50426. }
  50427. // Quick check to determine if target is callable, in the spec
  50428. // this throws a TypeError, but we will just return undefined.
  50429. if ( !isFunction( fn ) ) {
  50430. return undefined;
  50431. }
  50432. // Simulated bind
  50433. args = slice.call( arguments, 2 );
  50434. proxy = function() {
  50435. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  50436. };
  50437. // Set the guid of unique handler to the same of original handler, so it can be removed
  50438. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  50439. return proxy;
  50440. };
  50441. jQuery.holdReady = function( hold ) {
  50442. if ( hold ) {
  50443. jQuery.readyWait++;
  50444. } else {
  50445. jQuery.ready( true );
  50446. }
  50447. };
  50448. jQuery.isArray = Array.isArray;
  50449. jQuery.parseJSON = JSON.parse;
  50450. jQuery.nodeName = nodeName;
  50451. jQuery.isFunction = isFunction;
  50452. jQuery.isWindow = isWindow;
  50453. jQuery.camelCase = camelCase;
  50454. jQuery.type = toType;
  50455. jQuery.now = Date.now;
  50456. jQuery.isNumeric = function( obj ) {
  50457. // As of jQuery 3.0, isNumeric is limited to
  50458. // strings and numbers (primitives or objects)
  50459. // that can be coerced to finite numbers (gh-2662)
  50460. var type = jQuery.type( obj );
  50461. return ( type === "number" || type === "string" ) &&
  50462. // parseFloat NaNs numeric-cast false positives ("")
  50463. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  50464. // subtraction forces infinities to NaN
  50465. !isNaN( obj - parseFloat( obj ) );
  50466. };
  50467. // Register as a named AMD module, since jQuery can be concatenated with other
  50468. // files that may use define, but not via a proper concatenation script that
  50469. // understands anonymous AMD modules. A named AMD is safest and most robust
  50470. // way to register. Lowercase jquery is used because AMD module names are
  50471. // derived from file names, and jQuery is normally delivered in a lowercase
  50472. // file name. Do this after creating the global so that if an AMD module wants
  50473. // to call noConflict to hide this version of jQuery, it will work.
  50474. // Note that for maximum portability, libraries that are not jQuery should
  50475. // declare themselves as anonymous modules, and avoid setting a global if an
  50476. // AMD loader is present. jQuery is a special case. For more information, see
  50477. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  50478. if ( true ) {
  50479. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  50480. return jQuery;
  50481. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  50482. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  50483. }
  50484. var
  50485. // Map over jQuery in case of overwrite
  50486. _jQuery = window.jQuery,
  50487. // Map over the $ in case of overwrite
  50488. _$ = window.$;
  50489. jQuery.noConflict = function( deep ) {
  50490. if ( window.$ === jQuery ) {
  50491. window.$ = _$;
  50492. }
  50493. if ( deep && window.jQuery === jQuery ) {
  50494. window.jQuery = _jQuery;
  50495. }
  50496. return jQuery;
  50497. };
  50498. // Expose jQuery and $ identifiers, even in AMD
  50499. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  50500. // and CommonJS for browser emulators (#13566)
  50501. if ( !noGlobal ) {
  50502. window.jQuery = window.$ = jQuery;
  50503. }
  50504. return jQuery;
  50505. } );
  50506. /***/ }),
  50507. /***/ "./node_modules/line-i18n/dist/LanguageService.js":
  50508. /*!********************************************************!*\
  50509. !*** ./node_modules/line-i18n/dist/LanguageService.js ***!
  50510. \********************************************************/
  50511. /*! exports provided: LanguageService */
  50512. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  50513. "use strict";
  50514. __webpack_require__.r(__webpack_exports__);
  50515. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LanguageService", function() { return LanguageService; });
  50516. var LanguageService = /** @class */ (function () {
  50517. function LanguageService(lsKey, defaultLang) {
  50518. if (defaultLang === void 0) { defaultLang = 'pt'; }
  50519. this.lsKey = lsKey;
  50520. this.defaultLang = defaultLang;
  50521. this.listeners = [];
  50522. this.document = document;
  50523. this.setupListener();
  50524. }
  50525. LanguageService.prototype.setupListener = function () {
  50526. var _this = this;
  50527. if (this.document !== null) {
  50528. this.document.addEventListener("storage", (function (event) {
  50529. var e = event;
  50530. if (e.key === _this.lsKey) {
  50531. _this.listeners.forEach(function (l) { return l(); });
  50532. }
  50533. }));
  50534. }
  50535. };
  50536. LanguageService.prototype.getLang = function () {
  50537. var lang = localStorage.getItem(this.lsKey);
  50538. if (lang === null || lang === undefined) {
  50539. console.warn("Internal Error: User language information has not been set. Returning default...");
  50540. return this.getDefaultLang();
  50541. }
  50542. return lang;
  50543. };
  50544. LanguageService.prototype.getDefaultLang = function () {
  50545. return this.defaultLang;
  50546. };
  50547. LanguageService.prototype.registerLanguageChangeListener = function (listener) {
  50548. this.listeners.push(listener);
  50549. };
  50550. return LanguageService;
  50551. }());
  50552. /***/ }),
  50553. /***/ "./node_modules/line-i18n/dist/LanguageServiceNoLS.js":
  50554. /*!************************************************************!*\
  50555. !*** ./node_modules/line-i18n/dist/LanguageServiceNoLS.js ***!
  50556. \************************************************************/
  50557. /*! exports provided: LanguageServiceNoLS */
  50558. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  50559. "use strict";
  50560. __webpack_require__.r(__webpack_exports__);
  50561. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LanguageServiceNoLS", function() { return LanguageServiceNoLS; });
  50562. var LanguageServiceNoLS = /** @class */ (function () {
  50563. function LanguageServiceNoLS(lang) {
  50564. this.lang = lang;
  50565. this.listeners = [];
  50566. }
  50567. LanguageServiceNoLS.prototype.setupListener = function () { };
  50568. LanguageServiceNoLS.prototype.notifyChange = function () {
  50569. this.listeners.forEach(function (l) { return l(); });
  50570. };
  50571. LanguageServiceNoLS.prototype.setLang = function (lang) {
  50572. this.lang = lang;
  50573. this.notifyChange();
  50574. };
  50575. LanguageServiceNoLS.prototype.getLang = function () {
  50576. return this.lang;
  50577. };
  50578. LanguageServiceNoLS.prototype.getDefaultLang = function () {
  50579. return this.lang;
  50580. };
  50581. LanguageServiceNoLS.prototype.registerLanguageChangeListener = function (listener) {
  50582. this.listeners.push(listener);
  50583. };
  50584. return LanguageServiceNoLS;
  50585. }());
  50586. /***/ }),
  50587. /***/ "./node_modules/line-i18n/dist/LocalizedStrings.js":
  50588. /*!*********************************************************!*\
  50589. !*** ./node_modules/line-i18n/dist/LocalizedStrings.js ***!
  50590. \*********************************************************/
  50591. /*! exports provided: LocalizedStrings */
  50592. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  50593. "use strict";
  50594. __webpack_require__.r(__webpack_exports__);
  50595. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LocalizedStrings", function() { return LocalizedStrings; });
  50596. /* harmony import */ var _StringTypes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./StringTypes */ "./node_modules/line-i18n/dist/StringTypes.js");
  50597. var LocalizedStrings = /** @class */ (function () {
  50598. function LocalizedStrings(service, i18nData, listenToChange) {
  50599. if (listenToChange === void 0) { listenToChange = false; }
  50600. var _this = this;
  50601. this.service = service;
  50602. this.i18nData = i18nData;
  50603. this.listenToChange = listenToChange;
  50604. this.document = document;
  50605. if (this.listenToChange) {
  50606. service.registerLanguageChangeListener(function () {
  50607. _this.updateTagText();
  50608. });
  50609. }
  50610. }
  50611. LocalizedStrings.prototype.getString = function (id, type) {
  50612. var i18nObj = this.i18nData[this.service.getLang()];
  50613. if (!!!i18nObj) {
  50614. console.warn("Internal Error. The language set at ivprog.lang is not valid: " + this.service.getLang());
  50615. i18nObj = this.i18nData[this.service.getDefaultLang()];
  50616. }
  50617. if (!!!i18nObj[type]) {
  50618. return "{MISSING_I18N_TYPE_IDENTIFIER}";
  50619. }
  50620. else if (!!!i18nObj[type][id]) {
  50621. return "{MISSING_I18N_IDENTIFIER}";
  50622. }
  50623. else {
  50624. return i18nObj[type][id];
  50625. }
  50626. };
  50627. LocalizedStrings.prototype.getOR = function () {
  50628. return this.getUI('join_or');
  50629. };
  50630. LocalizedStrings.prototype.getError = function (id, context) {
  50631. if (context === void 0) { context = []; }
  50632. var text = this.getString(id, _StringTypes__WEBPACK_IMPORTED_MODULE_0__["StringTypes"].ERROR);
  50633. return this.processString(text, context);
  50634. };
  50635. LocalizedStrings.prototype.getMessage = function (id, context) {
  50636. if (context === void 0) { context = []; }
  50637. var text = this.getString(id, _StringTypes__WEBPACK_IMPORTED_MODULE_0__["StringTypes"].MESSAGE);
  50638. return this.processString(text, context);
  50639. };
  50640. LocalizedStrings.prototype.getUI = function (id, context) {
  50641. if (context === void 0) { context = []; }
  50642. var text = this.getString(id, _StringTypes__WEBPACK_IMPORTED_MODULE_0__["StringTypes"].UI);
  50643. return this.processString(text, context);
  50644. };
  50645. LocalizedStrings.prototype.processString = function (text, context) {
  50646. for (var i = 0; i < context.length; i++) {
  50647. var v = context[i];
  50648. text = text.replace('\$' + i, v);
  50649. }
  50650. return text;
  50651. };
  50652. LocalizedStrings.prototype.updateTagText = function (func) {
  50653. var _this = this;
  50654. if (func === void 0) { func = null; }
  50655. if (this.document !== null) {
  50656. var list = this.document.querySelectorAll("data.i18n");
  50657. list.forEach(function (node) {
  50658. if (func === null) {
  50659. node.innerHTML = _this.processTagTex(node.getAttribute("value"));
  50660. }
  50661. else {
  50662. node.innerHTML = func(node.getAttribute("value"));
  50663. }
  50664. });
  50665. }
  50666. };
  50667. LocalizedStrings.prototype.processTagTex = function (text) {
  50668. if (text === null) {
  50669. return "<Invalid i18n identifier>";
  50670. }
  50671. var opts = text.split(':');
  50672. var type = opts[0].toLowerCase();
  50673. var id = opts[1];
  50674. if (_StringTypes__WEBPACK_IMPORTED_MODULE_0__["StringTypes"].ERROR === type) {
  50675. return this.getError(id);
  50676. }
  50677. else if (_StringTypes__WEBPACK_IMPORTED_MODULE_0__["StringTypes"].MESSAGE === type) {
  50678. return this.getMessage(id);
  50679. }
  50680. else if (_StringTypes__WEBPACK_IMPORTED_MODULE_0__["StringTypes"].UI === type) {
  50681. return this.getUI(id);
  50682. }
  50683. else {
  50684. console.warn(" A string has been passed to the i18n helper function that was not in the form type:id -> " + text);
  50685. return this.getString(id, type);
  50686. }
  50687. };
  50688. return LocalizedStrings;
  50689. }());
  50690. /***/ }),
  50691. /***/ "./node_modules/line-i18n/dist/StringTypes.js":
  50692. /*!****************************************************!*\
  50693. !*** ./node_modules/line-i18n/dist/StringTypes.js ***!
  50694. \****************************************************/
  50695. /*! exports provided: StringTypes */
  50696. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  50697. "use strict";
  50698. __webpack_require__.r(__webpack_exports__);
  50699. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StringTypes", function() { return StringTypes; });
  50700. var StringTypes;
  50701. (function (StringTypes) {
  50702. StringTypes["ERROR"] = "error";
  50703. StringTypes["MESSAGE"] = "message";
  50704. StringTypes["UI"] = "ui";
  50705. })(StringTypes || (StringTypes = {}));
  50706. /***/ }),
  50707. /***/ "./node_modules/line-i18n/dist/index.js":
  50708. /*!**********************************************!*\
  50709. !*** ./node_modules/line-i18n/dist/index.js ***!
  50710. \**********************************************/
  50711. /*! exports provided: default */
  50712. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  50713. "use strict";
  50714. __webpack_require__.r(__webpack_exports__);
  50715. /* harmony import */ var _LanguageService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./LanguageService */ "./node_modules/line-i18n/dist/LanguageService.js");
  50716. /* harmony import */ var _LocalizedStrings__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./LocalizedStrings */ "./node_modules/line-i18n/dist/LocalizedStrings.js");
  50717. /* harmony import */ var _StringTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./StringTypes */ "./node_modules/line-i18n/dist/StringTypes.js");
  50718. /* harmony import */ var _LanguageServiceNoLS__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./LanguageServiceNoLS */ "./node_modules/line-i18n/dist/LanguageServiceNoLS.js");
  50719. /* harmony default export */ __webpack_exports__["default"] = ({
  50720. LanguageService: _LanguageService__WEBPACK_IMPORTED_MODULE_0__["LanguageService"],
  50721. LanguageServiceNoLS: _LanguageServiceNoLS__WEBPACK_IMPORTED_MODULE_3__["LanguageServiceNoLS"],
  50722. LocalizedStrings: _LocalizedStrings__WEBPACK_IMPORTED_MODULE_1__["LocalizedStrings"],
  50723. StringTypes: _StringTypes__WEBPACK_IMPORTED_MODULE_2__["StringTypes"]
  50724. });
  50725. /***/ }),
  50726. /***/ "./node_modules/melanke-watchjs/src/watch.js":
  50727. /*!***************************************************!*\
  50728. !*** ./node_modules/melanke-watchjs/src/watch.js ***!
  50729. \***************************************************/
  50730. /*! no static exports found */
  50731. /***/ (function(module, exports, __webpack_require__) {
  50732. "use strict";
  50733. /**
  50734. * DEVELOPED BY
  50735. * GIL LOPES BUENO
  50736. * gilbueno.mail@gmail.com
  50737. *
  50738. * WORKS WITH:
  50739. * IE8*, IE 9+, FF 4+, SF 5+, WebKit, CH 7+, OP 12+, BESEN, Rhino 1.7+
  50740. * For IE8 (and other legacy browsers) WatchJS will use dirty checking
  50741. *
  50742. * FORK:
  50743. * https://github.com/melanke/Watch.JS
  50744. *
  50745. * LICENSE: MIT
  50746. */
  50747. (function (factory) {
  50748. if (true) {
  50749. // Node. Does not work with strict CommonJS, but
  50750. // only CommonJS-like enviroments that support module.exports,
  50751. // like Node.
  50752. module.exports = factory();
  50753. } else {}
  50754. }(function () {
  50755. var WatchJS = {
  50756. noMore: false, // use WatchJS.suspend(obj) instead
  50757. useDirtyCheck: false, // use only dirty checking to track changes.
  50758. preserveExistingSetters: false
  50759. },
  50760. lengthsubjects = [];
  50761. var dirtyChecklist = [];
  50762. var pendingChanges = []; // used coalesce changes from defineProperty and __defineSetter__
  50763. var supportDefineProperty = false;
  50764. try {
  50765. supportDefineProperty = Object.defineProperty && Object.defineProperty({},'x', {});
  50766. } catch(ex) { /* not supported */ }
  50767. var isFunction = function (functionToCheck) {
  50768. var getType = {};
  50769. return functionToCheck && getType.toString.call(functionToCheck) == '[object Function]';
  50770. };
  50771. var isInt = function (x) {
  50772. return x % 1 === 0;
  50773. };
  50774. var isArray = function(obj) {
  50775. return Object.prototype.toString.call(obj) === '[object Array]';
  50776. };
  50777. var isObject = function(obj) {
  50778. return {}.toString.apply(obj) === '[object Object]';
  50779. };
  50780. var getObjDiff = function(a, b){
  50781. var aplus = [],
  50782. bplus = [];
  50783. if(!(typeof a == "string") && !(typeof b == "string")){
  50784. if (isArray(a) && b) {
  50785. for (var i=0; i<a.length; i++) {
  50786. if (b[i] === undefined) aplus.push(i);
  50787. }
  50788. } else {
  50789. for(var i in a){
  50790. if (a.hasOwnProperty(i)) {
  50791. if(b && !b.hasOwnProperty(i)) {
  50792. aplus.push(i);
  50793. }
  50794. }
  50795. }
  50796. }
  50797. if (isArray(b) && a) {
  50798. for (var j=0; j<b.length; j++) {
  50799. if (a[j] === undefined) bplus.push(j);
  50800. }
  50801. } else {
  50802. for(var j in b){
  50803. if (b.hasOwnProperty(j)) {
  50804. if(a && !a.hasOwnProperty(j)) {
  50805. bplus.push(j);
  50806. }
  50807. }
  50808. }
  50809. }
  50810. }
  50811. return {
  50812. added: aplus,
  50813. removed: bplus
  50814. }
  50815. };
  50816. var clone = function(obj){
  50817. if (null == obj || "object" != typeof obj) {
  50818. return obj;
  50819. }
  50820. var copy = obj.constructor();
  50821. for (var attr in obj) {
  50822. copy[attr] = obj[attr];
  50823. }
  50824. return copy;
  50825. }
  50826. var getExistingSetter = function (obj, propName) {
  50827. if (WatchJS.preserveExistingSetters) {
  50828. var existing = Object.getOwnPropertyDescriptor(obj, propName);
  50829. return existing.set;
  50830. }
  50831. return undefined;
  50832. }
  50833. var defineGetAndSet = function (obj, propName, getter, setter) {
  50834. try {
  50835. var existingSetter = getExistingSetter(obj, propName);
  50836. Object.defineProperty(obj, propName, {
  50837. get: getter,
  50838. set: function(value) {
  50839. setter.call(this, value, true); // coalesce changes
  50840. if (existingSetter) {
  50841. existingSetter(value);
  50842. }
  50843. },
  50844. enumerable: true,
  50845. configurable: true
  50846. });
  50847. }
  50848. catch(e1) {
  50849. try{
  50850. Object.prototype.__defineGetter__.call(obj, propName, getter);
  50851. Object.prototype.__defineSetter__.call(obj, propName, function(value) {
  50852. setter.call(this,value,true); // coalesce changes
  50853. });
  50854. }
  50855. catch(e2) {
  50856. observeDirtyChanges(obj,propName,setter);
  50857. //throw new Error("watchJS error: browser not supported :/")
  50858. }
  50859. }
  50860. };
  50861. var defineProp = function (obj, propName, value) {
  50862. try {
  50863. Object.defineProperty(obj, propName, {
  50864. enumerable: false,
  50865. configurable: true,
  50866. writable: false,
  50867. value: value
  50868. });
  50869. } catch(error) {
  50870. obj[propName] = value;
  50871. }
  50872. };
  50873. var observeDirtyChanges = function(obj,propName,setter) {
  50874. dirtyChecklist[dirtyChecklist.length] = {
  50875. prop: propName,
  50876. object: obj,
  50877. orig: clone(obj[propName]),
  50878. callback: setter
  50879. }
  50880. }
  50881. var watch = function () {
  50882. if (isFunction(arguments[1])) {
  50883. watchAll.apply(this, arguments);
  50884. } else if (isArray(arguments[1])) {
  50885. watchMany.apply(this, arguments);
  50886. } else {
  50887. watchOne.apply(this, arguments);
  50888. }
  50889. };
  50890. var watchAll = function (obj, watcher, level, addNRemove) {
  50891. if ((typeof obj == "string") || (!(obj instanceof Object) && !isArray(obj))) { //accepts only objects and array (not string)
  50892. return;
  50893. }
  50894. if(isArray(obj)) {
  50895. defineWatcher(obj, "__watchall__", watcher, level); // watch all changes on the array
  50896. if (level===undefined||level > 0) {
  50897. for (var prop = 0; prop < obj.length; prop++) { // watch objects in array
  50898. watchAll(obj[prop],watcher,level, addNRemove);
  50899. }
  50900. }
  50901. }
  50902. else {
  50903. var prop,props = [];
  50904. for (prop in obj) { //for each attribute if obj is an object
  50905. if (prop == "$val" || (!supportDefineProperty && prop === 'watchers')) {
  50906. continue;
  50907. }
  50908. if (Object.prototype.hasOwnProperty.call(obj, prop)) {
  50909. props.push(prop); //put in the props
  50910. }
  50911. }
  50912. watchMany(obj, props, watcher, level, addNRemove); //watch all items of the props
  50913. }
  50914. if (addNRemove) {
  50915. pushToLengthSubjects(obj, "$$watchlengthsubjectroot", watcher, level);
  50916. }
  50917. };
  50918. var watchMany = function (obj, props, watcher, level, addNRemove) {
  50919. if ((typeof obj == "string") || (!(obj instanceof Object) && !isArray(obj))) { //accepts only objects and array (not string)
  50920. return;
  50921. }
  50922. for (var i=0; i<props.length; i++) { //watch each property
  50923. var prop = props[i];
  50924. watchOne(obj, prop, watcher, level, addNRemove);
  50925. }
  50926. };
  50927. var watchOne = function (obj, prop, watcher, level, addNRemove) {
  50928. if ((typeof obj == "string") || (!(obj instanceof Object) && !isArray(obj))) { //accepts only objects and array (not string)
  50929. return;
  50930. }
  50931. if(isFunction(obj[prop])) { //dont watch if it is a function
  50932. return;
  50933. }
  50934. if(obj[prop] != null && (level === undefined || level > 0)){
  50935. watchAll(obj[prop], watcher, level!==undefined? level-1 : level); //recursively watch all attributes of this
  50936. }
  50937. defineWatcher(obj, prop, watcher, level);
  50938. if(addNRemove && (level === undefined || level > 0)){
  50939. pushToLengthSubjects(obj, prop, watcher, level);
  50940. }
  50941. };
  50942. var unwatch = function () {
  50943. if (isFunction(arguments[1])) {
  50944. unwatchAll.apply(this, arguments);
  50945. } else if (isArray(arguments[1])) {
  50946. unwatchMany.apply(this, arguments);
  50947. } else {
  50948. unwatchOne.apply(this, arguments);
  50949. }
  50950. };
  50951. var unwatchAll = function (obj, watcher) {
  50952. if (obj instanceof String || (!(obj instanceof Object) && !isArray(obj))) { //accepts only objects and array (not string)
  50953. return;
  50954. }
  50955. if (isArray(obj)) {
  50956. var props = ['__watchall__'];
  50957. for (var prop = 0; prop < obj.length; prop++) { //for each item if obj is an array
  50958. props.push(prop); //put in the props
  50959. }
  50960. unwatchMany(obj, props, watcher); //watch all itens of the props
  50961. } else {
  50962. var unwatchPropsInObject = function (obj2) {
  50963. var props = [];
  50964. for (var prop2 in obj2) { //for each attribute if obj is an object
  50965. if (obj2.hasOwnProperty(prop2)) {
  50966. if (obj2[prop2] instanceof Object) {
  50967. unwatchPropsInObject(obj2[prop2]); //recurs into object props
  50968. } else {
  50969. props.push(prop2); //put in the props
  50970. }
  50971. }
  50972. }
  50973. unwatchMany(obj2, props, watcher); //unwatch all of the props
  50974. };
  50975. unwatchPropsInObject(obj);
  50976. }
  50977. };
  50978. var unwatchMany = function (obj, props, watcher) {
  50979. for (var prop2 in props) { //watch each attribute of "props" if is an object
  50980. if (props.hasOwnProperty(prop2)) {
  50981. unwatchOne(obj, props[prop2], watcher);
  50982. }
  50983. }
  50984. };
  50985. var timeouts = [],
  50986. timerID = null;
  50987. function clearTimerID() {
  50988. timerID = null;
  50989. for(var i=0; i< timeouts.length; i++) {
  50990. timeouts[i]();
  50991. }
  50992. timeouts.length = 0;
  50993. }
  50994. var getTimerID= function () {
  50995. if (!timerID) {
  50996. timerID = setTimeout(clearTimerID);
  50997. }
  50998. return timerID;
  50999. }
  51000. var registerTimeout = function(fn) { // register function to be called on timeout
  51001. if (timerID==null) getTimerID();
  51002. timeouts[timeouts.length] = fn;
  51003. }
  51004. // Track changes made to an array, object or an object's property
  51005. // and invoke callback with a single change object containing type, value, oldvalue and array splices
  51006. // Syntax:
  51007. // trackChange(obj, callback, recursive, addNRemove)
  51008. // trackChange(obj, prop, callback, recursive, addNRemove)
  51009. var trackChange = function() {
  51010. var fn = (isFunction(arguments[2])) ? trackProperty : trackObject ;
  51011. fn.apply(this,arguments);
  51012. }
  51013. // track changes made to an object and invoke callback with a single change object containing type, value and array splices
  51014. var trackObject= function(obj, callback, recursive, addNRemove) {
  51015. var change = null,lastTimerID = -1;
  51016. var isArr = isArray(obj);
  51017. var level,fn = function(prop, action, newValue, oldValue) {
  51018. var timerID = getTimerID();
  51019. if (lastTimerID!==timerID) { // check if timer has changed since last update
  51020. lastTimerID = timerID;
  51021. change = {
  51022. type: 'update'
  51023. }
  51024. change['value'] = obj;
  51025. change['splices'] = null;
  51026. registerTimeout(function() {
  51027. callback.call(this,change);
  51028. change = null;
  51029. });
  51030. }
  51031. // create splices for array changes
  51032. if (isArr && obj === this && change !== null) {
  51033. if (action==='pop'||action==='shift') {
  51034. newValue = [];
  51035. oldValue = [oldValue];
  51036. }
  51037. else if (action==='push'||action==='unshift') {
  51038. newValue = [newValue];
  51039. oldValue = [];
  51040. }
  51041. else if (action!=='splice') {
  51042. return; // return here - for reverse and sort operations we don't need to return splices. a simple update will do
  51043. }
  51044. if (!change.splices) change.splices = [];
  51045. change.splices[change.splices.length] = {
  51046. index: prop,
  51047. deleteCount: oldValue ? oldValue.length : 0,
  51048. addedCount: newValue ? newValue.length : 0,
  51049. added: newValue,
  51050. deleted: oldValue
  51051. };
  51052. }
  51053. }
  51054. level = (recursive==true) ? undefined : 0;
  51055. watchAll(obj,fn, level, addNRemove);
  51056. }
  51057. // track changes made to the property of an object and invoke callback with a single change object containing type, value, oldvalue and splices
  51058. var trackProperty = function(obj,prop,callback,recursive, addNRemove) {
  51059. if (obj && prop) {
  51060. watchOne(obj,prop,function(prop, action, newvalue, oldvalue) {
  51061. var change = {
  51062. type: 'update'
  51063. }
  51064. change['value'] = newvalue;
  51065. change['oldvalue'] = oldvalue;
  51066. if (recursive && isObject(newvalue)||isArray(newvalue)) {
  51067. trackObject(newvalue,callback,recursive, addNRemove);
  51068. }
  51069. callback.call(this,change);
  51070. },0)
  51071. if (recursive && isObject(obj[prop])||isArray(obj[prop])) {
  51072. trackObject(obj[prop],callback,recursive, addNRemove);
  51073. }
  51074. }
  51075. }
  51076. var defineWatcher = function (obj, prop, watcher, level) {
  51077. var newWatcher = false;
  51078. var isArr = isArray(obj);
  51079. if (!obj.watchers) {
  51080. defineProp(obj, "watchers", {});
  51081. if (isArr) {
  51082. // watch array functions
  51083. watchFunctions(obj, function(index,action,newValue, oldValue) {
  51084. addPendingChange(obj, index, action,newValue, oldValue);
  51085. if (level !== 0 && newValue && (isObject(newValue) || isArray(newValue))) {
  51086. var i,n, ln, wAll, watchList = obj.watchers[prop];
  51087. if ((wAll = obj.watchers['__watchall__'])) {
  51088. watchList = watchList ? watchList.concat(wAll) : wAll;
  51089. }
  51090. ln = watchList ? watchList.length : 0;
  51091. for (i = 0; i<ln; i++) {
  51092. if (action!=='splice') {
  51093. watchAll(newValue, watchList[i], (level===undefined)?level:level-1);
  51094. }
  51095. else {
  51096. // watch spliced values
  51097. for(n=0; n < newValue.length; n++) {
  51098. watchAll(newValue[n], watchList[i], (level===undefined)?level:level-1);
  51099. }
  51100. }
  51101. }
  51102. }
  51103. });
  51104. }
  51105. }
  51106. if (!obj.watchers[prop]) {
  51107. obj.watchers[prop] = [];
  51108. if (!isArr) newWatcher = true;
  51109. }
  51110. for (var i=0; i<obj.watchers[prop].length; i++) {
  51111. if(obj.watchers[prop][i] === watcher){
  51112. return;
  51113. }
  51114. }
  51115. obj.watchers[prop].push(watcher); //add the new watcher to the watchers array
  51116. if (newWatcher) {
  51117. var val = obj[prop];
  51118. var getter = function () {
  51119. return val;
  51120. };
  51121. var setter = function (newval, delayWatcher) {
  51122. var oldval = val;
  51123. val = newval;
  51124. if (level !== 0
  51125. && obj[prop] && (isObject(obj[prop]) || isArray(obj[prop]))
  51126. && !obj[prop].watchers) {
  51127. // watch sub properties
  51128. var i,ln = obj.watchers[prop].length;
  51129. for(i=0; i<ln; i++) {
  51130. watchAll(obj[prop], obj.watchers[prop][i], (level===undefined)?level:level-1);
  51131. }
  51132. }
  51133. //watchFunctions(obj, prop);
  51134. if (isSuspended(obj, prop)) {
  51135. resume(obj, prop);
  51136. return;
  51137. }
  51138. if (!WatchJS.noMore){ // this does not work with Object.observe
  51139. //if (JSON.stringify(oldval) !== JSON.stringify(newval)) {
  51140. if (oldval !== newval) {
  51141. if (!delayWatcher) {
  51142. callWatchers(obj, prop, "set", newval, oldval);
  51143. }
  51144. else {
  51145. addPendingChange(obj, prop, "set", newval, oldval);
  51146. }
  51147. WatchJS.noMore = false;
  51148. }
  51149. }
  51150. };
  51151. if (WatchJS.useDirtyCheck) {
  51152. observeDirtyChanges(obj,prop,setter);
  51153. }
  51154. else {
  51155. defineGetAndSet(obj, prop, getter, setter);
  51156. }
  51157. }
  51158. };
  51159. var callWatchers = function (obj, prop, action, newval, oldval) {
  51160. if (prop !== undefined) {
  51161. var ln, wl, watchList = obj.watchers[prop];
  51162. if ((wl = obj.watchers['__watchall__'])) {
  51163. watchList = watchList ? watchList.concat(wl) : wl;
  51164. }
  51165. ln = watchList ? watchList.length : 0;
  51166. for (var wr=0; wr< ln; wr++) {
  51167. watchList[wr].call(obj, prop, action, newval, oldval);
  51168. }
  51169. } else {
  51170. for (var prop in obj) {//call all
  51171. if (obj.hasOwnProperty(prop)) {
  51172. callWatchers(obj, prop, action, newval, oldval);
  51173. }
  51174. }
  51175. }
  51176. };
  51177. var methodNames = ['pop', 'push', 'reverse', 'shift', 'sort', 'slice', 'unshift', 'splice'];
  51178. var defineArrayMethodWatcher = function (obj, original, methodName, callback) {
  51179. defineProp(obj, methodName, function () {
  51180. var index = 0;
  51181. var i,newValue, oldValue, response;
  51182. // get values before splicing array
  51183. if (methodName === 'splice') {
  51184. var start = arguments[0];
  51185. var end = start + arguments[1];
  51186. oldValue = obj.slice(start,end);
  51187. newValue = [];
  51188. for(i=2;i<arguments.length;i++) {
  51189. newValue[i-2] = arguments[i];
  51190. }
  51191. index = start;
  51192. }
  51193. else {
  51194. newValue = arguments.length > 0 ? arguments[0] : undefined;
  51195. }
  51196. response = original.apply(obj, arguments);
  51197. if (methodName !== 'slice') {
  51198. if (methodName === 'pop') {
  51199. oldValue = response;
  51200. index = obj.length;
  51201. }
  51202. else if (methodName === 'push') {
  51203. index = obj.length-1;
  51204. }
  51205. else if (methodName === 'shift') {
  51206. oldValue = response;
  51207. }
  51208. else if (methodName !== 'unshift' && newValue===undefined) {
  51209. newValue = response;
  51210. }
  51211. callback.call(obj, index, methodName,newValue, oldValue)
  51212. }
  51213. return response;
  51214. });
  51215. };
  51216. var watchFunctions = function(obj, callback) {
  51217. if (!isFunction(callback) || !obj || (obj instanceof String) || (!isArray(obj))) {
  51218. return;
  51219. }
  51220. for (var i = methodNames.length, methodName; i--;) {
  51221. methodName = methodNames[i];
  51222. defineArrayMethodWatcher(obj, obj[methodName], methodName, callback);
  51223. }
  51224. };
  51225. var unwatchOne = function (obj, prop, watcher) {
  51226. if (prop) {
  51227. if (obj.watchers && obj.watchers[prop]) {
  51228. if (watcher === undefined) {
  51229. delete obj.watchers[prop]; // remove all property watchers
  51230. }
  51231. else {
  51232. for (var i = 0; i < obj.watchers[prop].length; i++) {
  51233. var w = obj.watchers[prop][i];
  51234. if (w == watcher) {
  51235. obj.watchers[prop].splice(i, 1);
  51236. }
  51237. }
  51238. }
  51239. }
  51240. } else {
  51241. delete obj.watchers;
  51242. }
  51243. removeFromLengthSubjects(obj, prop, watcher);
  51244. removeFromDirtyChecklist(obj, prop);
  51245. };
  51246. // suspend watchers until next update cycle
  51247. var suspend = function(obj, prop) {
  51248. if (obj.watchers) {
  51249. var name = '__wjs_suspend__'+(prop!==undefined ? prop : '');
  51250. obj.watchers[name] = true;
  51251. }
  51252. }
  51253. var isSuspended = function(obj, prop) {
  51254. return obj.watchers
  51255. && (obj.watchers['__wjs_suspend__'] ||
  51256. obj.watchers['__wjs_suspend__'+prop]);
  51257. }
  51258. // resumes preivously suspended watchers
  51259. var resume = function(obj, prop) {
  51260. registerTimeout(function() {
  51261. delete obj.watchers['__wjs_suspend__'];
  51262. delete obj.watchers['__wjs_suspend__'+prop];
  51263. })
  51264. }
  51265. var pendingTimerID = null;
  51266. var addPendingChange = function(obj,prop, mode, newval, oldval) {
  51267. pendingChanges[pendingChanges.length] = {
  51268. obj:obj,
  51269. prop: prop,
  51270. mode: mode,
  51271. newval: newval,
  51272. oldval: oldval
  51273. };
  51274. if (pendingTimerID===null) {
  51275. pendingTimerID = setTimeout(applyPendingChanges);
  51276. }
  51277. };
  51278. var applyPendingChanges = function() {
  51279. // apply pending changes
  51280. var change = null;
  51281. pendingTimerID = null;
  51282. for(var i=0;i < pendingChanges.length;i++) {
  51283. change = pendingChanges[i];
  51284. callWatchers(change.obj, change.prop, change.mode, change.newval, change.oldval);
  51285. }
  51286. if (change) {
  51287. pendingChanges = [];
  51288. change = null;
  51289. }
  51290. }
  51291. var loop = function(){
  51292. // check for new or deleted props
  51293. for(var i=0; i<lengthsubjects.length; i++) {
  51294. var subj = lengthsubjects[i];
  51295. if (subj.prop === "$$watchlengthsubjectroot") {
  51296. var difference = getObjDiff(subj.obj, subj.actual);
  51297. if(difference.added.length || difference.removed.length){
  51298. if(difference.added.length){
  51299. watchMany(subj.obj, difference.added, subj.watcher, subj.level - 1, true);
  51300. }
  51301. subj.watcher.call(subj.obj, "root", "differentattr", difference, subj.actual);
  51302. }
  51303. subj.actual = clone(subj.obj);
  51304. } else {
  51305. var difference = getObjDiff(subj.obj[subj.prop], subj.actual);
  51306. if(difference.added.length || difference.removed.length){
  51307. if(difference.added.length){
  51308. for (var j=0; j<subj.obj.watchers[subj.prop].length; j++) {
  51309. watchMany(subj.obj[subj.prop], difference.added, subj.obj.watchers[subj.prop][j], subj.level - 1, true);
  51310. }
  51311. }
  51312. callWatchers(subj.obj, subj.prop, "differentattr", difference, subj.actual);
  51313. }
  51314. subj.actual = clone(subj.obj[subj.prop]);
  51315. }
  51316. }
  51317. // start dirty check
  51318. var n, value;
  51319. if (dirtyChecklist.length > 0) {
  51320. for (var i = 0; i < dirtyChecklist.length; i++) {
  51321. n = dirtyChecklist[i];
  51322. value = n.object[n.prop];
  51323. if (!compareValues(n.orig, value)) {
  51324. n.orig = clone(value);
  51325. n.callback(value);
  51326. }
  51327. }
  51328. }
  51329. };
  51330. var compareValues = function(a,b) {
  51331. var i, state = true;
  51332. if (a!==b) {
  51333. if (isObject(a)) {
  51334. for(i in a) {
  51335. if (!supportDefineProperty && i==='watchers') continue;
  51336. if (a[i]!==b[i]) {
  51337. state = false;
  51338. break;
  51339. };
  51340. }
  51341. }
  51342. else {
  51343. state = false;
  51344. }
  51345. }
  51346. return state;
  51347. }
  51348. var pushToLengthSubjects = function(obj, prop, watcher, level){
  51349. var actual;
  51350. if (prop === "$$watchlengthsubjectroot") {
  51351. actual = clone(obj);
  51352. } else {
  51353. actual = clone(obj[prop]);
  51354. }
  51355. lengthsubjects.push({
  51356. obj: obj,
  51357. prop: prop,
  51358. actual: actual,
  51359. watcher: watcher,
  51360. level: level
  51361. });
  51362. };
  51363. var removeFromLengthSubjects = function(obj, prop, watcher){
  51364. for (var i=0; i<lengthsubjects.length; i++) {
  51365. var subj = lengthsubjects[i];
  51366. if (subj.obj == obj) {
  51367. if (!prop || subj.prop == prop) {
  51368. if (!watcher || subj.watcher == watcher) {
  51369. // if we splice off one item at position i
  51370. // we need to decrement i as the array is one item shorter
  51371. // so when we increment i in the loop statement we
  51372. // will land at the correct index.
  51373. // if it's not decremented, you won't delete all length subjects
  51374. lengthsubjects.splice(i--, 1);
  51375. }
  51376. }
  51377. }
  51378. }
  51379. };
  51380. var removeFromDirtyChecklist = function(obj, prop){
  51381. var notInUse;
  51382. for (var i=0; i<dirtyChecklist.length; i++) {
  51383. var n = dirtyChecklist[i];
  51384. var watchers = n.object.watchers;
  51385. notInUse = (
  51386. n.object == obj
  51387. && (!prop || n.prop == prop)
  51388. && watchers
  51389. && (!prop || !watchers[prop] || watchers[prop].length == 0 )
  51390. );
  51391. if (notInUse) {
  51392. // we use the same syntax as in removeFromLengthSubjects
  51393. dirtyChecklist.splice(i--, 1);
  51394. }
  51395. }
  51396. };
  51397. setInterval(loop, 50);
  51398. WatchJS.watch = watch;
  51399. WatchJS.unwatch = unwatch;
  51400. WatchJS.callWatchers = callWatchers;
  51401. WatchJS.suspend = suspend; // suspend watchers
  51402. WatchJS.onChange = trackChange; // track changes made to object or it's property and return a single change object
  51403. return WatchJS;
  51404. }));
  51405. /***/ }),
  51406. /***/ "./node_modules/node-libs-browser/mock/empty.js":
  51407. /*!******************************************************!*\
  51408. !*** ./node_modules/node-libs-browser/mock/empty.js ***!
  51409. \******************************************************/
  51410. /*! no static exports found */
  51411. /***/ (function(module, exports) {
  51412. /***/ })
  51413. /******/ });
  51414. });
  51415. //# sourceMappingURL=ivprog.bundle.js.map