1
0

ivprog.bundle.js 2.0 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088510895109051091510925109351094510955109651097510985109951100511015110251103511045110551106511075110851109511105111151112511135111451115511165111751118511195112051121511225112351124511255112651127511285112951130511315113251133511345113551136511375113851139511405114151142511435114451145511465114751148511495115051151511525115351154511555115651157511585115951160511615116251163511645116551166511675116851169511705117151172511735117451175511765117751178511795118051181511825118351184511855118651187511885118951190511915119251193511945119551196511975119851199512005120151202512035120451205512065120751208512095121051211512125121351214512155121651217512185121951220512215122251223512245122551226512275122851229512305123151232512335123451235512365123751238512395124051241512425124351244512455124651247512485124951250512515125251253512545125551256512575125851259512605126151262512635126451265512665126751268512695127051271512725127351274512755127651277512785127951280512815128251283512845128551286512875128851289512905129151292512935129451295512965129751298512995130051301513025130351304513055130651307513085130951310513115131251313513145131551316513175131851319513205132151322513235132451325513265132751328513295133051331513325133351334513355133651337513385133951340513415134251343513445134551346513475134851349513505135151352513535135451355513565135751358513595136051361513625136351364513655136651367513685136951370513715137251373513745137551376513775137851379513805138151382513835138451385513865138751388513895139051391513925139351394513955139651397513985139951400514015140251403514045140551406514075140851409514105141151412514135141451415514165141751418514195142051421514225142351424514255142651427514285142951430514315143251433514345143551436514375143851439514405144151442514435144451445514465144751448514495145051451514525145351454514555145651457514585145951460514615146251463514645146551466514675146851469514705147151472514735147451475514765147751478514795148051481514825148351484514855148651487514885148951490514915149251493514945149551496514975149851499515005150151502515035150451505515065150751508515095151051511515125151351514515155151651517515185151951520515215152251523515245152551526515275152851529515305153151532515335153451535515365153751538515395154051541515425154351544515455154651547515485154951550515515155251553515545155551556515575155851559515605156151562515635156451565515665156751568515695157051571515725157351574515755157651577515785157951580515815158251583515845158551586515875158851589515905159151592515935159451595515965159751598515995160051601516025160351604516055160651607516085160951610516115161251613516145161551616516175161851619516205162151622516235162451625516265162751628516295163051631516325163351634516355163651637516385163951640516415164251643516445164551646516475164851649516505165151652516535165451655516565165751658516595166051661516625166351664516655166651667516685166951670516715167251673516745167551676516775167851679516805168151682516835168451685516865168751688516895169051691516925169351694516955169651697516985169951700517015170251703517045170551706517075170851709517105171151712517135171451715517165171751718517195172051721517225172351724517255172651727517285172951730517315173251733517345173551736517375173851739517405174151742517435174451745517465174751748517495175051751517525175351754517555175651757517585175951760517615176251763517645176551766517675176851769517705177151772517735177451775517765177751778517795178051781517825178351784517855178651787517885178951790517915179251793517945179551796517975179851799518005180151802518035180451805518065180751808518095181051811518125181351814518155181651817518185181951820518215182251823518245182551826518275182851829518305183151832518335183451835518365183751838518395184051841518425184351844518455184651847518485184951850518515185251853518545185551856518575185851859518605186151862518635186451865518665186751868518695187051871518725187351874518755187651877518785187951880518815188251883518845188551886518875188851889518905189151892518935189451895518965189751898518995190051901519025190351904519055190651907519085190951910519115191251913519145191551916519175191851919519205192151922519235192451925519265192751928519295193051931519325193351934519355193651937519385193951940519415194251943519445194551946519475194851949519505195151952519535195451955519565195751958519595196051961519625196351964519655196651967519685196951970519715197251973519745197551976519775197851979519805198151982519835198451985519865198751988519895199051991519925199351994519955199651997519985199952000520015200252003520045200552006520075200852009520105201152012520135201452015520165201752018520195202052021520225202352024520255202652027520285202952030520315203252033520345203552036520375203852039520405204152042520435204452045520465204752048520495205052051520525205352054520555205652057520585205952060520615206252063520645206552066520675206852069520705207152072520735207452075520765207752078520795208052081520825208352084520855208652087520885208952090520915209252093520945209552096520975209852099521005210152102521035210452105521065210752108521095211052111521125211352114521155211652117521185211952120521215212252123521245212552126521275212852129521305213152132521335213452135521365213752138521395214052141521425214352144521455214652147521485214952150521515215252153521545215552156521575215852159521605216152162521635216452165521665216752168521695217052171521725217352174521755217652177521785217952180521815218252183521845218552186521875218852189521905219152192521935219452195521965219752198521995220052201522025220352204522055220652207522085220952210522115221252213522145221552216522175221852219522205222152222522235222452225522265222752228522295223052231522325223352234522355223652237522385223952240522415224252243522445224552246522475224852249522505225152252522535225452255522565225752258522595226052261522625226352264522655226652267522685226952270522715227252273522745227552276522775227852279522805228152282522835228452285522865228752288522895229052291522925229352294522955229652297522985229952300523015230252303523045230552306523075230852309523105231152312523135231452315523165231752318523195232052321523225232352324523255232652327523285232952330523315233252333523345233552336523375233852339523405234152342523435234452345523465234752348523495235052351523525235352354523555235652357523585235952360523615236252363523645236552366523675236852369523705237152372523735237452375523765237752378523795238052381523825238352384523855238652387523885238952390523915239252393523945239552396523975239852399524005240152402524035240452405524065240752408524095241052411524125241352414524155241652417524185241952420524215242252423524245242552426524275242852429524305243152432524335243452435524365243752438524395244052441524425244352444524455244652447524485244952450524515245252453524545245552456524575245852459524605246152462524635246452465524665246752468524695247052471524725247352474524755247652477524785247952480524815248252483524845248552486524875248852489524905249152492524935249452495524965249752498524995250052501525025250352504525055250652507525085250952510525115251252513525145251552516525175251852519525205252152522525235252452525525265252752528525295253052531525325253352534525355253652537525385253952540525415254252543525445254552546525475254852549525505255152552525535255452555525565255752558525595256052561525625256352564525655256652567525685256952570525715257252573525745257552576525775257852579525805258152582525835258452585525865258752588525895259052591525925259352594525955259652597525985259952600526015260252603526045260552606526075260852609526105261152612526135261452615526165261752618526195262052621526225262352624526255262652627526285262952630526315263252633526345263552636526375263852639526405264152642526435264452645526465264752648526495265052651526525265352654526555265652657526585265952660526615266252663526645266552666526675266852669526705267152672526735267452675526765267752678526795268052681526825268352684526855268652687526885268952690526915269252693526945269552696526975269852699527005270152702527035270452705527065270752708527095271052711527125271352714527155271652717527185271952720527215272252723527245272552726527275272852729527305273152732527335273452735527365273752738527395274052741527425274352744527455274652747527485274952750527515275252753527545275552756527575275852759527605276152762527635276452765527665276752768527695277052771527725277352774527755277652777527785277952780527815278252783527845278552786527875278852789527905279152792527935279452795527965279752798527995280052801528025280352804528055280652807528085280952810528115281252813528145281552816528175281852819528205282152822528235282452825528265282752828528295283052831528325283352834528355283652837528385283952840528415284252843528445284552846528475284852849528505285152852528535285452855528565285752858528595286052861528625286352864528655286652867528685286952870528715287252873528745287552876528775287852879528805288152882528835288452885528865288752888528895289052891528925289352894528955289652897528985289952900529015290252903529045290552906529075290852909529105291152912529135291452915529165291752918529195292052921529225292352924529255292652927529285292952930529315293252933529345293552936529375293852939529405294152942529435294452945529465294752948529495295052951529525295352954529555295652957529585295952960529615296252963529645296552966529675296852969529705297152972529735297452975529765297752978529795298052981529825298352984529855298652987529885298952990529915299252993529945299552996529975299852999530005300153002530035300453005530065300753008530095301053011530125301353014530155301653017530185301953020530215302253023530245302553026530275302853029530305303153032530335303453035530365303753038530395304053041530425304353044530455304653047530485304953050530515305253053530545305553056530575305853059530605306153062530635306453065530665306753068530695307053071530725307353074530755307653077530785307953080530815308253083530845308553086530875308853089530905309153092530935309453095530965309753098530995310053101531025310353104531055310653107531085310953110531115311253113531145311553116531175311853119531205312153122531235312453125531265312753128531295313053131531325313353134531355313653137531385313953140531415314253143531445314553146531475314853149531505315153152531535315453155531565315753158531595316053161531625316353164531655316653167531685316953170531715317253173531745317553176531775317853179531805318153182531835318453185531865318753188531895319053191531925319353194531955319653197531985319953200532015320253203532045320553206532075320853209532105321153212532135321453215532165321753218532195322053221532225322353224532255322653227532285322953230532315323253233532345323553236532375323853239532405324153242532435324453245532465324753248532495325053251532525325353254532555325653257532585325953260532615326253263532645326553266532675326853269532705327153272532735327453275532765327753278532795328053281532825328353284532855328653287532885328953290532915329253293532945329553296532975329853299533005330153302533035330453305533065330753308533095331053311533125331353314533155331653317533185331953320533215332253323533245332553326533275332853329533305333153332533335333453335533365333753338533395334053341533425334353344533455334653347533485334953350533515335253353533545335553356533575335853359533605336153362
  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. /***/ "./grammar/en/ivprog.g4":
  99. /*!******************************!*\
  100. !*** ./grammar/en/ivprog.g4 ***!
  101. \******************************/
  102. /*! no static exports found */
  103. /***/ (function(module, exports, __webpack_require__) {
  104. module.exports =
  105. /******/ (function(modules) { // webpackBootstrap
  106. /******/ // The module cache
  107. /******/ var installedModules = {};
  108. /******/
  109. /******/ // The require function
  110. /******/ function __webpack_require__(moduleId) {
  111. /******/
  112. /******/ // Check if module is in cache
  113. /******/ if(installedModules[moduleId]) {
  114. /******/ return installedModules[moduleId].exports;
  115. /******/ }
  116. /******/ // Create a new module (and put it into the cache)
  117. /******/ var module = installedModules[moduleId] = {
  118. /******/ i: moduleId,
  119. /******/ l: false,
  120. /******/ exports: {}
  121. /******/ };
  122. /******/
  123. /******/ // Execute the module function
  124. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  125. /******/
  126. /******/ // Flag the module as loaded
  127. /******/ module.l = true;
  128. /******/
  129. /******/ // Return the exports of the module
  130. /******/ return module.exports;
  131. /******/ }
  132. /******/
  133. /******/
  134. /******/ // expose the modules object (__webpack_modules__)
  135. /******/ __webpack_require__.m = modules;
  136. /******/
  137. /******/ // expose the module cache
  138. /******/ __webpack_require__.c = installedModules;
  139. /******/
  140. /******/ // identity function for calling harmony imports with the correct context
  141. /******/ __webpack_require__.i = function(value) { return value; };
  142. /******/
  143. /******/ // define getter function for harmony exports
  144. /******/ __webpack_require__.d = function(exports, name, getter) {
  145. /******/ if(!__webpack_require__.o(exports, name)) {
  146. /******/ Object.defineProperty(exports, name, {
  147. /******/ configurable: false,
  148. /******/ enumerable: true,
  149. /******/ get: getter
  150. /******/ });
  151. /******/ }
  152. /******/ };
  153. /******/
  154. /******/ // getDefaultExport function for compatibility with non-harmony modules
  155. /******/ __webpack_require__.n = function(module) {
  156. /******/ var getter = module && module.__esModule ?
  157. /******/ function getDefault() { return module['default']; } :
  158. /******/ function getModuleExports() { return module; };
  159. /******/ __webpack_require__.d(getter, 'a', getter);
  160. /******/ return getter;
  161. /******/ };
  162. /******/
  163. /******/ // Object.prototype.hasOwnProperty.call
  164. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  165. /******/
  166. /******/ // __webpack_public_path__
  167. /******/ __webpack_require__.p = "";
  168. /******/
  169. /******/ // Load entry module and return exports
  170. /******/ return __webpack_require__(__webpack_require__.s = 1);
  171. /******/ })
  172. /************************************************************************/
  173. /******/ ([
  174. /* 0 */
  175. /***/ (function(module, exports, __webpack_require__) {
  176. // Generated from /tmp/tmp-2205VFRFBqKCnUxN/ivprog.g4 by ANTLR 4.7
  177. // jshint ignore: start
  178. var antlr4 = __webpack_require__(2);
  179. var serializedATN = ["\u0003\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964",
  180. "\u0002/\u01d1\b\u0001\u0004\u0002\t\u0002\u0004\u0003\t\u0003\u0004",
  181. "\u0004\t\u0004\u0004\u0005\t\u0005\u0004\u0006\t\u0006\u0004\u0007\t",
  182. "\u0007\u0004\b\t\b\u0004\t\t\t\u0004\n\t\n\u0004\u000b\t\u000b\u0004",
  183. "\f\t\f\u0004\r\t\r\u0004\u000e\t\u000e\u0004\u000f\t\u000f\u0004\u0010",
  184. "\t\u0010\u0004\u0011\t\u0011\u0004\u0012\t\u0012\u0004\u0013\t\u0013",
  185. "\u0004\u0014\t\u0014\u0004\u0015\t\u0015\u0004\u0016\t\u0016\u0004\u0017",
  186. "\t\u0017\u0004\u0018\t\u0018\u0004\u0019\t\u0019\u0004\u001a\t\u001a",
  187. "\u0004\u001b\t\u001b\u0004\u001c\t\u001c\u0004\u001d\t\u001d\u0004\u001e",
  188. "\t\u001e\u0004\u001f\t\u001f\u0004 \t \u0004!\t!\u0004\"\t\"\u0004#",
  189. "\t#\u0004$\t$\u0004%\t%\u0004&\t&\u0004\'\t\'\u0004(\t(\u0004)\t)\u0004",
  190. "*\t*\u0004+\t+\u0004,\t,\u0004-\t-\u0004.\t.\u0004/\t/\u00040\t0\u0004",
  191. "1\t1\u00042\t2\u00043\t3\u00044\t4\u00045\t5\u00046\t6\u00047\t7\u0004",
  192. "8\t8\u00049\t9\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003",
  193. "\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0003\u0003\u0003\u0003",
  194. "\u0003\u0003\u0003\u0003\u0003\u0003\u0004\u0003\u0004\u0003\u0004\u0003",
  195. "\u0004\u0003\u0004\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003",
  196. "\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0006\u0003\u0006\u0003",
  197. "\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0007\u0003",
  198. "\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003",
  199. "\u0007\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003",
  200. "\b\u0003\b\u0003\b\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0003",
  201. "\t\u0003\n\u0003\n\u0003\n\u0003\n\u0003\n\u0003\u000b\u0003\u000b\u0003",
  202. "\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003",
  203. "\u000b\u0003\u000b\u0003\f\u0003\f\u0003\f\u0003\f\u0003\f\u0003\f\u0003",
  204. "\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003",
  205. "\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003",
  206. "\u000e\u0003\u000f\u0003\u000f\u0003\u000f\u0003\u000f\u0003\u0010\u0003",
  207. "\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0011\u0003",
  208. "\u0011\u0003\u0011\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003",
  209. "\u0012\u0003\u0012\u0003\u0013\u0003\u0013\u0003\u0013\u0003\u0014\u0003",
  210. "\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0015\u0003\u0015\u0003",
  211. "\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0016\u0003\u0016\u0003",
  212. "\u0016\u0003\u0016\u0003\u0016\u0003\u0017\u0003\u0017\u0003\u0017\u0003",
  213. "\u0017\u0003\u0018\u0003\u0018\u0003\u0018\u0003\u0018\u0003\u0019\u0003",
  214. "\u0019\u0003\u0019\u0003\u001a\u0003\u001a\u0003\u001b\u0003\u001b\u0003",
  215. "\u001c\u0003\u001c\u0003\u001d\u0003\u001d\u0003\u001e\u0003\u001e\u0003",
  216. "\u001f\u0003\u001f\u0003 \u0003 \u0003!\u0003!\u0003\"\u0003\"\u0003",
  217. "#\u0003#\u0003$\u0003$\u0003%\u0003%\u0003&\u0003&\u0003&\u0003&\u0003",
  218. "&\u0003&\u0003&\u0003&\u0003&\u0005&\u0125\n&\u0003\'\u0003\'\u0003",
  219. "(\u0003(\u0003)\u0003)\u0007)\u012d\n)\f)\u000e)\u0130\u000b)\u0003",
  220. "*\u0003*\u0003*\u0003*\u0003+\u0006+\u0137\n+\r+\u000e+\u0138\u0003",
  221. "+\u0003+\u0003+\u0003+\u0005+\u013f\n+\u0003+\u0006+\u0142\n+\r+\u000e",
  222. "+\u0143\u0003+\u0003+\u0003+\u0003+\u0005+\u014a\n+\u0003+\u0006+\u014d",
  223. "\n+\r+\u000e+\u014e\u0005+\u0151\n+\u0003,\u0006,\u0154\n,\r,\u000e",
  224. ",\u0155\u0003,\u0003,\u0006,\u015a\n,\r,\u000e,\u015b\u0003,\u0006,",
  225. "\u015f\n,\r,\u000e,\u0160\u0003,\u0003,\u0007,\u0165\n,\f,\u000e,\u0168",
  226. "\u000b,\u0003,\u0005,\u016b\n,\u0003-\u0003-\u0005-\u016f\n-\u0003-",
  227. "\u0006-\u0172\n-\r-\u000e-\u0173\u0003.\u0003.\u0007.\u0178\n.\f.\u000e",
  228. ".\u017b\u000b.\u0003.\u0003.\u0003/\u0003/\u0005/\u0181\n/\u00030\u0003",
  229. "0\u00030\u00050\u0186\n0\u00030\u00030\u00031\u00031\u00031\u00031\u0003",
  230. "2\u00032\u00033\u00063\u0191\n3\r3\u000e3\u0192\u00033\u00053\u0196",
  231. "\n3\u00034\u00034\u00035\u00035\u00036\u00036\u00036\u00036\u00056\u01a0",
  232. "\n6\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u0003",
  233. "7\u00037\u00057\u01ad\n7\u00038\u00038\u00038\u00038\u00038\u00038\u0003",
  234. "8\u00039\u00039\u00039\u00039\u00079\u01ba\n9\f9\u000e9\u01bd\u000b",
  235. "9\u00039\u00059\u01c0\n9\u00039\u00039\u00039\u00039\u00039\u00079\u01c7",
  236. "\n9\f9\u000e9\u01ca\u000b9\u00039\u00039\u00059\u01ce\n9\u00039\u0003",
  237. "9\u0003\u01c8\u0002:\u0003\u0003\u0005\u0004\u0007\u0005\t\u0006\u000b",
  238. "\u0007\r\b\u000f\t\u0011\n\u0013\u000b\u0015\f\u0017\r\u0019\u000e\u001b",
  239. "\u000f\u001d\u0010\u001f\u0011!\u0012#\u0013%\u0014\'\u0015)\u0016+",
  240. "\u0017-\u0002/\u00021\u00023\u00185\u00197\u001a9\u001b;\u001c=\u001d",
  241. "?\u001eA\u001fC E!G\"I#K$M%O&Q\'S(U)W*Y\u0002[+]\u0002_,a-c\u0002e.",
  242. "g\u0002i\u0002k\u0002m\u0002o\u0002q/\u0003\u0002\u0012\u0004\u0002",
  243. "--//\u0005\u0002\'\',,11\u0004\u0002>>@@\u0005\u0002C\\aac|\u0006\u0002",
  244. "2;C\\aac|\u0003\u00022;\u0003\u000223\u0004\u0002GGgg\u0006\u0002\f",
  245. "\f\u000f\u000f$$^^\u0006\u0002\f\f\u000f\u000f))^^\u0004\u0002\u000b",
  246. "\u000b\"\"\u0004\u0002\f\f\u000f\u000f\u0005\u00022;CHch\u0003\u0002",
  247. "29\n\u0002$$))^^ddhhppttvv\u0003\u000225\u0002\u01e5\u0002\u0003\u0003",
  248. "\u0002\u0002\u0002\u0002\u0005\u0003\u0002\u0002\u0002\u0002\u0007\u0003",
  249. "\u0002\u0002\u0002\u0002\t\u0003\u0002\u0002\u0002\u0002\u000b\u0003",
  250. "\u0002\u0002\u0002\u0002\r\u0003\u0002\u0002\u0002\u0002\u000f\u0003",
  251. "\u0002\u0002\u0002\u0002\u0011\u0003\u0002\u0002\u0002\u0002\u0013\u0003",
  252. "\u0002\u0002\u0002\u0002\u0015\u0003\u0002\u0002\u0002\u0002\u0017\u0003",
  253. "\u0002\u0002\u0002\u0002\u0019\u0003\u0002\u0002\u0002\u0002\u001b\u0003",
  254. "\u0002\u0002\u0002\u0002\u001d\u0003\u0002\u0002\u0002\u0002\u001f\u0003",
  255. "\u0002\u0002\u0002\u0002!\u0003\u0002\u0002\u0002\u0002#\u0003\u0002",
  256. "\u0002\u0002\u0002%\u0003\u0002\u0002\u0002\u0002\'\u0003\u0002\u0002",
  257. "\u0002\u0002)\u0003\u0002\u0002\u0002\u0002+\u0003\u0002\u0002\u0002",
  258. "\u00023\u0003\u0002\u0002\u0002\u00025\u0003\u0002\u0002\u0002\u0002",
  259. "7\u0003\u0002\u0002\u0002\u00029\u0003\u0002\u0002\u0002\u0002;\u0003",
  260. "\u0002\u0002\u0002\u0002=\u0003\u0002\u0002\u0002\u0002?\u0003\u0002",
  261. "\u0002\u0002\u0002A\u0003\u0002\u0002\u0002\u0002C\u0003\u0002\u0002",
  262. "\u0002\u0002E\u0003\u0002\u0002\u0002\u0002G\u0003\u0002\u0002\u0002",
  263. "\u0002I\u0003\u0002\u0002\u0002\u0002K\u0003\u0002\u0002\u0002\u0002",
  264. "M\u0003\u0002\u0002\u0002\u0002O\u0003\u0002\u0002\u0002\u0002Q\u0003",
  265. "\u0002\u0002\u0002\u0002S\u0003\u0002\u0002\u0002\u0002U\u0003\u0002",
  266. "\u0002\u0002\u0002W\u0003\u0002\u0002\u0002\u0002[\u0003\u0002\u0002",
  267. "\u0002\u0002_\u0003\u0002\u0002\u0002\u0002a\u0003\u0002\u0002\u0002",
  268. "\u0002e\u0003\u0002\u0002\u0002\u0002q\u0003\u0002\u0002\u0002\u0003",
  269. "s\u0003\u0002\u0002\u0002\u0005{\u0003\u0002\u0002\u0002\u0007\u0080",
  270. "\u0003\u0002\u0002\u0002\t\u0085\u0003\u0002\u0002\u0002\u000b\u008d",
  271. "\u0003\u0002\u0002\u0002\r\u0094\u0003\u0002\u0002\u0002\u000f\u009c",
  272. "\u0003\u0002\u0002\u0002\u0011\u00a6\u0003\u0002\u0002\u0002\u0013\u00ad",
  273. "\u0003\u0002\u0002\u0002\u0015\u00b2\u0003\u0002\u0002\u0002\u0017\u00bc",
  274. "\u0003\u0002\u0002\u0002\u0019\u00c2\u0003\u0002\u0002\u0002\u001b\u00cb",
  275. "\u0003\u0002\u0002\u0002\u001d\u00d2\u0003\u0002\u0002\u0002\u001f\u00d6",
  276. "\u0003\u0002\u0002\u0002!\u00dc\u0003\u0002\u0002\u0002#\u00df\u0003",
  277. "\u0002\u0002\u0002%\u00e5\u0003\u0002\u0002\u0002\'\u00e8\u0003\u0002",
  278. "\u0002\u0002)\u00ed\u0003\u0002\u0002\u0002+\u00f3\u0003\u0002\u0002",
  279. "\u0002-\u00f8\u0003\u0002\u0002\u0002/\u00fc\u0003\u0002\u0002\u0002",
  280. "1\u0100\u0003\u0002\u0002\u00023\u0103\u0003\u0002\u0002\u00025\u0105",
  281. "\u0003\u0002\u0002\u00027\u0107\u0003\u0002\u0002\u00029\u0109\u0003",
  282. "\u0002\u0002\u0002;\u010b\u0003\u0002\u0002\u0002=\u010d\u0003\u0002",
  283. "\u0002\u0002?\u010f\u0003\u0002\u0002\u0002A\u0111\u0003\u0002\u0002",
  284. "\u0002C\u0113\u0003\u0002\u0002\u0002E\u0115\u0003\u0002\u0002\u0002",
  285. "G\u0117\u0003\u0002\u0002\u0002I\u0119\u0003\u0002\u0002\u0002K\u0124",
  286. "\u0003\u0002\u0002\u0002M\u0126\u0003\u0002\u0002\u0002O\u0128\u0003",
  287. "\u0002\u0002\u0002Q\u012a\u0003\u0002\u0002\u0002S\u0131\u0003\u0002",
  288. "\u0002\u0002U\u0150\u0003\u0002\u0002\u0002W\u016a\u0003\u0002\u0002",
  289. "\u0002Y\u016c\u0003\u0002\u0002\u0002[\u0175\u0003\u0002\u0002\u0002",
  290. "]\u0180\u0003\u0002\u0002\u0002_\u0182\u0003\u0002\u0002\u0002a\u0189",
  291. "\u0003\u0002\u0002\u0002c\u018d\u0003\u0002\u0002\u0002e\u0195\u0003",
  292. "\u0002\u0002\u0002g\u0197\u0003\u0002\u0002\u0002i\u0199\u0003\u0002",
  293. "\u0002\u0002k\u019f\u0003\u0002\u0002\u0002m\u01ac\u0003\u0002\u0002",
  294. "\u0002o\u01ae\u0003\u0002\u0002\u0002q\u01cd\u0003\u0002\u0002\u0002",
  295. "st\u0007r\u0002\u0002tu\u0007t\u0002\u0002uv\u0007q\u0002\u0002vw\u0007",
  296. "i\u0002\u0002wx\u0007t\u0002\u0002xy\u0007c\u0002\u0002yz\u0007o\u0002",
  297. "\u0002z\u0004\u0003\u0002\u0002\u0002{|\u0007t\u0002\u0002|}\u0007g",
  298. "\u0002\u0002}~\u0007c\u0002\u0002~\u007f\u0007n\u0002\u0002\u007f\u0006",
  299. "\u0003\u0002\u0002\u0002\u0080\u0081\u0007x\u0002\u0002\u0081\u0082",
  300. "\u0007q\u0002\u0002\u0082\u0083\u0007k\u0002\u0002\u0083\u0084\u0007",
  301. "f\u0002\u0002\u0084\b\u0003\u0002\u0002\u0002\u0085\u0086\u0007d\u0002",
  302. "\u0002\u0086\u0087\u0007q\u0002\u0002\u0087\u0088\u0007q\u0002\u0002",
  303. "\u0088\u0089\u0007n\u0002\u0002\u0089\u008a\u0007g\u0002\u0002\u008a",
  304. "\u008b\u0007c\u0002\u0002\u008b\u008c\u0007p\u0002\u0002\u008c\n\u0003",
  305. "\u0002\u0002\u0002\u008d\u008e\u0007u\u0002\u0002\u008e\u008f\u0007",
  306. "v\u0002\u0002\u008f\u0090\u0007t\u0002\u0002\u0090\u0091\u0007k\u0002",
  307. "\u0002\u0091\u0092\u0007p\u0002\u0002\u0092\u0093\u0007i\u0002\u0002",
  308. "\u0093\f\u0003\u0002\u0002\u0002\u0094\u0095\u0007k\u0002\u0002\u0095",
  309. "\u0096\u0007p\u0002\u0002\u0096\u0097\u0007v\u0002\u0002\u0097\u0098",
  310. "\u0007g\u0002\u0002\u0098\u0099\u0007i\u0002\u0002\u0099\u009a\u0007",
  311. "g\u0002\u0002\u009a\u009b\u0007t\u0002\u0002\u009b\u000e\u0003\u0002",
  312. "\u0002\u0002\u009c\u009d\u0007e\u0002\u0002\u009d\u009e\u0007j\u0002",
  313. "\u0002\u009e\u009f\u0007c\u0002\u0002\u009f\u00a0\u0007t\u0002\u0002",
  314. "\u00a0\u00a1\u0007c\u0002\u0002\u00a1\u00a2\u0007e\u0002\u0002\u00a2",
  315. "\u00a3\u0007v\u0002\u0002\u00a3\u00a4\u0007g\u0002\u0002\u00a4\u00a5",
  316. "\u0007t\u0002\u0002\u00a5\u0010\u0003\u0002\u0002\u0002\u00a6\u00a7",
  317. "\u0007u\u0002\u0002\u00a7\u00a8\u0007y\u0002\u0002\u00a8\u00a9\u0007",
  318. "k\u0002\u0002\u00a9\u00aa\u0007v\u0002\u0002\u00aa\u00ab\u0007e\u0002",
  319. "\u0002\u00ab\u00ac\u0007j\u0002\u0002\u00ac\u0012\u0003\u0002\u0002",
  320. "\u0002\u00ad\u00ae\u0007e\u0002\u0002\u00ae\u00af\u0007c\u0002\u0002",
  321. "\u00af\u00b0\u0007u\u0002\u0002\u00b0\u00b1\u0007g\u0002\u0002\u00b1",
  322. "\u0014\u0003\u0002\u0002\u0002\u00b2\u00b3\u0007q\u0002\u0002\u00b3",
  323. "\u00b4\u0007v\u0002\u0002\u00b4\u00b5\u0007j\u0002\u0002\u00b5\u00b6",
  324. "\u0007g\u0002\u0002\u00b6\u00b7\u0007t\u0002\u0002\u00b7\u00b8\u0007",
  325. "y\u0002\u0002\u00b8\u00b9\u0007k\u0002\u0002\u00b9\u00ba\u0007u\u0002",
  326. "\u0002\u00ba\u00bb\u0007g\u0002\u0002\u00bb\u0016\u0003\u0002\u0002",
  327. "\u0002\u00bc\u00bd\u0007e\u0002\u0002\u00bd\u00be\u0007q\u0002\u0002",
  328. "\u00be\u00bf\u0007p\u0002\u0002\u00bf\u00c0\u0007u\u0002\u0002\u00c0",
  329. "\u00c1\u0007v\u0002\u0002\u00c1\u0018\u0003\u0002\u0002\u0002\u00c2",
  330. "\u00c3\u0007h\u0002\u0002\u00c3\u00c4\u0007w\u0002\u0002\u00c4\u00c5",
  331. "\u0007p\u0002\u0002\u00c5\u00c6\u0007e\u0002\u0002\u00c6\u00c7\u0007",
  332. "v\u0002\u0002\u00c7\u00c8\u0007k\u0002\u0002\u00c8\u00c9\u0007q\u0002",
  333. "\u0002\u00c9\u00ca\u0007p\u0002\u0002\u00ca\u001a\u0003\u0002\u0002",
  334. "\u0002\u00cb\u00cc\u0007t\u0002\u0002\u00cc\u00cd\u0007g\u0002\u0002",
  335. "\u00cd\u00ce\u0007v\u0002\u0002\u00ce\u00cf\u0007w\u0002\u0002\u00cf",
  336. "\u00d0\u0007t\u0002\u0002\u00d0\u00d1\u0007p\u0002\u0002\u00d1\u001c",
  337. "\u0003\u0002\u0002\u0002\u00d2\u00d3\u0007h\u0002\u0002\u00d3\u00d4",
  338. "\u0007q\u0002\u0002\u00d4\u00d5\u0007t\u0002\u0002\u00d5\u001e\u0003",
  339. "\u0002\u0002\u0002\u00d6\u00d7\u0007d\u0002\u0002\u00d7\u00d8\u0007",
  340. "t\u0002\u0002\u00d8\u00d9\u0007g\u0002\u0002\u00d9\u00da\u0007c\u0002",
  341. "\u0002\u00da\u00db\u0007m\u0002\u0002\u00db \u0003\u0002\u0002\u0002",
  342. "\u00dc\u00dd\u0007f\u0002\u0002\u00dd\u00de\u0007q\u0002\u0002\u00de",
  343. "\"\u0003\u0002\u0002\u0002\u00df\u00e0\u0007y\u0002\u0002\u00e0\u00e1",
  344. "\u0007j\u0002\u0002\u00e1\u00e2\u0007k\u0002\u0002\u00e2\u00e3\u0007",
  345. "n\u0002\u0002\u00e3\u00e4\u0007g\u0002\u0002\u00e4$\u0003\u0002\u0002",
  346. "\u0002\u00e5\u00e6\u0007k\u0002\u0002\u00e6\u00e7\u0007h\u0002\u0002",
  347. "\u00e7&\u0003\u0002\u0002\u0002\u00e8\u00e9\u0007g\u0002\u0002\u00e9",
  348. "\u00ea\u0007n\u0002\u0002\u00ea\u00eb\u0007u\u0002\u0002\u00eb\u00ec",
  349. "\u0007g\u0002\u0002\u00ec(\u0003\u0002\u0002\u0002\u00ed\u00ee\u0007",
  350. "h\u0002\u0002\u00ee\u00ef\u0007c\u0002\u0002\u00ef\u00f0\u0007n\u0002",
  351. "\u0002\u00f0\u00f1\u0007u\u0002\u0002\u00f1\u00f2\u0007g\u0002\u0002",
  352. "\u00f2*\u0003\u0002\u0002\u0002\u00f3\u00f4\u0007v\u0002\u0002\u00f4",
  353. "\u00f5\u0007t\u0002\u0002\u00f5\u00f6\u0007w\u0002\u0002\u00f6\u00f7",
  354. "\u0007g\u0002\u0002\u00f7,\u0003\u0002\u0002\u0002\u00f8\u00f9\u0007",
  355. "p\u0002\u0002\u00f9\u00fa\u0007q\u0002\u0002\u00fa\u00fb\u0007v\u0002",
  356. "\u0002\u00fb.\u0003\u0002\u0002\u0002\u00fc\u00fd\u0007C\u0002\u0002",
  357. "\u00fd\u00fe\u0007P\u0002\u0002\u00fe\u00ff\u0007F\u0002\u0002\u00ff",
  358. "0\u0003\u0002\u0002\u0002\u0100\u0101\u0007Q\u0002\u0002\u0101\u0102",
  359. "\u0007T\u0002\u0002\u01022\u0003\u0002\u0002\u0002\u0103\u0104\u0007",
  360. "*\u0002\u0002\u01044\u0003\u0002\u0002\u0002\u0105\u0106\u0007+\u0002",
  361. "\u0002\u01066\u0003\u0002\u0002\u0002\u0107\u0108\u0007]\u0002\u0002",
  362. "\u01088\u0003\u0002\u0002\u0002\u0109\u010a\u0007_\u0002\u0002\u010a",
  363. ":\u0003\u0002\u0002\u0002\u010b\u010c\u0007}\u0002\u0002\u010c<\u0003",
  364. "\u0002\u0002\u0002\u010d\u010e\u0007\u007f\u0002\u0002\u010e>\u0003",
  365. "\u0002\u0002\u0002\u010f\u0110\u0007.\u0002\u0002\u0110@\u0003\u0002",
  366. "\u0002\u0002\u0111\u0112\u0007?\u0002\u0002\u0112B\u0003\u0002\u0002",
  367. "\u0002\u0113\u0114\t\u0002\u0002\u0002\u0114D\u0003\u0002\u0002\u0002",
  368. "\u0115\u0116\t\u0003\u0002\u0002\u0116F\u0003\u0002\u0002\u0002\u0117",
  369. "\u0118\u0005/\u0018\u0002\u0118H\u0003\u0002\u0002\u0002\u0119\u011a",
  370. "\u00051\u0019\u0002\u011aJ\u0003\u0002\u0002\u0002\u011b\u011c\u0007",
  371. "@\u0002\u0002\u011c\u0125\u0007?\u0002\u0002\u011d\u011e\u0007?\u0002",
  372. "\u0002\u011e\u0125\u0007?\u0002\u0002\u011f\u0120\u0007>\u0002\u0002",
  373. "\u0120\u0125\u0007?\u0002\u0002\u0121\u0125\t\u0004\u0002\u0002\u0122",
  374. "\u0123\u0007#\u0002\u0002\u0123\u0125\u0007?\u0002\u0002\u0124\u011b",
  375. "\u0003\u0002\u0002\u0002\u0124\u011d\u0003\u0002\u0002\u0002\u0124\u011f",
  376. "\u0003\u0002\u0002\u0002\u0124\u0121\u0003\u0002\u0002\u0002\u0124\u0122",
  377. "\u0003\u0002\u0002\u0002\u0125L\u0003\u0002\u0002\u0002\u0126\u0127",
  378. "\u0007<\u0002\u0002\u0127N\u0003\u0002\u0002\u0002\u0128\u0129\u0005",
  379. "-\u0017\u0002\u0129P\u0003\u0002\u0002\u0002\u012a\u012e\t\u0005\u0002",
  380. "\u0002\u012b\u012d\t\u0006\u0002\u0002\u012c\u012b\u0003\u0002\u0002",
  381. "\u0002\u012d\u0130\u0003\u0002\u0002\u0002\u012e\u012c\u0003\u0002\u0002",
  382. "\u0002\u012e\u012f\u0003\u0002\u0002\u0002\u012fR\u0003\u0002\u0002",
  383. "\u0002\u0130\u012e\u0003\u0002\u0002\u0002\u0131\u0132\u0005Q)\u0002",
  384. "\u0132\u0133\u00070\u0002\u0002\u0133\u0134\u0005Q)\u0002\u0134T\u0003",
  385. "\u0002\u0002\u0002\u0135\u0137\t\u0007\u0002\u0002\u0136\u0135\u0003",
  386. "\u0002\u0002\u0002\u0137\u0138\u0003\u0002\u0002\u0002\u0138\u0136\u0003",
  387. "\u0002\u0002\u0002\u0138\u0139\u0003\u0002\u0002\u0002\u0139\u0151\u0003",
  388. "\u0002\u0002\u0002\u013a\u013b\u00072\u0002\u0002\u013b\u013f\u0007",
  389. "z\u0002\u0002\u013c\u013d\u00072\u0002\u0002\u013d\u013f\u0007Z\u0002",
  390. "\u0002\u013e\u013a\u0003\u0002\u0002\u0002\u013e\u013c\u0003\u0002\u0002",
  391. "\u0002\u013f\u0141\u0003\u0002\u0002\u0002\u0140\u0142\u0005g4\u0002",
  392. "\u0141\u0140\u0003\u0002\u0002\u0002\u0142\u0143\u0003\u0002\u0002\u0002",
  393. "\u0143\u0141\u0003\u0002\u0002\u0002\u0143\u0144\u0003\u0002\u0002\u0002",
  394. "\u0144\u0151\u0003\u0002\u0002\u0002\u0145\u0146\u00072\u0002\u0002",
  395. "\u0146\u014a\u0007d\u0002\u0002\u0147\u0148\u00072\u0002\u0002\u0148",
  396. "\u014a\u0007D\u0002\u0002\u0149\u0145\u0003\u0002\u0002\u0002\u0149",
  397. "\u0147\u0003\u0002\u0002\u0002\u014a\u014c\u0003\u0002\u0002\u0002\u014b",
  398. "\u014d\t\b\u0002\u0002\u014c\u014b\u0003\u0002\u0002\u0002\u014d\u014e",
  399. "\u0003\u0002\u0002\u0002\u014e\u014c\u0003\u0002\u0002\u0002\u014e\u014f",
  400. "\u0003\u0002\u0002\u0002\u014f\u0151\u0003\u0002\u0002\u0002\u0150\u0136",
  401. "\u0003\u0002\u0002\u0002\u0150\u013e\u0003\u0002\u0002\u0002\u0150\u0149",
  402. "\u0003\u0002\u0002\u0002\u0151V\u0003\u0002\u0002\u0002\u0152\u0154",
  403. "\t\u0007\u0002\u0002\u0153\u0152\u0003\u0002\u0002\u0002\u0154\u0155",
  404. "\u0003\u0002\u0002\u0002\u0155\u0153\u0003\u0002\u0002\u0002\u0155\u0156",
  405. "\u0003\u0002\u0002\u0002\u0156\u0157\u0003\u0002\u0002\u0002\u0157\u0159",
  406. "\u00070\u0002\u0002\u0158\u015a\t\u0007\u0002\u0002\u0159\u0158\u0003",
  407. "\u0002\u0002\u0002\u015a\u015b\u0003\u0002\u0002\u0002\u015b\u0159\u0003",
  408. "\u0002\u0002\u0002\u015b\u015c\u0003\u0002\u0002\u0002\u015c\u016b\u0003",
  409. "\u0002\u0002\u0002\u015d\u015f\t\u0007\u0002\u0002\u015e\u015d\u0003",
  410. "\u0002\u0002\u0002\u015f\u0160\u0003\u0002\u0002\u0002\u0160\u015e\u0003",
  411. "\u0002\u0002\u0002\u0160\u0161\u0003\u0002\u0002\u0002\u0161\u0162\u0003",
  412. "\u0002\u0002\u0002\u0162\u0166\u00070\u0002\u0002\u0163\u0165\t\u0007",
  413. "\u0002\u0002\u0164\u0163\u0003\u0002\u0002\u0002\u0165\u0168\u0003\u0002",
  414. "\u0002\u0002\u0166\u0164\u0003\u0002\u0002\u0002\u0166\u0167\u0003\u0002",
  415. "\u0002\u0002\u0167\u0169\u0003\u0002\u0002\u0002\u0168\u0166\u0003\u0002",
  416. "\u0002\u0002\u0169\u016b\u0005Y-\u0002\u016a\u0153\u0003\u0002\u0002",
  417. "\u0002\u016a\u015e\u0003\u0002\u0002\u0002\u016bX\u0003\u0002\u0002",
  418. "\u0002\u016c\u016e\t\t\u0002\u0002\u016d\u016f\t\u0002\u0002\u0002\u016e",
  419. "\u016d\u0003\u0002\u0002\u0002\u016e\u016f\u0003\u0002\u0002\u0002\u016f",
  420. "\u0171\u0003\u0002\u0002\u0002\u0170\u0172\t\u0007\u0002\u0002\u0171",
  421. "\u0170\u0003\u0002\u0002\u0002\u0172\u0173\u0003\u0002\u0002\u0002\u0173",
  422. "\u0171\u0003\u0002\u0002\u0002\u0173\u0174\u0003\u0002\u0002\u0002\u0174",
  423. "Z\u0003\u0002\u0002\u0002\u0175\u0179\u0007$\u0002\u0002\u0176\u0178",
  424. "\u0005]/\u0002\u0177\u0176\u0003\u0002\u0002\u0002\u0178\u017b\u0003",
  425. "\u0002\u0002\u0002\u0179\u0177\u0003\u0002\u0002\u0002\u0179\u017a\u0003",
  426. "\u0002\u0002\u0002\u017a\u017c\u0003\u0002\u0002\u0002\u017b\u0179\u0003",
  427. "\u0002\u0002\u0002\u017c\u017d\u0007$\u0002\u0002\u017d\\\u0003\u0002",
  428. "\u0002\u0002\u017e\u0181\n\n\u0002\u0002\u017f\u0181\u0005k6\u0002\u0180",
  429. "\u017e\u0003\u0002\u0002\u0002\u0180\u017f\u0003\u0002\u0002\u0002\u0181",
  430. "^\u0003\u0002\u0002\u0002\u0182\u0185\u0007)\u0002\u0002\u0183\u0186",
  431. "\u0005k6\u0002\u0184\u0186\n\u000b\u0002\u0002\u0185\u0183\u0003\u0002",
  432. "\u0002\u0002\u0185\u0184\u0003\u0002\u0002\u0002\u0186\u0187\u0003\u0002",
  433. "\u0002\u0002\u0187\u0188\u0007)\u0002\u0002\u0188`\u0003\u0002\u0002",
  434. "\u0002\u0189\u018a\t\f\u0002\u0002\u018a\u018b\u0003\u0002\u0002\u0002",
  435. "\u018b\u018c\b1\u0002\u0002\u018cb\u0003\u0002\u0002\u0002\u018d\u018e",
  436. "\u0007=\u0002\u0002\u018ed\u0003\u0002\u0002\u0002\u018f\u0191\t\r\u0002",
  437. "\u0002\u0190\u018f\u0003\u0002\u0002\u0002\u0191\u0192\u0003\u0002\u0002",
  438. "\u0002\u0192\u0190\u0003\u0002\u0002\u0002\u0192\u0193\u0003\u0002\u0002",
  439. "\u0002\u0193\u0196\u0003\u0002\u0002\u0002\u0194\u0196\u0005c2\u0002",
  440. "\u0195\u0190\u0003\u0002\u0002\u0002\u0195\u0194\u0003\u0002\u0002\u0002",
  441. "\u0196f\u0003\u0002\u0002\u0002\u0197\u0198\t\u000e\u0002\u0002\u0198",
  442. "h\u0003\u0002\u0002\u0002\u0199\u019a\t\u000f\u0002\u0002\u019aj\u0003",
  443. "\u0002\u0002\u0002\u019b\u019c\u0007^\u0002\u0002\u019c\u01a0\t\u0010",
  444. "\u0002\u0002\u019d\u01a0\u0005o8\u0002\u019e\u01a0\u0005m7\u0002\u019f",
  445. "\u019b\u0003\u0002\u0002\u0002\u019f\u019d\u0003\u0002\u0002\u0002\u019f",
  446. "\u019e\u0003\u0002\u0002\u0002\u01a0l\u0003\u0002\u0002\u0002\u01a1",
  447. "\u01a2\u0007^\u0002\u0002\u01a2\u01a3\t\u0011\u0002\u0002\u01a3\u01a4",
  448. "\u0005i5\u0002\u01a4\u01a5\u0005i5\u0002\u01a5\u01ad\u0003\u0002\u0002",
  449. "\u0002\u01a6\u01a7\u0007^\u0002\u0002\u01a7\u01a8\u0005i5\u0002\u01a8",
  450. "\u01a9\u0005i5\u0002\u01a9\u01ad\u0003\u0002\u0002\u0002\u01aa\u01ab",
  451. "\u0007^\u0002\u0002\u01ab\u01ad\u0005i5\u0002\u01ac\u01a1\u0003\u0002",
  452. "\u0002\u0002\u01ac\u01a6\u0003\u0002\u0002\u0002\u01ac\u01aa\u0003\u0002",
  453. "\u0002\u0002\u01adn\u0003\u0002\u0002\u0002\u01ae\u01af\u0007^\u0002",
  454. "\u0002\u01af\u01b0\u0007w\u0002\u0002\u01b0\u01b1\u0005g4\u0002\u01b1",
  455. "\u01b2\u0005g4\u0002\u01b2\u01b3\u0005g4\u0002\u01b3\u01b4\u0005g4\u0002",
  456. "\u01b4p\u0003\u0002\u0002\u0002\u01b5\u01b6\u00071\u0002\u0002\u01b6",
  457. "\u01b7\u00071\u0002\u0002\u01b7\u01bb\u0003\u0002\u0002\u0002\u01b8",
  458. "\u01ba\n\r\u0002\u0002\u01b9\u01b8\u0003\u0002\u0002\u0002\u01ba\u01bd",
  459. "\u0003\u0002\u0002\u0002\u01bb\u01b9\u0003\u0002\u0002\u0002\u01bb\u01bc",
  460. "\u0003\u0002\u0002\u0002\u01bc\u01bf\u0003\u0002\u0002\u0002\u01bd\u01bb",
  461. "\u0003\u0002\u0002\u0002\u01be\u01c0\u0007\u000f\u0002\u0002\u01bf\u01be",
  462. "\u0003\u0002\u0002\u0002\u01bf\u01c0\u0003\u0002\u0002\u0002\u01c0\u01c1",
  463. "\u0003\u0002\u0002\u0002\u01c1\u01ce\u0007\f\u0002\u0002\u01c2\u01c3",
  464. "\u00071\u0002\u0002\u01c3\u01c4\u0007,\u0002\u0002\u01c4\u01c8\u0003",
  465. "\u0002\u0002\u0002\u01c5\u01c7\u000b\u0002\u0002\u0002\u01c6\u01c5\u0003",
  466. "\u0002\u0002\u0002\u01c7\u01ca\u0003\u0002\u0002\u0002\u01c8\u01c9\u0003",
  467. "\u0002\u0002\u0002\u01c8\u01c6\u0003\u0002\u0002\u0002\u01c9\u01cb\u0003",
  468. "\u0002\u0002\u0002\u01ca\u01c8\u0003\u0002\u0002\u0002\u01cb\u01cc\u0007",
  469. ",\u0002\u0002\u01cc\u01ce\u00071\u0002\u0002\u01cd\u01b5\u0003\u0002",
  470. "\u0002\u0002\u01cd\u01c2\u0003\u0002\u0002\u0002\u01ce\u01cf\u0003\u0002",
  471. "\u0002\u0002\u01cf\u01d0\b9\u0003\u0002\u01d0r\u0003\u0002\u0002\u0002",
  472. "\u001d\u0002\u0124\u012e\u0138\u013e\u0143\u0149\u014e\u0150\u0155\u015b",
  473. "\u0160\u0166\u016a\u016e\u0173\u0179\u0180\u0185\u0192\u0195\u019f\u01ac",
  474. "\u01bb\u01bf\u01c8\u01cd\u0004\b\u0002\u0002\u0002\u0003\u0002"].join("");
  475. var atn = new antlr4.atn.ATNDeserializer().deserialize(serializedATN);
  476. var decisionsToDFA = atn.decisionToState.map( function(ds, index) { return new antlr4.dfa.DFA(ds, index); });
  477. function ivprog(input) {
  478. antlr4.Lexer.call(this, input);
  479. this._interp = new antlr4.atn.LexerATNSimulator(this, atn, decisionsToDFA, new antlr4.PredictionContextCache());
  480. return this;
  481. }
  482. ivprog.prototype = Object.create(antlr4.Lexer.prototype);
  483. ivprog.prototype.constructor = ivprog;
  484. ivprog.EOF = antlr4.Token.EOF;
  485. ivprog.RK_PROGRAM = 1;
  486. ivprog.RK_REAL = 2;
  487. ivprog.RK_VOID = 3;
  488. ivprog.RK_BOOLEAN = 4;
  489. ivprog.RK_STRING = 5;
  490. ivprog.RK_INTEGER = 6;
  491. ivprog.RK_CHARACTER = 7;
  492. ivprog.RK_SWITCH = 8;
  493. ivprog.RK_CASE = 9;
  494. ivprog.RK_DEFAULT = 10;
  495. ivprog.RK_CONST = 11;
  496. ivprog.RK_FUNCTION = 12;
  497. ivprog.RK_RETURN = 13;
  498. ivprog.RK_FOR = 14;
  499. ivprog.RK_BREAK = 15;
  500. ivprog.RK_DO = 16;
  501. ivprog.RK_WHILE = 17;
  502. ivprog.RK_IF = 18;
  503. ivprog.RK_ELSE = 19;
  504. ivprog.RK_FALSE = 20;
  505. ivprog.RK_TRUE = 21;
  506. ivprog.OPEN_PARENTHESIS = 22;
  507. ivprog.CLOSE_PARENTHESIS = 23;
  508. ivprog.OPEN_BRACE = 24;
  509. ivprog.CLOSE_BRACE = 25;
  510. ivprog.OPEN_CURLY = 26;
  511. ivprog.CLOSE_CURLY = 27;
  512. ivprog.COMMA = 28;
  513. ivprog.EQUAL = 29;
  514. ivprog.SUM_OP = 30;
  515. ivprog.MULTI_OP = 31;
  516. ivprog.AND_OPERATOR = 32;
  517. ivprog.OR_OPERATOR = 33;
  518. ivprog.RELATIONAL_OPERATOR = 34;
  519. ivprog.COLON = 35;
  520. ivprog.NOT_OPERATOR = 36;
  521. ivprog.ID = 37;
  522. ivprog.LIB_ID = 38;
  523. ivprog.INTEGER = 39;
  524. ivprog.REAL = 40;
  525. ivprog.STRING = 41;
  526. ivprog.CHARACTER = 42;
  527. ivprog.WHITESPACE = 43;
  528. ivprog.EOS = 44;
  529. ivprog.COMMENTS = 45;
  530. ivprog.prototype.channelNames = [ "DEFAULT_TOKEN_CHANNEL", "HIDDEN" ];
  531. ivprog.prototype.modeNames = [ "DEFAULT_MODE" ];
  532. ivprog.prototype.literalNames = [ null, "'program'", "'real'", "'void'",
  533. "'boolean'", "'string'", "'integer'",
  534. "'character'", "'switch'", "'case'", "'otherwise'",
  535. "'const'", "'function'", "'return'", "'for'",
  536. "'break'", "'do'", "'while'", "'if'",
  537. "'else'", "'false'", "'true'", "'('",
  538. "')'", "'['", "']'", "'{'", "'}'", "','",
  539. "'='", null, null, null, null, null, "':'" ];
  540. ivprog.prototype.symbolicNames = [ null, "RK_PROGRAM", "RK_REAL", "RK_VOID",
  541. "RK_BOOLEAN", "RK_STRING", "RK_INTEGER",
  542. "RK_CHARACTER", "RK_SWITCH", "RK_CASE",
  543. "RK_DEFAULT", "RK_CONST", "RK_FUNCTION",
  544. "RK_RETURN", "RK_FOR", "RK_BREAK", "RK_DO",
  545. "RK_WHILE", "RK_IF", "RK_ELSE", "RK_FALSE",
  546. "RK_TRUE", "OPEN_PARENTHESIS", "CLOSE_PARENTHESIS",
  547. "OPEN_BRACE", "CLOSE_BRACE", "OPEN_CURLY",
  548. "CLOSE_CURLY", "COMMA", "EQUAL", "SUM_OP",
  549. "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  550. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  551. "ID", "LIB_ID", "INTEGER", "REAL", "STRING",
  552. "CHARACTER", "WHITESPACE", "EOS", "COMMENTS" ];
  553. ivprog.prototype.ruleNames = [ "RK_PROGRAM", "RK_REAL", "RK_VOID", "RK_BOOLEAN",
  554. "RK_STRING", "RK_INTEGER", "RK_CHARACTER",
  555. "RK_SWITCH", "RK_CASE", "RK_DEFAULT", "RK_CONST",
  556. "RK_FUNCTION", "RK_RETURN", "RK_FOR", "RK_BREAK",
  557. "RK_DO", "RK_WHILE", "RK_IF", "RK_ELSE",
  558. "RK_FALSE", "RK_TRUE", "RK_LOGICAL_NOT",
  559. "RK_LOGICAL_AND", "RK_LOGICAL_OR", "OPEN_PARENTHESIS",
  560. "CLOSE_PARENTHESIS", "OPEN_BRACE", "CLOSE_BRACE",
  561. "OPEN_CURLY", "CLOSE_CURLY", "COMMA", "EQUAL",
  562. "SUM_OP", "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  563. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  564. "ID", "LIB_ID", "INTEGER", "REAL", "ExponentPart",
  565. "STRING", "STRING_CHARACTER", "CHARACTER",
  566. "WHITESPACE", "SEMICOLON", "EOS", "HEX_DIGIT",
  567. "OCTAL_DIGIT", "ESC_SEQ", "ESC_OCTAL", "ESC_UNICODE",
  568. "COMMENTS" ];
  569. ivprog.prototype.grammarFileName = "ivprog.g4";
  570. exports.ivprog = ivprog;
  571. /***/ }),
  572. /* 1 */
  573. /***/ (function(module, exports, __webpack_require__) {
  574. module.exports = {
  575. ivprog: __webpack_require__(0).ivprog
  576. };
  577. /***/ }),
  578. /* 2 */
  579. /***/ (function(module, exports) {
  580. module.exports = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js");
  581. /***/ })
  582. /******/ ]);
  583. /***/ }),
  584. /***/ "./grammar/en/langFunctions.js":
  585. /*!*************************************!*\
  586. !*** ./grammar/en/langFunctions.js ***!
  587. \*************************************/
  588. /*! no static exports found */
  589. /***/ (function(module, exports, __webpack_require__) {
  590. "use strict";
  591. Object.defineProperty(exports, "__esModule", {
  592. value: true
  593. });
  594. /* This is a dictionary of the language defined functions
  595. **/
  596. exports.default = {
  597. main_function: "start",
  598. $read: "read",
  599. $write: "write",
  600. $numElements: "numero_elementos",
  601. $matrixLines: "matriz_linhas",
  602. $matrixColumns: "matriz_colunas",
  603. $substring: "subcadeia",
  604. $length: "comprimento",
  605. $uppercase: "caixa_alta",
  606. $lowercase: "caixa_baixa",
  607. $charAt: "char_at",
  608. $isReal: "e_real",
  609. $isInt: "e_inteiro",
  610. $isBool: "e_logico",
  611. $castReal: "como_real",
  612. $castInt: "como_inteiro",
  613. $castBool: "como_logico",
  614. $castString: "como_cadeia",
  615. $sin: "sin",
  616. $cos: "cos",
  617. $tan: "tan",
  618. $sqrt: "sqrt",
  619. $pow: "pow",
  620. $log: "log",
  621. $abs: "abs",
  622. $negate: "negate",
  623. $invert: "invert",
  624. $max: "maximum",
  625. $min: "minimum"
  626. };
  627. /***/ }),
  628. /***/ "./grammar/en/langLibs.js":
  629. /*!********************************!*\
  630. !*** ./grammar/en/langLibs.js ***!
  631. \********************************/
  632. /*! no static exports found */
  633. /***/ (function(module, exports, __webpack_require__) {
  634. "use strict";
  635. Object.defineProperty(exports, "__esModule", {
  636. value: true
  637. });
  638. /**
  639. * This is the dictionary of the language defined libraries
  640. */
  641. exports.default = {
  642. $mathLib: "Mathematic",
  643. $ioLib: "ES",
  644. $strLib: "Texto",
  645. $arrayLib: "Arranjo",
  646. $langLib: "IV"
  647. };
  648. /***/ }),
  649. /***/ "./grammar/es/ivprog.g4":
  650. /*!******************************!*\
  651. !*** ./grammar/es/ivprog.g4 ***!
  652. \******************************/
  653. /*! no static exports found */
  654. /***/ (function(module, exports, __webpack_require__) {
  655. module.exports =
  656. /******/ (function(modules) { // webpackBootstrap
  657. /******/ // The module cache
  658. /******/ var installedModules = {};
  659. /******/
  660. /******/ // The require function
  661. /******/ function __webpack_require__(moduleId) {
  662. /******/
  663. /******/ // Check if module is in cache
  664. /******/ if(installedModules[moduleId]) {
  665. /******/ return installedModules[moduleId].exports;
  666. /******/ }
  667. /******/ // Create a new module (and put it into the cache)
  668. /******/ var module = installedModules[moduleId] = {
  669. /******/ i: moduleId,
  670. /******/ l: false,
  671. /******/ exports: {}
  672. /******/ };
  673. /******/
  674. /******/ // Execute the module function
  675. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  676. /******/
  677. /******/ // Flag the module as loaded
  678. /******/ module.l = true;
  679. /******/
  680. /******/ // Return the exports of the module
  681. /******/ return module.exports;
  682. /******/ }
  683. /******/
  684. /******/
  685. /******/ // expose the modules object (__webpack_modules__)
  686. /******/ __webpack_require__.m = modules;
  687. /******/
  688. /******/ // expose the module cache
  689. /******/ __webpack_require__.c = installedModules;
  690. /******/
  691. /******/ // identity function for calling harmony imports with the correct context
  692. /******/ __webpack_require__.i = function(value) { return value; };
  693. /******/
  694. /******/ // define getter function for harmony exports
  695. /******/ __webpack_require__.d = function(exports, name, getter) {
  696. /******/ if(!__webpack_require__.o(exports, name)) {
  697. /******/ Object.defineProperty(exports, name, {
  698. /******/ configurable: false,
  699. /******/ enumerable: true,
  700. /******/ get: getter
  701. /******/ });
  702. /******/ }
  703. /******/ };
  704. /******/
  705. /******/ // getDefaultExport function for compatibility with non-harmony modules
  706. /******/ __webpack_require__.n = function(module) {
  707. /******/ var getter = module && module.__esModule ?
  708. /******/ function getDefault() { return module['default']; } :
  709. /******/ function getModuleExports() { return module; };
  710. /******/ __webpack_require__.d(getter, 'a', getter);
  711. /******/ return getter;
  712. /******/ };
  713. /******/
  714. /******/ // Object.prototype.hasOwnProperty.call
  715. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  716. /******/
  717. /******/ // __webpack_public_path__
  718. /******/ __webpack_require__.p = "";
  719. /******/
  720. /******/ // Load entry module and return exports
  721. /******/ return __webpack_require__(__webpack_require__.s = 1);
  722. /******/ })
  723. /************************************************************************/
  724. /******/ ([
  725. /* 0 */
  726. /***/ (function(module, exports, __webpack_require__) {
  727. // Generated from /tmp/tmp-2205UuHrucay0369/ivprog.g4 by ANTLR 4.7
  728. // jshint ignore: start
  729. var antlr4 = __webpack_require__(2);
  730. var serializedATN = ["\u0003\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964",
  731. "\u0002/\u01dc\b\u0001\u0004\u0002\t\u0002\u0004\u0003\t\u0003\u0004",
  732. "\u0004\t\u0004\u0004\u0005\t\u0005\u0004\u0006\t\u0006\u0004\u0007\t",
  733. "\u0007\u0004\b\t\b\u0004\t\t\t\u0004\n\t\n\u0004\u000b\t\u000b\u0004",
  734. "\f\t\f\u0004\r\t\r\u0004\u000e\t\u000e\u0004\u000f\t\u000f\u0004\u0010",
  735. "\t\u0010\u0004\u0011\t\u0011\u0004\u0012\t\u0012\u0004\u0013\t\u0013",
  736. "\u0004\u0014\t\u0014\u0004\u0015\t\u0015\u0004\u0016\t\u0016\u0004\u0017",
  737. "\t\u0017\u0004\u0018\t\u0018\u0004\u0019\t\u0019\u0004\u001a\t\u001a",
  738. "\u0004\u001b\t\u001b\u0004\u001c\t\u001c\u0004\u001d\t\u001d\u0004\u001e",
  739. "\t\u001e\u0004\u001f\t\u001f\u0004 \t \u0004!\t!\u0004\"\t\"\u0004#",
  740. "\t#\u0004$\t$\u0004%\t%\u0004&\t&\u0004\'\t\'\u0004(\t(\u0004)\t)\u0004",
  741. "*\t*\u0004+\t+\u0004,\t,\u0004-\t-\u0004.\t.\u0004/\t/\u00040\t0\u0004",
  742. "1\t1\u00042\t2\u00043\t3\u00044\t4\u00045\t5\u00046\t6\u00047\t7\u0004",
  743. "8\t8\u00049\t9\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003",
  744. "\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0003\u0003",
  745. "\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0004\u0003\u0004\u0003",
  746. "\u0004\u0003\u0004\u0003\u0004\u0003\u0004\u0003\u0005\u0003\u0005\u0003",
  747. "\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0006\u0003",
  748. "\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003",
  749. "\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003",
  750. "\u0007\u0003\u0007\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003",
  751. "\b\u0003\b\u0003\b\u0003\b\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0003",
  752. "\t\u0003\t\u0003\t\u0003\n\u0003\n\u0003\n\u0003\n\u0003\n\u0003\u000b",
  753. "\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b",
  754. "\u0003\u000b\u0003\u000b\u0003\u000b\u0003\f\u0003\f\u0003\f\u0003\f",
  755. "\u0003\f\u0003\f\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003",
  756. "\r\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003",
  757. "\u000e\u0003\u000e\u0003\u000e\u0003\u000f\u0003\u000f\u0003\u000f\u0003",
  758. "\u000f\u0003\u000f\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003",
  759. "\u0010\u0003\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0003",
  760. "\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003",
  761. "\u0012\u0003\u0012\u0003\u0012\u0003\u0013\u0003\u0013\u0003\u0013\u0003",
  762. "\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003",
  763. "\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003",
  764. "\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003",
  765. "\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0017\u0003",
  766. "\u0017\u0003\u0017\u0003\u0017\u0003\u0018\u0003\u0018\u0003\u0019\u0003",
  767. "\u0019\u0003\u0019\u0003\u001a\u0003\u001a\u0003\u001b\u0003\u001b\u0003",
  768. "\u001c\u0003\u001c\u0003\u001d\u0003\u001d\u0003\u001e\u0003\u001e\u0003",
  769. "\u001f\u0003\u001f\u0003 \u0003 \u0003!\u0003!\u0003\"\u0003\"\u0003",
  770. "#\u0003#\u0003$\u0003$\u0003%\u0003%\u0003&\u0003&\u0003&\u0003&\u0003",
  771. "&\u0003&\u0003&\u0003&\u0003&\u0005&\u0130\n&\u0003\'\u0003\'\u0003",
  772. "(\u0003(\u0003)\u0003)\u0007)\u0138\n)\f)\u000e)\u013b\u000b)\u0003",
  773. "*\u0003*\u0003*\u0003*\u0003+\u0006+\u0142\n+\r+\u000e+\u0143\u0003",
  774. "+\u0003+\u0003+\u0003+\u0005+\u014a\n+\u0003+\u0006+\u014d\n+\r+\u000e",
  775. "+\u014e\u0003+\u0003+\u0003+\u0003+\u0005+\u0155\n+\u0003+\u0006+\u0158",
  776. "\n+\r+\u000e+\u0159\u0005+\u015c\n+\u0003,\u0006,\u015f\n,\r,\u000e",
  777. ",\u0160\u0003,\u0003,\u0006,\u0165\n,\r,\u000e,\u0166\u0003,\u0006,",
  778. "\u016a\n,\r,\u000e,\u016b\u0003,\u0003,\u0007,\u0170\n,\f,\u000e,\u0173",
  779. "\u000b,\u0003,\u0005,\u0176\n,\u0003-\u0003-\u0005-\u017a\n-\u0003-",
  780. "\u0006-\u017d\n-\r-\u000e-\u017e\u0003.\u0003.\u0007.\u0183\n.\f.\u000e",
  781. ".\u0186\u000b.\u0003.\u0003.\u0003/\u0003/\u0005/\u018c\n/\u00030\u0003",
  782. "0\u00030\u00050\u0191\n0\u00030\u00030\u00031\u00031\u00031\u00031\u0003",
  783. "2\u00032\u00033\u00063\u019c\n3\r3\u000e3\u019d\u00033\u00053\u01a1",
  784. "\n3\u00034\u00034\u00035\u00035\u00036\u00036\u00036\u00036\u00056\u01ab",
  785. "\n6\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u0003",
  786. "7\u00037\u00057\u01b8\n7\u00038\u00038\u00038\u00038\u00038\u00038\u0003",
  787. "8\u00039\u00039\u00039\u00039\u00079\u01c5\n9\f9\u000e9\u01c8\u000b",
  788. "9\u00039\u00059\u01cb\n9\u00039\u00039\u00039\u00039\u00039\u00079\u01d2",
  789. "\n9\f9\u000e9\u01d5\u000b9\u00039\u00039\u00059\u01d9\n9\u00039\u0003",
  790. "9\u0003\u01d3\u0002:\u0003\u0003\u0005\u0004\u0007\u0005\t\u0006\u000b",
  791. "\u0007\r\b\u000f\t\u0011\n\u0013\u000b\u0015\f\u0017\r\u0019\u000e\u001b",
  792. "\u000f\u001d\u0010\u001f\u0011!\u0012#\u0013%\u0014\'\u0015)\u0016+",
  793. "\u0017-\u0002/\u00021\u00023\u00185\u00197\u001a9\u001b;\u001c=\u001d",
  794. "?\u001eA\u001fC E!G\"I#K$M%O&Q\'S(U)W*Y\u0002[+]\u0002_,a-c\u0002e.",
  795. "g\u0002i\u0002k\u0002m\u0002o\u0002q/\u0003\u0002\u0012\u0004\u0002",
  796. "--//\u0005\u0002\'\',,11\u0004\u0002>>@@\u0005\u0002C\\aac|\u0006\u0002",
  797. "2;C\\aac|\u0003\u00022;\u0003\u000223\u0004\u0002GGgg\u0006\u0002\f",
  798. "\f\u000f\u000f$$^^\u0006\u0002\f\f\u000f\u000f))^^\u0004\u0002\u000b",
  799. "\u000b\"\"\u0004\u0002\f\f\u000f\u000f\u0005\u00022;CHch\u0003\u0002",
  800. "29\n\u0002$$))^^ddhhppttvv\u0003\u000225\u0002\u01f0\u0002\u0003\u0003",
  801. "\u0002\u0002\u0002\u0002\u0005\u0003\u0002\u0002\u0002\u0002\u0007\u0003",
  802. "\u0002\u0002\u0002\u0002\t\u0003\u0002\u0002\u0002\u0002\u000b\u0003",
  803. "\u0002\u0002\u0002\u0002\r\u0003\u0002\u0002\u0002\u0002\u000f\u0003",
  804. "\u0002\u0002\u0002\u0002\u0011\u0003\u0002\u0002\u0002\u0002\u0013\u0003",
  805. "\u0002\u0002\u0002\u0002\u0015\u0003\u0002\u0002\u0002\u0002\u0017\u0003",
  806. "\u0002\u0002\u0002\u0002\u0019\u0003\u0002\u0002\u0002\u0002\u001b\u0003",
  807. "\u0002\u0002\u0002\u0002\u001d\u0003\u0002\u0002\u0002\u0002\u001f\u0003",
  808. "\u0002\u0002\u0002\u0002!\u0003\u0002\u0002\u0002\u0002#\u0003\u0002",
  809. "\u0002\u0002\u0002%\u0003\u0002\u0002\u0002\u0002\'\u0003\u0002\u0002",
  810. "\u0002\u0002)\u0003\u0002\u0002\u0002\u0002+\u0003\u0002\u0002\u0002",
  811. "\u00023\u0003\u0002\u0002\u0002\u00025\u0003\u0002\u0002\u0002\u0002",
  812. "7\u0003\u0002\u0002\u0002\u00029\u0003\u0002\u0002\u0002\u0002;\u0003",
  813. "\u0002\u0002\u0002\u0002=\u0003\u0002\u0002\u0002\u0002?\u0003\u0002",
  814. "\u0002\u0002\u0002A\u0003\u0002\u0002\u0002\u0002C\u0003\u0002\u0002",
  815. "\u0002\u0002E\u0003\u0002\u0002\u0002\u0002G\u0003\u0002\u0002\u0002",
  816. "\u0002I\u0003\u0002\u0002\u0002\u0002K\u0003\u0002\u0002\u0002\u0002",
  817. "M\u0003\u0002\u0002\u0002\u0002O\u0003\u0002\u0002\u0002\u0002Q\u0003",
  818. "\u0002\u0002\u0002\u0002S\u0003\u0002\u0002\u0002\u0002U\u0003\u0002",
  819. "\u0002\u0002\u0002W\u0003\u0002\u0002\u0002\u0002[\u0003\u0002\u0002",
  820. "\u0002\u0002_\u0003\u0002\u0002\u0002\u0002a\u0003\u0002\u0002\u0002",
  821. "\u0002e\u0003\u0002\u0002\u0002\u0002q\u0003\u0002\u0002\u0002\u0003",
  822. "s\u0003\u0002\u0002\u0002\u0005|\u0003\u0002\u0002\u0002\u0007\u0081",
  823. "\u0003\u0002\u0002\u0002\t\u0087\u0003\u0002\u0002\u0002\u000b\u008e",
  824. "\u0003\u0002\u0002\u0002\r\u0095\u0003\u0002\u0002\u0002\u000f\u009d",
  825. "\u0003\u0002\u0002\u0002\u0011\u00a7\u0003\u0002\u0002\u0002\u0013\u00af",
  826. "\u0003\u0002\u0002\u0002\u0015\u00b4\u0003\u0002\u0002\u0002\u0017\u00be",
  827. "\u0003\u0002\u0002\u0002\u0019\u00c4\u0003\u0002\u0002\u0002\u001b\u00cb",
  828. "\u0003\u0002\u0002\u0002\u001d\u00d3\u0003\u0002\u0002\u0002\u001f\u00d8",
  829. "\u0003\u0002\u0002\u0002!\u00dd\u0003\u0002\u0002\u0002#\u00e2\u0003",
  830. "\u0002\u0002\u0002%\u00eb\u0003\u0002\u0002\u0002\'\u00ee\u0003\u0002",
  831. "\u0002\u0002)\u00f4\u0003\u0002\u0002\u0002+\u00fa\u0003\u0002\u0002",
  832. "\u0002-\u0105\u0003\u0002\u0002\u0002/\u0109\u0003\u0002\u0002\u0002",
  833. "1\u010b\u0003\u0002\u0002\u00023\u010e\u0003\u0002\u0002\u00025\u0110",
  834. "\u0003\u0002\u0002\u00027\u0112\u0003\u0002\u0002\u00029\u0114\u0003",
  835. "\u0002\u0002\u0002;\u0116\u0003\u0002\u0002\u0002=\u0118\u0003\u0002",
  836. "\u0002\u0002?\u011a\u0003\u0002\u0002\u0002A\u011c\u0003\u0002\u0002",
  837. "\u0002C\u011e\u0003\u0002\u0002\u0002E\u0120\u0003\u0002\u0002\u0002",
  838. "G\u0122\u0003\u0002\u0002\u0002I\u0124\u0003\u0002\u0002\u0002K\u012f",
  839. "\u0003\u0002\u0002\u0002M\u0131\u0003\u0002\u0002\u0002O\u0133\u0003",
  840. "\u0002\u0002\u0002Q\u0135\u0003\u0002\u0002\u0002S\u013c\u0003\u0002",
  841. "\u0002\u0002U\u015b\u0003\u0002\u0002\u0002W\u0175\u0003\u0002\u0002",
  842. "\u0002Y\u0177\u0003\u0002\u0002\u0002[\u0180\u0003\u0002\u0002\u0002",
  843. "]\u018b\u0003\u0002\u0002\u0002_\u018d\u0003\u0002\u0002\u0002a\u0194",
  844. "\u0003\u0002\u0002\u0002c\u0198\u0003\u0002\u0002\u0002e\u01a0\u0003",
  845. "\u0002\u0002\u0002g\u01a2\u0003\u0002\u0002\u0002i\u01a4\u0003\u0002",
  846. "\u0002\u0002k\u01aa\u0003\u0002\u0002\u0002m\u01b7\u0003\u0002\u0002",
  847. "\u0002o\u01b9\u0003\u0002\u0002\u0002q\u01d8\u0003\u0002\u0002\u0002",
  848. "st\u0007r\u0002\u0002tu\u0007t\u0002\u0002uv\u0007q\u0002\u0002vw\u0007",
  849. "i\u0002\u0002wx\u0007t\u0002\u0002xy\u0007c\u0002\u0002yz\u0007o\u0002",
  850. "\u0002z{\u0007c\u0002\u0002{\u0004\u0003\u0002\u0002\u0002|}\u0007t",
  851. "\u0002\u0002}~\u0007g\u0002\u0002~\u007f\u0007c\u0002\u0002\u007f\u0080",
  852. "\u0007n\u0002\u0002\u0080\u0006\u0003\u0002\u0002\u0002\u0081\u0082",
  853. "\u0007x\u0002\u0002\u0082\u0083\u0007c\u0002\u0002\u0083\u0084\u0007",
  854. "|\u0002\u0002\u0084\u0085\u0007k\u0002\u0002\u0085\u0086\u0007q\u0002",
  855. "\u0002\u0086\b\u0003\u0002\u0002\u0002\u0087\u0088\u0007n\u0002\u0002",
  856. "\u0088\u0089\u0007q\u0002\u0002\u0089\u008a\u0007i\u0002\u0002\u008a",
  857. "\u008b\u0007k\u0002\u0002\u008b\u008c\u0007e\u0002\u0002\u008c\u008d",
  858. "\u0007q\u0002\u0002\u008d\n\u0003\u0002\u0002\u0002\u008e\u008f\u0007",
  859. "e\u0002\u0002\u008f\u0090\u0007c\u0002\u0002\u0090\u0091\u0007f\u0002",
  860. "\u0002\u0091\u0092\u0007g\u0002\u0002\u0092\u0093\u0007k\u0002\u0002",
  861. "\u0093\u0094\u0007c\u0002\u0002\u0094\f\u0003\u0002\u0002\u0002\u0095",
  862. "\u0096\u0007k\u0002\u0002\u0096\u0097\u0007p\u0002\u0002\u0097\u0098",
  863. "\u0007v\u0002\u0002\u0098\u0099\u0007g\u0002\u0002\u0099\u009a\u0007",
  864. "k\u0002\u0002\u009a\u009b\u0007t\u0002\u0002\u009b\u009c\u0007q\u0002",
  865. "\u0002\u009c\u000e\u0003\u0002\u0002\u0002\u009d\u009e\u0007e\u0002",
  866. "\u0002\u009e\u009f\u0007c\u0002\u0002\u009f\u00a0\u0007t\u0002\u0002",
  867. "\u00a0\u00a1\u0007c\u0002\u0002\u00a1\u00a2\u0007e\u0002\u0002\u00a2",
  868. "\u00a3\u0007v\u0002\u0002\u00a3\u00a4\u0007g\u0002\u0002\u00a4\u00a5",
  869. "\u0007t\u0002\u0002\u00a5\u00a6\u0007g\u0002\u0002\u00a6\u0010\u0003",
  870. "\u0002\u0002\u0002\u00a7\u00a8\u0007g\u0002\u0002\u00a8\u00a9\u0007",
  871. "u\u0002\u0002\u00a9\u00aa\u0007e\u0002\u0002\u00aa\u00ab\u0007q\u0002",
  872. "\u0002\u00ab\u00ac\u0007n\u0002\u0002\u00ac\u00ad\u0007j\u0002\u0002",
  873. "\u00ad\u00ae\u0007c\u0002\u0002\u00ae\u0012\u0003\u0002\u0002\u0002",
  874. "\u00af\u00b0\u0007e\u0002\u0002\u00b0\u00b1\u0007c\u0002\u0002\u00b1",
  875. "\u00b2\u0007u\u0002\u0002\u00b2\u00b3\u0007q\u0002\u0002\u00b3\u0014",
  876. "\u0003\u0002\u0002\u0002\u00b4\u00b5\u0007e\u0002\u0002\u00b5\u00b6",
  877. "\u0007q\u0002\u0002\u00b6\u00b7\u0007p\u0002\u0002\u00b7\u00b8\u0007",
  878. "v\u0002\u0002\u00b8\u00b9\u0007t\u0002\u0002\u00b9\u00ba\u0007c\u0002",
  879. "\u0002\u00ba\u00bb\u0007t\u0002\u0002\u00bb\u00bc\u0007k\u0002\u0002",
  880. "\u00bc\u00bd\u0007q\u0002\u0002\u00bd\u0016\u0003\u0002\u0002\u0002",
  881. "\u00be\u00bf\u0007e\u0002\u0002\u00bf\u00c0\u0007q\u0002\u0002\u00c0",
  882. "\u00c1\u0007p\u0002\u0002\u00c1\u00c2\u0007u\u0002\u0002\u00c2\u00c3",
  883. "\u0007v\u0002\u0002\u00c3\u0018\u0003\u0002\u0002\u0002\u00c4\u00c5",
  884. "\u0007h\u0002\u0002\u00c5\u00c6\u0007w\u0002\u0002\u00c6\u00c7\u0007",
  885. "p\u0002\u0002\u00c7\u00c8\u0007e\u0002\u0002\u00c8\u00c9\u0007c\u0002",
  886. "\u0002\u00c9\u00ca\u0007q\u0002\u0002\u00ca\u001a\u0003\u0002\u0002",
  887. "\u0002\u00cb\u00cc\u0007t\u0002\u0002\u00cc\u00cd\u0007g\u0002\u0002",
  888. "\u00cd\u00ce\u0007v\u0002\u0002\u00ce\u00cf\u0007q\u0002\u0002\u00cf",
  889. "\u00d0\u0007t\u0002\u0002\u00d0\u00d1\u0007p\u0002\u0002\u00d1\u00d2",
  890. "\u0007g\u0002\u0002\u00d2\u001c\u0003\u0002\u0002\u0002\u00d3\u00d4",
  891. "\u0007r\u0002\u0002\u00d4\u00d5\u0007c\u0002\u0002\u00d5\u00d6\u0007",
  892. "t\u0002\u0002\u00d6\u00d7\u0007c\u0002\u0002\u00d7\u001e\u0003\u0002",
  893. "\u0002\u0002\u00d8\u00d9\u0007r\u0002\u0002\u00d9\u00da\u0007c\u0002",
  894. "\u0002\u00da\u00db\u0007t\u0002\u0002\u00db\u00dc\u0007g\u0002\u0002",
  895. "\u00dc \u0003\u0002\u0002\u0002\u00dd\u00de\u0007h\u0002\u0002\u00de",
  896. "\u00df\u0007c\u0002\u0002\u00df\u00e0\u0007e\u0002\u0002\u00e0\u00e1",
  897. "\u0007c\u0002\u0002\u00e1\"\u0003\u0002\u0002\u0002\u00e2\u00e3\u0007",
  898. "g\u0002\u0002\u00e3\u00e4\u0007p\u0002\u0002\u00e4\u00e5\u0007s\u0002",
  899. "\u0002\u00e5\u00e6\u0007w\u0002\u0002\u00e6\u00e7\u0007c\u0002\u0002",
  900. "\u00e7\u00e8\u0007p\u0002\u0002\u00e8\u00e9\u0007v\u0002\u0002\u00e9",
  901. "\u00ea\u0007q\u0002\u0002\u00ea$\u0003\u0002\u0002\u0002\u00eb\u00ec",
  902. "\u0007u\u0002\u0002\u00ec\u00ed\u0007g\u0002\u0002\u00ed&\u0003\u0002",
  903. "\u0002\u0002\u00ee\u00ef\u0007u\u0002\u0002\u00ef\u00f0\u0007g\u0002",
  904. "\u0002\u00f0\u00f1\u0007p\u0002\u0002\u00f1\u00f2\u0007c\u0002\u0002",
  905. "\u00f2\u00f3\u0007q\u0002\u0002\u00f3(\u0003\u0002\u0002\u0002\u00f4",
  906. "\u00f5\u0007h\u0002\u0002\u00f5\u00f6\u0007c\u0002\u0002\u00f6\u00f7",
  907. "\u0007n\u0002\u0002\u00f7\u00f8\u0007u\u0002\u0002\u00f8\u00f9\u0007",
  908. "q\u0002\u0002\u00f9*\u0003\u0002\u0002\u0002\u00fa\u00fb\u0007x\u0002",
  909. "\u0002\u00fb\u00fc\u0007g\u0002\u0002\u00fc\u00fd\u0007t\u0002\u0002",
  910. "\u00fd\u00fe\u0007f\u0002\u0002\u00fe\u00ff\u0007c\u0002\u0002\u00ff",
  911. "\u0100\u0007f\u0002\u0002\u0100\u0101\u0007g\u0002\u0002\u0101\u0102",
  912. "\u0007k\u0002\u0002\u0102\u0103\u0007t\u0002\u0002\u0103\u0104\u0007",
  913. "q\u0002\u0002\u0104,\u0003\u0002\u0002\u0002\u0105\u0106\u0007p\u0002",
  914. "\u0002\u0106\u0107\u0007c\u0002\u0002\u0107\u0108\u0007q\u0002\u0002",
  915. "\u0108.\u0003\u0002\u0002\u0002\u0109\u010a\u0007G\u0002\u0002\u010a",
  916. "0\u0003\u0002\u0002\u0002\u010b\u010c\u0007Q\u0002\u0002\u010c\u010d",
  917. "\u0007W\u0002\u0002\u010d2\u0003\u0002\u0002\u0002\u010e\u010f\u0007",
  918. "*\u0002\u0002\u010f4\u0003\u0002\u0002\u0002\u0110\u0111\u0007+\u0002",
  919. "\u0002\u01116\u0003\u0002\u0002\u0002\u0112\u0113\u0007]\u0002\u0002",
  920. "\u01138\u0003\u0002\u0002\u0002\u0114\u0115\u0007_\u0002\u0002\u0115",
  921. ":\u0003\u0002\u0002\u0002\u0116\u0117\u0007}\u0002\u0002\u0117<\u0003",
  922. "\u0002\u0002\u0002\u0118\u0119\u0007\u007f\u0002\u0002\u0119>\u0003",
  923. "\u0002\u0002\u0002\u011a\u011b\u0007.\u0002\u0002\u011b@\u0003\u0002",
  924. "\u0002\u0002\u011c\u011d\u0007?\u0002\u0002\u011dB\u0003\u0002\u0002",
  925. "\u0002\u011e\u011f\t\u0002\u0002\u0002\u011fD\u0003\u0002\u0002\u0002",
  926. "\u0120\u0121\t\u0003\u0002\u0002\u0121F\u0003\u0002\u0002\u0002\u0122",
  927. "\u0123\u0005/\u0018\u0002\u0123H\u0003\u0002\u0002\u0002\u0124\u0125",
  928. "\u00051\u0019\u0002\u0125J\u0003\u0002\u0002\u0002\u0126\u0127\u0007",
  929. "@\u0002\u0002\u0127\u0130\u0007?\u0002\u0002\u0128\u0129\u0007?\u0002",
  930. "\u0002\u0129\u0130\u0007?\u0002\u0002\u012a\u012b\u0007>\u0002\u0002",
  931. "\u012b\u0130\u0007?\u0002\u0002\u012c\u0130\t\u0004\u0002\u0002\u012d",
  932. "\u012e\u0007#\u0002\u0002\u012e\u0130\u0007?\u0002\u0002\u012f\u0126",
  933. "\u0003\u0002\u0002\u0002\u012f\u0128\u0003\u0002\u0002\u0002\u012f\u012a",
  934. "\u0003\u0002\u0002\u0002\u012f\u012c\u0003\u0002\u0002\u0002\u012f\u012d",
  935. "\u0003\u0002\u0002\u0002\u0130L\u0003\u0002\u0002\u0002\u0131\u0132",
  936. "\u0007<\u0002\u0002\u0132N\u0003\u0002\u0002\u0002\u0133\u0134\u0005",
  937. "-\u0017\u0002\u0134P\u0003\u0002\u0002\u0002\u0135\u0139\t\u0005\u0002",
  938. "\u0002\u0136\u0138\t\u0006\u0002\u0002\u0137\u0136\u0003\u0002\u0002",
  939. "\u0002\u0138\u013b\u0003\u0002\u0002\u0002\u0139\u0137\u0003\u0002\u0002",
  940. "\u0002\u0139\u013a\u0003\u0002\u0002\u0002\u013aR\u0003\u0002\u0002",
  941. "\u0002\u013b\u0139\u0003\u0002\u0002\u0002\u013c\u013d\u0005Q)\u0002",
  942. "\u013d\u013e\u00070\u0002\u0002\u013e\u013f\u0005Q)\u0002\u013fT\u0003",
  943. "\u0002\u0002\u0002\u0140\u0142\t\u0007\u0002\u0002\u0141\u0140\u0003",
  944. "\u0002\u0002\u0002\u0142\u0143\u0003\u0002\u0002\u0002\u0143\u0141\u0003",
  945. "\u0002\u0002\u0002\u0143\u0144\u0003\u0002\u0002\u0002\u0144\u015c\u0003",
  946. "\u0002\u0002\u0002\u0145\u0146\u00072\u0002\u0002\u0146\u014a\u0007",
  947. "z\u0002\u0002\u0147\u0148\u00072\u0002\u0002\u0148\u014a\u0007Z\u0002",
  948. "\u0002\u0149\u0145\u0003\u0002\u0002\u0002\u0149\u0147\u0003\u0002\u0002",
  949. "\u0002\u014a\u014c\u0003\u0002\u0002\u0002\u014b\u014d\u0005g4\u0002",
  950. "\u014c\u014b\u0003\u0002\u0002\u0002\u014d\u014e\u0003\u0002\u0002\u0002",
  951. "\u014e\u014c\u0003\u0002\u0002\u0002\u014e\u014f\u0003\u0002\u0002\u0002",
  952. "\u014f\u015c\u0003\u0002\u0002\u0002\u0150\u0151\u00072\u0002\u0002",
  953. "\u0151\u0155\u0007d\u0002\u0002\u0152\u0153\u00072\u0002\u0002\u0153",
  954. "\u0155\u0007D\u0002\u0002\u0154\u0150\u0003\u0002\u0002\u0002\u0154",
  955. "\u0152\u0003\u0002\u0002\u0002\u0155\u0157\u0003\u0002\u0002\u0002\u0156",
  956. "\u0158\t\b\u0002\u0002\u0157\u0156\u0003\u0002\u0002\u0002\u0158\u0159",
  957. "\u0003\u0002\u0002\u0002\u0159\u0157\u0003\u0002\u0002\u0002\u0159\u015a",
  958. "\u0003\u0002\u0002\u0002\u015a\u015c\u0003\u0002\u0002\u0002\u015b\u0141",
  959. "\u0003\u0002\u0002\u0002\u015b\u0149\u0003\u0002\u0002\u0002\u015b\u0154",
  960. "\u0003\u0002\u0002\u0002\u015cV\u0003\u0002\u0002\u0002\u015d\u015f",
  961. "\t\u0007\u0002\u0002\u015e\u015d\u0003\u0002\u0002\u0002\u015f\u0160",
  962. "\u0003\u0002\u0002\u0002\u0160\u015e\u0003\u0002\u0002\u0002\u0160\u0161",
  963. "\u0003\u0002\u0002\u0002\u0161\u0162\u0003\u0002\u0002\u0002\u0162\u0164",
  964. "\u00070\u0002\u0002\u0163\u0165\t\u0007\u0002\u0002\u0164\u0163\u0003",
  965. "\u0002\u0002\u0002\u0165\u0166\u0003\u0002\u0002\u0002\u0166\u0164\u0003",
  966. "\u0002\u0002\u0002\u0166\u0167\u0003\u0002\u0002\u0002\u0167\u0176\u0003",
  967. "\u0002\u0002\u0002\u0168\u016a\t\u0007\u0002\u0002\u0169\u0168\u0003",
  968. "\u0002\u0002\u0002\u016a\u016b\u0003\u0002\u0002\u0002\u016b\u0169\u0003",
  969. "\u0002\u0002\u0002\u016b\u016c\u0003\u0002\u0002\u0002\u016c\u016d\u0003",
  970. "\u0002\u0002\u0002\u016d\u0171\u00070\u0002\u0002\u016e\u0170\t\u0007",
  971. "\u0002\u0002\u016f\u016e\u0003\u0002\u0002\u0002\u0170\u0173\u0003\u0002",
  972. "\u0002\u0002\u0171\u016f\u0003\u0002\u0002\u0002\u0171\u0172\u0003\u0002",
  973. "\u0002\u0002\u0172\u0174\u0003\u0002\u0002\u0002\u0173\u0171\u0003\u0002",
  974. "\u0002\u0002\u0174\u0176\u0005Y-\u0002\u0175\u015e\u0003\u0002\u0002",
  975. "\u0002\u0175\u0169\u0003\u0002\u0002\u0002\u0176X\u0003\u0002\u0002",
  976. "\u0002\u0177\u0179\t\t\u0002\u0002\u0178\u017a\t\u0002\u0002\u0002\u0179",
  977. "\u0178\u0003\u0002\u0002\u0002\u0179\u017a\u0003\u0002\u0002\u0002\u017a",
  978. "\u017c\u0003\u0002\u0002\u0002\u017b\u017d\t\u0007\u0002\u0002\u017c",
  979. "\u017b\u0003\u0002\u0002\u0002\u017d\u017e\u0003\u0002\u0002\u0002\u017e",
  980. "\u017c\u0003\u0002\u0002\u0002\u017e\u017f\u0003\u0002\u0002\u0002\u017f",
  981. "Z\u0003\u0002\u0002\u0002\u0180\u0184\u0007$\u0002\u0002\u0181\u0183",
  982. "\u0005]/\u0002\u0182\u0181\u0003\u0002\u0002\u0002\u0183\u0186\u0003",
  983. "\u0002\u0002\u0002\u0184\u0182\u0003\u0002\u0002\u0002\u0184\u0185\u0003",
  984. "\u0002\u0002\u0002\u0185\u0187\u0003\u0002\u0002\u0002\u0186\u0184\u0003",
  985. "\u0002\u0002\u0002\u0187\u0188\u0007$\u0002\u0002\u0188\\\u0003\u0002",
  986. "\u0002\u0002\u0189\u018c\n\n\u0002\u0002\u018a\u018c\u0005k6\u0002\u018b",
  987. "\u0189\u0003\u0002\u0002\u0002\u018b\u018a\u0003\u0002\u0002\u0002\u018c",
  988. "^\u0003\u0002\u0002\u0002\u018d\u0190\u0007)\u0002\u0002\u018e\u0191",
  989. "\u0005k6\u0002\u018f\u0191\n\u000b\u0002\u0002\u0190\u018e\u0003\u0002",
  990. "\u0002\u0002\u0190\u018f\u0003\u0002\u0002\u0002\u0191\u0192\u0003\u0002",
  991. "\u0002\u0002\u0192\u0193\u0007)\u0002\u0002\u0193`\u0003\u0002\u0002",
  992. "\u0002\u0194\u0195\t\f\u0002\u0002\u0195\u0196\u0003\u0002\u0002\u0002",
  993. "\u0196\u0197\b1\u0002\u0002\u0197b\u0003\u0002\u0002\u0002\u0198\u0199",
  994. "\u0007=\u0002\u0002\u0199d\u0003\u0002\u0002\u0002\u019a\u019c\t\r\u0002",
  995. "\u0002\u019b\u019a\u0003\u0002\u0002\u0002\u019c\u019d\u0003\u0002\u0002",
  996. "\u0002\u019d\u019b\u0003\u0002\u0002\u0002\u019d\u019e\u0003\u0002\u0002",
  997. "\u0002\u019e\u01a1\u0003\u0002\u0002\u0002\u019f\u01a1\u0005c2\u0002",
  998. "\u01a0\u019b\u0003\u0002\u0002\u0002\u01a0\u019f\u0003\u0002\u0002\u0002",
  999. "\u01a1f\u0003\u0002\u0002\u0002\u01a2\u01a3\t\u000e\u0002\u0002\u01a3",
  1000. "h\u0003\u0002\u0002\u0002\u01a4\u01a5\t\u000f\u0002\u0002\u01a5j\u0003",
  1001. "\u0002\u0002\u0002\u01a6\u01a7\u0007^\u0002\u0002\u01a7\u01ab\t\u0010",
  1002. "\u0002\u0002\u01a8\u01ab\u0005o8\u0002\u01a9\u01ab\u0005m7\u0002\u01aa",
  1003. "\u01a6\u0003\u0002\u0002\u0002\u01aa\u01a8\u0003\u0002\u0002\u0002\u01aa",
  1004. "\u01a9\u0003\u0002\u0002\u0002\u01abl\u0003\u0002\u0002\u0002\u01ac",
  1005. "\u01ad\u0007^\u0002\u0002\u01ad\u01ae\t\u0011\u0002\u0002\u01ae\u01af",
  1006. "\u0005i5\u0002\u01af\u01b0\u0005i5\u0002\u01b0\u01b8\u0003\u0002\u0002",
  1007. "\u0002\u01b1\u01b2\u0007^\u0002\u0002\u01b2\u01b3\u0005i5\u0002\u01b3",
  1008. "\u01b4\u0005i5\u0002\u01b4\u01b8\u0003\u0002\u0002\u0002\u01b5\u01b6",
  1009. "\u0007^\u0002\u0002\u01b6\u01b8\u0005i5\u0002\u01b7\u01ac\u0003\u0002",
  1010. "\u0002\u0002\u01b7\u01b1\u0003\u0002\u0002\u0002\u01b7\u01b5\u0003\u0002",
  1011. "\u0002\u0002\u01b8n\u0003\u0002\u0002\u0002\u01b9\u01ba\u0007^\u0002",
  1012. "\u0002\u01ba\u01bb\u0007w\u0002\u0002\u01bb\u01bc\u0005g4\u0002\u01bc",
  1013. "\u01bd\u0005g4\u0002\u01bd\u01be\u0005g4\u0002\u01be\u01bf\u0005g4\u0002",
  1014. "\u01bfp\u0003\u0002\u0002\u0002\u01c0\u01c1\u00071\u0002\u0002\u01c1",
  1015. "\u01c2\u00071\u0002\u0002\u01c2\u01c6\u0003\u0002\u0002\u0002\u01c3",
  1016. "\u01c5\n\r\u0002\u0002\u01c4\u01c3\u0003\u0002\u0002\u0002\u01c5\u01c8",
  1017. "\u0003\u0002\u0002\u0002\u01c6\u01c4\u0003\u0002\u0002\u0002\u01c6\u01c7",
  1018. "\u0003\u0002\u0002\u0002\u01c7\u01ca\u0003\u0002\u0002\u0002\u01c8\u01c6",
  1019. "\u0003\u0002\u0002\u0002\u01c9\u01cb\u0007\u000f\u0002\u0002\u01ca\u01c9",
  1020. "\u0003\u0002\u0002\u0002\u01ca\u01cb\u0003\u0002\u0002\u0002\u01cb\u01cc",
  1021. "\u0003\u0002\u0002\u0002\u01cc\u01d9\u0007\f\u0002\u0002\u01cd\u01ce",
  1022. "\u00071\u0002\u0002\u01ce\u01cf\u0007,\u0002\u0002\u01cf\u01d3\u0003",
  1023. "\u0002\u0002\u0002\u01d0\u01d2\u000b\u0002\u0002\u0002\u01d1\u01d0\u0003",
  1024. "\u0002\u0002\u0002\u01d2\u01d5\u0003\u0002\u0002\u0002\u01d3\u01d4\u0003",
  1025. "\u0002\u0002\u0002\u01d3\u01d1\u0003\u0002\u0002\u0002\u01d4\u01d6\u0003",
  1026. "\u0002\u0002\u0002\u01d5\u01d3\u0003\u0002\u0002\u0002\u01d6\u01d7\u0007",
  1027. ",\u0002\u0002\u01d7\u01d9\u00071\u0002\u0002\u01d8\u01c0\u0003\u0002",
  1028. "\u0002\u0002\u01d8\u01cd\u0003\u0002\u0002\u0002\u01d9\u01da\u0003\u0002",
  1029. "\u0002\u0002\u01da\u01db\b9\u0003\u0002\u01dbr\u0003\u0002\u0002\u0002",
  1030. "\u001d\u0002\u012f\u0139\u0143\u0149\u014e\u0154\u0159\u015b\u0160\u0166",
  1031. "\u016b\u0171\u0175\u0179\u017e\u0184\u018b\u0190\u019d\u01a0\u01aa\u01b7",
  1032. "\u01c6\u01ca\u01d3\u01d8\u0004\b\u0002\u0002\u0002\u0003\u0002"].join("");
  1033. var atn = new antlr4.atn.ATNDeserializer().deserialize(serializedATN);
  1034. var decisionsToDFA = atn.decisionToState.map( function(ds, index) { return new antlr4.dfa.DFA(ds, index); });
  1035. function ivprog(input) {
  1036. antlr4.Lexer.call(this, input);
  1037. this._interp = new antlr4.atn.LexerATNSimulator(this, atn, decisionsToDFA, new antlr4.PredictionContextCache());
  1038. return this;
  1039. }
  1040. ivprog.prototype = Object.create(antlr4.Lexer.prototype);
  1041. ivprog.prototype.constructor = ivprog;
  1042. ivprog.EOF = antlr4.Token.EOF;
  1043. ivprog.RK_PROGRAM = 1;
  1044. ivprog.RK_REAL = 2;
  1045. ivprog.RK_VOID = 3;
  1046. ivprog.RK_BOOLEAN = 4;
  1047. ivprog.RK_STRING = 5;
  1048. ivprog.RK_INTEGER = 6;
  1049. ivprog.RK_CHARACTER = 7;
  1050. ivprog.RK_SWITCH = 8;
  1051. ivprog.RK_CASE = 9;
  1052. ivprog.RK_DEFAULT = 10;
  1053. ivprog.RK_CONST = 11;
  1054. ivprog.RK_FUNCTION = 12;
  1055. ivprog.RK_RETURN = 13;
  1056. ivprog.RK_FOR = 14;
  1057. ivprog.RK_BREAK = 15;
  1058. ivprog.RK_DO = 16;
  1059. ivprog.RK_WHILE = 17;
  1060. ivprog.RK_IF = 18;
  1061. ivprog.RK_ELSE = 19;
  1062. ivprog.RK_FALSE = 20;
  1063. ivprog.RK_TRUE = 21;
  1064. ivprog.OPEN_PARENTHESIS = 22;
  1065. ivprog.CLOSE_PARENTHESIS = 23;
  1066. ivprog.OPEN_BRACE = 24;
  1067. ivprog.CLOSE_BRACE = 25;
  1068. ivprog.OPEN_CURLY = 26;
  1069. ivprog.CLOSE_CURLY = 27;
  1070. ivprog.COMMA = 28;
  1071. ivprog.EQUAL = 29;
  1072. ivprog.SUM_OP = 30;
  1073. ivprog.MULTI_OP = 31;
  1074. ivprog.AND_OPERATOR = 32;
  1075. ivprog.OR_OPERATOR = 33;
  1076. ivprog.RELATIONAL_OPERATOR = 34;
  1077. ivprog.COLON = 35;
  1078. ivprog.NOT_OPERATOR = 36;
  1079. ivprog.ID = 37;
  1080. ivprog.LIB_ID = 38;
  1081. ivprog.INTEGER = 39;
  1082. ivprog.REAL = 40;
  1083. ivprog.STRING = 41;
  1084. ivprog.CHARACTER = 42;
  1085. ivprog.WHITESPACE = 43;
  1086. ivprog.EOS = 44;
  1087. ivprog.COMMENTS = 45;
  1088. ivprog.prototype.channelNames = [ "DEFAULT_TOKEN_CHANNEL", "HIDDEN" ];
  1089. ivprog.prototype.modeNames = [ "DEFAULT_MODE" ];
  1090. ivprog.prototype.literalNames = [ null, "'programa'", "'real'", "'vazio'",
  1091. "'logico'", "'cadeia'", "'inteiro'", "'caractere'",
  1092. "'escolha'", "'caso'", "'contrario'",
  1093. "'const'", "'funcao'", "'retorne'", "'para'",
  1094. "'pare'", "'faca'", "'enquanto'", "'se'",
  1095. "'senao'", "'falso'", "'verdadeiro'",
  1096. "'('", "')'", "'['", "']'", "'{'", "'}'",
  1097. "','", "'='", null, null, null, null,
  1098. null, "':'" ];
  1099. ivprog.prototype.symbolicNames = [ null, "RK_PROGRAM", "RK_REAL", "RK_VOID",
  1100. "RK_BOOLEAN", "RK_STRING", "RK_INTEGER",
  1101. "RK_CHARACTER", "RK_SWITCH", "RK_CASE",
  1102. "RK_DEFAULT", "RK_CONST", "RK_FUNCTION",
  1103. "RK_RETURN", "RK_FOR", "RK_BREAK", "RK_DO",
  1104. "RK_WHILE", "RK_IF", "RK_ELSE", "RK_FALSE",
  1105. "RK_TRUE", "OPEN_PARENTHESIS", "CLOSE_PARENTHESIS",
  1106. "OPEN_BRACE", "CLOSE_BRACE", "OPEN_CURLY",
  1107. "CLOSE_CURLY", "COMMA", "EQUAL", "SUM_OP",
  1108. "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  1109. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  1110. "ID", "LIB_ID", "INTEGER", "REAL", "STRING",
  1111. "CHARACTER", "WHITESPACE", "EOS", "COMMENTS" ];
  1112. ivprog.prototype.ruleNames = [ "RK_PROGRAM", "RK_REAL", "RK_VOID", "RK_BOOLEAN",
  1113. "RK_STRING", "RK_INTEGER", "RK_CHARACTER",
  1114. "RK_SWITCH", "RK_CASE", "RK_DEFAULT", "RK_CONST",
  1115. "RK_FUNCTION", "RK_RETURN", "RK_FOR", "RK_BREAK",
  1116. "RK_DO", "RK_WHILE", "RK_IF", "RK_ELSE",
  1117. "RK_FALSE", "RK_TRUE", "RK_LOGICAL_NOT",
  1118. "RK_LOGICAL_AND", "RK_LOGICAL_OR", "OPEN_PARENTHESIS",
  1119. "CLOSE_PARENTHESIS", "OPEN_BRACE", "CLOSE_BRACE",
  1120. "OPEN_CURLY", "CLOSE_CURLY", "COMMA", "EQUAL",
  1121. "SUM_OP", "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  1122. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  1123. "ID", "LIB_ID", "INTEGER", "REAL", "ExponentPart",
  1124. "STRING", "STRING_CHARACTER", "CHARACTER",
  1125. "WHITESPACE", "SEMICOLON", "EOS", "HEX_DIGIT",
  1126. "OCTAL_DIGIT", "ESC_SEQ", "ESC_OCTAL", "ESC_UNICODE",
  1127. "COMMENTS" ];
  1128. ivprog.prototype.grammarFileName = "ivprog.g4";
  1129. exports.ivprog = ivprog;
  1130. /***/ }),
  1131. /* 1 */
  1132. /***/ (function(module, exports, __webpack_require__) {
  1133. module.exports = {
  1134. ivprog: __webpack_require__(0).ivprog
  1135. };
  1136. /***/ }),
  1137. /* 2 */
  1138. /***/ (function(module, exports) {
  1139. module.exports = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js");
  1140. /***/ })
  1141. /******/ ]);
  1142. /***/ }),
  1143. /***/ "./grammar/es/langFunctions.js":
  1144. /*!*************************************!*\
  1145. !*** ./grammar/es/langFunctions.js ***!
  1146. \*************************************/
  1147. /*! no static exports found */
  1148. /***/ (function(module, exports, __webpack_require__) {
  1149. "use strict";
  1150. Object.defineProperty(exports, "__esModule", {
  1151. value: true
  1152. });
  1153. /* This is a dictionary of the language defined functions
  1154. **/
  1155. exports.default = {
  1156. main_function: "inicio",
  1157. $read: "leia",
  1158. $write: "escreva",
  1159. $numElements: "numero_elementos",
  1160. $matrixLines: "matriz_linhas",
  1161. $matrixColumns: "matriz_colunas",
  1162. $substring: "subcadeia",
  1163. $length: "comprimento",
  1164. $uppercase: "caixa_alta",
  1165. $lowercase: "caixa_baixa",
  1166. $charAt: "char_at",
  1167. $isReal: "e_real",
  1168. $isInt: "e_inteiro",
  1169. $isBool: "e_logico",
  1170. $castReal: "como_real",
  1171. $castInt: "como_inteiro",
  1172. $castBool: "como_logico",
  1173. $castString: "como_cadeia",
  1174. $sin: "sin",
  1175. $cos: "cos",
  1176. $tan: "tan",
  1177. $sqrt: "sqrt",
  1178. $pow: "pow",
  1179. $log: "log",
  1180. $abs: "abs",
  1181. $negate: "negate",
  1182. $invert: "invert",
  1183. $max: "maximum",
  1184. $min: "minimum"
  1185. };
  1186. /***/ }),
  1187. /***/ "./grammar/es/langLibs.js":
  1188. /*!********************************!*\
  1189. !*** ./grammar/es/langLibs.js ***!
  1190. \********************************/
  1191. /*! no static exports found */
  1192. /***/ (function(module, exports, __webpack_require__) {
  1193. "use strict";
  1194. Object.defineProperty(exports, "__esModule", {
  1195. value: true
  1196. });
  1197. /**
  1198. * This is the dictionary of the language defined libraries
  1199. */
  1200. exports.default = {
  1201. $mathLib: "Mathematic",
  1202. $ioLib: "ES",
  1203. $strLib: "Texto",
  1204. $arrayLib: "Arranjo",
  1205. $langLib: "IV"
  1206. };
  1207. /***/ }),
  1208. /***/ "./grammar/index.js":
  1209. /*!**************************!*\
  1210. !*** ./grammar/index.js ***!
  1211. \**************************/
  1212. /*! no static exports found */
  1213. /***/ (function(module, exports, __webpack_require__) {
  1214. "use strict";
  1215. var _ivprog = __webpack_require__(/*! ./pt/ivprog.g4 */ "./grammar/pt/ivprog.g4");
  1216. var PT = _interopRequireWildcard(_ivprog);
  1217. var _langFunctions = __webpack_require__(/*! ./pt/langFunctions */ "./grammar/pt/langFunctions.js");
  1218. var _langFunctions2 = _interopRequireDefault(_langFunctions);
  1219. var _langLibs = __webpack_require__(/*! ./pt/langLibs */ "./grammar/pt/langLibs.js");
  1220. var _langLibs2 = _interopRequireDefault(_langLibs);
  1221. var _ivprog2 = __webpack_require__(/*! ./en/ivprog.g4 */ "./grammar/en/ivprog.g4");
  1222. var EN = _interopRequireWildcard(_ivprog2);
  1223. var _langFunctions3 = __webpack_require__(/*! ./en/langFunctions */ "./grammar/en/langFunctions.js");
  1224. var _langFunctions4 = _interopRequireDefault(_langFunctions3);
  1225. var _langLibs3 = __webpack_require__(/*! ./en/langLibs */ "./grammar/en/langLibs.js");
  1226. var _langLibs4 = _interopRequireDefault(_langLibs3);
  1227. var _ivprog3 = __webpack_require__(/*! ./es/ivprog.g4 */ "./grammar/es/ivprog.g4");
  1228. var ES = _interopRequireWildcard(_ivprog3);
  1229. var _langFunctions5 = __webpack_require__(/*! ./es/langFunctions */ "./grammar/es/langFunctions.js");
  1230. var _langFunctions6 = _interopRequireDefault(_langFunctions5);
  1231. var _langLibs5 = __webpack_require__(/*! ./es/langLibs */ "./grammar/es/langLibs.js");
  1232. var _langLibs6 = _interopRequireDefault(_langLibs5);
  1233. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1234. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  1235. exports.pt = { lexer: PT.ivprog, langFuncs: _langFunctions2.default, langLibs: _langLibs2.default };
  1236. exports.en = { lexer: EN.ivprog, langFuncs: _langFunctions4.default, langLibs: _langLibs4.default };
  1237. exports.es = { lexer: ES.ivprog, langFuncs: _langFunctions6.default, langLibs: _langLibs6.default };
  1238. /***/ }),
  1239. /***/ "./grammar/pt/ivprog.g4":
  1240. /*!******************************!*\
  1241. !*** ./grammar/pt/ivprog.g4 ***!
  1242. \******************************/
  1243. /*! no static exports found */
  1244. /***/ (function(module, exports, __webpack_require__) {
  1245. module.exports =
  1246. /******/ (function(modules) { // webpackBootstrap
  1247. /******/ // The module cache
  1248. /******/ var installedModules = {};
  1249. /******/
  1250. /******/ // The require function
  1251. /******/ function __webpack_require__(moduleId) {
  1252. /******/
  1253. /******/ // Check if module is in cache
  1254. /******/ if(installedModules[moduleId]) {
  1255. /******/ return installedModules[moduleId].exports;
  1256. /******/ }
  1257. /******/ // Create a new module (and put it into the cache)
  1258. /******/ var module = installedModules[moduleId] = {
  1259. /******/ i: moduleId,
  1260. /******/ l: false,
  1261. /******/ exports: {}
  1262. /******/ };
  1263. /******/
  1264. /******/ // Execute the module function
  1265. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  1266. /******/
  1267. /******/ // Flag the module as loaded
  1268. /******/ module.l = true;
  1269. /******/
  1270. /******/ // Return the exports of the module
  1271. /******/ return module.exports;
  1272. /******/ }
  1273. /******/
  1274. /******/
  1275. /******/ // expose the modules object (__webpack_modules__)
  1276. /******/ __webpack_require__.m = modules;
  1277. /******/
  1278. /******/ // expose the module cache
  1279. /******/ __webpack_require__.c = installedModules;
  1280. /******/
  1281. /******/ // identity function for calling harmony imports with the correct context
  1282. /******/ __webpack_require__.i = function(value) { return value; };
  1283. /******/
  1284. /******/ // define getter function for harmony exports
  1285. /******/ __webpack_require__.d = function(exports, name, getter) {
  1286. /******/ if(!__webpack_require__.o(exports, name)) {
  1287. /******/ Object.defineProperty(exports, name, {
  1288. /******/ configurable: false,
  1289. /******/ enumerable: true,
  1290. /******/ get: getter
  1291. /******/ });
  1292. /******/ }
  1293. /******/ };
  1294. /******/
  1295. /******/ // getDefaultExport function for compatibility with non-harmony modules
  1296. /******/ __webpack_require__.n = function(module) {
  1297. /******/ var getter = module && module.__esModule ?
  1298. /******/ function getDefault() { return module['default']; } :
  1299. /******/ function getModuleExports() { return module; };
  1300. /******/ __webpack_require__.d(getter, 'a', getter);
  1301. /******/ return getter;
  1302. /******/ };
  1303. /******/
  1304. /******/ // Object.prototype.hasOwnProperty.call
  1305. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  1306. /******/
  1307. /******/ // __webpack_public_path__
  1308. /******/ __webpack_require__.p = "";
  1309. /******/
  1310. /******/ // Load entry module and return exports
  1311. /******/ return __webpack_require__(__webpack_require__.s = 1);
  1312. /******/ })
  1313. /************************************************************************/
  1314. /******/ ([
  1315. /* 0 */
  1316. /***/ (function(module, exports, __webpack_require__) {
  1317. // Generated from /tmp/tmp-2205R3VF7jNkk3no/ivprog.g4 by ANTLR 4.7
  1318. // jshint ignore: start
  1319. var antlr4 = __webpack_require__(2);
  1320. var serializedATN = ["\u0003\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964",
  1321. "\u0002/\u01dc\b\u0001\u0004\u0002\t\u0002\u0004\u0003\t\u0003\u0004",
  1322. "\u0004\t\u0004\u0004\u0005\t\u0005\u0004\u0006\t\u0006\u0004\u0007\t",
  1323. "\u0007\u0004\b\t\b\u0004\t\t\t\u0004\n\t\n\u0004\u000b\t\u000b\u0004",
  1324. "\f\t\f\u0004\r\t\r\u0004\u000e\t\u000e\u0004\u000f\t\u000f\u0004\u0010",
  1325. "\t\u0010\u0004\u0011\t\u0011\u0004\u0012\t\u0012\u0004\u0013\t\u0013",
  1326. "\u0004\u0014\t\u0014\u0004\u0015\t\u0015\u0004\u0016\t\u0016\u0004\u0017",
  1327. "\t\u0017\u0004\u0018\t\u0018\u0004\u0019\t\u0019\u0004\u001a\t\u001a",
  1328. "\u0004\u001b\t\u001b\u0004\u001c\t\u001c\u0004\u001d\t\u001d\u0004\u001e",
  1329. "\t\u001e\u0004\u001f\t\u001f\u0004 \t \u0004!\t!\u0004\"\t\"\u0004#",
  1330. "\t#\u0004$\t$\u0004%\t%\u0004&\t&\u0004\'\t\'\u0004(\t(\u0004)\t)\u0004",
  1331. "*\t*\u0004+\t+\u0004,\t,\u0004-\t-\u0004.\t.\u0004/\t/\u00040\t0\u0004",
  1332. "1\t1\u00042\t2\u00043\t3\u00044\t4\u00045\t5\u00046\t6\u00047\t7\u0004",
  1333. "8\t8\u00049\t9\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003",
  1334. "\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0003\u0003",
  1335. "\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0004\u0003\u0004\u0003",
  1336. "\u0004\u0003\u0004\u0003\u0004\u0003\u0004\u0003\u0005\u0003\u0005\u0003",
  1337. "\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0006\u0003",
  1338. "\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003",
  1339. "\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003",
  1340. "\u0007\u0003\u0007\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003",
  1341. "\b\u0003\b\u0003\b\u0003\b\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0003",
  1342. "\t\u0003\t\u0003\t\u0003\n\u0003\n\u0003\n\u0003\n\u0003\n\u0003\u000b",
  1343. "\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b",
  1344. "\u0003\u000b\u0003\u000b\u0003\u000b\u0003\f\u0003\f\u0003\f\u0003\f",
  1345. "\u0003\f\u0003\f\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003",
  1346. "\r\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003",
  1347. "\u000e\u0003\u000e\u0003\u000e\u0003\u000f\u0003\u000f\u0003\u000f\u0003",
  1348. "\u000f\u0003\u000f\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003",
  1349. "\u0010\u0003\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0003",
  1350. "\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003",
  1351. "\u0012\u0003\u0012\u0003\u0012\u0003\u0013\u0003\u0013\u0003\u0013\u0003",
  1352. "\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003",
  1353. "\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003",
  1354. "\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003",
  1355. "\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0017\u0003",
  1356. "\u0017\u0003\u0017\u0003\u0017\u0003\u0018\u0003\u0018\u0003\u0019\u0003",
  1357. "\u0019\u0003\u0019\u0003\u001a\u0003\u001a\u0003\u001b\u0003\u001b\u0003",
  1358. "\u001c\u0003\u001c\u0003\u001d\u0003\u001d\u0003\u001e\u0003\u001e\u0003",
  1359. "\u001f\u0003\u001f\u0003 \u0003 \u0003!\u0003!\u0003\"\u0003\"\u0003",
  1360. "#\u0003#\u0003$\u0003$\u0003%\u0003%\u0003&\u0003&\u0003&\u0003&\u0003",
  1361. "&\u0003&\u0003&\u0003&\u0003&\u0005&\u0130\n&\u0003\'\u0003\'\u0003",
  1362. "(\u0003(\u0003)\u0003)\u0007)\u0138\n)\f)\u000e)\u013b\u000b)\u0003",
  1363. "*\u0003*\u0003*\u0003*\u0003+\u0006+\u0142\n+\r+\u000e+\u0143\u0003",
  1364. "+\u0003+\u0003+\u0003+\u0005+\u014a\n+\u0003+\u0006+\u014d\n+\r+\u000e",
  1365. "+\u014e\u0003+\u0003+\u0003+\u0003+\u0005+\u0155\n+\u0003+\u0006+\u0158",
  1366. "\n+\r+\u000e+\u0159\u0005+\u015c\n+\u0003,\u0006,\u015f\n,\r,\u000e",
  1367. ",\u0160\u0003,\u0003,\u0006,\u0165\n,\r,\u000e,\u0166\u0003,\u0006,",
  1368. "\u016a\n,\r,\u000e,\u016b\u0003,\u0003,\u0007,\u0170\n,\f,\u000e,\u0173",
  1369. "\u000b,\u0003,\u0005,\u0176\n,\u0003-\u0003-\u0005-\u017a\n-\u0003-",
  1370. "\u0006-\u017d\n-\r-\u000e-\u017e\u0003.\u0003.\u0007.\u0183\n.\f.\u000e",
  1371. ".\u0186\u000b.\u0003.\u0003.\u0003/\u0003/\u0005/\u018c\n/\u00030\u0003",
  1372. "0\u00030\u00050\u0191\n0\u00030\u00030\u00031\u00031\u00031\u00031\u0003",
  1373. "2\u00032\u00033\u00063\u019c\n3\r3\u000e3\u019d\u00033\u00053\u01a1",
  1374. "\n3\u00034\u00034\u00035\u00035\u00036\u00036\u00036\u00036\u00056\u01ab",
  1375. "\n6\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u0003",
  1376. "7\u00037\u00057\u01b8\n7\u00038\u00038\u00038\u00038\u00038\u00038\u0003",
  1377. "8\u00039\u00039\u00039\u00039\u00079\u01c5\n9\f9\u000e9\u01c8\u000b",
  1378. "9\u00039\u00059\u01cb\n9\u00039\u00039\u00039\u00039\u00039\u00079\u01d2",
  1379. "\n9\f9\u000e9\u01d5\u000b9\u00039\u00039\u00059\u01d9\n9\u00039\u0003",
  1380. "9\u0003\u01d3\u0002:\u0003\u0003\u0005\u0004\u0007\u0005\t\u0006\u000b",
  1381. "\u0007\r\b\u000f\t\u0011\n\u0013\u000b\u0015\f\u0017\r\u0019\u000e\u001b",
  1382. "\u000f\u001d\u0010\u001f\u0011!\u0012#\u0013%\u0014\'\u0015)\u0016+",
  1383. "\u0017-\u0002/\u00021\u00023\u00185\u00197\u001a9\u001b;\u001c=\u001d",
  1384. "?\u001eA\u001fC E!G\"I#K$M%O&Q\'S(U)W*Y\u0002[+]\u0002_,a-c\u0002e.",
  1385. "g\u0002i\u0002k\u0002m\u0002o\u0002q/\u0003\u0002\u0012\u0004\u0002",
  1386. "--//\u0005\u0002\'\',,11\u0004\u0002>>@@\u0005\u0002C\\aac|\u0006\u0002",
  1387. "2;C\\aac|\u0003\u00022;\u0003\u000223\u0004\u0002GGgg\u0006\u0002\f",
  1388. "\f\u000f\u000f$$^^\u0006\u0002\f\f\u000f\u000f))^^\u0004\u0002\u000b",
  1389. "\u000b\"\"\u0004\u0002\f\f\u000f\u000f\u0005\u00022;CHch\u0003\u0002",
  1390. "29\n\u0002$$))^^ddhhppttvv\u0003\u000225\u0002\u01f0\u0002\u0003\u0003",
  1391. "\u0002\u0002\u0002\u0002\u0005\u0003\u0002\u0002\u0002\u0002\u0007\u0003",
  1392. "\u0002\u0002\u0002\u0002\t\u0003\u0002\u0002\u0002\u0002\u000b\u0003",
  1393. "\u0002\u0002\u0002\u0002\r\u0003\u0002\u0002\u0002\u0002\u000f\u0003",
  1394. "\u0002\u0002\u0002\u0002\u0011\u0003\u0002\u0002\u0002\u0002\u0013\u0003",
  1395. "\u0002\u0002\u0002\u0002\u0015\u0003\u0002\u0002\u0002\u0002\u0017\u0003",
  1396. "\u0002\u0002\u0002\u0002\u0019\u0003\u0002\u0002\u0002\u0002\u001b\u0003",
  1397. "\u0002\u0002\u0002\u0002\u001d\u0003\u0002\u0002\u0002\u0002\u001f\u0003",
  1398. "\u0002\u0002\u0002\u0002!\u0003\u0002\u0002\u0002\u0002#\u0003\u0002",
  1399. "\u0002\u0002\u0002%\u0003\u0002\u0002\u0002\u0002\'\u0003\u0002\u0002",
  1400. "\u0002\u0002)\u0003\u0002\u0002\u0002\u0002+\u0003\u0002\u0002\u0002",
  1401. "\u00023\u0003\u0002\u0002\u0002\u00025\u0003\u0002\u0002\u0002\u0002",
  1402. "7\u0003\u0002\u0002\u0002\u00029\u0003\u0002\u0002\u0002\u0002;\u0003",
  1403. "\u0002\u0002\u0002\u0002=\u0003\u0002\u0002\u0002\u0002?\u0003\u0002",
  1404. "\u0002\u0002\u0002A\u0003\u0002\u0002\u0002\u0002C\u0003\u0002\u0002",
  1405. "\u0002\u0002E\u0003\u0002\u0002\u0002\u0002G\u0003\u0002\u0002\u0002",
  1406. "\u0002I\u0003\u0002\u0002\u0002\u0002K\u0003\u0002\u0002\u0002\u0002",
  1407. "M\u0003\u0002\u0002\u0002\u0002O\u0003\u0002\u0002\u0002\u0002Q\u0003",
  1408. "\u0002\u0002\u0002\u0002S\u0003\u0002\u0002\u0002\u0002U\u0003\u0002",
  1409. "\u0002\u0002\u0002W\u0003\u0002\u0002\u0002\u0002[\u0003\u0002\u0002",
  1410. "\u0002\u0002_\u0003\u0002\u0002\u0002\u0002a\u0003\u0002\u0002\u0002",
  1411. "\u0002e\u0003\u0002\u0002\u0002\u0002q\u0003\u0002\u0002\u0002\u0003",
  1412. "s\u0003\u0002\u0002\u0002\u0005|\u0003\u0002\u0002\u0002\u0007\u0081",
  1413. "\u0003\u0002\u0002\u0002\t\u0087\u0003\u0002\u0002\u0002\u000b\u008e",
  1414. "\u0003\u0002\u0002\u0002\r\u0095\u0003\u0002\u0002\u0002\u000f\u009d",
  1415. "\u0003\u0002\u0002\u0002\u0011\u00a7\u0003\u0002\u0002\u0002\u0013\u00af",
  1416. "\u0003\u0002\u0002\u0002\u0015\u00b4\u0003\u0002\u0002\u0002\u0017\u00be",
  1417. "\u0003\u0002\u0002\u0002\u0019\u00c4\u0003\u0002\u0002\u0002\u001b\u00cb",
  1418. "\u0003\u0002\u0002\u0002\u001d\u00d3\u0003\u0002\u0002\u0002\u001f\u00d8",
  1419. "\u0003\u0002\u0002\u0002!\u00dd\u0003\u0002\u0002\u0002#\u00e2\u0003",
  1420. "\u0002\u0002\u0002%\u00eb\u0003\u0002\u0002\u0002\'\u00ee\u0003\u0002",
  1421. "\u0002\u0002)\u00f4\u0003\u0002\u0002\u0002+\u00fa\u0003\u0002\u0002",
  1422. "\u0002-\u0105\u0003\u0002\u0002\u0002/\u0109\u0003\u0002\u0002\u0002",
  1423. "1\u010b\u0003\u0002\u0002\u00023\u010e\u0003\u0002\u0002\u00025\u0110",
  1424. "\u0003\u0002\u0002\u00027\u0112\u0003\u0002\u0002\u00029\u0114\u0003",
  1425. "\u0002\u0002\u0002;\u0116\u0003\u0002\u0002\u0002=\u0118\u0003\u0002",
  1426. "\u0002\u0002?\u011a\u0003\u0002\u0002\u0002A\u011c\u0003\u0002\u0002",
  1427. "\u0002C\u011e\u0003\u0002\u0002\u0002E\u0120\u0003\u0002\u0002\u0002",
  1428. "G\u0122\u0003\u0002\u0002\u0002I\u0124\u0003\u0002\u0002\u0002K\u012f",
  1429. "\u0003\u0002\u0002\u0002M\u0131\u0003\u0002\u0002\u0002O\u0133\u0003",
  1430. "\u0002\u0002\u0002Q\u0135\u0003\u0002\u0002\u0002S\u013c\u0003\u0002",
  1431. "\u0002\u0002U\u015b\u0003\u0002\u0002\u0002W\u0175\u0003\u0002\u0002",
  1432. "\u0002Y\u0177\u0003\u0002\u0002\u0002[\u0180\u0003\u0002\u0002\u0002",
  1433. "]\u018b\u0003\u0002\u0002\u0002_\u018d\u0003\u0002\u0002\u0002a\u0194",
  1434. "\u0003\u0002\u0002\u0002c\u0198\u0003\u0002\u0002\u0002e\u01a0\u0003",
  1435. "\u0002\u0002\u0002g\u01a2\u0003\u0002\u0002\u0002i\u01a4\u0003\u0002",
  1436. "\u0002\u0002k\u01aa\u0003\u0002\u0002\u0002m\u01b7\u0003\u0002\u0002",
  1437. "\u0002o\u01b9\u0003\u0002\u0002\u0002q\u01d8\u0003\u0002\u0002\u0002",
  1438. "st\u0007r\u0002\u0002tu\u0007t\u0002\u0002uv\u0007q\u0002\u0002vw\u0007",
  1439. "i\u0002\u0002wx\u0007t\u0002\u0002xy\u0007c\u0002\u0002yz\u0007o\u0002",
  1440. "\u0002z{\u0007c\u0002\u0002{\u0004\u0003\u0002\u0002\u0002|}\u0007t",
  1441. "\u0002\u0002}~\u0007g\u0002\u0002~\u007f\u0007c\u0002\u0002\u007f\u0080",
  1442. "\u0007n\u0002\u0002\u0080\u0006\u0003\u0002\u0002\u0002\u0081\u0082",
  1443. "\u0007x\u0002\u0002\u0082\u0083\u0007c\u0002\u0002\u0083\u0084\u0007",
  1444. "|\u0002\u0002\u0084\u0085\u0007k\u0002\u0002\u0085\u0086\u0007q\u0002",
  1445. "\u0002\u0086\b\u0003\u0002\u0002\u0002\u0087\u0088\u0007n\u0002\u0002",
  1446. "\u0088\u0089\u0007q\u0002\u0002\u0089\u008a\u0007i\u0002\u0002\u008a",
  1447. "\u008b\u0007k\u0002\u0002\u008b\u008c\u0007e\u0002\u0002\u008c\u008d",
  1448. "\u0007q\u0002\u0002\u008d\n\u0003\u0002\u0002\u0002\u008e\u008f\u0007",
  1449. "e\u0002\u0002\u008f\u0090\u0007c\u0002\u0002\u0090\u0091\u0007f\u0002",
  1450. "\u0002\u0091\u0092\u0007g\u0002\u0002\u0092\u0093\u0007k\u0002\u0002",
  1451. "\u0093\u0094\u0007c\u0002\u0002\u0094\f\u0003\u0002\u0002\u0002\u0095",
  1452. "\u0096\u0007k\u0002\u0002\u0096\u0097\u0007p\u0002\u0002\u0097\u0098",
  1453. "\u0007v\u0002\u0002\u0098\u0099\u0007g\u0002\u0002\u0099\u009a\u0007",
  1454. "k\u0002\u0002\u009a\u009b\u0007t\u0002\u0002\u009b\u009c\u0007q\u0002",
  1455. "\u0002\u009c\u000e\u0003\u0002\u0002\u0002\u009d\u009e\u0007e\u0002",
  1456. "\u0002\u009e\u009f\u0007c\u0002\u0002\u009f\u00a0\u0007t\u0002\u0002",
  1457. "\u00a0\u00a1\u0007c\u0002\u0002\u00a1\u00a2\u0007e\u0002\u0002\u00a2",
  1458. "\u00a3\u0007v\u0002\u0002\u00a3\u00a4\u0007g\u0002\u0002\u00a4\u00a5",
  1459. "\u0007t\u0002\u0002\u00a5\u00a6\u0007g\u0002\u0002\u00a6\u0010\u0003",
  1460. "\u0002\u0002\u0002\u00a7\u00a8\u0007g\u0002\u0002\u00a8\u00a9\u0007",
  1461. "u\u0002\u0002\u00a9\u00aa\u0007e\u0002\u0002\u00aa\u00ab\u0007q\u0002",
  1462. "\u0002\u00ab\u00ac\u0007n\u0002\u0002\u00ac\u00ad\u0007j\u0002\u0002",
  1463. "\u00ad\u00ae\u0007c\u0002\u0002\u00ae\u0012\u0003\u0002\u0002\u0002",
  1464. "\u00af\u00b0\u0007e\u0002\u0002\u00b0\u00b1\u0007c\u0002\u0002\u00b1",
  1465. "\u00b2\u0007u\u0002\u0002\u00b2\u00b3\u0007q\u0002\u0002\u00b3\u0014",
  1466. "\u0003\u0002\u0002\u0002\u00b4\u00b5\u0007e\u0002\u0002\u00b5\u00b6",
  1467. "\u0007q\u0002\u0002\u00b6\u00b7\u0007p\u0002\u0002\u00b7\u00b8\u0007",
  1468. "v\u0002\u0002\u00b8\u00b9\u0007t\u0002\u0002\u00b9\u00ba\u0007c\u0002",
  1469. "\u0002\u00ba\u00bb\u0007t\u0002\u0002\u00bb\u00bc\u0007k\u0002\u0002",
  1470. "\u00bc\u00bd\u0007q\u0002\u0002\u00bd\u0016\u0003\u0002\u0002\u0002",
  1471. "\u00be\u00bf\u0007e\u0002\u0002\u00bf\u00c0\u0007q\u0002\u0002\u00c0",
  1472. "\u00c1\u0007p\u0002\u0002\u00c1\u00c2\u0007u\u0002\u0002\u00c2\u00c3",
  1473. "\u0007v\u0002\u0002\u00c3\u0018\u0003\u0002\u0002\u0002\u00c4\u00c5",
  1474. "\u0007h\u0002\u0002\u00c5\u00c6\u0007w\u0002\u0002\u00c6\u00c7\u0007",
  1475. "p\u0002\u0002\u00c7\u00c8\u0007e\u0002\u0002\u00c8\u00c9\u0007c\u0002",
  1476. "\u0002\u00c9\u00ca\u0007q\u0002\u0002\u00ca\u001a\u0003\u0002\u0002",
  1477. "\u0002\u00cb\u00cc\u0007t\u0002\u0002\u00cc\u00cd\u0007g\u0002\u0002",
  1478. "\u00cd\u00ce\u0007v\u0002\u0002\u00ce\u00cf\u0007q\u0002\u0002\u00cf",
  1479. "\u00d0\u0007t\u0002\u0002\u00d0\u00d1\u0007p\u0002\u0002\u00d1\u00d2",
  1480. "\u0007g\u0002\u0002\u00d2\u001c\u0003\u0002\u0002\u0002\u00d3\u00d4",
  1481. "\u0007r\u0002\u0002\u00d4\u00d5\u0007c\u0002\u0002\u00d5\u00d6\u0007",
  1482. "t\u0002\u0002\u00d6\u00d7\u0007c\u0002\u0002\u00d7\u001e\u0003\u0002",
  1483. "\u0002\u0002\u00d8\u00d9\u0007r\u0002\u0002\u00d9\u00da\u0007c\u0002",
  1484. "\u0002\u00da\u00db\u0007t\u0002\u0002\u00db\u00dc\u0007g\u0002\u0002",
  1485. "\u00dc \u0003\u0002\u0002\u0002\u00dd\u00de\u0007h\u0002\u0002\u00de",
  1486. "\u00df\u0007c\u0002\u0002\u00df\u00e0\u0007e\u0002\u0002\u00e0\u00e1",
  1487. "\u0007c\u0002\u0002\u00e1\"\u0003\u0002\u0002\u0002\u00e2\u00e3\u0007",
  1488. "g\u0002\u0002\u00e3\u00e4\u0007p\u0002\u0002\u00e4\u00e5\u0007s\u0002",
  1489. "\u0002\u00e5\u00e6\u0007w\u0002\u0002\u00e6\u00e7\u0007c\u0002\u0002",
  1490. "\u00e7\u00e8\u0007p\u0002\u0002\u00e8\u00e9\u0007v\u0002\u0002\u00e9",
  1491. "\u00ea\u0007q\u0002\u0002\u00ea$\u0003\u0002\u0002\u0002\u00eb\u00ec",
  1492. "\u0007u\u0002\u0002\u00ec\u00ed\u0007g\u0002\u0002\u00ed&\u0003\u0002",
  1493. "\u0002\u0002\u00ee\u00ef\u0007u\u0002\u0002\u00ef\u00f0\u0007g\u0002",
  1494. "\u0002\u00f0\u00f1\u0007p\u0002\u0002\u00f1\u00f2\u0007c\u0002\u0002",
  1495. "\u00f2\u00f3\u0007q\u0002\u0002\u00f3(\u0003\u0002\u0002\u0002\u00f4",
  1496. "\u00f5\u0007h\u0002\u0002\u00f5\u00f6\u0007c\u0002\u0002\u00f6\u00f7",
  1497. "\u0007n\u0002\u0002\u00f7\u00f8\u0007u\u0002\u0002\u00f8\u00f9\u0007",
  1498. "q\u0002\u0002\u00f9*\u0003\u0002\u0002\u0002\u00fa\u00fb\u0007x\u0002",
  1499. "\u0002\u00fb\u00fc\u0007g\u0002\u0002\u00fc\u00fd\u0007t\u0002\u0002",
  1500. "\u00fd\u00fe\u0007f\u0002\u0002\u00fe\u00ff\u0007c\u0002\u0002\u00ff",
  1501. "\u0100\u0007f\u0002\u0002\u0100\u0101\u0007g\u0002\u0002\u0101\u0102",
  1502. "\u0007k\u0002\u0002\u0102\u0103\u0007t\u0002\u0002\u0103\u0104\u0007",
  1503. "q\u0002\u0002\u0104,\u0003\u0002\u0002\u0002\u0105\u0106\u0007p\u0002",
  1504. "\u0002\u0106\u0107\u0007c\u0002\u0002\u0107\u0108\u0007q\u0002\u0002",
  1505. "\u0108.\u0003\u0002\u0002\u0002\u0109\u010a\u0007G\u0002\u0002\u010a",
  1506. "0\u0003\u0002\u0002\u0002\u010b\u010c\u0007Q\u0002\u0002\u010c\u010d",
  1507. "\u0007W\u0002\u0002\u010d2\u0003\u0002\u0002\u0002\u010e\u010f\u0007",
  1508. "*\u0002\u0002\u010f4\u0003\u0002\u0002\u0002\u0110\u0111\u0007+\u0002",
  1509. "\u0002\u01116\u0003\u0002\u0002\u0002\u0112\u0113\u0007]\u0002\u0002",
  1510. "\u01138\u0003\u0002\u0002\u0002\u0114\u0115\u0007_\u0002\u0002\u0115",
  1511. ":\u0003\u0002\u0002\u0002\u0116\u0117\u0007}\u0002\u0002\u0117<\u0003",
  1512. "\u0002\u0002\u0002\u0118\u0119\u0007\u007f\u0002\u0002\u0119>\u0003",
  1513. "\u0002\u0002\u0002\u011a\u011b\u0007.\u0002\u0002\u011b@\u0003\u0002",
  1514. "\u0002\u0002\u011c\u011d\u0007?\u0002\u0002\u011dB\u0003\u0002\u0002",
  1515. "\u0002\u011e\u011f\t\u0002\u0002\u0002\u011fD\u0003\u0002\u0002\u0002",
  1516. "\u0120\u0121\t\u0003\u0002\u0002\u0121F\u0003\u0002\u0002\u0002\u0122",
  1517. "\u0123\u0005/\u0018\u0002\u0123H\u0003\u0002\u0002\u0002\u0124\u0125",
  1518. "\u00051\u0019\u0002\u0125J\u0003\u0002\u0002\u0002\u0126\u0127\u0007",
  1519. "@\u0002\u0002\u0127\u0130\u0007?\u0002\u0002\u0128\u0129\u0007?\u0002",
  1520. "\u0002\u0129\u0130\u0007?\u0002\u0002\u012a\u012b\u0007>\u0002\u0002",
  1521. "\u012b\u0130\u0007?\u0002\u0002\u012c\u0130\t\u0004\u0002\u0002\u012d",
  1522. "\u012e\u0007#\u0002\u0002\u012e\u0130\u0007?\u0002\u0002\u012f\u0126",
  1523. "\u0003\u0002\u0002\u0002\u012f\u0128\u0003\u0002\u0002\u0002\u012f\u012a",
  1524. "\u0003\u0002\u0002\u0002\u012f\u012c\u0003\u0002\u0002\u0002\u012f\u012d",
  1525. "\u0003\u0002\u0002\u0002\u0130L\u0003\u0002\u0002\u0002\u0131\u0132",
  1526. "\u0007<\u0002\u0002\u0132N\u0003\u0002\u0002\u0002\u0133\u0134\u0005",
  1527. "-\u0017\u0002\u0134P\u0003\u0002\u0002\u0002\u0135\u0139\t\u0005\u0002",
  1528. "\u0002\u0136\u0138\t\u0006\u0002\u0002\u0137\u0136\u0003\u0002\u0002",
  1529. "\u0002\u0138\u013b\u0003\u0002\u0002\u0002\u0139\u0137\u0003\u0002\u0002",
  1530. "\u0002\u0139\u013a\u0003\u0002\u0002\u0002\u013aR\u0003\u0002\u0002",
  1531. "\u0002\u013b\u0139\u0003\u0002\u0002\u0002\u013c\u013d\u0005Q)\u0002",
  1532. "\u013d\u013e\u00070\u0002\u0002\u013e\u013f\u0005Q)\u0002\u013fT\u0003",
  1533. "\u0002\u0002\u0002\u0140\u0142\t\u0007\u0002\u0002\u0141\u0140\u0003",
  1534. "\u0002\u0002\u0002\u0142\u0143\u0003\u0002\u0002\u0002\u0143\u0141\u0003",
  1535. "\u0002\u0002\u0002\u0143\u0144\u0003\u0002\u0002\u0002\u0144\u015c\u0003",
  1536. "\u0002\u0002\u0002\u0145\u0146\u00072\u0002\u0002\u0146\u014a\u0007",
  1537. "z\u0002\u0002\u0147\u0148\u00072\u0002\u0002\u0148\u014a\u0007Z\u0002",
  1538. "\u0002\u0149\u0145\u0003\u0002\u0002\u0002\u0149\u0147\u0003\u0002\u0002",
  1539. "\u0002\u014a\u014c\u0003\u0002\u0002\u0002\u014b\u014d\u0005g4\u0002",
  1540. "\u014c\u014b\u0003\u0002\u0002\u0002\u014d\u014e\u0003\u0002\u0002\u0002",
  1541. "\u014e\u014c\u0003\u0002\u0002\u0002\u014e\u014f\u0003\u0002\u0002\u0002",
  1542. "\u014f\u015c\u0003\u0002\u0002\u0002\u0150\u0151\u00072\u0002\u0002",
  1543. "\u0151\u0155\u0007d\u0002\u0002\u0152\u0153\u00072\u0002\u0002\u0153",
  1544. "\u0155\u0007D\u0002\u0002\u0154\u0150\u0003\u0002\u0002\u0002\u0154",
  1545. "\u0152\u0003\u0002\u0002\u0002\u0155\u0157\u0003\u0002\u0002\u0002\u0156",
  1546. "\u0158\t\b\u0002\u0002\u0157\u0156\u0003\u0002\u0002\u0002\u0158\u0159",
  1547. "\u0003\u0002\u0002\u0002\u0159\u0157\u0003\u0002\u0002\u0002\u0159\u015a",
  1548. "\u0003\u0002\u0002\u0002\u015a\u015c\u0003\u0002\u0002\u0002\u015b\u0141",
  1549. "\u0003\u0002\u0002\u0002\u015b\u0149\u0003\u0002\u0002\u0002\u015b\u0154",
  1550. "\u0003\u0002\u0002\u0002\u015cV\u0003\u0002\u0002\u0002\u015d\u015f",
  1551. "\t\u0007\u0002\u0002\u015e\u015d\u0003\u0002\u0002\u0002\u015f\u0160",
  1552. "\u0003\u0002\u0002\u0002\u0160\u015e\u0003\u0002\u0002\u0002\u0160\u0161",
  1553. "\u0003\u0002\u0002\u0002\u0161\u0162\u0003\u0002\u0002\u0002\u0162\u0164",
  1554. "\u00070\u0002\u0002\u0163\u0165\t\u0007\u0002\u0002\u0164\u0163\u0003",
  1555. "\u0002\u0002\u0002\u0165\u0166\u0003\u0002\u0002\u0002\u0166\u0164\u0003",
  1556. "\u0002\u0002\u0002\u0166\u0167\u0003\u0002\u0002\u0002\u0167\u0176\u0003",
  1557. "\u0002\u0002\u0002\u0168\u016a\t\u0007\u0002\u0002\u0169\u0168\u0003",
  1558. "\u0002\u0002\u0002\u016a\u016b\u0003\u0002\u0002\u0002\u016b\u0169\u0003",
  1559. "\u0002\u0002\u0002\u016b\u016c\u0003\u0002\u0002\u0002\u016c\u016d\u0003",
  1560. "\u0002\u0002\u0002\u016d\u0171\u00070\u0002\u0002\u016e\u0170\t\u0007",
  1561. "\u0002\u0002\u016f\u016e\u0003\u0002\u0002\u0002\u0170\u0173\u0003\u0002",
  1562. "\u0002\u0002\u0171\u016f\u0003\u0002\u0002\u0002\u0171\u0172\u0003\u0002",
  1563. "\u0002\u0002\u0172\u0174\u0003\u0002\u0002\u0002\u0173\u0171\u0003\u0002",
  1564. "\u0002\u0002\u0174\u0176\u0005Y-\u0002\u0175\u015e\u0003\u0002\u0002",
  1565. "\u0002\u0175\u0169\u0003\u0002\u0002\u0002\u0176X\u0003\u0002\u0002",
  1566. "\u0002\u0177\u0179\t\t\u0002\u0002\u0178\u017a\t\u0002\u0002\u0002\u0179",
  1567. "\u0178\u0003\u0002\u0002\u0002\u0179\u017a\u0003\u0002\u0002\u0002\u017a",
  1568. "\u017c\u0003\u0002\u0002\u0002\u017b\u017d\t\u0007\u0002\u0002\u017c",
  1569. "\u017b\u0003\u0002\u0002\u0002\u017d\u017e\u0003\u0002\u0002\u0002\u017e",
  1570. "\u017c\u0003\u0002\u0002\u0002\u017e\u017f\u0003\u0002\u0002\u0002\u017f",
  1571. "Z\u0003\u0002\u0002\u0002\u0180\u0184\u0007$\u0002\u0002\u0181\u0183",
  1572. "\u0005]/\u0002\u0182\u0181\u0003\u0002\u0002\u0002\u0183\u0186\u0003",
  1573. "\u0002\u0002\u0002\u0184\u0182\u0003\u0002\u0002\u0002\u0184\u0185\u0003",
  1574. "\u0002\u0002\u0002\u0185\u0187\u0003\u0002\u0002\u0002\u0186\u0184\u0003",
  1575. "\u0002\u0002\u0002\u0187\u0188\u0007$\u0002\u0002\u0188\\\u0003\u0002",
  1576. "\u0002\u0002\u0189\u018c\n\n\u0002\u0002\u018a\u018c\u0005k6\u0002\u018b",
  1577. "\u0189\u0003\u0002\u0002\u0002\u018b\u018a\u0003\u0002\u0002\u0002\u018c",
  1578. "^\u0003\u0002\u0002\u0002\u018d\u0190\u0007)\u0002\u0002\u018e\u0191",
  1579. "\u0005k6\u0002\u018f\u0191\n\u000b\u0002\u0002\u0190\u018e\u0003\u0002",
  1580. "\u0002\u0002\u0190\u018f\u0003\u0002\u0002\u0002\u0191\u0192\u0003\u0002",
  1581. "\u0002\u0002\u0192\u0193\u0007)\u0002\u0002\u0193`\u0003\u0002\u0002",
  1582. "\u0002\u0194\u0195\t\f\u0002\u0002\u0195\u0196\u0003\u0002\u0002\u0002",
  1583. "\u0196\u0197\b1\u0002\u0002\u0197b\u0003\u0002\u0002\u0002\u0198\u0199",
  1584. "\u0007=\u0002\u0002\u0199d\u0003\u0002\u0002\u0002\u019a\u019c\t\r\u0002",
  1585. "\u0002\u019b\u019a\u0003\u0002\u0002\u0002\u019c\u019d\u0003\u0002\u0002",
  1586. "\u0002\u019d\u019b\u0003\u0002\u0002\u0002\u019d\u019e\u0003\u0002\u0002",
  1587. "\u0002\u019e\u01a1\u0003\u0002\u0002\u0002\u019f\u01a1\u0005c2\u0002",
  1588. "\u01a0\u019b\u0003\u0002\u0002\u0002\u01a0\u019f\u0003\u0002\u0002\u0002",
  1589. "\u01a1f\u0003\u0002\u0002\u0002\u01a2\u01a3\t\u000e\u0002\u0002\u01a3",
  1590. "h\u0003\u0002\u0002\u0002\u01a4\u01a5\t\u000f\u0002\u0002\u01a5j\u0003",
  1591. "\u0002\u0002\u0002\u01a6\u01a7\u0007^\u0002\u0002\u01a7\u01ab\t\u0010",
  1592. "\u0002\u0002\u01a8\u01ab\u0005o8\u0002\u01a9\u01ab\u0005m7\u0002\u01aa",
  1593. "\u01a6\u0003\u0002\u0002\u0002\u01aa\u01a8\u0003\u0002\u0002\u0002\u01aa",
  1594. "\u01a9\u0003\u0002\u0002\u0002\u01abl\u0003\u0002\u0002\u0002\u01ac",
  1595. "\u01ad\u0007^\u0002\u0002\u01ad\u01ae\t\u0011\u0002\u0002\u01ae\u01af",
  1596. "\u0005i5\u0002\u01af\u01b0\u0005i5\u0002\u01b0\u01b8\u0003\u0002\u0002",
  1597. "\u0002\u01b1\u01b2\u0007^\u0002\u0002\u01b2\u01b3\u0005i5\u0002\u01b3",
  1598. "\u01b4\u0005i5\u0002\u01b4\u01b8\u0003\u0002\u0002\u0002\u01b5\u01b6",
  1599. "\u0007^\u0002\u0002\u01b6\u01b8\u0005i5\u0002\u01b7\u01ac\u0003\u0002",
  1600. "\u0002\u0002\u01b7\u01b1\u0003\u0002\u0002\u0002\u01b7\u01b5\u0003\u0002",
  1601. "\u0002\u0002\u01b8n\u0003\u0002\u0002\u0002\u01b9\u01ba\u0007^\u0002",
  1602. "\u0002\u01ba\u01bb\u0007w\u0002\u0002\u01bb\u01bc\u0005g4\u0002\u01bc",
  1603. "\u01bd\u0005g4\u0002\u01bd\u01be\u0005g4\u0002\u01be\u01bf\u0005g4\u0002",
  1604. "\u01bfp\u0003\u0002\u0002\u0002\u01c0\u01c1\u00071\u0002\u0002\u01c1",
  1605. "\u01c2\u00071\u0002\u0002\u01c2\u01c6\u0003\u0002\u0002\u0002\u01c3",
  1606. "\u01c5\n\r\u0002\u0002\u01c4\u01c3\u0003\u0002\u0002\u0002\u01c5\u01c8",
  1607. "\u0003\u0002\u0002\u0002\u01c6\u01c4\u0003\u0002\u0002\u0002\u01c6\u01c7",
  1608. "\u0003\u0002\u0002\u0002\u01c7\u01ca\u0003\u0002\u0002\u0002\u01c8\u01c6",
  1609. "\u0003\u0002\u0002\u0002\u01c9\u01cb\u0007\u000f\u0002\u0002\u01ca\u01c9",
  1610. "\u0003\u0002\u0002\u0002\u01ca\u01cb\u0003\u0002\u0002\u0002\u01cb\u01cc",
  1611. "\u0003\u0002\u0002\u0002\u01cc\u01d9\u0007\f\u0002\u0002\u01cd\u01ce",
  1612. "\u00071\u0002\u0002\u01ce\u01cf\u0007,\u0002\u0002\u01cf\u01d3\u0003",
  1613. "\u0002\u0002\u0002\u01d0\u01d2\u000b\u0002\u0002\u0002\u01d1\u01d0\u0003",
  1614. "\u0002\u0002\u0002\u01d2\u01d5\u0003\u0002\u0002\u0002\u01d3\u01d4\u0003",
  1615. "\u0002\u0002\u0002\u01d3\u01d1\u0003\u0002\u0002\u0002\u01d4\u01d6\u0003",
  1616. "\u0002\u0002\u0002\u01d5\u01d3\u0003\u0002\u0002\u0002\u01d6\u01d7\u0007",
  1617. ",\u0002\u0002\u01d7\u01d9\u00071\u0002\u0002\u01d8\u01c0\u0003\u0002",
  1618. "\u0002\u0002\u01d8\u01cd\u0003\u0002\u0002\u0002\u01d9\u01da\u0003\u0002",
  1619. "\u0002\u0002\u01da\u01db\b9\u0003\u0002\u01dbr\u0003\u0002\u0002\u0002",
  1620. "\u001d\u0002\u012f\u0139\u0143\u0149\u014e\u0154\u0159\u015b\u0160\u0166",
  1621. "\u016b\u0171\u0175\u0179\u017e\u0184\u018b\u0190\u019d\u01a0\u01aa\u01b7",
  1622. "\u01c6\u01ca\u01d3\u01d8\u0004\b\u0002\u0002\u0002\u0003\u0002"].join("");
  1623. var atn = new antlr4.atn.ATNDeserializer().deserialize(serializedATN);
  1624. var decisionsToDFA = atn.decisionToState.map( function(ds, index) { return new antlr4.dfa.DFA(ds, index); });
  1625. function ivprog(input) {
  1626. antlr4.Lexer.call(this, input);
  1627. this._interp = new antlr4.atn.LexerATNSimulator(this, atn, decisionsToDFA, new antlr4.PredictionContextCache());
  1628. return this;
  1629. }
  1630. ivprog.prototype = Object.create(antlr4.Lexer.prototype);
  1631. ivprog.prototype.constructor = ivprog;
  1632. ivprog.EOF = antlr4.Token.EOF;
  1633. ivprog.RK_PROGRAM = 1;
  1634. ivprog.RK_REAL = 2;
  1635. ivprog.RK_VOID = 3;
  1636. ivprog.RK_BOOLEAN = 4;
  1637. ivprog.RK_STRING = 5;
  1638. ivprog.RK_INTEGER = 6;
  1639. ivprog.RK_CHARACTER = 7;
  1640. ivprog.RK_SWITCH = 8;
  1641. ivprog.RK_CASE = 9;
  1642. ivprog.RK_DEFAULT = 10;
  1643. ivprog.RK_CONST = 11;
  1644. ivprog.RK_FUNCTION = 12;
  1645. ivprog.RK_RETURN = 13;
  1646. ivprog.RK_FOR = 14;
  1647. ivprog.RK_BREAK = 15;
  1648. ivprog.RK_DO = 16;
  1649. ivprog.RK_WHILE = 17;
  1650. ivprog.RK_IF = 18;
  1651. ivprog.RK_ELSE = 19;
  1652. ivprog.RK_FALSE = 20;
  1653. ivprog.RK_TRUE = 21;
  1654. ivprog.OPEN_PARENTHESIS = 22;
  1655. ivprog.CLOSE_PARENTHESIS = 23;
  1656. ivprog.OPEN_BRACE = 24;
  1657. ivprog.CLOSE_BRACE = 25;
  1658. ivprog.OPEN_CURLY = 26;
  1659. ivprog.CLOSE_CURLY = 27;
  1660. ivprog.COMMA = 28;
  1661. ivprog.EQUAL = 29;
  1662. ivprog.SUM_OP = 30;
  1663. ivprog.MULTI_OP = 31;
  1664. ivprog.AND_OPERATOR = 32;
  1665. ivprog.OR_OPERATOR = 33;
  1666. ivprog.RELATIONAL_OPERATOR = 34;
  1667. ivprog.COLON = 35;
  1668. ivprog.NOT_OPERATOR = 36;
  1669. ivprog.ID = 37;
  1670. ivprog.LIB_ID = 38;
  1671. ivprog.INTEGER = 39;
  1672. ivprog.REAL = 40;
  1673. ivprog.STRING = 41;
  1674. ivprog.CHARACTER = 42;
  1675. ivprog.WHITESPACE = 43;
  1676. ivprog.EOS = 44;
  1677. ivprog.COMMENTS = 45;
  1678. ivprog.prototype.channelNames = [ "DEFAULT_TOKEN_CHANNEL", "HIDDEN" ];
  1679. ivprog.prototype.modeNames = [ "DEFAULT_MODE" ];
  1680. ivprog.prototype.literalNames = [ null, "'programa'", "'real'", "'vazio'",
  1681. "'logico'", "'cadeia'", "'inteiro'", "'caractere'",
  1682. "'escolha'", "'caso'", "'contrario'",
  1683. "'const'", "'funcao'", "'retorne'", "'para'",
  1684. "'pare'", "'faca'", "'enquanto'", "'se'",
  1685. "'senao'", "'falso'", "'verdadeiro'",
  1686. "'('", "')'", "'['", "']'", "'{'", "'}'",
  1687. "','", "'='", null, null, null, null,
  1688. null, "':'" ];
  1689. ivprog.prototype.symbolicNames = [ null, "RK_PROGRAM", "RK_REAL", "RK_VOID",
  1690. "RK_BOOLEAN", "RK_STRING", "RK_INTEGER",
  1691. "RK_CHARACTER", "RK_SWITCH", "RK_CASE",
  1692. "RK_DEFAULT", "RK_CONST", "RK_FUNCTION",
  1693. "RK_RETURN", "RK_FOR", "RK_BREAK", "RK_DO",
  1694. "RK_WHILE", "RK_IF", "RK_ELSE", "RK_FALSE",
  1695. "RK_TRUE", "OPEN_PARENTHESIS", "CLOSE_PARENTHESIS",
  1696. "OPEN_BRACE", "CLOSE_BRACE", "OPEN_CURLY",
  1697. "CLOSE_CURLY", "COMMA", "EQUAL", "SUM_OP",
  1698. "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  1699. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  1700. "ID", "LIB_ID", "INTEGER", "REAL", "STRING",
  1701. "CHARACTER", "WHITESPACE", "EOS", "COMMENTS" ];
  1702. ivprog.prototype.ruleNames = [ "RK_PROGRAM", "RK_REAL", "RK_VOID", "RK_BOOLEAN",
  1703. "RK_STRING", "RK_INTEGER", "RK_CHARACTER",
  1704. "RK_SWITCH", "RK_CASE", "RK_DEFAULT", "RK_CONST",
  1705. "RK_FUNCTION", "RK_RETURN", "RK_FOR", "RK_BREAK",
  1706. "RK_DO", "RK_WHILE", "RK_IF", "RK_ELSE",
  1707. "RK_FALSE", "RK_TRUE", "RK_LOGICAL_NOT",
  1708. "RK_LOGICAL_AND", "RK_LOGICAL_OR", "OPEN_PARENTHESIS",
  1709. "CLOSE_PARENTHESIS", "OPEN_BRACE", "CLOSE_BRACE",
  1710. "OPEN_CURLY", "CLOSE_CURLY", "COMMA", "EQUAL",
  1711. "SUM_OP", "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  1712. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  1713. "ID", "LIB_ID", "INTEGER", "REAL", "ExponentPart",
  1714. "STRING", "STRING_CHARACTER", "CHARACTER",
  1715. "WHITESPACE", "SEMICOLON", "EOS", "HEX_DIGIT",
  1716. "OCTAL_DIGIT", "ESC_SEQ", "ESC_OCTAL", "ESC_UNICODE",
  1717. "COMMENTS" ];
  1718. ivprog.prototype.grammarFileName = "ivprog.g4";
  1719. exports.ivprog = ivprog;
  1720. /***/ }),
  1721. /* 1 */
  1722. /***/ (function(module, exports, __webpack_require__) {
  1723. module.exports = {
  1724. ivprog: __webpack_require__(0).ivprog
  1725. };
  1726. /***/ }),
  1727. /* 2 */
  1728. /***/ (function(module, exports) {
  1729. module.exports = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js");
  1730. /***/ })
  1731. /******/ ]);
  1732. /***/ }),
  1733. /***/ "./grammar/pt/langFunctions.js":
  1734. /*!*************************************!*\
  1735. !*** ./grammar/pt/langFunctions.js ***!
  1736. \*************************************/
  1737. /*! no static exports found */
  1738. /***/ (function(module, exports, __webpack_require__) {
  1739. "use strict";
  1740. Object.defineProperty(exports, "__esModule", {
  1741. value: true
  1742. });
  1743. /* This is a dictionary of the language defined functions
  1744. **/
  1745. exports.default = {
  1746. main_function: "inicio",
  1747. $read: "leia",
  1748. $write: "escreva",
  1749. $numElements: "numero_elementos",
  1750. $matrixLines: "matriz_linhas",
  1751. $matrixColumns: "matriz_colunas",
  1752. $substring: "subcadeia",
  1753. $length: "comprimento",
  1754. $uppercase: "caixa_alta",
  1755. $lowercase: "caixa_baixa",
  1756. $charAt: "char_at",
  1757. $isReal: "e_real",
  1758. $isInt: "e_inteiro",
  1759. $isBool: "e_logico",
  1760. $castReal: "como_real",
  1761. $castInt: "como_inteiro",
  1762. $castBool: "como_logico",
  1763. $castString: "como_cadeia",
  1764. $sin: "seno",
  1765. $cos: "cosseno",
  1766. $tan: "tangente",
  1767. $sqrt: "raiz_quadrada",
  1768. $pow: "potencia",
  1769. $log: "logaritmo",
  1770. $abs: "modulo",
  1771. $negate: "trocar_sinal",
  1772. $invert: "inverter_valor",
  1773. $max: "maximo",
  1774. $min: "minimo"
  1775. };
  1776. /***/ }),
  1777. /***/ "./grammar/pt/langLibs.js":
  1778. /*!********************************!*\
  1779. !*** ./grammar/pt/langLibs.js ***!
  1780. \********************************/
  1781. /*! no static exports found */
  1782. /***/ (function(module, exports, __webpack_require__) {
  1783. "use strict";
  1784. Object.defineProperty(exports, "__esModule", {
  1785. value: true
  1786. });
  1787. /**
  1788. * This is the dictionary of the language defined libraries
  1789. */
  1790. exports.default = {
  1791. $mathLib: "Matematica",
  1792. $ioLib: "ES",
  1793. $strLib: "Texto",
  1794. $arrayLib: "Arranjo",
  1795. $langLib: "IV"
  1796. };
  1797. /***/ }),
  1798. /***/ "./i18n/en/error.json":
  1799. /*!****************************!*\
  1800. !*** ./i18n/en/error.json ***!
  1801. \****************************/
  1802. /*! 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, id_missing, main_missing, invalid_global_var, not_implemented, function_missing, invalid_parameters_size, invalid_ref, invalid_parameter_type, unknown_command, loop_condition_type, if_condition_type, invalid_return_type, unexpected_break_command, invalid_dimension, void_in_expression, invalid_array, invalid_array_access, column_outbounds, line_outbounds, invalid_infix_op, invalid_unary_op, unknown_op, default */
  1803. /***/ (function(module) {
  1804. 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.","id_missing":"Esperava-se um identificador, mas encontrou-se $0 na linha: $1, coluna: $2","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","invalid_parameters_size":"A quantidade de parâmetros fornecidos está incorreta. Esperava-se $0, encontrou-se $1","invalid_ref":"Você deve fornecer apenas um identificador como parâmetro","invalid_parameter_type":"O valor fornecido como parâmetro é do tipo $0, mas o tipo esperado é $1","unknown_command":"Erro interno crítico: Comando desconhecido encontrado","loop_condition_type":"A condição dos laços de repetição deve ser do tipo lógico","if_condition_type":"A condição de um comando se...senao deve ser do tipo lógico","invalid_return_type":"A função $0 deve retornar um tipo $1, ao invés de $1","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":"A função $0 não pode ser utilizada aqui pois seu tipo de retorno é vazio","invalid_array":"Expressão literal de Vetor/Mariz inválida","invalid_array_access":"Identificador $0 não se refere a um vetor/matriz válido","column_outbounds":"Número de colunas $0 é inválido para a matriz $1 que possui $2 colunas","line_outbounds":"Número de linhas $0 é invaálido para a matriz $1 que possui $2 linhas","invalid_infix_op":"Não é possível aplicar a operação $0 entre os tipos $1 e $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"};
  1805. /***/ }),
  1806. /***/ "./i18n/en/index.js":
  1807. /*!**************************!*\
  1808. !*** ./i18n/en/index.js ***!
  1809. \**************************/
  1810. /*! no static exports found */
  1811. /***/ (function(module, exports, __webpack_require__) {
  1812. "use strict";
  1813. Object.defineProperty(exports, "__esModule", {
  1814. value: true
  1815. });
  1816. var _error = __webpack_require__(/*! ./error.json */ "./i18n/en/error.json");
  1817. var _error2 = _interopRequireDefault(_error);
  1818. var _message = __webpack_require__(/*! ./message.json */ "./i18n/en/message.json");
  1819. var _message2 = _interopRequireDefault(_message);
  1820. var _ui = __webpack_require__(/*! ./ui.json */ "./i18n/en/ui.json");
  1821. var _ui2 = _interopRequireDefault(_ui);
  1822. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1823. exports.default = {
  1824. 'message': _message2.default,
  1825. 'error': _error2.default,
  1826. 'ui': _ui2.default
  1827. };
  1828. /***/ }),
  1829. /***/ "./i18n/en/message.json":
  1830. /*!******************************!*\
  1831. !*** ./i18n/en/message.json ***!
  1832. \******************************/
  1833. /*! exports provided: default */
  1834. /***/ (function(module) {
  1835. module.exports = {};
  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, 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, arrangement, conversion, $sin, $cos, $tan, $sqrt, $pow, $log, $abs, $negate, $invert, $max, $min, $substring, $length, $uppercase, $lowercase, $charAt, 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":"Arithmetic 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","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":"Select an expression","math":"Mathematic","text_t":"Text","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"};
  1844. /***/ }),
  1845. /***/ "./i18n/es/error.json":
  1846. /*!****************************!*\
  1847. !*** ./i18n/es/error.json ***!
  1848. \****************************/
  1849. /*! exports provided: default */
  1850. /***/ (function(module) {
  1851. module.exports = {};
  1852. /***/ }),
  1853. /***/ "./i18n/es/index.js":
  1854. /*!**************************!*\
  1855. !*** ./i18n/es/index.js ***!
  1856. \**************************/
  1857. /*! no static exports found */
  1858. /***/ (function(module, exports, __webpack_require__) {
  1859. "use strict";
  1860. Object.defineProperty(exports, "__esModule", {
  1861. value: true
  1862. });
  1863. var _error = __webpack_require__(/*! ./error.json */ "./i18n/es/error.json");
  1864. var _error2 = _interopRequireDefault(_error);
  1865. var _message = __webpack_require__(/*! ./message.json */ "./i18n/es/message.json");
  1866. var _message2 = _interopRequireDefault(_message);
  1867. var _ui = __webpack_require__(/*! ./ui.json */ "./i18n/es/ui.json");
  1868. var _ui2 = _interopRequireDefault(_ui);
  1869. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1870. exports.default = {
  1871. 'message': _message2.default,
  1872. 'error': _error2.default,
  1873. 'ui': _ui2.default
  1874. };
  1875. /***/ }),
  1876. /***/ "./i18n/es/message.json":
  1877. /*!******************************!*\
  1878. !*** ./i18n/es/message.json ***!
  1879. \******************************/
  1880. /*! exports provided: default */
  1881. /***/ (function(module) {
  1882. module.exports = {};
  1883. /***/ }),
  1884. /***/ "./i18n/es/ui.json":
  1885. /*!*************************!*\
  1886. !*** ./i18n/es/ui.json ***!
  1887. \*************************/
  1888. /*! 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_break, text_else, text_return, text_btn_return, 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, 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, $sin, math, arrangement, conversion, text_t, $cos, $tan, $sqrt, $pow, $log, $abs, $negate, $invert, $max, $min, $substring, $length, $uppercase, $lowercase, $charAt, default */
  1889. /***/ (function(module) {
  1890. 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":"Text","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_break":"break","text_else":"else","text_return":"return","text_btn_return":"Return","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":"Arithmetic Expression","text_iftrue":"If true then","text_repeatNtimes":"Repeat N times","text_receives":"receives","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":"Mathematics","text_menu_functions_text":"Text","text_menu_functions_arrangement":"Arrangement","text_menu_functions_conversion":"Conversion","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":"Select an expression","$sin":"sin","math":"Mathematic","arrangement":"Arrangement","conversion":"Conversion","text_t":"Text","$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"};
  1891. /***/ }),
  1892. /***/ "./i18n/index.js":
  1893. /*!***********************!*\
  1894. !*** ./i18n/index.js ***!
  1895. \***********************/
  1896. /*! no static exports found */
  1897. /***/ (function(module, exports, __webpack_require__) {
  1898. "use strict";
  1899. Object.defineProperty(exports, "__esModule", {
  1900. value: true
  1901. });
  1902. var _en = __webpack_require__(/*! ./en */ "./i18n/en/index.js");
  1903. var _en2 = _interopRequireDefault(_en);
  1904. var _pt = __webpack_require__(/*! ./pt */ "./i18n/pt/index.js");
  1905. var _pt2 = _interopRequireDefault(_pt);
  1906. var _es = __webpack_require__(/*! ./es */ "./i18n/es/index.js");
  1907. var _es2 = _interopRequireDefault(_es);
  1908. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1909. exports.default = {
  1910. 'en': _en2.default,
  1911. 'pt': _pt2.default,
  1912. 'es': _es2.default
  1913. };
  1914. /***/ }),
  1915. /***/ "./i18n/pt/error.json":
  1916. /*!****************************!*\
  1917. !*** ./i18n/pt/error.json ***!
  1918. \****************************/
  1919. /*! 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, default */
  1920. /***/ (function(module) {
  1921. 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 dos laços de repetição deve ser do tipo lógico","loop_condition_type":"A condição dos laços 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 do comando para(...) deve ser do tipo lógico","for_condition_type":"A condição de parada do comando para(...) deve ser do tipo lógico","if_condition_type_full":"Erro na linha: $0, coluna $1: a condição de um comando se...senao deve ser do tipo lógico","if_condition_type":"A condição de um 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."};
  1922. /***/ }),
  1923. /***/ "./i18n/pt/index.js":
  1924. /*!**************************!*\
  1925. !*** ./i18n/pt/index.js ***!
  1926. \**************************/
  1927. /*! no static exports found */
  1928. /***/ (function(module, exports, __webpack_require__) {
  1929. "use strict";
  1930. Object.defineProperty(exports, "__esModule", {
  1931. value: true
  1932. });
  1933. var _error = __webpack_require__(/*! ./error.json */ "./i18n/pt/error.json");
  1934. var _error2 = _interopRequireDefault(_error);
  1935. var _message = __webpack_require__(/*! ./message.json */ "./i18n/pt/message.json");
  1936. var _message2 = _interopRequireDefault(_message);
  1937. var _ui = __webpack_require__(/*! ./ui.json */ "./i18n/pt/ui.json");
  1938. var _ui2 = _interopRequireDefault(_ui);
  1939. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1940. exports.default = {
  1941. 'message': _message2.default,
  1942. 'error': _error2.default,
  1943. 'ui': _ui2.default
  1944. };
  1945. /***/ }),
  1946. /***/ "./i18n/pt/message.json":
  1947. /*!******************************!*\
  1948. !*** ./i18n/pt/message.json ***!
  1949. \******************************/
  1950. /*! exports provided: default */
  1951. /***/ (function(module) {
  1952. module.exports = {};
  1953. /***/ }),
  1954. /***/ "./i18n/pt/ui.json":
  1955. /*!*************************!*\
  1956. !*** ./i18n/pt/ui.json ***!
  1957. \*************************/
  1958. /*! 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, 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, $sin, math, text_t, arrangement, conversion, $cos, $tan, $sqrt, $pow, $log, $abs, $negate, $invert, $max, $min, $substring, $length, $uppercase, $lowercase, $charAt, default */
  1959. /***/ (function(module) {
  1960. 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 Aritmética","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","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":"Selecione uma expressão","$sin":"seno","math":"Matematica","text_t":"Texto","arrangement":"Arranjo","conversion":"Conversao","$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"};
  1961. /***/ }),
  1962. /***/ "./js/Sortable.js":
  1963. /*!************************!*\
  1964. !*** ./js/Sortable.js ***!
  1965. \************************/
  1966. /*! no static exports found */
  1967. /***/ (function(module, exports, __webpack_require__) {
  1968. "use strict";
  1969. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;
  1970. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  1971. /**!
  1972. * Sortable
  1973. * @author RubaXa <trash@rubaxa.org>
  1974. * @license MIT
  1975. */
  1976. (function sortableModule(factory) {
  1977. "use strict";
  1978. if (true) {
  1979. !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  1980. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  1981. (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
  1982. __WEBPACK_AMD_DEFINE_FACTORY__),
  1983. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  1984. } else {}
  1985. })(function sortableFactory() {
  1986. "use strict";
  1987. if (typeof window == "undefined" || !window.document) {
  1988. return function sortableError() {
  1989. throw new Error("Sortable.js requires a window with a document");
  1990. };
  1991. }
  1992. var dragEl,
  1993. parentEl,
  1994. ghostEl,
  1995. cloneEl,
  1996. rootEl,
  1997. nextEl,
  1998. lastDownEl,
  1999. scrollEl,
  2000. scrollParentEl,
  2001. scrollCustomFn,
  2002. lastEl,
  2003. lastCSS,
  2004. lastParentCSS,
  2005. oldIndex,
  2006. newIndex,
  2007. activeGroup,
  2008. putSortable,
  2009. autoScroll = {},
  2010. tapEvt,
  2011. touchEvt,
  2012. moved,
  2013. /** @const */
  2014. R_SPACE = /\s+/g,
  2015. R_FLOAT = /left|right|inline/,
  2016. expando = 'Sortable' + new Date().getTime(),
  2017. win = window,
  2018. document = win.document,
  2019. parseInt = win.parseInt,
  2020. $ = win.jQuery || win.Zepto,
  2021. Polymer = win.Polymer,
  2022. captureMode = false,
  2023. supportDraggable = !!('draggable' in document.createElement('div')),
  2024. supportCssPointerEvents = function (el) {
  2025. // false when IE11
  2026. if (!!navigator.userAgent.match(/Trident.*rv[ :]?11\./)) {
  2027. return false;
  2028. }
  2029. el = document.createElement('x');
  2030. el.style.cssText = 'pointer-events:auto';
  2031. return el.style.pointerEvents === 'auto';
  2032. }(),
  2033. _silent = false,
  2034. abs = Math.abs,
  2035. min = Math.min,
  2036. savedInputChecked = [],
  2037. touchDragOverListeners = [],
  2038. _autoScroll = _throttle(function ( /**Event*/evt, /**Object*/options, /**HTMLElement*/rootEl) {
  2039. // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=505521
  2040. if (rootEl && options.scroll) {
  2041. var _this = rootEl[expando],
  2042. el,
  2043. rect,
  2044. sens = options.scrollSensitivity,
  2045. speed = options.scrollSpeed,
  2046. x = evt.clientX,
  2047. y = evt.clientY,
  2048. winWidth = window.innerWidth,
  2049. winHeight = window.innerHeight,
  2050. vx,
  2051. vy,
  2052. scrollOffsetX,
  2053. scrollOffsetY;
  2054. // Delect scrollEl
  2055. if (scrollParentEl !== rootEl) {
  2056. scrollEl = options.scroll;
  2057. scrollParentEl = rootEl;
  2058. scrollCustomFn = options.scrollFn;
  2059. if (scrollEl === true) {
  2060. scrollEl = rootEl;
  2061. do {
  2062. if (scrollEl.offsetWidth < scrollEl.scrollWidth || scrollEl.offsetHeight < scrollEl.scrollHeight) {
  2063. break;
  2064. }
  2065. /* jshint boss:true */
  2066. } while (scrollEl = scrollEl.parentNode);
  2067. }
  2068. }
  2069. if (scrollEl) {
  2070. el = scrollEl;
  2071. rect = scrollEl.getBoundingClientRect();
  2072. vx = (abs(rect.right - x) <= sens) - (abs(rect.left - x) <= sens);
  2073. vy = (abs(rect.bottom - y) <= sens) - (abs(rect.top - y) <= sens);
  2074. }
  2075. if (!(vx || vy)) {
  2076. vx = (winWidth - x <= sens) - (x <= sens);
  2077. vy = (winHeight - y <= sens) - (y <= sens);
  2078. /* jshint expr:true */
  2079. (vx || vy) && (el = win);
  2080. }
  2081. if (autoScroll.vx !== vx || autoScroll.vy !== vy || autoScroll.el !== el) {
  2082. autoScroll.el = el;
  2083. autoScroll.vx = vx;
  2084. autoScroll.vy = vy;
  2085. clearInterval(autoScroll.pid);
  2086. if (el) {
  2087. autoScroll.pid = setInterval(function () {
  2088. scrollOffsetY = vy ? vy * speed : 0;
  2089. scrollOffsetX = vx ? vx * speed : 0;
  2090. if ('function' === typeof scrollCustomFn) {
  2091. return scrollCustomFn.call(_this, scrollOffsetX, scrollOffsetY, evt);
  2092. }
  2093. if (el === win) {
  2094. win.scrollTo(win.pageXOffset + scrollOffsetX, win.pageYOffset + scrollOffsetY);
  2095. } else {
  2096. el.scrollTop += scrollOffsetY;
  2097. el.scrollLeft += scrollOffsetX;
  2098. }
  2099. }, 24);
  2100. }
  2101. }
  2102. }
  2103. }, 30),
  2104. _prepareGroup = function _prepareGroup(options) {
  2105. function toFn(value, pull) {
  2106. if (value === void 0 || value === true) {
  2107. value = group.name;
  2108. }
  2109. if (typeof value === 'function') {
  2110. return value;
  2111. } else {
  2112. return function (to, from) {
  2113. var fromGroup = from.options.group.name;
  2114. return pull ? value : value && (value.join ? value.indexOf(fromGroup) > -1 : fromGroup == value);
  2115. };
  2116. }
  2117. }
  2118. var group = {};
  2119. var originalGroup = options.group;
  2120. if (!originalGroup || (typeof originalGroup === "undefined" ? "undefined" : _typeof(originalGroup)) != 'object') {
  2121. originalGroup = { name: originalGroup };
  2122. }
  2123. group.name = originalGroup.name;
  2124. group.checkPull = toFn(originalGroup.pull, true);
  2125. group.checkPut = toFn(originalGroup.put);
  2126. group.revertClone = originalGroup.revertClone;
  2127. options.group = group;
  2128. };
  2129. /**
  2130. * @class Sortable
  2131. * @param {HTMLElement} el
  2132. * @param {Object} [options]
  2133. */
  2134. function Sortable(el, options) {
  2135. if (!(el && el.nodeType && el.nodeType === 1)) {
  2136. throw 'Sortable: `el` must be HTMLElement, and not ' + {}.toString.call(el);
  2137. }
  2138. this.el = el; // root element
  2139. this.options = options = _extend({}, options);
  2140. // Export instance
  2141. el[expando] = this;
  2142. // Default options
  2143. var defaults = {
  2144. group: Math.random(),
  2145. sort: true,
  2146. disabled: false,
  2147. store: null,
  2148. handle: null,
  2149. scroll: true,
  2150. scrollSensitivity: 30,
  2151. scrollSpeed: 10,
  2152. draggable: /[uo]l/i.test(el.nodeName) ? 'li' : '>*',
  2153. ghostClass: 'sortable-ghost',
  2154. chosenClass: 'sortable-chosen',
  2155. dragClass: 'sortable-drag',
  2156. ignore: 'a, img',
  2157. filter: null,
  2158. preventOnFilter: true,
  2159. animation: 0,
  2160. setData: function setData(dataTransfer, dragEl) {
  2161. dataTransfer.setData('Text', dragEl.textContent);
  2162. },
  2163. dropBubble: false,
  2164. dragoverBubble: false,
  2165. dataIdAttr: 'data-id',
  2166. delay: 0,
  2167. forceFallback: false,
  2168. fallbackClass: 'sortable-fallback',
  2169. fallbackOnBody: false,
  2170. fallbackTolerance: 0,
  2171. fallbackOffset: { x: 0, y: 0 }
  2172. };
  2173. // Set default options
  2174. for (var name in defaults) {
  2175. !(name in options) && (options[name] = defaults[name]);
  2176. }
  2177. _prepareGroup(options);
  2178. // Bind all private methods
  2179. for (var fn in this) {
  2180. if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {
  2181. this[fn] = this[fn].bind(this);
  2182. }
  2183. }
  2184. // Setup drag mode
  2185. this.nativeDraggable = options.forceFallback ? false : supportDraggable;
  2186. // Bind events
  2187. _on(el, 'mousedown', this._onTapStart);
  2188. _on(el, 'touchstart', this._onTapStart);
  2189. _on(el, 'pointerdown', this._onTapStart);
  2190. if (this.nativeDraggable) {
  2191. _on(el, 'dragover', this);
  2192. _on(el, 'dragenter', this);
  2193. }
  2194. touchDragOverListeners.push(this._onDragOver);
  2195. // Restore sorting
  2196. options.store && this.sort(options.store.get(this));
  2197. }
  2198. Sortable.prototype = /** @lends Sortable.prototype */{
  2199. constructor: Sortable,
  2200. _onTapStart: function _onTapStart( /** Event|TouchEvent */evt) {
  2201. var _this = this,
  2202. el = this.el,
  2203. options = this.options,
  2204. preventOnFilter = options.preventOnFilter,
  2205. type = evt.type,
  2206. touch = evt.touches && evt.touches[0],
  2207. target = (touch || evt).target,
  2208. originalTarget = evt.target.shadowRoot && evt.path && evt.path[0] || target,
  2209. filter = options.filter,
  2210. startIndex;
  2211. _saveInputCheckedState(el);
  2212. // Don't trigger start event when an element is been dragged, otherwise the evt.oldindex always wrong when set option.group.
  2213. if (dragEl) {
  2214. return;
  2215. }
  2216. if (/mousedown|pointerdown/.test(type) && evt.button !== 0 || options.disabled) {
  2217. return; // only left button or enabled
  2218. }
  2219. target = _closest(target, options.draggable, el);
  2220. if (!target) {
  2221. return;
  2222. }
  2223. if (lastDownEl === target) {
  2224. // Ignoring duplicate `down`
  2225. return;
  2226. }
  2227. // Get the index of the dragged element within its parent
  2228. startIndex = _index(target, options.draggable);
  2229. // Check filter
  2230. if (typeof filter === 'function') {
  2231. if (filter.call(this, evt, target, this)) {
  2232. _dispatchEvent(_this, originalTarget, 'filter', target, el, startIndex);
  2233. preventOnFilter && evt.preventDefault();
  2234. return; // cancel dnd
  2235. }
  2236. } else if (filter) {
  2237. filter = filter.split(',').some(function (criteria) {
  2238. criteria = _closest(originalTarget, criteria.trim(), el);
  2239. if (criteria) {
  2240. _dispatchEvent(_this, criteria, 'filter', target, el, startIndex);
  2241. return true;
  2242. }
  2243. });
  2244. if (filter) {
  2245. preventOnFilter && evt.preventDefault();
  2246. return; // cancel dnd
  2247. }
  2248. }
  2249. if (options.handle && !_closest(originalTarget, options.handle, el)) {
  2250. return;
  2251. }
  2252. // Prepare `dragstart`
  2253. this._prepareDragStart(evt, touch, target, startIndex);
  2254. },
  2255. _prepareDragStart: function _prepareDragStart( /** Event */evt, /** Touch */touch, /** HTMLElement */target, /** Number */startIndex) {
  2256. var _this = this,
  2257. el = _this.el,
  2258. options = _this.options,
  2259. ownerDocument = el.ownerDocument,
  2260. dragStartFn;
  2261. if (target && !dragEl && target.parentNode === el) {
  2262. tapEvt = evt;
  2263. rootEl = el;
  2264. dragEl = target;
  2265. parentEl = dragEl.parentNode;
  2266. nextEl = dragEl.nextSibling;
  2267. lastDownEl = target;
  2268. activeGroup = options.group;
  2269. oldIndex = startIndex;
  2270. this._lastX = (touch || evt).clientX;
  2271. this._lastY = (touch || evt).clientY;
  2272. dragEl.style['will-change'] = 'transform';
  2273. dragStartFn = function dragStartFn() {
  2274. // Delayed drag has been triggered
  2275. // we can re-enable the events: touchmove/mousemove
  2276. _this._disableDelayedDrag();
  2277. // Make the element draggable
  2278. dragEl.draggable = _this.nativeDraggable;
  2279. // Chosen item
  2280. _toggleClass(dragEl, options.chosenClass, true);
  2281. // Bind the events: dragstart/dragend
  2282. _this._triggerDragStart(evt, touch);
  2283. // Drag start event
  2284. _dispatchEvent(_this, rootEl, 'choose', dragEl, rootEl, oldIndex);
  2285. };
  2286. // Disable "draggable"
  2287. options.ignore.split(',').forEach(function (criteria) {
  2288. _find(dragEl, criteria.trim(), _disableDraggable);
  2289. });
  2290. _on(ownerDocument, 'mouseup', _this._onDrop);
  2291. _on(ownerDocument, 'touchend', _this._onDrop);
  2292. _on(ownerDocument, 'touchcancel', _this._onDrop);
  2293. _on(ownerDocument, 'pointercancel', _this._onDrop);
  2294. _on(ownerDocument, 'selectstart', _this);
  2295. if (options.delay) {
  2296. // If the user moves the pointer or let go the click or touch
  2297. // before the delay has been reached:
  2298. // disable the delayed drag
  2299. _on(ownerDocument, 'mouseup', _this._disableDelayedDrag);
  2300. _on(ownerDocument, 'touchend', _this._disableDelayedDrag);
  2301. _on(ownerDocument, 'touchcancel', _this._disableDelayedDrag);
  2302. _on(ownerDocument, 'mousemove', _this._disableDelayedDrag);
  2303. _on(ownerDocument, 'touchmove', _this._disableDelayedDrag);
  2304. _on(ownerDocument, 'pointermove', _this._disableDelayedDrag);
  2305. _this._dragStartTimer = setTimeout(dragStartFn, options.delay);
  2306. } else {
  2307. dragStartFn();
  2308. }
  2309. }
  2310. },
  2311. _disableDelayedDrag: function _disableDelayedDrag() {
  2312. var ownerDocument = this.el.ownerDocument;
  2313. clearTimeout(this._dragStartTimer);
  2314. _off(ownerDocument, 'mouseup', this._disableDelayedDrag);
  2315. _off(ownerDocument, 'touchend', this._disableDelayedDrag);
  2316. _off(ownerDocument, 'touchcancel', this._disableDelayedDrag);
  2317. _off(ownerDocument, 'mousemove', this._disableDelayedDrag);
  2318. _off(ownerDocument, 'touchmove', this._disableDelayedDrag);
  2319. _off(ownerDocument, 'pointermove', this._disableDelayedDrag);
  2320. },
  2321. _triggerDragStart: function _triggerDragStart( /** Event */evt, /** Touch */touch) {
  2322. touch = touch || (evt.pointerType == 'touch' ? evt : null);
  2323. if (touch) {
  2324. // Touch device support
  2325. tapEvt = {
  2326. target: dragEl,
  2327. clientX: touch.clientX,
  2328. clientY: touch.clientY
  2329. };
  2330. this._onDragStart(tapEvt, 'touch');
  2331. } else if (!this.nativeDraggable) {
  2332. this._onDragStart(tapEvt, true);
  2333. } else {
  2334. _on(dragEl, 'dragend', this);
  2335. _on(rootEl, 'dragstart', this._onDragStart);
  2336. }
  2337. try {
  2338. if (document.selection) {
  2339. // Timeout neccessary for IE9
  2340. setTimeout(function () {
  2341. document.selection.empty();
  2342. });
  2343. } else {
  2344. window.getSelection().removeAllRanges();
  2345. }
  2346. } catch (err) {}
  2347. },
  2348. _dragStarted: function _dragStarted() {
  2349. if (rootEl && dragEl) {
  2350. var options = this.options;
  2351. // Apply effect
  2352. _toggleClass(dragEl, options.ghostClass, true);
  2353. _toggleClass(dragEl, options.dragClass, false);
  2354. Sortable.active = this;
  2355. // Drag start event
  2356. _dispatchEvent(this, rootEl, 'start', dragEl, rootEl, oldIndex);
  2357. } else {
  2358. this._nulling();
  2359. }
  2360. },
  2361. _emulateDragOver: function _emulateDragOver() {
  2362. if (touchEvt) {
  2363. if (this._lastX === touchEvt.clientX && this._lastY === touchEvt.clientY) {
  2364. return;
  2365. }
  2366. this._lastX = touchEvt.clientX;
  2367. this._lastY = touchEvt.clientY;
  2368. if (!supportCssPointerEvents) {
  2369. _css(ghostEl, 'display', 'none');
  2370. }
  2371. var target = document.elementFromPoint(touchEvt.clientX, touchEvt.clientY),
  2372. parent = target,
  2373. i = touchDragOverListeners.length;
  2374. if (parent) {
  2375. do {
  2376. if (parent[expando]) {
  2377. while (i--) {
  2378. touchDragOverListeners[i]({
  2379. clientX: touchEvt.clientX,
  2380. clientY: touchEvt.clientY,
  2381. target: target,
  2382. rootEl: parent
  2383. });
  2384. }
  2385. break;
  2386. }
  2387. target = parent; // store last element
  2388. }
  2389. /* jshint boss:true */
  2390. while (parent = parent.parentNode);
  2391. }
  2392. if (!supportCssPointerEvents) {
  2393. _css(ghostEl, 'display', '');
  2394. }
  2395. }
  2396. },
  2397. _onTouchMove: function _onTouchMove( /**TouchEvent*/evt) {
  2398. if (tapEvt) {
  2399. var options = this.options,
  2400. fallbackTolerance = options.fallbackTolerance,
  2401. fallbackOffset = options.fallbackOffset,
  2402. touch = evt.touches ? evt.touches[0] : evt,
  2403. dx = touch.clientX - tapEvt.clientX + fallbackOffset.x,
  2404. dy = touch.clientY - tapEvt.clientY + fallbackOffset.y,
  2405. translate3d = evt.touches ? 'translate3d(' + dx + 'px,' + dy + 'px,0)' : 'translate(' + dx + 'px,' + dy + 'px)';
  2406. // only set the status to dragging, when we are actually dragging
  2407. if (!Sortable.active) {
  2408. if (fallbackTolerance && min(abs(touch.clientX - this._lastX), abs(touch.clientY - this._lastY)) < fallbackTolerance) {
  2409. return;
  2410. }
  2411. this._dragStarted();
  2412. }
  2413. // as well as creating the ghost element on the document body
  2414. this._appendGhost();
  2415. moved = true;
  2416. touchEvt = touch;
  2417. _css(ghostEl, 'webkitTransform', translate3d);
  2418. _css(ghostEl, 'mozTransform', translate3d);
  2419. _css(ghostEl, 'msTransform', translate3d);
  2420. _css(ghostEl, 'transform', translate3d);
  2421. evt.preventDefault();
  2422. }
  2423. },
  2424. _appendGhost: function _appendGhost() {
  2425. if (!ghostEl) {
  2426. var rect = dragEl.getBoundingClientRect(),
  2427. css = _css(dragEl),
  2428. options = this.options,
  2429. ghostRect;
  2430. ghostEl = dragEl.cloneNode(true);
  2431. _toggleClass(ghostEl, options.ghostClass, false);
  2432. _toggleClass(ghostEl, options.fallbackClass, true);
  2433. _toggleClass(ghostEl, options.dragClass, true);
  2434. _css(ghostEl, 'top', rect.top - parseInt(css.marginTop, 10));
  2435. _css(ghostEl, 'left', rect.left - parseInt(css.marginLeft, 10));
  2436. _css(ghostEl, 'width', rect.width);
  2437. _css(ghostEl, 'height', rect.height);
  2438. _css(ghostEl, 'opacity', '0.8');
  2439. _css(ghostEl, 'position', 'fixed');
  2440. _css(ghostEl, 'zIndex', '100000');
  2441. _css(ghostEl, 'pointerEvents', 'none');
  2442. options.fallbackOnBody && document.body.appendChild(ghostEl) || rootEl.appendChild(ghostEl);
  2443. // Fixing dimensions.
  2444. ghostRect = ghostEl.getBoundingClientRect();
  2445. _css(ghostEl, 'width', rect.width * 2 - ghostRect.width);
  2446. _css(ghostEl, 'height', rect.height * 2 - ghostRect.height);
  2447. }
  2448. },
  2449. _onDragStart: function _onDragStart( /**Event*/evt, /**boolean*/useFallback) {
  2450. var dataTransfer = evt.dataTransfer,
  2451. options = this.options;
  2452. this._offUpEvents();
  2453. if (activeGroup.checkPull(this, this, dragEl, evt)) {
  2454. cloneEl = _clone(dragEl);
  2455. cloneEl.draggable = false;
  2456. cloneEl.style['will-change'] = '';
  2457. _css(cloneEl, 'display', 'none');
  2458. _toggleClass(cloneEl, this.options.chosenClass, false);
  2459. rootEl.insertBefore(cloneEl, dragEl);
  2460. _dispatchEvent(this, rootEl, 'clone', dragEl);
  2461. }
  2462. _toggleClass(dragEl, options.dragClass, true);
  2463. if (useFallback) {
  2464. if (useFallback === 'touch') {
  2465. // Bind touch events
  2466. _on(document, 'touchmove', this._onTouchMove);
  2467. _on(document, 'touchend', this._onDrop);
  2468. _on(document, 'touchcancel', this._onDrop);
  2469. _on(document, 'pointermove', this._onTouchMove);
  2470. _on(document, 'pointerup', this._onDrop);
  2471. } else {
  2472. // Old brwoser
  2473. _on(document, 'mousemove', this._onTouchMove);
  2474. _on(document, 'mouseup', this._onDrop);
  2475. }
  2476. this._loopId = setInterval(this._emulateDragOver, 50);
  2477. } else {
  2478. if (dataTransfer) {
  2479. dataTransfer.effectAllowed = 'move';
  2480. options.setData && options.setData.call(this, dataTransfer, dragEl);
  2481. }
  2482. _on(document, 'drop', this);
  2483. setTimeout(this._dragStarted, 0);
  2484. }
  2485. },
  2486. _onDragOver: function _onDragOver( /**Event*/evt) {
  2487. var el = this.el,
  2488. target,
  2489. dragRect,
  2490. targetRect,
  2491. revert,
  2492. options = this.options,
  2493. group = options.group,
  2494. activeSortable = Sortable.active,
  2495. isOwner = activeGroup === group,
  2496. isMovingBetweenSortable = false,
  2497. canSort = options.sort;
  2498. if (evt.preventDefault !== void 0) {
  2499. evt.preventDefault();
  2500. !options.dragoverBubble && evt.stopPropagation();
  2501. }
  2502. if (dragEl.animated) {
  2503. return;
  2504. }
  2505. moved = true;
  2506. if (activeSortable && !options.disabled && (isOwner ? canSort || (revert = !rootEl.contains(dragEl)) // Reverting item into the original list
  2507. : 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
  2508. ) {
  2509. // Smart auto-scrolling
  2510. _autoScroll(evt, options, this.el);
  2511. if (_silent) {
  2512. return;
  2513. }
  2514. target = _closest(evt.target, options.draggable, el);
  2515. dragRect = dragEl.getBoundingClientRect();
  2516. if (putSortable !== this) {
  2517. putSortable = this;
  2518. isMovingBetweenSortable = true;
  2519. }
  2520. if (revert) {
  2521. _cloneHide(activeSortable, true);
  2522. parentEl = rootEl; // actualization
  2523. if (cloneEl || nextEl) {
  2524. rootEl.insertBefore(dragEl, cloneEl || nextEl);
  2525. } else if (!canSort) {
  2526. rootEl.appendChild(dragEl);
  2527. }
  2528. return;
  2529. }
  2530. if (el.children.length === 0 || el.children[0] === ghostEl || el === evt.target && _ghostIsLast(el, evt)) {
  2531. //assign target only if condition is true
  2532. if (el.children.length !== 0 && el.children[0] !== ghostEl && el === evt.target) {
  2533. target = el.lastElementChild;
  2534. }
  2535. if (target) {
  2536. if (target.animated) {
  2537. return;
  2538. }
  2539. targetRect = target.getBoundingClientRect();
  2540. }
  2541. _cloneHide(activeSortable, isOwner);
  2542. if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt) !== false) {
  2543. if (!dragEl.contains(el)) {
  2544. el.appendChild(dragEl);
  2545. parentEl = el; // actualization
  2546. }
  2547. this._animate(dragRect, dragEl);
  2548. target && this._animate(targetRect, target);
  2549. }
  2550. } else if (target && !target.animated && target !== dragEl && target.parentNode[expando] !== void 0) {
  2551. if (lastEl !== target) {
  2552. lastEl = target;
  2553. lastCSS = _css(target);
  2554. lastParentCSS = _css(target.parentNode);
  2555. }
  2556. targetRect = target.getBoundingClientRect();
  2557. var width = targetRect.right - targetRect.left,
  2558. height = targetRect.bottom - targetRect.top,
  2559. floating = R_FLOAT.test(lastCSS.cssFloat + lastCSS.display) || lastParentCSS.display == 'flex' && lastParentCSS['flex-direction'].indexOf('row') === 0,
  2560. isWide = target.offsetWidth > dragEl.offsetWidth,
  2561. isLong = target.offsetHeight > dragEl.offsetHeight,
  2562. halfway = (floating ? (evt.clientX - targetRect.left) / width : (evt.clientY - targetRect.top) / height) > 0.5,
  2563. nextSibling = target.nextElementSibling,
  2564. after = false;
  2565. if (floating) {
  2566. var elTop = dragEl.offsetTop,
  2567. tgTop = target.offsetTop;
  2568. if (elTop === tgTop) {
  2569. after = target.previousElementSibling === dragEl && !isWide || halfway && isWide;
  2570. } else if (target.previousElementSibling === dragEl || dragEl.previousElementSibling === target) {
  2571. after = (evt.clientY - targetRect.top) / height > 0.5;
  2572. } else {
  2573. after = tgTop > elTop;
  2574. }
  2575. } else if (!isMovingBetweenSortable) {
  2576. after = nextSibling !== dragEl && !isLong || halfway && isLong;
  2577. }
  2578. var moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, after);
  2579. if (moveVector !== false) {
  2580. if (moveVector === 1 || moveVector === -1) {
  2581. after = moveVector === 1;
  2582. }
  2583. _silent = true;
  2584. setTimeout(_unsilent, 30);
  2585. _cloneHide(activeSortable, isOwner);
  2586. if (!dragEl.contains(el)) {
  2587. if (after && !nextSibling) {
  2588. el.appendChild(dragEl);
  2589. } else {
  2590. target.parentNode.insertBefore(dragEl, after ? nextSibling : target);
  2591. }
  2592. }
  2593. parentEl = dragEl.parentNode; // actualization
  2594. this._animate(dragRect, dragEl);
  2595. this._animate(targetRect, target);
  2596. }
  2597. }
  2598. }
  2599. },
  2600. _animate: function _animate(prevRect, target) {
  2601. var ms = this.options.animation;
  2602. if (ms) {
  2603. var currentRect = target.getBoundingClientRect();
  2604. if (prevRect.nodeType === 1) {
  2605. prevRect = prevRect.getBoundingClientRect();
  2606. }
  2607. _css(target, 'transition', 'none');
  2608. _css(target, 'transform', 'translate3d(' + (prevRect.left - currentRect.left) + 'px,' + (prevRect.top - currentRect.top) + 'px,0)');
  2609. target.offsetWidth; // repaint
  2610. _css(target, 'transition', 'all ' + ms + 'ms');
  2611. _css(target, 'transform', 'translate3d(0,0,0)');
  2612. clearTimeout(target.animated);
  2613. target.animated = setTimeout(function () {
  2614. _css(target, 'transition', '');
  2615. _css(target, 'transform', '');
  2616. target.animated = false;
  2617. }, ms);
  2618. }
  2619. },
  2620. _offUpEvents: function _offUpEvents() {
  2621. var ownerDocument = this.el.ownerDocument;
  2622. _off(document, 'touchmove', this._onTouchMove);
  2623. _off(document, 'pointermove', this._onTouchMove);
  2624. _off(ownerDocument, 'mouseup', this._onDrop);
  2625. _off(ownerDocument, 'touchend', this._onDrop);
  2626. _off(ownerDocument, 'pointerup', this._onDrop);
  2627. _off(ownerDocument, 'touchcancel', this._onDrop);
  2628. _off(ownerDocument, 'pointercancel', this._onDrop);
  2629. _off(ownerDocument, 'selectstart', this);
  2630. },
  2631. _onDrop: function _onDrop( /**Event*/evt) {
  2632. var el = this.el,
  2633. options = this.options;
  2634. clearInterval(this._loopId);
  2635. clearInterval(autoScroll.pid);
  2636. clearTimeout(this._dragStartTimer);
  2637. // 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'] = '';
  2660. // Remove class's
  2661. _toggleClass(dragEl, this.options.ghostClass, false);
  2662. _toggleClass(dragEl, this.options.chosenClass, false);
  2663. // Drag stop event
  2664. _dispatchEvent(this, rootEl, 'unchoose', dragEl, rootEl, oldIndex);
  2665. if (rootEl !== parentEl) {
  2666. newIndex = _index(dragEl, options.draggable);
  2667. if (newIndex >= 0) {
  2668. // Add event
  2669. _dispatchEvent(null, parentEl, 'add', dragEl, rootEl, oldIndex, newIndex);
  2670. // Remove event
  2671. _dispatchEvent(this, rootEl, 'remove', dragEl, rootEl, oldIndex, newIndex);
  2672. // drag from one list and drop into another
  2673. _dispatchEvent(null, parentEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
  2674. _dispatchEvent(this, rootEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
  2675. }
  2676. } else {
  2677. if (dragEl.nextSibling !== nextEl) {
  2678. // Get the index of the dragged element within its parent
  2679. newIndex = _index(dragEl, options.draggable);
  2680. if (newIndex >= 0) {
  2681. // drag & drop within the same list
  2682. _dispatchEvent(this, rootEl, 'update', dragEl, rootEl, oldIndex, newIndex);
  2683. _dispatchEvent(this, rootEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
  2684. }
  2685. }
  2686. }
  2687. if (Sortable.active) {
  2688. /* jshint eqnull:true */
  2689. if (newIndex == null || newIndex === -1) {
  2690. newIndex = oldIndex;
  2691. }
  2692. _dispatchEvent(this, rootEl, 'end', dragEl, rootEl, oldIndex, newIndex);
  2693. // Save sorting
  2694. this.save();
  2695. }
  2696. }
  2697. }
  2698. this._nulling();
  2699. },
  2700. _nulling: function _nulling() {
  2701. rootEl = dragEl = parentEl = ghostEl = nextEl = cloneEl = lastDownEl = scrollEl = scrollParentEl = tapEvt = touchEvt = moved = newIndex = lastEl = lastCSS = putSortable = activeGroup = Sortable.active = null;
  2702. savedInputChecked.forEach(function (el) {
  2703. el.checked = true;
  2704. });
  2705. savedInputChecked.length = 0;
  2706. },
  2707. handleEvent: function handleEvent( /**Event*/evt) {
  2708. switch (evt.type) {
  2709. case 'drop':
  2710. case 'dragend':
  2711. this._onDrop(evt);
  2712. break;
  2713. case 'dragover':
  2714. case 'dragenter':
  2715. if (dragEl) {
  2716. this._onDragOver(evt);
  2717. _globalDragOver(evt);
  2718. }
  2719. break;
  2720. case 'selectstart':
  2721. evt.preventDefault();
  2722. break;
  2723. }
  2724. },
  2725. /**
  2726. * Serializes the item into an array of string.
  2727. * @returns {String[]}
  2728. */
  2729. toArray: function toArray() {
  2730. var order = [],
  2731. el,
  2732. children = this.el.children,
  2733. i = 0,
  2734. n = children.length,
  2735. options = this.options;
  2736. for (; i < n; i++) {
  2737. el = children[i];
  2738. if (_closest(el, options.draggable, this.el)) {
  2739. order.push(el.getAttribute(options.dataIdAttr) || _generateId(el));
  2740. }
  2741. }
  2742. return order;
  2743. },
  2744. /**
  2745. * Sorts the elements according to the array.
  2746. * @param {String[]} order order of the items
  2747. */
  2748. sort: function sort(order) {
  2749. var items = {},
  2750. rootEl = this.el;
  2751. this.toArray().forEach(function (id, i) {
  2752. var el = rootEl.children[i];
  2753. if (_closest(el, this.options.draggable, rootEl)) {
  2754. items[id] = el;
  2755. }
  2756. }, this);
  2757. order.forEach(function (id) {
  2758. if (items[id]) {
  2759. rootEl.removeChild(items[id]);
  2760. rootEl.appendChild(items[id]);
  2761. }
  2762. });
  2763. },
  2764. /**
  2765. * Save the current sorting
  2766. */
  2767. save: function save() {
  2768. var store = this.options.store;
  2769. store && store.set(this);
  2770. },
  2771. /**
  2772. * 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.
  2773. * @param {HTMLElement} el
  2774. * @param {String} [selector] default: `options.draggable`
  2775. * @returns {HTMLElement|null}
  2776. */
  2777. closest: function closest(el, selector) {
  2778. return _closest(el, selector || this.options.draggable, this.el);
  2779. },
  2780. /**
  2781. * Set/get option
  2782. * @param {string} name
  2783. * @param {*} [value]
  2784. * @returns {*}
  2785. */
  2786. option: function option(name, value) {
  2787. var options = this.options;
  2788. if (value === void 0) {
  2789. return options[name];
  2790. } else {
  2791. options[name] = value;
  2792. if (name === 'group') {
  2793. _prepareGroup(options);
  2794. }
  2795. }
  2796. },
  2797. /**
  2798. * Destroy
  2799. */
  2800. destroy: function destroy() {
  2801. var el = this.el;
  2802. el[expando] = null;
  2803. _off(el, 'mousedown', this._onTapStart);
  2804. _off(el, 'touchstart', this._onTapStart);
  2805. _off(el, 'pointerdown', this._onTapStart);
  2806. if (this.nativeDraggable) {
  2807. _off(el, 'dragover', this);
  2808. _off(el, 'dragenter', this);
  2809. }
  2810. // Remove draggable attributes
  2811. Array.prototype.forEach.call(el.querySelectorAll('[draggable]'), function (el) {
  2812. el.removeAttribute('draggable');
  2813. });
  2814. touchDragOverListeners.splice(touchDragOverListeners.indexOf(this._onDragOver), 1);
  2815. this._onDrop();
  2816. this.el = el = null;
  2817. }
  2818. };
  2819. function _cloneHide(sortable, state) {
  2820. if (sortable.lastPullMode !== 'clone') {
  2821. state = true;
  2822. }
  2823. if (cloneEl && cloneEl.state !== state) {
  2824. _css(cloneEl, 'display', state ? 'none' : '');
  2825. if (!state) {
  2826. if (cloneEl.state) {
  2827. if (sortable.options.group.revertClone) {
  2828. rootEl.insertBefore(cloneEl, nextEl);
  2829. sortable._animate(dragEl, cloneEl);
  2830. } else {
  2831. rootEl.insertBefore(cloneEl, dragEl);
  2832. }
  2833. }
  2834. }
  2835. cloneEl.state = state;
  2836. }
  2837. }
  2838. function _closest( /**HTMLElement*/el, /**String*/selector, /**HTMLElement*/ctx) {
  2839. if (el) {
  2840. ctx = ctx || document;
  2841. do {
  2842. if (selector === '>*' && el.parentNode === ctx || _matches(el, selector)) {
  2843. return el;
  2844. }
  2845. /* jshint boss:true */
  2846. } while (el = _getParentOrHost(el));
  2847. }
  2848. return null;
  2849. }
  2850. function _getParentOrHost(el) {
  2851. var parent = el.host;
  2852. return parent && parent.nodeType ? parent : el.parentNode;
  2853. }
  2854. function _globalDragOver( /**Event*/evt) {
  2855. if (evt.dataTransfer) {
  2856. evt.dataTransfer.dropEffect = 'move';
  2857. }
  2858. evt.preventDefault();
  2859. }
  2860. function _on(el, event, fn) {
  2861. el.addEventListener(event, fn, captureMode);
  2862. }
  2863. function _off(el, event, fn) {
  2864. el.removeEventListener(event, fn, captureMode);
  2865. }
  2866. function _toggleClass(el, name, state) {
  2867. if (el) {
  2868. if (el.classList) {
  2869. el.classList[state ? 'add' : 'remove'](name);
  2870. } else {
  2871. var className = (' ' + el.className + ' ').replace(R_SPACE, ' ').replace(' ' + name + ' ', ' ');
  2872. el.className = (className + (state ? ' ' + name : '')).replace(R_SPACE, ' ');
  2873. }
  2874. }
  2875. }
  2876. function _css(el, prop, val) {
  2877. var style = el && el.style;
  2878. if (style) {
  2879. if (val === void 0) {
  2880. if (document.defaultView && document.defaultView.getComputedStyle) {
  2881. val = document.defaultView.getComputedStyle(el, '');
  2882. } else if (el.currentStyle) {
  2883. val = el.currentStyle;
  2884. }
  2885. return prop === void 0 ? val : val[prop];
  2886. } else {
  2887. if (!(prop in style)) {
  2888. prop = '-webkit-' + prop;
  2889. }
  2890. style[prop] = val + (typeof val === 'string' ? '' : 'px');
  2891. }
  2892. }
  2893. }
  2894. function _find(ctx, tagName, iterator) {
  2895. if (ctx) {
  2896. var list = ctx.getElementsByTagName(tagName),
  2897. i = 0,
  2898. n = list.length;
  2899. if (iterator) {
  2900. for (; i < n; i++) {
  2901. iterator(list[i], i);
  2902. }
  2903. }
  2904. return list;
  2905. }
  2906. return [];
  2907. }
  2908. function _dispatchEvent(sortable, rootEl, name, targetEl, fromEl, startIndex, newIndex) {
  2909. sortable = sortable || rootEl[expando];
  2910. var evt = document.createEvent('Event'),
  2911. options = sortable.options,
  2912. onName = 'on' + name.charAt(0).toUpperCase() + name.substr(1);
  2913. evt.initEvent(name, true, true);
  2914. evt.to = rootEl;
  2915. evt.from = fromEl || rootEl;
  2916. evt.item = targetEl || rootEl;
  2917. evt.clone = cloneEl;
  2918. evt.oldIndex = startIndex;
  2919. evt.newIndex = newIndex;
  2920. rootEl.dispatchEvent(evt);
  2921. if (options[onName]) {
  2922. options[onName].call(sortable, evt);
  2923. }
  2924. }
  2925. function _onMove(fromEl, toEl, dragEl, dragRect, targetEl, targetRect, originalEvt, willInsertAfter) {
  2926. var evt,
  2927. sortable = fromEl[expando],
  2928. onMoveFn = sortable.options.onMove,
  2929. retVal;
  2930. evt = document.createEvent('Event');
  2931. evt.initEvent('move', true, true);
  2932. evt.to = toEl;
  2933. evt.from = fromEl;
  2934. evt.dragged = dragEl;
  2935. evt.draggedRect = dragRect;
  2936. evt.related = targetEl || toEl;
  2937. evt.relatedRect = targetRect || toEl.getBoundingClientRect();
  2938. evt.willInsertAfter = willInsertAfter;
  2939. fromEl.dispatchEvent(evt);
  2940. if (onMoveFn) {
  2941. retVal = onMoveFn.call(sortable, evt, originalEvt);
  2942. }
  2943. return retVal;
  2944. }
  2945. function _disableDraggable(el) {
  2946. el.draggable = false;
  2947. }
  2948. function _unsilent() {
  2949. _silent = false;
  2950. }
  2951. /** @returns {HTMLElement|false} */
  2952. function _ghostIsLast(el, evt) {
  2953. var lastEl = el.lastElementChild,
  2954. rect = lastEl.getBoundingClientRect();
  2955. // 5 — min delta
  2956. // abs — нельзя добавлять, а то глюки при наведении сверху
  2957. return evt.clientY - (rect.top + rect.height) > 5 || evt.clientX - (rect.left + rect.width) > 5;
  2958. }
  2959. /**
  2960. * Generate id
  2961. * @param {HTMLElement} el
  2962. * @returns {String}
  2963. * @private
  2964. */
  2965. function _generateId(el) {
  2966. var str = el.tagName + el.className + el.src + el.href + el.textContent,
  2967. i = str.length,
  2968. sum = 0;
  2969. while (i--) {
  2970. sum += str.charCodeAt(i);
  2971. }
  2972. return sum.toString(36);
  2973. }
  2974. /**
  2975. * Returns the index of an element within its parent for a selected set of
  2976. * elements
  2977. * @param {HTMLElement} el
  2978. * @param {selector} selector
  2979. * @return {number}
  2980. */
  2981. function _index(el, selector) {
  2982. var index = 0;
  2983. if (!el || !el.parentNode) {
  2984. return -1;
  2985. }
  2986. while (el && (el = el.previousElementSibling)) {
  2987. if (el.nodeName.toUpperCase() !== 'TEMPLATE' && (selector === '>*' || _matches(el, selector))) {
  2988. index++;
  2989. }
  2990. }
  2991. return index;
  2992. }
  2993. function _matches( /**HTMLElement*/el, /**String*/selector) {
  2994. if (el) {
  2995. selector = selector.split('.');
  2996. var tag = selector.shift().toUpperCase(),
  2997. re = new RegExp('\\s(' + selector.join('|') + ')(?=\\s)', 'g');
  2998. return (tag === '' || el.nodeName.toUpperCase() == tag) && (!selector.length || ((' ' + el.className + ' ').match(re) || []).length == selector.length);
  2999. }
  3000. return false;
  3001. }
  3002. function _throttle(callback, ms) {
  3003. var args, _this;
  3004. return function () {
  3005. if (args === void 0) {
  3006. args = arguments;
  3007. _this = this;
  3008. setTimeout(function () {
  3009. if (args.length === 1) {
  3010. callback.call(_this, args[0]);
  3011. } else {
  3012. callback.apply(_this, args);
  3013. }
  3014. args = void 0;
  3015. }, ms);
  3016. }
  3017. };
  3018. }
  3019. function _extend(dst, src) {
  3020. if (dst && src) {
  3021. for (var key in src) {
  3022. if (src.hasOwnProperty(key)) {
  3023. dst[key] = src[key];
  3024. }
  3025. }
  3026. }
  3027. return dst;
  3028. }
  3029. function _clone(el) {
  3030. return $ ? $(el).clone(true)[0] : Polymer && Polymer.dom ? Polymer.dom(el).cloneNode(true) : el.cloneNode(true);
  3031. }
  3032. function _saveInputCheckedState(root) {
  3033. var inputs = root.getElementsByTagName('input');
  3034. var idx = inputs.length;
  3035. while (idx--) {
  3036. var el = inputs[idx];
  3037. el.checked && savedInputChecked.push(el);
  3038. }
  3039. }
  3040. // Fixed #973:
  3041. _on(document, 'touchmove', function (evt) {
  3042. if (Sortable.active) {
  3043. evt.preventDefault();
  3044. }
  3045. });
  3046. try {
  3047. window.addEventListener('test', null, Object.defineProperty({}, 'passive', {
  3048. get: function get() {
  3049. captureMode = {
  3050. capture: false,
  3051. passive: false
  3052. };
  3053. }
  3054. }));
  3055. } catch (err) {}
  3056. // Export utils
  3057. Sortable.utils = {
  3058. on: _on,
  3059. off: _off,
  3060. css: _css,
  3061. find: _find,
  3062. is: function is(el, selector) {
  3063. return !!_closest(el, selector, el);
  3064. },
  3065. extend: _extend,
  3066. throttle: _throttle,
  3067. closest: _closest,
  3068. toggleClass: _toggleClass,
  3069. clone: _clone,
  3070. index: _index
  3071. };
  3072. /**
  3073. * Create sortable instance
  3074. * @param {HTMLElement} el
  3075. * @param {Object} [options]
  3076. */
  3077. Sortable.create = function (el, options) {
  3078. return new Sortable(el, options);
  3079. };
  3080. // Export
  3081. Sortable.version = '1.6.1';
  3082. return Sortable;
  3083. });
  3084. /***/ }),
  3085. /***/ "./js/assessment/ivprogAssessment.js":
  3086. /*!*******************************************!*\
  3087. !*** ./js/assessment/ivprogAssessment.js ***!
  3088. \*******************************************/
  3089. /*! no static exports found */
  3090. /***/ (function(module, exports, __webpack_require__) {
  3091. "use strict";
  3092. Object.defineProperty(exports, "__esModule", {
  3093. value: true
  3094. });
  3095. exports.IVProgAssessment = undefined;
  3096. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3097. var _ivprogParser = __webpack_require__(/*! ./../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  3098. var _semanticAnalyser = __webpack_require__(/*! ./../processor/semantic/semanticAnalyser */ "./js/processor/semantic/semanticAnalyser.js");
  3099. var _ivprogProcessor = __webpack_require__(/*! ./../processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  3100. var _inputTest = __webpack_require__(/*! ./../util/inputTest */ "./js/util/inputTest.js");
  3101. var _outputTest = __webpack_require__(/*! ./../util/outputTest */ "./js/util/outputTest.js");
  3102. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3103. var IVProgAssessment = exports.IVProgAssessment = function () {
  3104. function IVProgAssessment(textCode, testCases, domConsole) {
  3105. _classCallCheck(this, IVProgAssessment);
  3106. this.textCode = textCode;
  3107. this.testCases = testCases;
  3108. this.domConsole = domConsole;
  3109. }
  3110. _createClass(IVProgAssessment, [{
  3111. key: "runTest",
  3112. value: function runTest() {
  3113. var _this = this;
  3114. try {
  3115. // try and show error messages through domconsole
  3116. var parser = _ivprogParser.IVProgParser.createParser(this.textCode);
  3117. var semantic = new _semanticAnalyser.SemanticAnalyser(parser.parseTree());
  3118. var validTree = semantic.analyseTree();
  3119. // loop test cases and show messages through domconsole
  3120. var partialTests = this.testCases.map(function (t, name) {
  3121. return _this.partialEvaluateTestCase(new _ivprogProcessor.IVProgProcessor(validTree), t.input, t.output, name);
  3122. });
  3123. var testResult = partialTests.reduce(function (acc, curr) {
  3124. return acc.then(function (v) {
  3125. return curr(v);
  3126. });
  3127. }, Promise.resolve(0));
  3128. return testResult.then(function (total) {
  3129. return Promise.resolve(total / _this.testCases.length);
  3130. }).catch(function (err) {
  3131. _this.domConsole.err("Erro durante a execução do programa"); // try and show error messages through domconsole
  3132. _this.domConsole.err(err.message);
  3133. return Promise.resolve(0);
  3134. });
  3135. } catch (error) {
  3136. this.domConsole.err("Erro durante a execução do programa"); // try and show error messages through domconsole
  3137. this.domConsole.err(error.message);
  3138. return Promise.resolve(0);
  3139. }
  3140. }
  3141. }, {
  3142. key: "evaluateTestCase",
  3143. value: function evaluateTestCase(prog, inputList, outputList, name, accumulator) {
  3144. var outerThis = this;
  3145. var input = new _inputTest.InputTest(inputList);
  3146. var output = new _outputTest.OutputTest();
  3147. prog.registerInput(input);
  3148. prog.registerOutput(output);
  3149. var startTime = Date.now();
  3150. return prog.interpretAST().then(function (_) {
  3151. var millis = Date.now() - startTime;
  3152. if (input.inputList.length !== input.index) {
  3153. outerThis.domConsole.err("Caso de teste " + (name + 1) + ": Falhou, ainda restam entradas!");
  3154. outerThis.domConsole.info("Levou " + millis + "ms");
  3155. return Promise.resolve(accumulator + 1 * (input.index / inputList.length));
  3156. } else if (output.list.length < outputList.length) {
  3157. outerThis.domConsole.err("Caso de teste " + (name + 1) + ": Falhou <" + inputList.join(", ") + ";" + outputList.join(", ") + ";" + output.list.join(", ") + ">");
  3158. outerThis.domConsole.info("Levou " + millis + "ms");
  3159. return Promise.resolve(accumulator + 1 * (output.list.length / outputList.length));
  3160. } else if (output.list.length > outputList.length) {
  3161. outerThis.domConsole.err("Caso de teste " + (name + 1) + ": Falhou <" + inputList.join(", ") + ";" + outputList.join(", ") + ";" + output.list.join(", ") + ">");
  3162. outerThis.domConsole.info("Levou " + millis + "ms");
  3163. return Promise.resolve(accumulator + 1 * (outputList.length / output.list.length));
  3164. } else {
  3165. var isOk = outerThis.checkOutput(output.list, outputList);
  3166. if (!isOk) {
  3167. outerThis.domConsole.err("Caso de teste " + (name + 1) + ": Falhou <" + inputList.join(", ") + ";" + outputList.join(", ") + ";" + output.list.join(", ") + ">");
  3168. outerThis.domConsole.info("Levou " + millis + "ms");
  3169. return Promise.resolve(accumulator);
  3170. } else {
  3171. outerThis.domConsole.info("Caso de teste " + (name + 1) + ": OK!");
  3172. outerThis.domConsole.info("Levou " + millis + "ms");
  3173. return Promise.resolve(accumulator + 1);
  3174. }
  3175. }
  3176. }).catch(function (_) {
  3177. return Promise.resolve(accumulator);
  3178. });
  3179. }
  3180. }, {
  3181. key: "partialEvaluateTestCase",
  3182. value: function partialEvaluateTestCase(prog, inputList, outputList, name) {
  3183. var _this2 = this;
  3184. var partial = function partial(accumulator) {
  3185. return _this2.evaluateTestCase(prog, inputList, outputList, name, accumulator);
  3186. };
  3187. partial = partial.bind(this);
  3188. return partial;
  3189. }
  3190. }, {
  3191. key: "checkOutput",
  3192. value: function checkOutput(aList, bList) {
  3193. for (var i = 0; i < aList.length; i++) {
  3194. var outValue = aList[i];
  3195. if (outValue != bList[i]) {
  3196. return false;
  3197. }
  3198. }
  3199. return true;
  3200. }
  3201. }]);
  3202. return IVProgAssessment;
  3203. }();
  3204. /***/ }),
  3205. /***/ "./js/ast/commands/arrayAssign.js":
  3206. /*!****************************************!*\
  3207. !*** ./js/ast/commands/arrayAssign.js ***!
  3208. \****************************************/
  3209. /*! no static exports found */
  3210. /***/ (function(module, exports, __webpack_require__) {
  3211. "use strict";
  3212. Object.defineProperty(exports, "__esModule", {
  3213. value: true
  3214. });
  3215. exports.ArrayIndexAssign = undefined;
  3216. var _assign = __webpack_require__(/*! ./assign */ "./js/ast/commands/assign.js");
  3217. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3218. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3219. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3220. var ArrayIndexAssign = exports.ArrayIndexAssign = function (_Assign) {
  3221. _inherits(ArrayIndexAssign, _Assign);
  3222. function ArrayIndexAssign(id, lineExpression, columnExpression, expression) {
  3223. _classCallCheck(this, ArrayIndexAssign);
  3224. var _this = _possibleConstructorReturn(this, (ArrayIndexAssign.__proto__ || Object.getPrototypeOf(ArrayIndexAssign)).call(this, id, expression));
  3225. _this.line = lineExpression;
  3226. _this.column = columnExpression;
  3227. return _this;
  3228. }
  3229. return ArrayIndexAssign;
  3230. }(_assign.Assign);
  3231. /***/ }),
  3232. /***/ "./js/ast/commands/arrayDeclaration.js":
  3233. /*!*********************************************!*\
  3234. !*** ./js/ast/commands/arrayDeclaration.js ***!
  3235. \*********************************************/
  3236. /*! no static exports found */
  3237. /***/ (function(module, exports, __webpack_require__) {
  3238. "use strict";
  3239. Object.defineProperty(exports, "__esModule", {
  3240. value: true
  3241. });
  3242. exports.ArrayDeclaration = undefined;
  3243. var _declaration = __webpack_require__(/*! ./declaration */ "./js/ast/commands/declaration.js");
  3244. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3245. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3246. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3247. var ArrayDeclaration = exports.ArrayDeclaration = function (_Declaration) {
  3248. _inherits(ArrayDeclaration, _Declaration);
  3249. function ArrayDeclaration(id, type, lines, columns, initial, isConst) {
  3250. _classCallCheck(this, ArrayDeclaration);
  3251. var _this = _possibleConstructorReturn(this, (ArrayDeclaration.__proto__ || Object.getPrototypeOf(ArrayDeclaration)).call(this, id, type, initial, isConst));
  3252. _this.lines = lines;
  3253. _this.columns = columns;
  3254. return _this;
  3255. }
  3256. return ArrayDeclaration;
  3257. }(_declaration.Declaration);
  3258. /***/ }),
  3259. /***/ "./js/ast/commands/assign.js":
  3260. /*!***********************************!*\
  3261. !*** ./js/ast/commands/assign.js ***!
  3262. \***********************************/
  3263. /*! no static exports found */
  3264. /***/ (function(module, exports, __webpack_require__) {
  3265. "use strict";
  3266. Object.defineProperty(exports, "__esModule", {
  3267. value: true
  3268. });
  3269. exports.Assign = undefined;
  3270. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3271. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3272. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3273. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3274. var Assign = exports.Assign = function (_Command) {
  3275. _inherits(Assign, _Command);
  3276. function Assign(id, expression) {
  3277. _classCallCheck(this, Assign);
  3278. var _this = _possibleConstructorReturn(this, (Assign.__proto__ || Object.getPrototypeOf(Assign)).call(this));
  3279. _this.id = id;
  3280. _this.expression = expression;
  3281. return _this;
  3282. }
  3283. return Assign;
  3284. }(_command.Command);
  3285. /***/ }),
  3286. /***/ "./js/ast/commands/break.js":
  3287. /*!**********************************!*\
  3288. !*** ./js/ast/commands/break.js ***!
  3289. \**********************************/
  3290. /*! no static exports found */
  3291. /***/ (function(module, exports, __webpack_require__) {
  3292. "use strict";
  3293. Object.defineProperty(exports, "__esModule", {
  3294. value: true
  3295. });
  3296. exports.Break = undefined;
  3297. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3298. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3299. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3300. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3301. var Break = exports.Break = function (_Command) {
  3302. _inherits(Break, _Command);
  3303. function Break() {
  3304. _classCallCheck(this, Break);
  3305. return _possibleConstructorReturn(this, (Break.__proto__ || Object.getPrototypeOf(Break)).call(this));
  3306. }
  3307. return Break;
  3308. }(_command.Command);
  3309. /***/ }),
  3310. /***/ "./js/ast/commands/case.js":
  3311. /*!*********************************!*\
  3312. !*** ./js/ast/commands/case.js ***!
  3313. \*********************************/
  3314. /*! no static exports found */
  3315. /***/ (function(module, exports, __webpack_require__) {
  3316. "use strict";
  3317. Object.defineProperty(exports, "__esModule", {
  3318. value: true
  3319. });
  3320. exports.Case = undefined;
  3321. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3322. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3323. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3324. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3325. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3326. var Case = exports.Case = function (_Command) {
  3327. _inherits(Case, _Command);
  3328. function Case(expression) {
  3329. _classCallCheck(this, Case);
  3330. var _this = _possibleConstructorReturn(this, (Case.__proto__ || Object.getPrototypeOf(Case)).call(this));
  3331. _this.expression = expression;
  3332. _this.commands = [];
  3333. return _this;
  3334. }
  3335. _createClass(Case, [{
  3336. key: 'setCommands',
  3337. value: function setCommands(commands) {
  3338. this.commands = commands;
  3339. }
  3340. }, {
  3341. key: 'isDefault',
  3342. get: function get() {
  3343. return this.expression === null;
  3344. }
  3345. }]);
  3346. return Case;
  3347. }(_command.Command);
  3348. /***/ }),
  3349. /***/ "./js/ast/commands/command.js":
  3350. /*!************************************!*\
  3351. !*** ./js/ast/commands/command.js ***!
  3352. \************************************/
  3353. /*! no static exports found */
  3354. /***/ (function(module, exports, __webpack_require__) {
  3355. "use strict";
  3356. Object.defineProperty(exports, "__esModule", {
  3357. value: true
  3358. });
  3359. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3360. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3361. var Command = exports.Command = function () {
  3362. function Command() {
  3363. _classCallCheck(this, Command);
  3364. this._sourceInfo = null;
  3365. }
  3366. _createClass(Command, [{
  3367. key: "sourceInfo",
  3368. set: function set(sourceInfo) {
  3369. this._sourceInfo = sourceInfo;
  3370. },
  3371. get: function get() {
  3372. return this._sourceInfo;
  3373. }
  3374. }]);
  3375. return Command;
  3376. }();
  3377. /***/ }),
  3378. /***/ "./js/ast/commands/commandBlock.js":
  3379. /*!*****************************************!*\
  3380. !*** ./js/ast/commands/commandBlock.js ***!
  3381. \*****************************************/
  3382. /*! no static exports found */
  3383. /***/ (function(module, exports, __webpack_require__) {
  3384. "use strict";
  3385. Object.defineProperty(exports, "__esModule", {
  3386. value: true
  3387. });
  3388. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3389. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3390. var CommandBlock = exports.CommandBlock = function () {
  3391. function CommandBlock(variables, commands) {
  3392. _classCallCheck(this, CommandBlock);
  3393. this.variables = variables;
  3394. this.commands = commands;
  3395. this._sourceInfo = null;
  3396. }
  3397. _createClass(CommandBlock, [{
  3398. key: "sourceInfo",
  3399. set: function set(sourceInfo) {
  3400. this._sourceInfo = sourceInfo;
  3401. },
  3402. get: function get() {
  3403. return this._sourceInfo;
  3404. }
  3405. }]);
  3406. return CommandBlock;
  3407. }();
  3408. /***/ }),
  3409. /***/ "./js/ast/commands/declaration.js":
  3410. /*!****************************************!*\
  3411. !*** ./js/ast/commands/declaration.js ***!
  3412. \****************************************/
  3413. /*! no static exports found */
  3414. /***/ (function(module, exports, __webpack_require__) {
  3415. "use strict";
  3416. Object.defineProperty(exports, "__esModule", {
  3417. value: true
  3418. });
  3419. exports.Declaration = undefined;
  3420. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3421. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3422. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3423. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3424. var Declaration = exports.Declaration = function (_Command) {
  3425. _inherits(Declaration, _Command);
  3426. function Declaration(id, type, initial, isConst) {
  3427. _classCallCheck(this, Declaration);
  3428. var _this = _possibleConstructorReturn(this, (Declaration.__proto__ || Object.getPrototypeOf(Declaration)).call(this));
  3429. _this.id = id;
  3430. _this.type = type;
  3431. _this.initial = initial;
  3432. _this.isConst = isConst;
  3433. return _this;
  3434. }
  3435. return Declaration;
  3436. }(_command.Command);
  3437. /***/ }),
  3438. /***/ "./js/ast/commands/doWhile.js":
  3439. /*!************************************!*\
  3440. !*** ./js/ast/commands/doWhile.js ***!
  3441. \************************************/
  3442. /*! no static exports found */
  3443. /***/ (function(module, exports, __webpack_require__) {
  3444. "use strict";
  3445. Object.defineProperty(exports, "__esModule", {
  3446. value: true
  3447. });
  3448. exports.DoWhile = undefined;
  3449. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3450. var _while = __webpack_require__(/*! ./while */ "./js/ast/commands/while.js");
  3451. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3452. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3453. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3454. var DoWhile = exports.DoWhile = function (_While) {
  3455. _inherits(DoWhile, _While);
  3456. function DoWhile(condition, commandBlock) {
  3457. _classCallCheck(this, DoWhile);
  3458. return _possibleConstructorReturn(this, (DoWhile.__proto__ || Object.getPrototypeOf(DoWhile)).call(this, condition, commandBlock));
  3459. }
  3460. _createClass(DoWhile, [{
  3461. key: 'testFirst',
  3462. get: function get() {
  3463. return false;
  3464. }
  3465. }]);
  3466. return DoWhile;
  3467. }(_while.While);
  3468. /***/ }),
  3469. /***/ "./js/ast/commands/for.js":
  3470. /*!********************************!*\
  3471. !*** ./js/ast/commands/for.js ***!
  3472. \********************************/
  3473. /*! no static exports found */
  3474. /***/ (function(module, exports, __webpack_require__) {
  3475. "use strict";
  3476. Object.defineProperty(exports, "__esModule", {
  3477. value: true
  3478. });
  3479. exports.For = undefined;
  3480. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3481. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3482. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3483. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3484. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3485. var For = exports.For = function (_Command) {
  3486. _inherits(For, _Command);
  3487. function For(assignment, condition, increment, commandBlock) {
  3488. _classCallCheck(this, For);
  3489. var _this = _possibleConstructorReturn(this, (For.__proto__ || Object.getPrototypeOf(For)).call(this));
  3490. _this.assignment = assignment;
  3491. _this.condition = condition;
  3492. _this.increment = increment;
  3493. _this.commandBlock = commandBlock;
  3494. return _this;
  3495. }
  3496. _createClass(For, [{
  3497. key: 'commands',
  3498. get: function get() {
  3499. return this.commandBlock.commands;
  3500. }
  3501. }]);
  3502. return For;
  3503. }(_command.Command);
  3504. /***/ }),
  3505. /***/ "./js/ast/commands/formalParameter.js":
  3506. /*!********************************************!*\
  3507. !*** ./js/ast/commands/formalParameter.js ***!
  3508. \********************************************/
  3509. /*! no static exports found */
  3510. /***/ (function(module, exports, __webpack_require__) {
  3511. "use strict";
  3512. Object.defineProperty(exports, "__esModule", {
  3513. value: true
  3514. });
  3515. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3516. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3517. var FormalParameter = exports.FormalParameter = function () {
  3518. function FormalParameter(type, id) {
  3519. var byRef = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  3520. _classCallCheck(this, FormalParameter);
  3521. this.type = type;
  3522. this.id = id;
  3523. this.byRef = byRef;
  3524. this._sourceInfo = null;
  3525. }
  3526. _createClass(FormalParameter, [{
  3527. key: "sourceInfo",
  3528. set: function set(sourceInfo) {
  3529. this._sourceInfo = sourceInfo;
  3530. },
  3531. get: function get() {
  3532. return this._sourceInfo;
  3533. }
  3534. }]);
  3535. return FormalParameter;
  3536. }();
  3537. /***/ }),
  3538. /***/ "./js/ast/commands/function.js":
  3539. /*!*************************************!*\
  3540. !*** ./js/ast/commands/function.js ***!
  3541. \*************************************/
  3542. /*! no static exports found */
  3543. /***/ (function(module, exports, __webpack_require__) {
  3544. "use strict";
  3545. Object.defineProperty(exports, "__esModule", {
  3546. value: true
  3547. });
  3548. exports.Function = undefined;
  3549. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3550. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  3551. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3552. var Function = exports.Function = function () {
  3553. function Function(name, returnType, formalParameters, commandBlock) {
  3554. _classCallCheck(this, Function);
  3555. this.name = name;
  3556. this.returnType = returnType;
  3557. this.formalParameters = formalParameters;
  3558. this.commandBlock = commandBlock;
  3559. this._sourceInfo = null;
  3560. }
  3561. _createClass(Function, [{
  3562. key: 'isMain',
  3563. get: function get() {
  3564. return this.name === null && this.returnType.isCompatible(_types.Types.VOID);
  3565. }
  3566. }, {
  3567. key: 'commands',
  3568. get: function get() {
  3569. return this.commandBlock.commands;
  3570. }
  3571. }, {
  3572. key: 'variablesDeclarations',
  3573. get: function get() {
  3574. return this.commandBlock.variables;
  3575. }
  3576. }, {
  3577. key: 'sourceInfo',
  3578. set: function set(sourceInfo) {
  3579. this._sourceInfo = sourceInfo;
  3580. },
  3581. get: function get() {
  3582. return this._sourceInfo;
  3583. }
  3584. }]);
  3585. return Function;
  3586. }();
  3587. /***/ }),
  3588. /***/ "./js/ast/commands/ifThenElse.js":
  3589. /*!***************************************!*\
  3590. !*** ./js/ast/commands/ifThenElse.js ***!
  3591. \***************************************/
  3592. /*! no static exports found */
  3593. /***/ (function(module, exports, __webpack_require__) {
  3594. "use strict";
  3595. Object.defineProperty(exports, "__esModule", {
  3596. value: true
  3597. });
  3598. exports.IfThenElse = undefined;
  3599. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3600. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3601. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3602. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3603. var IfThenElse = exports.IfThenElse = function (_Command) {
  3604. _inherits(IfThenElse, _Command);
  3605. function IfThenElse(condition, ifTrue, ifFalse) {
  3606. _classCallCheck(this, IfThenElse);
  3607. var _this = _possibleConstructorReturn(this, (IfThenElse.__proto__ || Object.getPrototypeOf(IfThenElse)).call(this));
  3608. _this.condition = condition;
  3609. _this.ifTrue = ifTrue;
  3610. _this.ifFalse = ifFalse;
  3611. return _this;
  3612. }
  3613. return IfThenElse;
  3614. }(_command.Command);
  3615. /***/ }),
  3616. /***/ "./js/ast/commands/index.js":
  3617. /*!**********************************!*\
  3618. !*** ./js/ast/commands/index.js ***!
  3619. \**********************************/
  3620. /*! no static exports found */
  3621. /***/ (function(module, exports, __webpack_require__) {
  3622. "use strict";
  3623. Object.defineProperty(exports, "__esModule", {
  3624. value: true
  3625. });
  3626. exports.FunctionCall = exports.FormalParameter = exports.SysCall = exports.Case = exports.Switch = exports.DoWhile = exports.CommandBlock = exports.IfThenElse = exports.Function = exports.For = exports.While = exports.ArrayDeclaration = exports.Declaration = exports.ArrayIndexAssign = exports.Assign = exports.Return = exports.Break = undefined;
  3627. var _break = __webpack_require__(/*! ./break */ "./js/ast/commands/break.js");
  3628. var _return = __webpack_require__(/*! ./return */ "./js/ast/commands/return.js");
  3629. var _assign = __webpack_require__(/*! ./assign */ "./js/ast/commands/assign.js");
  3630. var _arrayAssign = __webpack_require__(/*! ./arrayAssign */ "./js/ast/commands/arrayAssign.js");
  3631. var _declaration = __webpack_require__(/*! ./declaration */ "./js/ast/commands/declaration.js");
  3632. var _arrayDeclaration = __webpack_require__(/*! ./arrayDeclaration */ "./js/ast/commands/arrayDeclaration.js");
  3633. var _while = __webpack_require__(/*! ./while */ "./js/ast/commands/while.js");
  3634. var _for = __webpack_require__(/*! ./for */ "./js/ast/commands/for.js");
  3635. var _function = __webpack_require__(/*! ./function */ "./js/ast/commands/function.js");
  3636. var _ifThenElse = __webpack_require__(/*! ./ifThenElse */ "./js/ast/commands/ifThenElse.js");
  3637. var _commandBlock = __webpack_require__(/*! ./commandBlock */ "./js/ast/commands/commandBlock.js");
  3638. var _doWhile = __webpack_require__(/*! ./doWhile */ "./js/ast/commands/doWhile.js");
  3639. var _switch = __webpack_require__(/*! ./switch */ "./js/ast/commands/switch.js");
  3640. var _case = __webpack_require__(/*! ./case */ "./js/ast/commands/case.js");
  3641. var _sysCall = __webpack_require__(/*! ./sysCall */ "./js/ast/commands/sysCall.js");
  3642. var _formalParameter = __webpack_require__(/*! ./formalParameter */ "./js/ast/commands/formalParameter.js");
  3643. var _functionCall = __webpack_require__(/*! ./../expressions/functionCall */ "./js/ast/expressions/functionCall.js");
  3644. //Proxy to expression since they do exatcly the same thing
  3645. exports.Break = _break.Break;
  3646. exports.Return = _return.Return;
  3647. exports.Assign = _assign.Assign;
  3648. exports.ArrayIndexAssign = _arrayAssign.ArrayIndexAssign;
  3649. exports.Declaration = _declaration.Declaration;
  3650. exports.ArrayDeclaration = _arrayDeclaration.ArrayDeclaration;
  3651. exports.While = _while.While;
  3652. exports.For = _for.For;
  3653. exports.Function = _function.Function;
  3654. exports.IfThenElse = _ifThenElse.IfThenElse;
  3655. exports.CommandBlock = _commandBlock.CommandBlock;
  3656. exports.DoWhile = _doWhile.DoWhile;
  3657. exports.Switch = _switch.Switch;
  3658. exports.Case = _case.Case;
  3659. exports.SysCall = _sysCall.SysCall;
  3660. exports.FormalParameter = _formalParameter.FormalParameter;
  3661. exports.FunctionCall = _functionCall.FunctionCall;
  3662. /***/ }),
  3663. /***/ "./js/ast/commands/return.js":
  3664. /*!***********************************!*\
  3665. !*** ./js/ast/commands/return.js ***!
  3666. \***********************************/
  3667. /*! no static exports found */
  3668. /***/ (function(module, exports, __webpack_require__) {
  3669. "use strict";
  3670. Object.defineProperty(exports, "__esModule", {
  3671. value: true
  3672. });
  3673. exports.Return = undefined;
  3674. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3675. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3676. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3677. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3678. var Return = exports.Return = function (_Command) {
  3679. _inherits(Return, _Command);
  3680. function Return(expression) {
  3681. _classCallCheck(this, Return);
  3682. var _this = _possibleConstructorReturn(this, (Return.__proto__ || Object.getPrototypeOf(Return)).call(this));
  3683. _this.expression = expression;
  3684. return _this;
  3685. }
  3686. return Return;
  3687. }(_command.Command);
  3688. /***/ }),
  3689. /***/ "./js/ast/commands/switch.js":
  3690. /*!***********************************!*\
  3691. !*** ./js/ast/commands/switch.js ***!
  3692. \***********************************/
  3693. /*! no static exports found */
  3694. /***/ (function(module, exports, __webpack_require__) {
  3695. "use strict";
  3696. Object.defineProperty(exports, "__esModule", {
  3697. value: true
  3698. });
  3699. exports.Switch = undefined;
  3700. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3701. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3702. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3703. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3704. var Switch = exports.Switch = function (_Command) {
  3705. _inherits(Switch, _Command);
  3706. function Switch(expression, cases) {
  3707. _classCallCheck(this, Switch);
  3708. var _this = _possibleConstructorReturn(this, (Switch.__proto__ || Object.getPrototypeOf(Switch)).call(this));
  3709. _this.expression = expression;
  3710. _this.cases = cases;
  3711. return _this;
  3712. }
  3713. return Switch;
  3714. }(_command.Command);
  3715. /***/ }),
  3716. /***/ "./js/ast/commands/sysCall.js":
  3717. /*!************************************!*\
  3718. !*** ./js/ast/commands/sysCall.js ***!
  3719. \************************************/
  3720. /*! no static exports found */
  3721. /***/ (function(module, exports, __webpack_require__) {
  3722. "use strict";
  3723. Object.defineProperty(exports, "__esModule", {
  3724. value: true
  3725. });
  3726. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3727. /**
  3728. * This class represents all the language defined functions.
  3729. * The language processor uses the id provided here to properly execute the desired function.
  3730. * The function is actually implemented inside the language processor.
  3731. * All the functions can be found at: js/processor/definedFunctions.js
  3732. */
  3733. var SysCall = exports.SysCall = function SysCall(langFunc) {
  3734. _classCallCheck(this, SysCall);
  3735. this.langFunc = langFunc;
  3736. };
  3737. /***/ }),
  3738. /***/ "./js/ast/commands/while.js":
  3739. /*!**********************************!*\
  3740. !*** ./js/ast/commands/while.js ***!
  3741. \**********************************/
  3742. /*! no static exports found */
  3743. /***/ (function(module, exports, __webpack_require__) {
  3744. "use strict";
  3745. Object.defineProperty(exports, "__esModule", {
  3746. value: true
  3747. });
  3748. exports.While = undefined;
  3749. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3750. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3751. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3752. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3753. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3754. var While = exports.While = function (_Command) {
  3755. _inherits(While, _Command);
  3756. function While(expression, commandBlock) {
  3757. _classCallCheck(this, While);
  3758. var _this = _possibleConstructorReturn(this, (While.__proto__ || Object.getPrototypeOf(While)).call(this));
  3759. _this.expression = expression;
  3760. _this.commandBlock = commandBlock;
  3761. return _this;
  3762. }
  3763. _createClass(While, [{
  3764. key: 'commands',
  3765. get: function get() {
  3766. return this.commandBlock.commands;
  3767. }
  3768. }, {
  3769. key: 'testFirst',
  3770. get: function get() {
  3771. return true;
  3772. }
  3773. }]);
  3774. return While;
  3775. }(_command.Command);
  3776. /***/ }),
  3777. /***/ "./js/ast/error/syntaxError.js":
  3778. /*!*************************************!*\
  3779. !*** ./js/ast/error/syntaxError.js ***!
  3780. \*************************************/
  3781. /*! no static exports found */
  3782. /***/ (function(module, exports, __webpack_require__) {
  3783. "use strict";
  3784. Object.defineProperty(exports, "__esModule", {
  3785. value: true
  3786. });
  3787. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3788. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3789. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3790. var SyntaxError = exports.SyntaxError = function (_Error) {
  3791. _inherits(SyntaxError, _Error);
  3792. function SyntaxError() {
  3793. var _ref;
  3794. _classCallCheck(this, SyntaxError);
  3795. for (var _len = arguments.length, msg = Array(_len), _key = 0; _key < _len; _key++) {
  3796. msg[_key] = arguments[_key];
  3797. }
  3798. var _this = _possibleConstructorReturn(this, (_ref = SyntaxError.__proto__ || Object.getPrototypeOf(SyntaxError)).call.apply(_ref, [this].concat(msg)));
  3799. if (Error.captureStackTrace) Error.captureStackTrace(_this, SyntaxError);
  3800. return _this;
  3801. }
  3802. return SyntaxError;
  3803. }(Error);
  3804. /***/ }),
  3805. /***/ "./js/ast/error/syntaxErrorFactory.js":
  3806. /*!********************************************!*\
  3807. !*** ./js/ast/error/syntaxErrorFactory.js ***!
  3808. \********************************************/
  3809. /*! no static exports found */
  3810. /***/ (function(module, exports, __webpack_require__) {
  3811. "use strict";
  3812. Object.defineProperty(exports, "__esModule", {
  3813. value: true
  3814. });
  3815. exports.SyntaxErrorFactory = undefined;
  3816. var _localizedStringsService = __webpack_require__(/*! ./../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  3817. var _syntaxError = __webpack_require__(/*! ./syntaxError */ "./js/ast/error/syntaxError.js");
  3818. var SyntaxErrorFactory = exports.SyntaxErrorFactory = Object.freeze({
  3819. extra_lines: function extra_lines() {
  3820. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("extra_lines"));
  3821. },
  3822. token_missing_one: function token_missing_one(expected, token) {
  3823. var context = [expected, token.text, token.line, token.column];
  3824. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("token_missing_one", context));
  3825. },
  3826. token_missing_list: function token_missing_list(expectedList, token) {
  3827. var line = expectedList.join(_localizedStringsService.LocalizedStrings.getOR());
  3828. return SyntaxErrorFactory.token_missing_one(line, token);
  3829. },
  3830. id_missing: function id_missing(token) {
  3831. var context = [token.text, token.line, token.column];
  3832. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("id_missing", context));
  3833. },
  3834. eos_missing: function eos_missing(token) {
  3835. var context = [token.line, token.column];
  3836. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("eos_missing", context));
  3837. },
  3838. invalid_array_dimension: function invalid_array_dimension(typeName, token) {
  3839. var context = [token.line, token.column, typeName];
  3840. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_array_dimension", context));
  3841. },
  3842. invalid_array_size: function invalid_array_size(token) {
  3843. var context = [token.line];
  3844. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_array_size", context));
  3845. },
  3846. invalid_main_return: function invalid_main_return(name, typeName, token) {
  3847. var context = [name, typeName, token.line];
  3848. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_main_return", context));
  3849. },
  3850. invalid_var_declaration: function invalid_var_declaration(token) {
  3851. var context = [token.line];
  3852. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_var_declaration", context));
  3853. },
  3854. invalid_break_command: function invalid_break_command(cmdName, token) {
  3855. var context = [token.line, cmdName];
  3856. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_break_command", context));
  3857. },
  3858. invalid_terminal: function invalid_terminal(token) {
  3859. var context = [token.text, token.line, token.column];
  3860. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError('invalid_terminal', context));
  3861. },
  3862. invalid_type: function invalid_type(list, token) {
  3863. var line = list.join(_localizedStringsService.LocalizedStrings.getOR());
  3864. var context = [token.text, token.line, token.column, line];
  3865. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_type", context));
  3866. },
  3867. const_not_init: function const_not_init(token) {
  3868. var context = [token.line, token.column];
  3869. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("const_not_init", context));
  3870. },
  3871. invalid_id_format: function invalid_id_format(token) {
  3872. var context = [token.text, token.line, token.column];
  3873. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_id_format", context));
  3874. },
  3875. duplicate_function: function duplicate_function(token) {
  3876. var context = [token.text, token.line, token.column];
  3877. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("duplicate_function", context));
  3878. },
  3879. main_parameters: function main_parameters() {
  3880. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("main_parameters"));
  3881. },
  3882. duplicate_variable: function duplicate_variable(token) {
  3883. var context = [token.text, token.line, token.column];
  3884. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("duplicate_variable", context));
  3885. }
  3886. });
  3887. /***/ }),
  3888. /***/ "./js/ast/expressions/arrayAccess.js":
  3889. /*!*******************************************!*\
  3890. !*** ./js/ast/expressions/arrayAccess.js ***!
  3891. \*******************************************/
  3892. /*! no static exports found */
  3893. /***/ (function(module, exports, __webpack_require__) {
  3894. "use strict";
  3895. Object.defineProperty(exports, "__esModule", {
  3896. value: true
  3897. });
  3898. exports.ArrayAccess = undefined;
  3899. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3900. var _expression = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  3901. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3902. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3903. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3904. var ArrayAccess = exports.ArrayAccess = function (_Expression) {
  3905. _inherits(ArrayAccess, _Expression);
  3906. function ArrayAccess(id, line, column) {
  3907. _classCallCheck(this, ArrayAccess);
  3908. var _this = _possibleConstructorReturn(this, (ArrayAccess.__proto__ || Object.getPrototypeOf(ArrayAccess)).call(this));
  3909. _this.id = id;
  3910. _this.line = line;
  3911. _this.column = column;
  3912. return _this;
  3913. }
  3914. _createClass(ArrayAccess, [{
  3915. key: 'toString',
  3916. value: function toString() {
  3917. var strLine = this.line.toString();
  3918. var strColumn = null;
  3919. if (this.column) {
  3920. strColumn = this.column.toString();
  3921. }
  3922. if (strColumn) {
  3923. return this.id + '[' + strLine + '][' + strColumn + ']';
  3924. } else {
  3925. return this.id + '[' + strLine + ']';
  3926. }
  3927. }
  3928. }]);
  3929. return ArrayAccess;
  3930. }(_expression.Expression);
  3931. /***/ }),
  3932. /***/ "./js/ast/expressions/arrayLiteral.js":
  3933. /*!********************************************!*\
  3934. !*** ./js/ast/expressions/arrayLiteral.js ***!
  3935. \********************************************/
  3936. /*! no static exports found */
  3937. /***/ (function(module, exports, __webpack_require__) {
  3938. "use strict";
  3939. Object.defineProperty(exports, "__esModule", {
  3940. value: true
  3941. });
  3942. exports.ArrayLiteral = undefined;
  3943. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3944. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  3945. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3946. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3947. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3948. var ArrayLiteral = exports.ArrayLiteral = function (_Literal) {
  3949. _inherits(ArrayLiteral, _Literal);
  3950. function ArrayLiteral(type, value) {
  3951. _classCallCheck(this, ArrayLiteral);
  3952. var _this = _possibleConstructorReturn(this, (ArrayLiteral.__proto__ || Object.getPrototypeOf(ArrayLiteral)).call(this, type));
  3953. _this.value = value;
  3954. return _this;
  3955. }
  3956. _createClass(ArrayLiteral, [{
  3957. key: 'validateType',
  3958. value: function validateType() {
  3959. // let valid = true;
  3960. // if(this.columns !== null) {
  3961. // const len = this.columns;
  3962. // const len2 = this.lines;
  3963. // for (let i = len - 1; i >= 0; i--) {
  3964. // for (let j = len2 - 1; j >= 0; j--) {
  3965. // if(this.value[i].value[j].type !== this.subtype) {
  3966. // valid = false;
  3967. // break;
  3968. // }
  3969. // }
  3970. // }
  3971. // } else {
  3972. // const len = this.lines;
  3973. // for (var i = len - 1; i >= 0; i--) {
  3974. // if(this.value[i].type !== this.subtype) {
  3975. // valid = false;
  3976. // break;
  3977. // }
  3978. // }
  3979. // }
  3980. return true; //valid;
  3981. }
  3982. }, {
  3983. key: 'validateSize',
  3984. value: function validateSize() {
  3985. var valid = true;
  3986. if (this.columns !== null) {
  3987. var equalityTest = data.value.map(function (v) {
  3988. return v.length;
  3989. }).reduce(function (old, next) {
  3990. if (old === null) {
  3991. return next;
  3992. } else if (old === next) {
  3993. return old;
  3994. } else {
  3995. return -1;
  3996. }
  3997. }, null);
  3998. valid = equalityTest !== -1;
  3999. }
  4000. return valid;
  4001. }
  4002. }, {
  4003. key: 'toString',
  4004. value: function toString() {
  4005. var strList = this.value.map(function (arrayLiteral) {
  4006. return arrayLiteral.toString();
  4007. });
  4008. return "{" + strList.join(',') + "}";
  4009. }
  4010. }, {
  4011. key: 'subtype',
  4012. get: function get() {
  4013. var element = this.value[0];
  4014. if (element instanceof ArrayLiteral) {
  4015. return element.value[0].type;
  4016. } else {
  4017. return element.type;
  4018. }
  4019. }
  4020. }, {
  4021. key: 'lines',
  4022. get: function get() {
  4023. return this.value.length;
  4024. }
  4025. }, {
  4026. key: 'columns',
  4027. get: function get() {
  4028. var element = this.value[0];
  4029. if (!(element instanceof ArrayLiteral)) {
  4030. return null;
  4031. } else {
  4032. return element.value[0].value.length;
  4033. }
  4034. }
  4035. }, {
  4036. key: 'isVector',
  4037. get: function get() {
  4038. return this.columns === null;
  4039. }
  4040. }, {
  4041. key: 'isValid',
  4042. get: function get() {
  4043. return true; //this.validateType() && this.validateSize();
  4044. }
  4045. }]);
  4046. return ArrayLiteral;
  4047. }(_literal.Literal);
  4048. /***/ }),
  4049. /***/ "./js/ast/expressions/boolLiteral.js":
  4050. /*!*******************************************!*\
  4051. !*** ./js/ast/expressions/boolLiteral.js ***!
  4052. \*******************************************/
  4053. /*! no static exports found */
  4054. /***/ (function(module, exports, __webpack_require__) {
  4055. "use strict";
  4056. Object.defineProperty(exports, "__esModule", {
  4057. value: true
  4058. });
  4059. exports.BoolLiteral = undefined;
  4060. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4061. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4062. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  4063. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  4064. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4065. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4066. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4067. var BoolLiteral = exports.BoolLiteral = function (_Literal) {
  4068. _inherits(BoolLiteral, _Literal);
  4069. function BoolLiteral(value) {
  4070. _classCallCheck(this, BoolLiteral);
  4071. var _this = _possibleConstructorReturn(this, (BoolLiteral.__proto__ || Object.getPrototypeOf(BoolLiteral)).call(this, _types.Types.BOOLEAN));
  4072. _this.value = value;
  4073. return _this;
  4074. }
  4075. _createClass(BoolLiteral, [{
  4076. key: 'toString',
  4077. value: function toString() {
  4078. return (0, _parsers.convertBoolToString)(this.value);
  4079. }
  4080. }]);
  4081. return BoolLiteral;
  4082. }(_literal.Literal);
  4083. /***/ }),
  4084. /***/ "./js/ast/expressions/expression.js":
  4085. /*!******************************************!*\
  4086. !*** ./js/ast/expressions/expression.js ***!
  4087. \******************************************/
  4088. /*! no static exports found */
  4089. /***/ (function(module, exports, __webpack_require__) {
  4090. "use strict";
  4091. Object.defineProperty(exports, "__esModule", {
  4092. value: true
  4093. });
  4094. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4095. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4096. var Expression = exports.Expression = function () {
  4097. function Expression() {
  4098. _classCallCheck(this, Expression);
  4099. this._sourceInfo = null;
  4100. }
  4101. _createClass(Expression, [{
  4102. key: "sourceInfo",
  4103. set: function set(sourceInfo) {
  4104. this._sourceInfo = sourceInfo;
  4105. },
  4106. get: function get() {
  4107. return this._sourceInfo;
  4108. }
  4109. }]);
  4110. return Expression;
  4111. }();
  4112. /***/ }),
  4113. /***/ "./js/ast/expressions/functionCall.js":
  4114. /*!********************************************!*\
  4115. !*** ./js/ast/expressions/functionCall.js ***!
  4116. \********************************************/
  4117. /*! no static exports found */
  4118. /***/ (function(module, exports, __webpack_require__) {
  4119. "use strict";
  4120. Object.defineProperty(exports, "__esModule", {
  4121. value: true
  4122. });
  4123. exports.FunctionCall = undefined;
  4124. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4125. var _expression = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  4126. var _definedFunctions = __webpack_require__(/*! ../../processor/definedFunctions */ "./js/processor/definedFunctions.js");
  4127. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4128. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4129. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4130. var FunctionCall = exports.FunctionCall = function (_Expression) {
  4131. _inherits(FunctionCall, _Expression);
  4132. function FunctionCall(id, actualParameters) {
  4133. _classCallCheck(this, FunctionCall);
  4134. var _this = _possibleConstructorReturn(this, (FunctionCall.__proto__ || Object.getPrototypeOf(FunctionCall)).call(this));
  4135. _this.id = id;
  4136. _this.actualParameters = actualParameters;
  4137. return _this;
  4138. }
  4139. _createClass(FunctionCall, [{
  4140. key: 'toString',
  4141. value: function toString() {
  4142. var name = null;
  4143. if (this.isMainCall) {
  4144. name = _definedFunctions.LanguageDefinedFunction.getMainFunctionName();
  4145. } else {
  4146. name = _definedFunctions.LanguageDefinedFunction.getLocalName(this.id);
  4147. }
  4148. var params = null;
  4149. if (this.actualParameters.length == 0) {
  4150. params = "()";
  4151. } else {
  4152. var strParams = this.actualParameters.map(function (v) {
  4153. return v.toString();
  4154. });
  4155. params = "(" + strParams.join(",") + ")";
  4156. }
  4157. return name + params;
  4158. }
  4159. }, {
  4160. key: 'isMainCall',
  4161. get: function get() {
  4162. return this.id === null;
  4163. }
  4164. }, {
  4165. key: 'parametersSize',
  4166. get: function get() {
  4167. return this.actualParameters.length;
  4168. }
  4169. }]);
  4170. return FunctionCall;
  4171. }(_expression.Expression);
  4172. /***/ }),
  4173. /***/ "./js/ast/expressions/index.js":
  4174. /*!*************************************!*\
  4175. !*** ./js/ast/expressions/index.js ***!
  4176. \*************************************/
  4177. /*! no static exports found */
  4178. /***/ (function(module, exports, __webpack_require__) {
  4179. "use strict";
  4180. Object.defineProperty(exports, "__esModule", {
  4181. value: true
  4182. });
  4183. exports.UnaryApp = exports.InfixApp = exports.VariableLiteral = exports.ArrayLiteral = exports.StringLiteral = exports.BoolLiteral = exports.RealLiteral = exports.IntLiteral = exports.FunctionCall = exports.ArrayAccess = undefined;
  4184. var _arrayAccess = __webpack_require__(/*! ./arrayAccess */ "./js/ast/expressions/arrayAccess.js");
  4185. var _functionCall = __webpack_require__(/*! ./functionCall */ "./js/ast/expressions/functionCall.js");
  4186. var _intLiteral = __webpack_require__(/*! ./intLiteral */ "./js/ast/expressions/intLiteral.js");
  4187. var _realLiteral = __webpack_require__(/*! ./realLiteral */ "./js/ast/expressions/realLiteral.js");
  4188. var _boolLiteral = __webpack_require__(/*! ./boolLiteral */ "./js/ast/expressions/boolLiteral.js");
  4189. var _stringLiteral = __webpack_require__(/*! ./stringLiteral */ "./js/ast/expressions/stringLiteral.js");
  4190. var _arrayLiteral = __webpack_require__(/*! ./arrayLiteral */ "./js/ast/expressions/arrayLiteral.js");
  4191. var _variableLiteral = __webpack_require__(/*! ./variableLiteral */ "./js/ast/expressions/variableLiteral.js");
  4192. var _infixApp = __webpack_require__(/*! ./infixApp */ "./js/ast/expressions/infixApp.js");
  4193. var _unaryApp = __webpack_require__(/*! ./unaryApp */ "./js/ast/expressions/unaryApp.js");
  4194. exports.ArrayAccess = _arrayAccess.ArrayAccess;
  4195. exports.FunctionCall = _functionCall.FunctionCall;
  4196. exports.IntLiteral = _intLiteral.IntLiteral;
  4197. exports.RealLiteral = _realLiteral.RealLiteral;
  4198. exports.BoolLiteral = _boolLiteral.BoolLiteral;
  4199. exports.StringLiteral = _stringLiteral.StringLiteral;
  4200. exports.ArrayLiteral = _arrayLiteral.ArrayLiteral;
  4201. exports.VariableLiteral = _variableLiteral.VariableLiteral;
  4202. exports.InfixApp = _infixApp.InfixApp;
  4203. exports.UnaryApp = _unaryApp.UnaryApp;
  4204. /***/ }),
  4205. /***/ "./js/ast/expressions/infixApp.js":
  4206. /*!****************************************!*\
  4207. !*** ./js/ast/expressions/infixApp.js ***!
  4208. \****************************************/
  4209. /*! no static exports found */
  4210. /***/ (function(module, exports, __webpack_require__) {
  4211. "use strict";
  4212. Object.defineProperty(exports, "__esModule", {
  4213. value: true
  4214. });
  4215. exports.InfixApp = undefined;
  4216. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4217. var _expression = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  4218. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4219. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4220. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4221. var InfixApp = exports.InfixApp = function (_Expression) {
  4222. _inherits(InfixApp, _Expression);
  4223. function InfixApp(op, left, right) {
  4224. _classCallCheck(this, InfixApp);
  4225. var _this = _possibleConstructorReturn(this, (InfixApp.__proto__ || Object.getPrototypeOf(InfixApp)).call(this));
  4226. _this.op = op;
  4227. _this.left = left;
  4228. _this.right = right;
  4229. return _this;
  4230. }
  4231. _createClass(InfixApp, [{
  4232. key: 'toString',
  4233. value: function toString() {
  4234. var l = this.left.toString();
  4235. var op = this.op.value;
  4236. var r = this.right.toString();
  4237. return l + op + r;
  4238. }
  4239. }]);
  4240. return InfixApp;
  4241. }(_expression.Expression);
  4242. /***/ }),
  4243. /***/ "./js/ast/expressions/intLiteral.js":
  4244. /*!******************************************!*\
  4245. !*** ./js/ast/expressions/intLiteral.js ***!
  4246. \******************************************/
  4247. /*! no static exports found */
  4248. /***/ (function(module, exports, __webpack_require__) {
  4249. "use strict";
  4250. Object.defineProperty(exports, "__esModule", {
  4251. value: true
  4252. });
  4253. exports.IntLiteral = undefined;
  4254. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4255. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4256. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  4257. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  4258. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4259. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4260. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4261. var IntLiteral = exports.IntLiteral = function (_Literal) {
  4262. _inherits(IntLiteral, _Literal);
  4263. function IntLiteral(value) {
  4264. _classCallCheck(this, IntLiteral);
  4265. var _this = _possibleConstructorReturn(this, (IntLiteral.__proto__ || Object.getPrototypeOf(IntLiteral)).call(this, _types.Types.INTEGER));
  4266. _this.value = value;
  4267. return _this;
  4268. }
  4269. _createClass(IntLiteral, [{
  4270. key: 'toString',
  4271. value: function toString() {
  4272. return (0, _parsers.convertToString)(this.value, this.type);
  4273. }
  4274. }]);
  4275. return IntLiteral;
  4276. }(_literal.Literal);
  4277. /***/ }),
  4278. /***/ "./js/ast/expressions/literal.js":
  4279. /*!***************************************!*\
  4280. !*** ./js/ast/expressions/literal.js ***!
  4281. \***************************************/
  4282. /*! no static exports found */
  4283. /***/ (function(module, exports, __webpack_require__) {
  4284. "use strict";
  4285. Object.defineProperty(exports, "__esModule", {
  4286. value: true
  4287. });
  4288. exports.Literal = undefined;
  4289. var _expression = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  4290. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4291. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4292. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4293. var Literal = exports.Literal = function (_Expression) {
  4294. _inherits(Literal, _Expression);
  4295. function Literal(type) {
  4296. _classCallCheck(this, Literal);
  4297. var _this = _possibleConstructorReturn(this, (Literal.__proto__ || Object.getPrototypeOf(Literal)).call(this));
  4298. _this.type = type;
  4299. return _this;
  4300. }
  4301. return Literal;
  4302. }(_expression.Expression);
  4303. /***/ }),
  4304. /***/ "./js/ast/expressions/realLiteral.js":
  4305. /*!*******************************************!*\
  4306. !*** ./js/ast/expressions/realLiteral.js ***!
  4307. \*******************************************/
  4308. /*! no static exports found */
  4309. /***/ (function(module, exports, __webpack_require__) {
  4310. "use strict";
  4311. Object.defineProperty(exports, "__esModule", {
  4312. value: true
  4313. });
  4314. exports.RealLiteral = undefined;
  4315. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4316. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4317. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  4318. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  4319. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4320. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4321. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4322. var RealLiteral = exports.RealLiteral = function (_Literal) {
  4323. _inherits(RealLiteral, _Literal);
  4324. function RealLiteral(value) {
  4325. _classCallCheck(this, RealLiteral);
  4326. var _this = _possibleConstructorReturn(this, (RealLiteral.__proto__ || Object.getPrototypeOf(RealLiteral)).call(this, _types.Types.REAL));
  4327. _this.value = value;
  4328. return _this;
  4329. }
  4330. _createClass(RealLiteral, [{
  4331. key: 'toString',
  4332. value: function toString() {
  4333. return (0, _parsers.convertToString)(this.value, this.type);
  4334. }
  4335. }]);
  4336. return RealLiteral;
  4337. }(_literal.Literal);
  4338. /***/ }),
  4339. /***/ "./js/ast/expressions/stringLiteral.js":
  4340. /*!*********************************************!*\
  4341. !*** ./js/ast/expressions/stringLiteral.js ***!
  4342. \*********************************************/
  4343. /*! no static exports found */
  4344. /***/ (function(module, exports, __webpack_require__) {
  4345. "use strict";
  4346. Object.defineProperty(exports, "__esModule", {
  4347. value: true
  4348. });
  4349. exports.StringLiteral = undefined;
  4350. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4351. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4352. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  4353. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4354. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4355. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4356. var StringLiteral = exports.StringLiteral = function (_Literal) {
  4357. _inherits(StringLiteral, _Literal);
  4358. function StringLiteral(value) {
  4359. _classCallCheck(this, StringLiteral);
  4360. var _this = _possibleConstructorReturn(this, (StringLiteral.__proto__ || Object.getPrototypeOf(StringLiteral)).call(this, _types.Types.STRING));
  4361. _this.value = value;
  4362. return _this;
  4363. }
  4364. _createClass(StringLiteral, [{
  4365. key: 'toString',
  4366. value: function toString() {
  4367. return this.value;
  4368. }
  4369. }]);
  4370. return StringLiteral;
  4371. }(_literal.Literal);
  4372. /***/ }),
  4373. /***/ "./js/ast/expressions/unaryApp.js":
  4374. /*!****************************************!*\
  4375. !*** ./js/ast/expressions/unaryApp.js ***!
  4376. \****************************************/
  4377. /*! no static exports found */
  4378. /***/ (function(module, exports, __webpack_require__) {
  4379. "use strict";
  4380. Object.defineProperty(exports, "__esModule", {
  4381. value: true
  4382. });
  4383. exports.UnaryApp = undefined;
  4384. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4385. var _infixApp = __webpack_require__(/*! ./infixApp */ "./js/ast/expressions/infixApp.js");
  4386. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4387. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4388. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4389. var UnaryApp = exports.UnaryApp = function (_InfixApp) {
  4390. _inherits(UnaryApp, _InfixApp);
  4391. function UnaryApp(op, left) {
  4392. _classCallCheck(this, UnaryApp);
  4393. return _possibleConstructorReturn(this, (UnaryApp.__proto__ || Object.getPrototypeOf(UnaryApp)).call(this, op, left, null));
  4394. }
  4395. _createClass(UnaryApp, [{
  4396. key: 'toString',
  4397. value: function toString() {
  4398. var l = this.left.toString();
  4399. var op = this.op.value;
  4400. return op + l;
  4401. }
  4402. }]);
  4403. return UnaryApp;
  4404. }(_infixApp.InfixApp);
  4405. /***/ }),
  4406. /***/ "./js/ast/expressions/variableLiteral.js":
  4407. /*!***********************************************!*\
  4408. !*** ./js/ast/expressions/variableLiteral.js ***!
  4409. \***********************************************/
  4410. /*! no static exports found */
  4411. /***/ (function(module, exports, __webpack_require__) {
  4412. "use strict";
  4413. Object.defineProperty(exports, "__esModule", {
  4414. value: true
  4415. });
  4416. exports.VariableLiteral = undefined;
  4417. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4418. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4419. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  4420. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4421. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4422. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4423. var VariableLiteral = exports.VariableLiteral = function (_Literal) {
  4424. _inherits(VariableLiteral, _Literal);
  4425. function VariableLiteral(id) {
  4426. _classCallCheck(this, VariableLiteral);
  4427. var _this = _possibleConstructorReturn(this, (VariableLiteral.__proto__ || Object.getPrototypeOf(VariableLiteral)).call(this, _types.Types.UNDEFINED));
  4428. _this.id = id;
  4429. return _this;
  4430. }
  4431. _createClass(VariableLiteral, [{
  4432. key: 'toString',
  4433. value: function toString() {
  4434. return this.id;
  4435. }
  4436. }]);
  4437. return VariableLiteral;
  4438. }(_literal.Literal);
  4439. /***/ }),
  4440. /***/ "./js/ast/ivprogParser.js":
  4441. /*!********************************!*\
  4442. !*** ./js/ast/ivprogParser.js ***!
  4443. \********************************/
  4444. /*! no static exports found */
  4445. /***/ (function(module, exports, __webpack_require__) {
  4446. "use strict";
  4447. Object.defineProperty(exports, "__esModule", {
  4448. value: true
  4449. });
  4450. exports.IVProgParser = undefined;
  4451. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4452. var _index = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js");
  4453. var _expressions = __webpack_require__(/*! ./expressions/ */ "./js/ast/expressions/index.js");
  4454. var Expressions = _interopRequireWildcard(_expressions);
  4455. var _commands = __webpack_require__(/*! ./commands/ */ "./js/ast/commands/index.js");
  4456. var Commands = _interopRequireWildcard(_commands);
  4457. var _parsers = __webpack_require__(/*! ./../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  4458. var _types = __webpack_require__(/*! ./../typeSystem/types */ "./js/typeSystem/types.js");
  4459. var _compoundType = __webpack_require__(/*! ./../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  4460. var _sourceInfo2 = __webpack_require__(/*! ./sourceInfo */ "./js/ast/sourceInfo.js");
  4461. var _operators = __webpack_require__(/*! ./operators */ "./js/ast/operators.js");
  4462. var _syntaxErrorFactory = __webpack_require__(/*! ./error/syntaxErrorFactory */ "./js/ast/error/syntaxErrorFactory.js");
  4463. var _definedFunctions = __webpack_require__(/*! ./../processor/definedFunctions */ "./js/processor/definedFunctions.js");
  4464. var _languageService = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js");
  4465. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  4466. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4467. var IVProgParser = exports.IVProgParser = function () {
  4468. _createClass(IVProgParser, null, [{
  4469. key: 'createParser',
  4470. value: function createParser(input) {
  4471. var lexerClass = _languageService.LanguageService.getCurrentLexer();
  4472. return new IVProgParser(input, lexerClass);
  4473. }
  4474. // <BEGIN scope consts>
  4475. }, {
  4476. key: 'BASE',
  4477. get: function get() {
  4478. return 0;
  4479. }
  4480. }, {
  4481. key: 'FUNCTION',
  4482. get: function get() {
  4483. return 1;
  4484. }
  4485. }, {
  4486. key: 'COMMAND',
  4487. get: function get() {
  4488. return 2;
  4489. }
  4490. }, {
  4491. key: 'BREAKABLE',
  4492. get: function get() {
  4493. return 4;
  4494. }
  4495. // </ END scope consts>
  4496. }]);
  4497. function IVProgParser(input, lexerClass) {
  4498. _classCallCheck(this, IVProgParser);
  4499. this.lexerClass = lexerClass;
  4500. this.lexer = new lexerClass(new _index.InputStream(input));
  4501. this.tokenStream = new _index.CommonTokenStream(this.lexer);
  4502. this.tokenStream.fill();
  4503. this.pos = 1;
  4504. this.variableTypes = [this.lexerClass.RK_INTEGER, this.lexerClass.RK_REAL, this.lexerClass.RK_BOOLEAN, this.lexerClass.RK_STRING];
  4505. this.functionTypes = this.variableTypes.concat(this.lexerClass.RK_VOID);
  4506. this.parsingArrayDimension = 0;
  4507. this.scope = [];
  4508. this.langFuncs = _languageService.LanguageService.getCurrentLangFuncs();
  4509. this.definedFuncsNameList = [];
  4510. this.definedVariablesStack = [];
  4511. }
  4512. _createClass(IVProgParser, [{
  4513. key: 'parseTree',
  4514. value: function parseTree() {
  4515. return this.parseProgram();
  4516. }
  4517. }, {
  4518. key: 'getToken',
  4519. value: function getToken() {
  4520. var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.pos;
  4521. // if(index === null)
  4522. // index = this.pos;
  4523. return this.tokenStream.LT(index);
  4524. }
  4525. }, {
  4526. key: 'insideScope',
  4527. value: function insideScope(scope) {
  4528. if (this.scope.length <= 0) {
  4529. return IVProgParser.BASE === scope;
  4530. } else {
  4531. return this.scope[this.scope.length - 1] === scope;
  4532. }
  4533. }
  4534. }, {
  4535. key: 'pushScope',
  4536. value: function pushScope(scope) {
  4537. this.scope.push(scope);
  4538. }
  4539. }, {
  4540. key: 'pushVariableStack',
  4541. value: function pushVariableStack() {
  4542. this.definedVariablesStack.push([]);
  4543. }
  4544. }, {
  4545. key: 'popScope',
  4546. value: function popScope() {
  4547. return this.scope.pop();
  4548. }
  4549. }, {
  4550. key: 'popVariableStack',
  4551. value: function popVariableStack() {
  4552. return this.definedVariablesStack.pop();
  4553. }
  4554. }, {
  4555. key: 'getCurrentVariableStack',
  4556. value: function getCurrentVariableStack() {
  4557. return this.definedVariablesStack[this.definedVariablesStack.length - 1];
  4558. }
  4559. }, {
  4560. key: 'isEOF',
  4561. value: function isEOF() {
  4562. this.getToken(this.pos);
  4563. return this.tokenStream.fetchedEOF;
  4564. }
  4565. }, {
  4566. key: 'parseProgram',
  4567. value: function parseProgram() {
  4568. var token = this.getToken();
  4569. var globalVars = [];
  4570. var functions = [];
  4571. if (this.lexerClass.RK_PROGRAM === token.type) {
  4572. this.pos++;
  4573. this.consumeNewLines();
  4574. this.checkOpenCurly();
  4575. this.pos++;
  4576. this.pushVariableStack();
  4577. while (true) {
  4578. this.consumeNewLines();
  4579. var _token = this.getToken();
  4580. if (_token.type === this.lexerClass.RK_CONST || this.isVariableType(_token)) {
  4581. globalVars = globalVars.concat(this.parseGlobalVariables());
  4582. } else if (_token.type === this.lexerClass.RK_FUNCTION) {
  4583. this.pushVariableStack();
  4584. functions = functions.concat(this.parseFunction());
  4585. this.popVariableStack();
  4586. } else {
  4587. break;
  4588. }
  4589. }
  4590. this.consumeNewLines();
  4591. this.checkCloseCurly();
  4592. this.pos++;
  4593. this.consumeNewLines();
  4594. if (!this.isEOF()) {
  4595. throw _syntaxErrorFactory.SyntaxErrorFactory.extra_lines();
  4596. }
  4597. this.popVariableStack();
  4598. return { global: globalVars, functions: functions };
  4599. } else {
  4600. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(this.lexer.literalNames[this.lexerClass.RK_PROGRAM], token);
  4601. }
  4602. }
  4603. }, {
  4604. key: 'checkOpenCurly',
  4605. value: function checkOpenCurly() {
  4606. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4607. var token = this.getToken();
  4608. if (this.lexerClass.OPEN_CURLY !== token.type) {
  4609. if (!attempt) throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('{', token);else return false;
  4610. }
  4611. return true;
  4612. }
  4613. }, {
  4614. key: 'checkCloseCurly',
  4615. value: function checkCloseCurly() {
  4616. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4617. var token = this.getToken();
  4618. if (this.lexerClass.CLOSE_CURLY !== token.type) {
  4619. if (!attempt) throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('}', token);else return false;
  4620. }
  4621. return true;
  4622. }
  4623. /* It checks if the current token at position pos is a ']'.
  4624. * As a check function it doesn't increment pos.
  4625. *
  4626. * @params bool:attempt, indicates that the token is optional. Defaults: false
  4627. *
  4628. * @returns true if the attempt is true and current token is '[',
  4629. * false is attempt is true and current token is not '['
  4630. **/
  4631. }, {
  4632. key: 'checkOpenBrace',
  4633. value: function checkOpenBrace() {
  4634. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4635. var token = this.getToken();
  4636. if (this.lexerClass.OPEN_BRACE !== token.type) {
  4637. if (!attempt) {
  4638. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('[', token);
  4639. } else {
  4640. return false;
  4641. }
  4642. }
  4643. return true;
  4644. }
  4645. }, {
  4646. key: 'checkCloseBrace',
  4647. value: function checkCloseBrace() {
  4648. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4649. var token = this.getToken();
  4650. if (this.lexerClass.CLOSE_BRACE !== token.type) {
  4651. if (!attempt) {
  4652. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(']', token);
  4653. } else {
  4654. return false;
  4655. }
  4656. }
  4657. return true;
  4658. }
  4659. }, {
  4660. key: 'checkOpenParenthesis',
  4661. value: function checkOpenParenthesis() {
  4662. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4663. var token = this.getToken();
  4664. if (this.lexerClass.OPEN_PARENTHESIS !== token.type) {
  4665. if (!attempt) {
  4666. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('(', token);
  4667. } else {
  4668. return false;
  4669. }
  4670. }
  4671. return true;
  4672. }
  4673. }, {
  4674. key: 'checkCloseParenthesis',
  4675. value: function checkCloseParenthesis() {
  4676. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4677. var token = this.getToken();
  4678. if (this.lexerClass.CLOSE_PARENTHESIS !== token.type) {
  4679. if (!attempt) {
  4680. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(')', token);
  4681. } else {
  4682. return false;
  4683. }
  4684. }
  4685. return true;
  4686. }
  4687. }, {
  4688. key: 'checkEOS',
  4689. value: function checkEOS() {
  4690. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4691. var eosToken = this.getToken();
  4692. if (eosToken.type !== this.lexerClass.EOS) {
  4693. if (!attempt) throw _syntaxErrorFactory.SyntaxErrorFactory.eos_missing(eosToken);else return false;
  4694. }
  4695. return true;
  4696. }
  4697. }, {
  4698. key: 'checkFunctionDuplicate',
  4699. value: function checkFunctionDuplicate(functionID, funcIDToken) {
  4700. var id = functionID === null ? "$main" : functionID;
  4701. var index = this.definedFuncsNameList.indexOf(id);
  4702. if (index !== -1) {
  4703. throw _syntaxErrorFactory.SyntaxErrorFactory.duplicate_function(funcIDToken);
  4704. }
  4705. this.definedFuncsNameList.push(id);
  4706. }
  4707. }, {
  4708. key: 'checkVariableDuplicate',
  4709. value: function checkVariableDuplicate(variableID, variableIDToken) {
  4710. var index = this.getCurrentVariableStack().indexOf(variableID);
  4711. if (index !== -1) {
  4712. throw _syntaxErrorFactory.SyntaxErrorFactory.duplicate_variable(variableIDToken);
  4713. }
  4714. this.getCurrentVariableStack().push(variableID);
  4715. }
  4716. }, {
  4717. key: 'consumeForSemiColon',
  4718. value: function consumeForSemiColon() {
  4719. var eosToken = this.getToken();
  4720. if (eosToken.type === this.lexerClass.EOS && eosToken.text.match(';')) {
  4721. this.pos++;
  4722. return;
  4723. }
  4724. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(';', eosToken);
  4725. }
  4726. }, {
  4727. key: 'parseGlobalVariables',
  4728. value: function parseGlobalVariables() {
  4729. var decl = this.parseMaybeConst();
  4730. this.checkEOS();
  4731. this.pos++;
  4732. return decl;
  4733. }
  4734. /*
  4735. * Checks if the next token is PR_CONST. It's only available
  4736. * at global variables declaration level
  4737. * @returns Declararion(const, type, id, initVal?)
  4738. **/
  4739. }, {
  4740. key: 'parseMaybeConst',
  4741. value: function parseMaybeConst() {
  4742. var constToken = this.getToken();
  4743. if (constToken.type === this.lexerClass.RK_CONST) {
  4744. this.pos++;
  4745. var typeString = this.parseType();
  4746. return this.parseDeclaration(typeString, true);
  4747. } else if (this.isVariableType(constToken)) {
  4748. var _typeString = this.parseType();
  4749. return this.parseDeclaration(_typeString);
  4750. } else {
  4751. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_list([this.lexer.literalNames[this.lexerClass.RK_CONST]].concat(this.getTypeArray()), constToken);
  4752. }
  4753. }
  4754. /*
  4755. * Parses a declarion of the form: type --- id --- (= --- EAnd)?
  4756. * @returns a list of Declararion(const, type, id, initVal?)
  4757. **/
  4758. }, {
  4759. key: 'parseDeclaration',
  4760. value: function parseDeclaration(typeString) {
  4761. var isConst = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  4762. var initial = null;
  4763. var dim1 = null;
  4764. var dim2 = null;
  4765. var idToken = this.getToken();
  4766. var idString = this.parseID();
  4767. this.checkVariableDuplicate(idString, idToken);
  4768. // Check for array or vector
  4769. // ID[int/IDi][int/IDj]
  4770. if (this.checkOpenBrace(true)) {
  4771. this.pos++;
  4772. this.consumeNewLines();
  4773. dim1 = this.parseArrayDimension();
  4774. this.consumeNewLines();
  4775. this.checkCloseBrace();
  4776. this.pos++;
  4777. if (this.checkOpenBrace(true)) {
  4778. this.pos++;
  4779. this.consumeNewLines();
  4780. dim2 = this.parseArrayDimension();
  4781. this.consumeNewLines();
  4782. this.checkCloseBrace();
  4783. this.pos++;
  4784. }
  4785. }
  4786. var equalsToken = this.getToken();
  4787. if (isConst && equalsToken.type !== this.lexerClass.EQUAL) {
  4788. throw _syntaxErrorFactory.SyntaxErrorFactory.const_not_init(idToken);
  4789. }
  4790. if (equalsToken.type === this.lexerClass.EQUAL) {
  4791. this.pos++;
  4792. initial = this.parseExpressionOR();
  4793. }
  4794. var declaration = null;
  4795. var dimensions = 0;
  4796. if (dim1 !== null) {
  4797. dimensions++;
  4798. if (dim2 !== null) {
  4799. dimensions++;
  4800. }
  4801. declaration = new Commands.ArrayDeclaration(idString, new _compoundType.CompoundType(typeString, dimensions), dim1, dim2, initial, isConst);
  4802. } else {
  4803. declaration = new Commands.Declaration(idString, typeString, initial, isConst);
  4804. }
  4805. declaration.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(idToken);
  4806. var commaToken = this.getToken();
  4807. if (commaToken.type === this.lexerClass.COMMA) {
  4808. this.pos++;
  4809. this.consumeNewLines();
  4810. return [declaration].concat(this.parseDeclaration(typeString, isConst));
  4811. } else {
  4812. return [declaration];
  4813. }
  4814. }
  4815. }, {
  4816. key: 'consumeNewLines',
  4817. value: function consumeNewLines() {
  4818. var token = this.getToken();
  4819. while (token.type === this.lexerClass.EOS && token.text.match('[\r\n]+')) {
  4820. this.pos++;
  4821. token = this.getToken();
  4822. }
  4823. }
  4824. }, {
  4825. key: 'isVariableType',
  4826. value: function isVariableType(token) {
  4827. return this.variableTypes.find(function (v) {
  4828. return v === token.type;
  4829. });
  4830. }
  4831. /*
  4832. * Reads the next token of the stream to check if it is a Integer or an ID.
  4833. * @returns Integer | ID
  4834. **/
  4835. }, {
  4836. key: 'parseArrayDimension',
  4837. value: function parseArrayDimension() {
  4838. var dimToken = this.getToken();
  4839. if (dimToken.type === this.lexerClass.INTEGER) {
  4840. //parse as int literal
  4841. this.pos++;
  4842. return this.getIntLiteral(dimToken);
  4843. } else if (dimToken.type === this.lexerClass.ID) {
  4844. //parse as variable
  4845. this.pos++;
  4846. return this.parseVariable(dimToken);
  4847. } else {
  4848. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_array_dimension(this.lexer.literalNames[this.lexerClass.RK_INTEGER], dimToken);
  4849. }
  4850. }
  4851. /*
  4852. * Returns an object {type: 'int', value: value}.
  4853. * It checks for binary and hexadecimal integers.
  4854. * @returns object with fields type and value
  4855. **/
  4856. }, {
  4857. key: 'getIntLiteral',
  4858. value: function getIntLiteral(token) {
  4859. var text = token.text;
  4860. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);
  4861. var exp = new Expressions.IntLiteral((0, _parsers.toInt)(text));
  4862. exp.sourceInfo = sourceInfo;
  4863. return exp;
  4864. }
  4865. }, {
  4866. key: 'getRealLiteral',
  4867. value: function getRealLiteral(token) {
  4868. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);
  4869. var exp = new Expressions.RealLiteral((0, _parsers.toReal)(token.text));
  4870. exp.sourceInfo = sourceInfo;
  4871. return exp;
  4872. }
  4873. }, {
  4874. key: 'getStringLiteral',
  4875. value: function getStringLiteral(token) {
  4876. var text = token.text;
  4877. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);
  4878. var exp = new Expressions.StringLiteral((0, _parsers.toString)(text));
  4879. exp.sourceInfo = sourceInfo;
  4880. return exp;
  4881. }
  4882. }, {
  4883. key: 'getBoolLiteral',
  4884. value: function getBoolLiteral(token) {
  4885. var val = (0, _parsers.toBool)(token.text);
  4886. var exp = new Expressions.BoolLiteral(val);
  4887. exp.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);;
  4888. return exp;
  4889. }
  4890. }, {
  4891. key: 'parseArrayLiteral',
  4892. value: function parseArrayLiteral() {
  4893. this.checkOpenCurly();
  4894. var beginArray = this.getToken();
  4895. if (this.parsingArrayDimension >= 2) {
  4896. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_list('Array dimensions exceed maximum size of 2 at line ' + beginArray.line);
  4897. }
  4898. this.pos++;
  4899. this.parsingArrayDimension++;
  4900. this.consumeNewLines();
  4901. var data = this.parseExpressionList();
  4902. this.consumeNewLines();
  4903. this.checkCloseCurly();
  4904. var endArray = this.getToken();
  4905. this.pos++;
  4906. this.parsingArrayDimension--;
  4907. if (this.parsingArrayDimension === 0) {
  4908. // if (!data.isValid) {
  4909. // // TODO: better error message
  4910. // console.log('invalid array');
  4911. // throw new Error(`Invalid array at line ${beginArray.line}`);
  4912. // }
  4913. }
  4914. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfoFromList(beginArray, endArray);
  4915. var dataDim = 1;
  4916. if (data[0] instanceof Expressions.ArrayLiteral) {
  4917. dataDim++;
  4918. }
  4919. var type = new _compoundType.CompoundType(_types.Types.UNDEFINED, dataDim);
  4920. var exp = new Expressions.ArrayLiteral(type, data);
  4921. exp.sourceInfo = sourceInfo;
  4922. return exp;
  4923. }
  4924. /*
  4925. * Returns an object {type: 'variable', value: value}.
  4926. * @returns object with fields type and value
  4927. **/
  4928. }, {
  4929. key: 'parseVariable',
  4930. value: function parseVariable(token) {
  4931. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);
  4932. var exp = new Expressions.VariableLiteral(token.text);
  4933. exp.sourceInfo = sourceInfo;
  4934. return exp;
  4935. }
  4936. /*
  4937. * Returns an object representing a function. It has
  4938. * four attributes: returnType, id, formalParams and block.
  4939. * The block object has two attributes: declarations and commands
  4940. **/
  4941. }, {
  4942. key: 'parseFunction',
  4943. value: function parseFunction() {
  4944. this.pushScope(IVProgParser.FUNCTION);
  4945. var formalParams = [];
  4946. var token = this.getToken();
  4947. if (token.type !== this.lexerClass.RK_FUNCTION) {
  4948. //throw SyntaxError.createError(this.lexer.literalNames[this.lexerClass.PR_FUNCAO], token);
  4949. return null;
  4950. }
  4951. this.pos++;
  4952. var funType = this.parseType();
  4953. var dimensions = 0;
  4954. if (this.checkOpenBrace(true)) {
  4955. this.pos++;
  4956. this.checkCloseBrace();
  4957. this.pos++;
  4958. dimensions++;
  4959. if (this.checkOpenBrace(true)) {
  4960. this.pos++;
  4961. this.checkCloseBrace();
  4962. this.pos++;
  4963. dimensions++;
  4964. }
  4965. }
  4966. var funcIDToken = this.getToken();
  4967. var functionID = this.parseID();
  4968. this.checkFunctionDuplicate(functionID, funcIDToken);
  4969. this.checkOpenParenthesis();
  4970. this.pos++;
  4971. this.consumeNewLines();
  4972. if (!this.checkCloseParenthesis(true)) {
  4973. formalParams = this.parseFormalParameters(); // formal parameters
  4974. this.consumeNewLines();
  4975. this.checkCloseParenthesis();
  4976. this.pos++;
  4977. } else {
  4978. this.pos++;
  4979. }
  4980. this.consumeNewLines();
  4981. var commandsBlock = this.parseCommandBlock();
  4982. var returnType = funType;
  4983. if (dimensions > 0) {
  4984. returnType = new _compoundType.CompoundType(funType, dimensions);
  4985. }
  4986. var func = new Commands.Function(functionID, returnType, formalParams, commandsBlock);
  4987. if (functionID === null && !func.isMain) {
  4988. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_main_return(_definedFunctions.LanguageDefinedFunction.getMainFunctionName(), this.lexer.literalNames[this.lexerClass.RK_VOID], token.line);
  4989. } else if (func.isMain && formalParams.length !== 0) {
  4990. throw _syntaxErrorFactory.SyntaxErrorFactory.main_parameters();
  4991. }
  4992. this.popScope();
  4993. return func;
  4994. }
  4995. /*
  4996. * Parse the formal parameters of a function.
  4997. * @returns a list of objects with the following attributes: type, id and dimensions.
  4998. **/
  4999. }, {
  5000. key: 'parseFormalParameters',
  5001. value: function parseFormalParameters() {
  5002. var list = [];
  5003. while (true) {
  5004. var dimensions = 0;
  5005. var typeString = this.parseType();
  5006. var idToken = this.getToken();
  5007. var idString = this.parseID();
  5008. this.checkVariableDuplicate(idString, idToken);
  5009. if (this.checkOpenBrace(true)) {
  5010. this.pos++;
  5011. dimensions++;
  5012. this.checkCloseBrace();
  5013. this.pos++;
  5014. if (this.checkOpenBrace(true)) {
  5015. this.pos++;
  5016. dimensions++;
  5017. this.checkCloseBrace();
  5018. this.pos++;
  5019. }
  5020. }
  5021. var type = null;
  5022. if (dimensions > 0) {
  5023. type = new _compoundType.CompoundType(typeString, dimensions);
  5024. } else {
  5025. type = typeString;
  5026. }
  5027. list.push(new Commands.FormalParameter(type, idString));
  5028. var commaToken = this.getToken();
  5029. if (commaToken.type !== this.lexerClass.COMMA) break;
  5030. this.pos++;
  5031. this.consumeNewLines();
  5032. }
  5033. return list;
  5034. }
  5035. }, {
  5036. key: 'parseID',
  5037. value: function parseID() {
  5038. var token = this.getToken();
  5039. if (token.type !== this.lexerClass.ID) {
  5040. throw _syntaxErrorFactory.SyntaxErrorFactory.id_missing(token);
  5041. }
  5042. this.pos++;
  5043. if (this.insideScope(IVProgParser.FUNCTION)) {
  5044. if (token.text === _definedFunctions.LanguageDefinedFunction.getMainFunctionName()) {
  5045. return null;
  5046. }
  5047. }
  5048. return token.text;
  5049. }
  5050. }, {
  5051. key: 'parseMaybeLibID',
  5052. value: function parseMaybeLibID() {
  5053. var token = this.getToken();
  5054. if (token.type !== this.lexerClass.ID && token.type !== this.lexerClass.LIB_ID) {
  5055. throw _syntaxErrorFactory.SyntaxErrorFactory.id_missing(token);
  5056. }
  5057. this.pos++;
  5058. return token.text;
  5059. }
  5060. }, {
  5061. key: 'parseType',
  5062. value: function parseType() {
  5063. var token = this.getToken();
  5064. if (token.type === this.lexerClass.ID && this.insideScope(IVProgParser.FUNCTION)) {
  5065. return _types.Types.VOID;
  5066. } else if (token.type === this.lexerClass.RK_VOID && this.insideScope(IVProgParser.FUNCTION)) {
  5067. this.pos++;
  5068. return _types.Types.VOID;
  5069. } else if (this.isVariableType(token)) {
  5070. this.pos++;
  5071. switch (token.type) {
  5072. case this.lexerClass.RK_INTEGER:
  5073. return _types.Types.INTEGER;
  5074. case this.lexerClass.RK_BOOLEAN:
  5075. return _types.Types.BOOLEAN;
  5076. case this.lexerClass.RK_REAL:
  5077. return _types.Types.REAL;
  5078. case this.lexerClass.RK_STRING:
  5079. return _types.Types.STRING;
  5080. default:
  5081. break;
  5082. }
  5083. }
  5084. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_type(this.getTypeArray(), token);
  5085. }
  5086. }, {
  5087. key: 'parseCommandBlock',
  5088. value: function parseCommandBlock() {
  5089. var optionalCurly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  5090. var variablesDecl = [];
  5091. var commands = [];
  5092. var hasOpen = false;
  5093. if (this.checkOpenCurly(optionalCurly)) {
  5094. this.pos++;
  5095. hasOpen = true;
  5096. }
  5097. this.consumeNewLines();
  5098. while (true) {
  5099. var cmd = this.parseCommand();
  5100. if (cmd === null) break;
  5101. if (cmd !== -1) {
  5102. if (cmd instanceof Array) {
  5103. variablesDecl = variablesDecl.concat(cmd);
  5104. } else {
  5105. commands.push(cmd);
  5106. }
  5107. }
  5108. }
  5109. this.consumeNewLines();
  5110. if (hasOpen) {
  5111. this.checkCloseCurly();
  5112. this.pos++;
  5113. this.consumeNewLines();
  5114. }
  5115. return new Commands.CommandBlock(variablesDecl, commands);
  5116. }
  5117. }, {
  5118. key: 'parseCommand',
  5119. value: function parseCommand() {
  5120. var token = this.getToken();
  5121. if (this.isVariableType(token)) {
  5122. if (!this.insideScope(IVProgParser.FUNCTION)) {
  5123. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_var_declaration(token.line);
  5124. }
  5125. this.pushScope(IVProgParser.BASE);
  5126. var varType = this.parseType();
  5127. this.popScope();
  5128. var cmd = this.parseDeclaration(varType);
  5129. this.checkEOS();
  5130. this.pos++;
  5131. return cmd;
  5132. } else if (token.type === this.lexerClass.ID) {
  5133. return this.parseIDCommand();
  5134. } else if (token.type === this.lexerClass.LIB_ID) {
  5135. return this.parseIDCommand();
  5136. } else if (token.type === this.lexerClass.RK_RETURN) {
  5137. return this.parseReturn();
  5138. } else if (token.type === this.lexerClass.RK_WHILE) {
  5139. return this.parseWhile();
  5140. } else if (token.type === this.lexerClass.RK_FOR) {
  5141. return this.parseFor();
  5142. } else if (token.type === this.lexerClass.RK_BREAK) {
  5143. if (!this.insideScope(IVProgParser.BREAKABLE)) {
  5144. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_break_command(this.lexer.literalNames[this.lexerClass.RK_BREAK], token);
  5145. }
  5146. return this.parseBreak();
  5147. } else if (token.type === this.lexerClass.RK_SWITCH) {
  5148. return this.parseSwitchCase();
  5149. } else if (token.type === this.lexerClass.RK_DO) {
  5150. return this.parseDoWhile();
  5151. } else if (token.type === this.lexerClass.RK_IF) {
  5152. return this.parseIfThenElse();
  5153. } else if (this.checkEOS(true)) {
  5154. this.pos++;
  5155. return -1;
  5156. } else {
  5157. return null;
  5158. }
  5159. }
  5160. }, {
  5161. key: 'parseSwitchCase',
  5162. value: function parseSwitchCase() {
  5163. this.pushScope(IVProgParser.BREAKABLE);
  5164. this.pos++;
  5165. this.checkOpenParenthesis();
  5166. this.pos++;
  5167. this.consumeNewLines();
  5168. var exp = this.parseExpressionOR();
  5169. this.consumeNewLines();
  5170. this.checkCloseParenthesis();
  5171. this.pos++;
  5172. this.consumeNewLines();
  5173. this.checkOpenCurly();
  5174. this.pos++;
  5175. this.consumeNewLines();
  5176. var casesList = this.parseCases();
  5177. this.consumeNewLines();
  5178. this.checkCloseCurly();
  5179. this.pos++;
  5180. this.consumeNewLines();
  5181. this.popScope();
  5182. return new Commands.Switch(exp, casesList);
  5183. }
  5184. }, {
  5185. key: 'parseDoWhile',
  5186. value: function parseDoWhile() {
  5187. this.pos++;
  5188. this.consumeNewLines();
  5189. this.pushScope(IVProgParser.BREAKABLE);
  5190. var commandsBlock = this.parseCommandBlock();
  5191. this.consumeNewLines(); //Maybe not...
  5192. var whileToken = this.getToken();
  5193. if (whileToken.type !== this.lexerClass.RK_WHILE) {
  5194. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(this.lexer.literalNames[this.lexerClass.RK_WHILE], whileToken);
  5195. }
  5196. this.pos++;
  5197. this.checkOpenParenthesis();
  5198. this.pos++;
  5199. this.consumeNewLines();
  5200. var condition = this.parseExpressionOR();
  5201. this.consumeNewLines();
  5202. this.checkCloseParenthesis();
  5203. this.pos++;
  5204. this.checkEOS();
  5205. this.popScope();
  5206. return new Commands.DoWhile(condition, commandsBlock);
  5207. }
  5208. }, {
  5209. key: 'parseIfThenElse',
  5210. value: function parseIfThenElse() {
  5211. if (this.insideScope(IVProgParser.BREAKABLE)) {
  5212. this.pushScope(IVProgParser.BREAKABLE);
  5213. } else {
  5214. this.pushScope(IVProgParser.COMMAND);
  5215. }
  5216. this.pos++;
  5217. this.checkOpenParenthesis();
  5218. this.pos++;
  5219. this.consumeNewLines();
  5220. var logicalExpression = this.parseExpressionOR();
  5221. this.consumeNewLines();
  5222. this.checkCloseParenthesis();
  5223. this.pos++;
  5224. this.consumeNewLines();
  5225. var cmdBlocks = this.parseCommandBlock();
  5226. var maybeElse = this.getToken();
  5227. if (maybeElse.type === this.lexerClass.RK_ELSE) {
  5228. this.pos++;
  5229. this.consumeNewLines();
  5230. var maybeIf = this.getToken();
  5231. var elseBlock = null;
  5232. if (this.checkOpenCurly(true)) {
  5233. elseBlock = this.parseCommandBlock();
  5234. } else if (maybeIf.type === this.lexerClass.RK_IF) {
  5235. elseBlock = this.parseIfThenElse();
  5236. } else {
  5237. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_list([this.lexer.literalNames[this.lexerClass.RK_IF], '{'], maybeIf);
  5238. }
  5239. return new Commands.IfThenElse(logicalExpression, cmdBlocks, elseBlock);
  5240. }
  5241. this.popScope();
  5242. return new Commands.IfThenElse(logicalExpression, cmdBlocks, null);
  5243. }
  5244. }, {
  5245. key: 'parseFor',
  5246. value: function parseFor() {
  5247. this.pushScope(IVProgParser.BREAKABLE);
  5248. this.pos++;
  5249. this.checkOpenParenthesis();
  5250. this.pos++;
  5251. this.consumeNewLines();
  5252. var attribution = this.parseForAssign();
  5253. this.consumeNewLines();
  5254. var condition = this.parseExpressionOR();
  5255. this.consumeForSemiColon();
  5256. var increment = this.parseForAssign(true);
  5257. this.checkCloseParenthesis();
  5258. this.pos++;
  5259. this.consumeNewLines();
  5260. var commandsBlock = this.parseCommandBlock();
  5261. this.popScope();
  5262. return new Commands.For(attribution, condition, increment, commandsBlock);
  5263. }
  5264. }, {
  5265. key: 'parseWhile',
  5266. value: function parseWhile() {
  5267. this.pushScope(IVProgParser.BREAKABLE);
  5268. this.pos++;
  5269. this.checkOpenParenthesis();
  5270. this.pos++;
  5271. this.consumeNewLines();
  5272. var logicalExpression = this.parseExpressionOR();
  5273. this.consumeNewLines();
  5274. this.checkCloseParenthesis();
  5275. this.pos++;
  5276. this.consumeNewLines();
  5277. var cmdBlocks = this.parseCommandBlock();
  5278. this.popScope();
  5279. return new Commands.While(logicalExpression, cmdBlocks);
  5280. }
  5281. }, {
  5282. key: 'parseBreak',
  5283. value: function parseBreak() {
  5284. this.pos++;
  5285. this.checkEOS();
  5286. this.pos++;
  5287. return new Commands.Break();
  5288. }
  5289. }, {
  5290. key: 'parseReturn',
  5291. value: function parseReturn() {
  5292. this.pos++;
  5293. var exp = null;
  5294. if (!this.checkEOS(true)) {
  5295. exp = this.parseExpressionOR();
  5296. this.checkEOS();
  5297. }
  5298. this.pos++;
  5299. return new Commands.Return(exp);
  5300. }
  5301. }, {
  5302. key: 'parseIDCommand',
  5303. value: function parseIDCommand() {
  5304. var refToken = this.getToken();
  5305. var isID = refToken.type === this.lexerClass.ID;
  5306. var id = this.parseMaybeLibID();
  5307. if (this.checkOpenBrace(true)) {
  5308. this.pos++;
  5309. var lineExpression = null;
  5310. var columnExpression = null;
  5311. this.consumeNewLines();
  5312. lineExpression = this.parseExpression();
  5313. this.consumeNewLines();
  5314. this.checkCloseBrace();
  5315. this.pos++;
  5316. if (this.checkOpenBrace(true)) {
  5317. this.pos++;
  5318. this.consumeNewLines();
  5319. columnExpression = this.parseExpression();
  5320. this.consumeNewLines();
  5321. this.checkCloseBrace();
  5322. this.pos++;
  5323. }
  5324. var equalToken = this.getToken();
  5325. if (equalToken.type !== this.lexerClass.EQUAL) {
  5326. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('=', equalToken);
  5327. }
  5328. this.pos++;
  5329. var exp = this.parseExpressionOR();
  5330. this.checkEOS();
  5331. this.pos++;
  5332. var cmd = new Commands.ArrayIndexAssign(id, lineExpression, columnExpression, exp);
  5333. cmd.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(equalToken);
  5334. return cmd;
  5335. }
  5336. var equalOrParenthesis = this.getToken();
  5337. if (isID && equalOrParenthesis.type === this.lexerClass.EQUAL) {
  5338. this.pos++;
  5339. var _exp = this.parseExpressionOR();
  5340. this.checkEOS();
  5341. this.pos++;
  5342. var _cmd = new Commands.Assign(id, _exp);
  5343. _cmd.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(equalOrParenthesis);
  5344. return _cmd;
  5345. } else if (equalOrParenthesis.type === this.lexerClass.OPEN_PARENTHESIS) {
  5346. var funcCall = this.parseFunctionCallCommand(id);
  5347. this.checkEOS();
  5348. this.pos++;
  5349. return funcCall;
  5350. } else if (isID) {
  5351. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_list(['=', '('], equalOrParenthesis);
  5352. } else {
  5353. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_id_format(refToken);
  5354. }
  5355. }
  5356. }, {
  5357. key: 'parseForAssign',
  5358. value: function parseForAssign() {
  5359. var isLast = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  5360. if (!isLast) this.consumeNewLines();
  5361. if (this.checkEOS(true)) {
  5362. return null;
  5363. }
  5364. var id = this.parseID();
  5365. var equal = this.getToken();
  5366. if (equal.type !== this.lexerClass.EQUAL) {
  5367. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('=', equal);
  5368. }
  5369. this.pos++;
  5370. var exp = this.parseExpressionOR();
  5371. if (!isLast) {
  5372. this.consumeForSemiColon();
  5373. }
  5374. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(equal);
  5375. var cmd = new Commands.Assign(id, exp);
  5376. cmd.sourceInfo = sourceInfo;
  5377. return cmd;
  5378. }
  5379. }, {
  5380. key: 'parseCases',
  5381. value: function parseCases() {
  5382. var token = this.getToken();
  5383. if (token.type !== this.lexerClass.RK_CASE) {
  5384. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(this.lexer.literalNames[this.lexerClass.RK_CASE], token);
  5385. }
  5386. this.pos++;
  5387. var nextToken = this.getToken();
  5388. if (nextToken.type === this.lexerClass.RK_DEFAULT) {
  5389. this.pos++;
  5390. var colonToken = this.getToken();
  5391. if (colonToken.type !== this.lexerClass.COLON) {
  5392. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(':', colonToken);
  5393. }
  5394. this.pos++;
  5395. this.consumeNewLines();
  5396. var block = this.parseCommandBlock(true);
  5397. var defaultCase = new Commands.Case(null);
  5398. defaultCase.setCommands(block.commands);
  5399. return [defaultCase];
  5400. } else {
  5401. var exp = this.parseExpressionOR();
  5402. var _colonToken = this.getToken();
  5403. if (_colonToken.type !== this.lexerClass.COLON) {
  5404. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(':', _colonToken);
  5405. }
  5406. this.pos++;
  5407. this.consumeNewLines();
  5408. var _block = this.parseCommandBlock(true);
  5409. var aCase = new Commands.Case(exp);
  5410. aCase.setCommands(_block.commands);
  5411. var caseToken = this.getToken();
  5412. if (caseToken.type === this.lexerClass.RK_CASE) {
  5413. return [aCase].concat(this.parseCases());
  5414. } else {
  5415. return [aCase];
  5416. }
  5417. }
  5418. }
  5419. /*
  5420. * Parses an Expression following the structure:
  5421. *
  5422. * EOR => EAnd ( 'or' EOR)? #expression and
  5423. *
  5424. * EOR => ENot ('and' EOR)? #expression or
  5425. *
  5426. * ENot => 'not'? ER #expression not
  5427. *
  5428. * ER => E ((>=, <=, ==, >, <) E)? #expression relational
  5429. *
  5430. * E => factor ((+, -) E)? #expression
  5431. *
  5432. * factor=> term ((*, /, %) factor)?
  5433. *
  5434. * term => literal || arrayAccess || FuncCall || ID || '('EAnd')'
  5435. **/
  5436. }, {
  5437. key: 'parseExpressionOR',
  5438. value: function parseExpressionOR() {
  5439. var exp1 = this.parseExpressionAND();
  5440. while (this.getToken().type === this.lexerClass.OR_OPERATOR) {
  5441. var opToken = this.getToken();
  5442. this.pos++;
  5443. var or = (0, _operators.convertFromString)('or');
  5444. this.consumeNewLines();
  5445. var exp2 = this.parseExpressionAND();
  5446. var _finalExp = new Expressions.InfixApp(or, exp1, exp2);
  5447. _finalExp.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(opToken);
  5448. exp1 = _finalExp;
  5449. }
  5450. return exp1;
  5451. }
  5452. }, {
  5453. key: 'parseExpressionAND',
  5454. value: function parseExpressionAND() {
  5455. var exp1 = this.parseExpressionNot();
  5456. while (this.getToken().type === this.lexerClass.AND_OPERATOR) {
  5457. var opToken = this.getToken();
  5458. this.pos++;
  5459. var and = (0, _operators.convertFromString)('and');
  5460. this.consumeNewLines();
  5461. var exp2 = this.parseExpressionNot();
  5462. var _finalExp2 = new Expressions.InfixApp(and, exp1, exp2);
  5463. _finalExp2.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(opToken);
  5464. exp1 = _finalExp2;
  5465. }
  5466. return exp1;
  5467. }
  5468. }, {
  5469. key: 'parseExpressionNot',
  5470. value: function parseExpressionNot() {
  5471. var maybeNotToken = this.getToken();
  5472. if (maybeNotToken.type === this.lexerClass.NOT_OPERATOR) {
  5473. var opToken = this.getToken();
  5474. this.pos++;
  5475. var not = (0, _operators.convertFromString)('not');
  5476. var exp1 = this.parseExpressionRel();
  5477. finalExp = new Expressions.UnaryApp(not, exp1);
  5478. finalExp.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(opToken);
  5479. return finalExp;
  5480. } else {
  5481. return this.parseExpressionRel();
  5482. }
  5483. }
  5484. }, {
  5485. key: 'parseExpressionRel',
  5486. value: function parseExpressionRel() {
  5487. var exp1 = this.parseExpression();
  5488. while (this.getToken().type === this.lexerClass.RELATIONAL_OPERATOR) {
  5489. var relToken = this.getToken();
  5490. this.pos++;
  5491. var rel = (0, _operators.convertFromString)(relToken.text);
  5492. var exp2 = this.parseExpression();
  5493. var _finalExp3 = new Expressions.InfixApp(rel, exp1, exp2);
  5494. _finalExp3.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(relToken);
  5495. exp1 = _finalExp3;
  5496. }
  5497. return exp1;
  5498. }
  5499. }, {
  5500. key: 'parseExpression',
  5501. value: function parseExpression() {
  5502. var factor = this.parseFactor();
  5503. while (this.getToken().type === this.lexerClass.SUM_OP) {
  5504. var sumOpToken = this.getToken();
  5505. this.pos++;
  5506. var op = (0, _operators.convertFromString)(sumOpToken.text);
  5507. var factor2 = this.parseFactor();
  5508. var _finalExp4 = new Expressions.InfixApp(op, factor, factor2);
  5509. _finalExp4.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(sumOpToken);
  5510. factor = _finalExp4;
  5511. }
  5512. return factor;
  5513. }
  5514. }, {
  5515. key: 'parseFactor',
  5516. value: function parseFactor() {
  5517. var term = this.parseTerm();
  5518. while (this.getToken().type === this.lexerClass.MULTI_OP) {
  5519. var multOpToken = this.getToken();
  5520. this.pos++;
  5521. var op = (0, _operators.convertFromString)(multOpToken.text);
  5522. var term2 = this.parseTerm();
  5523. var _finalExp5 = new Expressions.InfixApp(op, term, term2);
  5524. _finalExp5.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(multOpToken);
  5525. term = _finalExp5;
  5526. }
  5527. return term;
  5528. }
  5529. }, {
  5530. key: 'parseTerm',
  5531. value: function parseTerm() {
  5532. var token = this.getToken();
  5533. var sourceInfo = null;
  5534. switch (token.type) {
  5535. case this.lexerClass.SUM_OP:
  5536. this.pos++;
  5537. sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);
  5538. var exp = new Expressions.UnaryApp((0, _operators.convertFromString)(token.text), this.parseTerm());
  5539. exp.sourceInfo = sourceInfo;
  5540. return exp;
  5541. case this.lexerClass.INTEGER:
  5542. this.pos++;
  5543. return this.getIntLiteral(token);
  5544. case this.lexerClass.REAL:
  5545. this.pos++;
  5546. return this.getRealLiteral(token);
  5547. case this.lexerClass.STRING:
  5548. this.pos++;
  5549. return this.getStringLiteral(token);
  5550. case this.lexerClass.RK_TRUE:
  5551. case this.lexerClass.RK_FALSE:
  5552. this.pos++;
  5553. return this.getBoolLiteral(token);
  5554. case this.lexerClass.OPEN_CURLY:
  5555. return this.parseArrayLiteral();
  5556. case this.lexerClass.ID:
  5557. case this.lexerClass.LIB_ID:
  5558. return this.parseIDTerm();
  5559. case this.lexerClass.OPEN_PARENTHESIS:
  5560. return this.parseParenthesisExp();
  5561. default:
  5562. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_terminal(token);
  5563. }
  5564. }
  5565. }, {
  5566. key: 'parseIDTerm',
  5567. value: function parseIDTerm() {
  5568. var tokenA = this.getToken();
  5569. var id = this.parseMaybeLibID();
  5570. var isID = tokenA.type === this.lexerClass.ID;
  5571. if (isID && this.checkOpenBrace(true)) {
  5572. var tokenB = null;
  5573. this.pos++;
  5574. var firstIndex = this.parseExpression();
  5575. var secondIndex = null;
  5576. this.consumeNewLines();
  5577. this.checkCloseBrace();
  5578. tokenB = this.getToken();
  5579. this.pos++;
  5580. if (this.checkOpenBrace(true)) {
  5581. this.pos++;
  5582. secondIndex = this.parseExpression();
  5583. this.consumeNewLines();
  5584. this.checkCloseBrace();
  5585. tokenB = this.getToken();
  5586. this.pos++;
  5587. }
  5588. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfoFromList(tokenA, tokenB);
  5589. var exp = new Expressions.ArrayAccess(id, firstIndex, secondIndex);
  5590. exp.sourceInfo = sourceInfo;
  5591. return exp;
  5592. } else if (this.checkOpenParenthesis(true)) {
  5593. return this.parseFunctionCallExpression(id);
  5594. } else if (isID) {
  5595. var _sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(tokenA);
  5596. var _exp2 = new Expressions.VariableLiteral(id);
  5597. _exp2.sourceInfo = _sourceInfo;
  5598. return _exp2;
  5599. } else {
  5600. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_id_format(tokenA);
  5601. }
  5602. }
  5603. }, {
  5604. key: 'getFunctionName',
  5605. value: function getFunctionName(id) {
  5606. var name = _definedFunctions.LanguageDefinedFunction.getInternalName(id);
  5607. if (name === null) {
  5608. if (id === _definedFunctions.LanguageDefinedFunction.getMainFunctionName()) {
  5609. return null;
  5610. }
  5611. return id;
  5612. } else {
  5613. return name;
  5614. }
  5615. }
  5616. }, {
  5617. key: 'parseFunctionCallExpression',
  5618. value: function parseFunctionCallExpression(id) {
  5619. var tokenA = this.getToken(this.pos - 1);
  5620. var actualParameters = this.parseActualParameters();
  5621. var tokenB = this.getToken(this.pos - 1);
  5622. var funcName = this.getFunctionName(id);
  5623. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfoFromList(tokenA, tokenB);
  5624. var cmd = new Expressions.FunctionCall(funcName, actualParameters);
  5625. cmd.sourceInfo = sourceInfo;
  5626. return cmd;
  5627. }
  5628. }, {
  5629. key: 'parseFunctionCallCommand',
  5630. value: function parseFunctionCallCommand(id) {
  5631. return this.parseFunctionCallExpression(id);
  5632. }
  5633. }, {
  5634. key: 'parseParenthesisExp',
  5635. value: function parseParenthesisExp() {
  5636. this.checkOpenParenthesis();
  5637. var tokenA = this.getToken();
  5638. this.pos++;
  5639. this.consumeNewLines();
  5640. var exp = this.parseExpressionOR();
  5641. this.consumeNewLines();
  5642. this.checkCloseParenthesis();
  5643. var tokenB = this.getToken();
  5644. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfoFromList(tokenA, tokenB);
  5645. this.pos++;
  5646. exp.sourceInfo = sourceInfo;
  5647. return exp;
  5648. }
  5649. }, {
  5650. key: 'parseActualParameters',
  5651. value: function parseActualParameters() {
  5652. this.checkOpenParenthesis();
  5653. this.pos++;
  5654. if (this.checkCloseParenthesis(true)) {
  5655. this.pos++;
  5656. return [];
  5657. }
  5658. this.consumeNewLines();
  5659. var list = this.parseExpressionList();
  5660. this.consumeNewLines();
  5661. this.checkCloseParenthesis();
  5662. this.pos++;
  5663. return list;
  5664. }
  5665. }, {
  5666. key: 'parseExpressionList',
  5667. value: function parseExpressionList() {
  5668. var list = [];
  5669. while (true) {
  5670. var exp = this.parseExpressionOR();
  5671. list.push(exp);
  5672. var maybeToken = this.getToken();
  5673. if (maybeToken.type !== this.lexerClass.COMMA) {
  5674. break;
  5675. } else {
  5676. this.pos++;
  5677. this.consumeNewLines();
  5678. }
  5679. }
  5680. return list;
  5681. }
  5682. }, {
  5683. key: 'getTypeArray',
  5684. value: function getTypeArray() {
  5685. var _this = this;
  5686. var types = this.insideScope(IVProgParser.FUNCTION) ? this.functionTypes : this.variableTypes;
  5687. return types.map(function (x) {
  5688. return _this.lexer.literalNames[x];
  5689. });
  5690. }
  5691. }]);
  5692. return IVProgParser;
  5693. }();
  5694. /***/ }),
  5695. /***/ "./js/ast/operators.js":
  5696. /*!*****************************!*\
  5697. !*** ./js/ast/operators.js ***!
  5698. \*****************************/
  5699. /*! no static exports found */
  5700. /***/ (function(module, exports, __webpack_require__) {
  5701. "use strict";
  5702. Object.defineProperty(exports, "__esModule", {
  5703. value: true
  5704. });
  5705. exports.convertFromString = convertFromString;
  5706. var Operators = exports.Operators = Object.freeze({
  5707. ADD: { ord: 0, value: "+" },
  5708. SUB: { ord: 1, value: "-" },
  5709. MULT: { ord: 2, value: '*' },
  5710. DIV: { ord: 3, value: '/' },
  5711. MOD: { ord: 4, value: '%' },
  5712. GT: { ord: 5, value: '>' },
  5713. GE: { ord: 6, value: '>=' },
  5714. LT: { ord: 7, value: '<' },
  5715. LE: { ord: 8, value: '<=' },
  5716. EQ: { ord: 9, value: '==' },
  5717. NEQ: { ord: 10, value: '!=' },
  5718. AND: { ord: 11, value: 'and' },
  5719. OR: { ord: 12, value: 'or' },
  5720. NOT: { ord: 13, value: 'not' }
  5721. });
  5722. function convertFromString(op) {
  5723. switch (op) {
  5724. case '+':
  5725. return Operators.ADD;
  5726. case '-':
  5727. return Operators.SUB;
  5728. case '*':
  5729. return Operators.MULT;
  5730. case '/':
  5731. return Operators.DIV;
  5732. case '%':
  5733. return Operators.MOD;
  5734. case '>':
  5735. return Operators.GT;
  5736. case '>=':
  5737. return Operators.GE;
  5738. case '<':
  5739. return Operators.LT;
  5740. case '<=':
  5741. return Operators.LE;
  5742. case '==':
  5743. return Operators.EQ;
  5744. case '!=':
  5745. return Operators.NEQ;
  5746. case 'and':
  5747. return Operators.AND;
  5748. case 'or':
  5749. return Operators.OR;
  5750. case 'not':
  5751. return Operators.NOT;
  5752. }
  5753. }
  5754. /***/ }),
  5755. /***/ "./js/ast/sourceInfo.js":
  5756. /*!******************************!*\
  5757. !*** ./js/ast/sourceInfo.js ***!
  5758. \******************************/
  5759. /*! no static exports found */
  5760. /***/ (function(module, exports, __webpack_require__) {
  5761. "use strict";
  5762. Object.defineProperty(exports, "__esModule", {
  5763. value: true
  5764. });
  5765. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  5766. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5767. var SourceInfo = exports.SourceInfo = function () {
  5768. _createClass(SourceInfo, null, [{
  5769. key: "createSourceInfo",
  5770. value: function createSourceInfo(token) {
  5771. return new SourceInfo(token.line, token.column, token.text.length);
  5772. }
  5773. }, {
  5774. key: "createSourceInfoFromList",
  5775. value: function createSourceInfoFromList(tokenA, tokenB) {
  5776. var line = tokenA.line;
  5777. var column = tokenA.column;
  5778. // copied from https://github.com/UNIVALI-LITE/Portugol-Studio/blob/master/core/src/main/java/br/univali/portugol/nucleo/analise/sintatica/Portugol.g
  5779. // No idea why...
  5780. var size = tokenB.tokenIndex + 1 - tokenA.tokenIndex;
  5781. return new SourceInfo(line, column, size);
  5782. }
  5783. }]);
  5784. function SourceInfo(line, column, size) {
  5785. _classCallCheck(this, SourceInfo);
  5786. this.line = line;
  5787. this.column = column;
  5788. this.size = size;
  5789. }
  5790. return SourceInfo;
  5791. }();
  5792. /***/ }),
  5793. /***/ "./js/io/domConsole.js":
  5794. /*!*****************************!*\
  5795. !*** ./js/io/domConsole.js ***!
  5796. \*****************************/
  5797. /*! no static exports found */
  5798. /***/ (function(module, exports, __webpack_require__) {
  5799. "use strict";
  5800. Object.defineProperty(exports, "__esModule", {
  5801. value: true
  5802. });
  5803. exports.DOMConsole = undefined;
  5804. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  5805. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  5806. var _jquery2 = _interopRequireDefault(_jquery);
  5807. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5808. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5809. var DOMConsole = exports.DOMConsole = function () {
  5810. _createClass(DOMConsole, null, [{
  5811. key: 'USER',
  5812. get: function get() {
  5813. return 0;
  5814. }
  5815. }, {
  5816. key: 'INFO',
  5817. get: function get() {
  5818. return 1;
  5819. }
  5820. }, {
  5821. key: 'ERR',
  5822. get: function get() {
  5823. return 2;
  5824. }
  5825. }]);
  5826. function DOMConsole(elementID) {
  5827. _classCallCheck(this, DOMConsole);
  5828. this.input = null;
  5829. this.needInput = false;
  5830. this.termDiv = null;
  5831. this.anyKey = false;
  5832. this.parent = (0, _jquery2.default)(elementID);
  5833. this.setup();
  5834. this.inputListeners = [];
  5835. }
  5836. _createClass(DOMConsole, [{
  5837. key: 'setup',
  5838. value: function setup() {
  5839. this._setupDom();
  5840. this._setupEvents();
  5841. }
  5842. }, {
  5843. key: '_setupEvents',
  5844. value: function _setupEvents() {
  5845. var _this = this;
  5846. this.input.on("keydown", function (event) {
  5847. if (!_this.needInput) {
  5848. event.preventDefault();
  5849. return;
  5850. }
  5851. var keyCode = event.which;
  5852. if (keyCode === 13 || _this.anyKey) {
  5853. var text = _this.input.val();
  5854. text = text.replace('[\n\r]+', '');
  5855. _this.notifyListeners(text);
  5856. _this.write(text);
  5857. _this.input.val("");
  5858. }
  5859. });
  5860. }
  5861. }, {
  5862. key: '_setupDom',
  5863. value: function _setupDom() {
  5864. this.termDiv = (0, _jquery2.default)("<div></div>");
  5865. this.termDiv.addClass("ivprog-term-div");
  5866. this.input = (0, _jquery2.default)('<input text="type">');
  5867. this.input.addClass("ivprog-term-input");
  5868. this.termDiv.append(this.input);
  5869. this.parent.append(this.termDiv);
  5870. }
  5871. }, {
  5872. key: 'notifyListeners',
  5873. value: function notifyListeners(text) {
  5874. this.inputListeners.forEach(function (resolve) {
  5875. return resolve(text);
  5876. });
  5877. this.inputListeners.splice(0, this.inputListeners.length);
  5878. this.hideInput();
  5879. this.anyKey = false;
  5880. }
  5881. }, {
  5882. key: 'write',
  5883. value: function write(text) {
  5884. this._appendText(text, DOMConsole.USER);
  5885. }
  5886. }, {
  5887. key: 'info',
  5888. value: function info(text) {
  5889. this._appendText(text, DOMConsole.INFO);
  5890. }
  5891. }, {
  5892. key: 'err',
  5893. value: function err(text) {
  5894. this._appendText(text, DOMConsole.ERR);
  5895. }
  5896. }, {
  5897. key: '_appendText',
  5898. value: function _appendText(text, type) {
  5899. var divClass = this.getClassForType(type);
  5900. var textDiv = (0, _jquery2.default)("<div></div>");
  5901. textDiv.addClass(divClass);
  5902. textDiv.append(text);
  5903. textDiv.insertBefore(this.input);
  5904. this.scrollTerm();
  5905. }
  5906. }, {
  5907. key: 'scrollTerm',
  5908. value: function scrollTerm() {
  5909. this.termDiv.animate({
  5910. scrollTop: this.termDiv.prop('scrollHeight')
  5911. }, 0);
  5912. }
  5913. }, {
  5914. key: 'getClassForType',
  5915. value: function getClassForType(type) {
  5916. switch (type) {
  5917. case DOMConsole.USER:
  5918. return "ivprog-term-userText";
  5919. case DOMConsole.INFO:
  5920. return "ivprog-term-info";
  5921. case DOMConsole.ERR:
  5922. return "ivprog-term-error";
  5923. }
  5924. }
  5925. }, {
  5926. key: 'dispose',
  5927. value: function dispose() {
  5928. this.parent.off();
  5929. this.input.off();
  5930. this.input = null;
  5931. this.parent.empty();
  5932. }
  5933. }, {
  5934. key: 'showInput',
  5935. value: function showInput() {
  5936. this.needInput = true;
  5937. this.input.show();
  5938. this.input.focus();
  5939. }
  5940. }, {
  5941. key: 'hideInput',
  5942. value: function hideInput() {
  5943. this.needInput = false;
  5944. this.input.hide();
  5945. }
  5946. }, {
  5947. key: 'requestInput',
  5948. value: function requestInput(callback) {
  5949. var anyKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  5950. this.inputListeners.push(callback);
  5951. this.anyKey = anyKey;
  5952. this.showInput();
  5953. }
  5954. }, {
  5955. key: 'sendOutput',
  5956. value: function sendOutput(text) {
  5957. var _this2 = this;
  5958. text.split("\n").forEach(function (t) {
  5959. t = t.replace(/\t/g, '&#9;');
  5960. _this2.write(t);
  5961. });
  5962. }
  5963. }, {
  5964. key: 'clear',
  5965. value: function clear() {
  5966. this.input.parent().children().not(this.input).remove();
  5967. this.input.val("");
  5968. }
  5969. }]);
  5970. return DOMConsole;
  5971. }();
  5972. /***/ }),
  5973. /***/ "./js/io/input.js":
  5974. /*!************************!*\
  5975. !*** ./js/io/input.js ***!
  5976. \************************/
  5977. /*! no static exports found */
  5978. /***/ (function(module, exports, __webpack_require__) {
  5979. "use strict";
  5980. Object.defineProperty(exports, "__esModule", {
  5981. value: true
  5982. });
  5983. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  5984. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5985. var Input = exports.Input = function () {
  5986. function Input() {
  5987. _classCallCheck(this, Input);
  5988. }
  5989. _createClass(Input, [{
  5990. key: "requestInput",
  5991. value: function requestInput(callback) {
  5992. throw new Error("Must be implemented");
  5993. }
  5994. }]);
  5995. return Input;
  5996. }();
  5997. /***/ }),
  5998. /***/ "./js/io/output.js":
  5999. /*!*************************!*\
  6000. !*** ./js/io/output.js ***!
  6001. \*************************/
  6002. /*! no static exports found */
  6003. /***/ (function(module, exports, __webpack_require__) {
  6004. "use strict";
  6005. Object.defineProperty(exports, "__esModule", {
  6006. value: true
  6007. });
  6008. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  6009. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6010. var Output = exports.Output = function () {
  6011. function Output() {
  6012. _classCallCheck(this, Output);
  6013. }
  6014. _createClass(Output, [{
  6015. key: "sendOutput",
  6016. value: function sendOutput(text) {
  6017. throw new Error("Must be implemented");
  6018. }
  6019. }]);
  6020. return Output;
  6021. }();
  6022. /***/ }),
  6023. /***/ "./js/main.js":
  6024. /*!********************!*\
  6025. !*** ./js/main.js ***!
  6026. \********************/
  6027. /*! no static exports found */
  6028. /***/ (function(module, exports, __webpack_require__) {
  6029. "use strict";
  6030. Object.defineProperty(exports, "__esModule", {
  6031. value: true
  6032. });
  6033. exports.i18n = exports.LocalizedStrings = exports.initVisualUI = exports.runner = undefined;
  6034. var _runner = __webpack_require__(/*! ./runner */ "./js/runner.js");
  6035. var _functions = __webpack_require__(/*! ./visualUI/functions */ "./js/visualUI/functions.js");
  6036. var _localizedStringsService = __webpack_require__(/*! ./services/localizedStringsService */ "./js/services/localizedStringsService.js");
  6037. var _i18nHelper = __webpack_require__(/*! ./services/i18nHelper */ "./js/services/i18nHelper.js");
  6038. var i18n = _i18nHelper.i18nHelper.i18n;
  6039. exports.runner = _runner.runner;
  6040. exports.initVisualUI = _functions.initVisualUI;
  6041. exports.LocalizedStrings = _localizedStringsService.LocalizedStrings;
  6042. exports.i18n = i18n;
  6043. /***/ }),
  6044. /***/ "./js/processor/compatibilityTable.js":
  6045. /*!********************************************!*\
  6046. !*** ./js/processor/compatibilityTable.js ***!
  6047. \********************************************/
  6048. /*! no static exports found */
  6049. /***/ (function(module, exports, __webpack_require__) {
  6050. "use strict";
  6051. Object.defineProperty(exports, "__esModule", {
  6052. value: true
  6053. });
  6054. exports.resultTypeAfterInfixOp = resultTypeAfterInfixOp;
  6055. exports.resultTypeAfterUnaryOp = resultTypeAfterUnaryOp;
  6056. var _types = __webpack_require__(/*! ./../typeSystem/types */ "./js/typeSystem/types.js");
  6057. var _operators = __webpack_require__(/*! ./../ast/operators */ "./js/ast/operators.js");
  6058. var _multiType = __webpack_require__(/*! ../typeSystem/multiType */ "./js/typeSystem/multiType.js");
  6059. function buildInfixAddTable() {
  6060. var table = [[], [], [], []];
  6061. table[_types.Types.INTEGER.ord][_types.Types.INTEGER.ord] = _types.Types.INTEGER;
  6062. table[_types.Types.INTEGER.ord][_types.Types.REAL.ord] = _types.Types.REAL;
  6063. table[_types.Types.INTEGER.ord][_types.Types.STRING.ord] = _types.Types.STRING;
  6064. table[_types.Types.REAL.ord][_types.Types.INTEGER.ord] = _types.Types.REAL;
  6065. table[_types.Types.REAL.ord][_types.Types.REAL.ord] = _types.Types.REAL;
  6066. table[_types.Types.REAL.ord][_types.Types.STRING.ord] = _types.Types.STRING;
  6067. table[_types.Types.STRING.ord][_types.Types.INTEGER.ord] = _types.Types.STRING;
  6068. table[_types.Types.STRING.ord][_types.Types.REAL.ord] = _types.Types.STRING;
  6069. table[_types.Types.STRING.ord][_types.Types.STRING.ord] = _types.Types.STRING;
  6070. table[_types.Types.STRING.ord][_types.Types.BOOLEAN.ord] = _types.Types.STRING;
  6071. return table;
  6072. }
  6073. function buildInfixMultiDivSubTable() {
  6074. var table = [[], [], [], []];
  6075. table[_types.Types.INTEGER.ord][_types.Types.INTEGER.ord] = _types.Types.INTEGER;
  6076. table[_types.Types.INTEGER.ord][_types.Types.REAL.ord] = _types.Types.REAL;
  6077. table[_types.Types.REAL.ord][_types.Types.INTEGER.ord] = _types.Types.REAL;
  6078. table[_types.Types.REAL.ord][_types.Types.REAL.ord] = _types.Types.REAL;
  6079. return table;
  6080. }
  6081. function buildInfixEqualityInequalityTable() {
  6082. var table = [[], [], [], []];
  6083. table[_types.Types.INTEGER.ord][_types.Types.INTEGER.ord] = _types.Types.BOOLEAN;
  6084. table[_types.Types.REAL.ord][_types.Types.REAL.ord] = _types.Types.BOOLEAN;
  6085. table[_types.Types.BOOLEAN.ord][_types.Types.BOOLEAN.ord] = _types.Types.BOOLEAN;
  6086. table[_types.Types.STRING.ord][_types.Types.STRING.ord] = _types.Types.BOOLEAN;
  6087. return table;
  6088. }
  6089. function buildInfixRelationalTable() {
  6090. var table = [[], [], [], []];
  6091. table[_types.Types.INTEGER.ord][_types.Types.INTEGER.ord] = _types.Types.BOOLEAN;
  6092. table[_types.Types.REAL.ord][_types.Types.REAL.ord] = _types.Types.BOOLEAN;
  6093. table[_types.Types.STRING.ord][_types.Types.STRING.ord] = _types.Types.BOOLEAN;
  6094. return table;
  6095. }
  6096. function buildInfixAndOrTable() {
  6097. var table = [[], [], [], []];
  6098. table[_types.Types.BOOLEAN.ord][_types.Types.BOOLEAN.ord] = _types.Types.BOOLEAN;
  6099. return table;
  6100. }
  6101. function buildInfixModTable() {
  6102. var table = [[], [], [], []];
  6103. table[_types.Types.INTEGER.ord][_types.Types.INTEGER.ord] = _types.Types.INTEGER;
  6104. return table;
  6105. }
  6106. function buildUnarySumSubList() {
  6107. var list = [];
  6108. list[_types.Types.INTEGER.ord] = _types.Types.INTEGER;
  6109. list[_types.Types.REAL.ord] = _types.Types.REAL;
  6110. return list;
  6111. }
  6112. function buildUnaryNegList() {
  6113. var list = [];
  6114. list[_types.Types.BOOLEAN.ord] = _types.Types.BOOLEAN;
  6115. return list;
  6116. }
  6117. function buildInfixCompatibilityTable() {
  6118. var compatibilityMap = new WeakMap();
  6119. compatibilityMap.set(_operators.Operators.ADD, buildInfixAddTable());
  6120. compatibilityMap.set(_operators.Operators.SUB, buildInfixMultiDivSubTable());
  6121. compatibilityMap.set(_operators.Operators.MULT, buildInfixMultiDivSubTable());
  6122. compatibilityMap.set(_operators.Operators.DIV, buildInfixMultiDivSubTable());
  6123. compatibilityMap.set(_operators.Operators.EQ, buildInfixEqualityInequalityTable());
  6124. compatibilityMap.set(_operators.Operators.NEQ, buildInfixEqualityInequalityTable());
  6125. compatibilityMap.set(_operators.Operators.GE, buildInfixRelationalTable());
  6126. compatibilityMap.set(_operators.Operators.GT, buildInfixRelationalTable());
  6127. compatibilityMap.set(_operators.Operators.LE, buildInfixRelationalTable());
  6128. compatibilityMap.set(_operators.Operators.LT, buildInfixRelationalTable());
  6129. compatibilityMap.set(_operators.Operators.OR, buildInfixAndOrTable());
  6130. compatibilityMap.set(_operators.Operators.AND, buildInfixAndOrTable());
  6131. compatibilityMap.set(_operators.Operators.MOD, buildInfixModTable());
  6132. return compatibilityMap;
  6133. }
  6134. function buildUnaryCompatibilityTable() {
  6135. var compatibilityMap = new WeakMap();
  6136. compatibilityMap.set(_operators.Operators.ADD, buildUnarySumSubList());
  6137. compatibilityMap.set(_operators.Operators.SUB, buildUnarySumSubList());
  6138. compatibilityMap.set(_operators.Operators.NOT, buildUnaryNegList());
  6139. return compatibilityMap;
  6140. }
  6141. var infixMap = buildInfixCompatibilityTable();
  6142. var unaryMap = buildUnaryCompatibilityTable();
  6143. function resultTypeAfterInfixOp(operator, leftExpressionType, rightExpressionType) {
  6144. try {
  6145. if (leftExpressionType instanceof _multiType.MultiType && rightExpressionType instanceof _multiType.MultiType) {
  6146. var newMulti = [];
  6147. for (var i = 0; i < leftExpressionType.types.length; i++) {
  6148. var element = leftExpressionType.types[i];
  6149. if (rightExpressionType.types.indexOf(element) !== -1) {
  6150. newMulti.push(element);
  6151. }
  6152. }
  6153. if (newMulti.length <= 0) {
  6154. return _types.Types.UNDEFINED;
  6155. } else {
  6156. return new _multiType.MultiType(newMulti);
  6157. }
  6158. } else if (leftExpressionType instanceof _multiType.MultiType) {
  6159. if (leftExpressionType.isCompatible(rightExpressionType)) {
  6160. return rightExpressionType;
  6161. } else {
  6162. return _types.Types.UNDEFINED;
  6163. }
  6164. } else if (rightExpressionType instanceof _multiType.MultiType) {
  6165. if (rightExpressionType.isCompatible(leftExpressionType)) {
  6166. return leftExpressionType;
  6167. } else {
  6168. return _types.Types.UNDEFINED;
  6169. }
  6170. }
  6171. var resultType = infixMap.get(operator)[leftExpressionType.ord][rightExpressionType.ord];
  6172. if (resultType === null || resultType === undefined) {
  6173. return _types.Types.UNDEFINED;
  6174. }
  6175. return resultType;
  6176. } catch (e) {
  6177. if (e instanceof TypeError) {
  6178. return _types.Types.UNDEFINED;
  6179. } else {
  6180. throw e;
  6181. }
  6182. }
  6183. }
  6184. function resultTypeAfterUnaryOp(operator, leftExpressionType) {
  6185. try {
  6186. if (leftExpressionType instanceof _multiType.MultiType) {
  6187. return leftExpressionType;
  6188. }
  6189. return unaryMap.get(operator)[leftExpressionType.ord];
  6190. } catch (e) {
  6191. if (e instanceof TypeError) {
  6192. return _types.Types.UNDEFINED;
  6193. } else {
  6194. throw e;
  6195. }
  6196. }
  6197. }
  6198. /***/ }),
  6199. /***/ "./js/processor/context.js":
  6200. /*!*********************************!*\
  6201. !*** ./js/processor/context.js ***!
  6202. \*********************************/
  6203. /*! no static exports found */
  6204. /***/ (function(module, exports, __webpack_require__) {
  6205. "use strict";
  6206. Object.defineProperty(exports, "__esModule", {
  6207. value: true
  6208. });
  6209. var Context = exports.Context = Object.freeze({
  6210. BASE: Symbol('context:base'),
  6211. BREAKABLE: Symbol('context:breakable'),
  6212. FUNCTION: Symbol('context:function')
  6213. });
  6214. /***/ }),
  6215. /***/ "./js/processor/definedFunctions.js":
  6216. /*!******************************************!*\
  6217. !*** ./js/processor/definedFunctions.js ***!
  6218. \******************************************/
  6219. /*! no static exports found */
  6220. /***/ (function(module, exports, __webpack_require__) {
  6221. "use strict";
  6222. Object.defineProperty(exports, "__esModule", {
  6223. value: true
  6224. });
  6225. exports.LanguageDefinedFunction = undefined;
  6226. var _languageService = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js");
  6227. var _io = __webpack_require__(/*! ./lib/io */ "./js/processor/lib/io.js");
  6228. var _strings = __webpack_require__(/*! ./lib/strings */ "./js/processor/lib/strings.js");
  6229. var _arrays = __webpack_require__(/*! ./lib/arrays */ "./js/processor/lib/arrays.js");
  6230. var _lang = __webpack_require__(/*! ./lib/lang */ "./js/processor/lib/lang.js");
  6231. var _math = __webpack_require__(/*! ./lib/math */ "./js/processor/lib/math.js");
  6232. function valueToKey(value, object) {
  6233. for (var key in object) {
  6234. if (object.hasOwnProperty(key)) {
  6235. if (object[key] === value) {
  6236. return key;
  6237. }
  6238. }
  6239. }
  6240. return null;
  6241. }
  6242. function concatObjects() {
  6243. var result = {};
  6244. for (var _len = arguments.length, objs = Array(_len), _key = 0; _key < _len; _key++) {
  6245. objs[_key] = arguments[_key];
  6246. }
  6247. for (var i = 0; i < objs.length; i++) {
  6248. var obj = objs[i];
  6249. for (var key in obj) {
  6250. if (obj.hasOwnProperty(key)) {
  6251. result[key] = obj[key];
  6252. }
  6253. }
  6254. }
  6255. return result;
  6256. }
  6257. var libsObject = {
  6258. $mathLib: {
  6259. $sin: (0, _math.createSinFun)(),
  6260. $cos: (0, _math.createCosFun)(),
  6261. $tan: (0, _math.createTanFun)(),
  6262. $sqrt: (0, _math.createSqrtFun)(),
  6263. $pow: (0, _math.createPowFun)(),
  6264. $log: (0, _math.createLogFun)(),
  6265. $abs: (0, _math.createAbsFun)(),
  6266. $negate: (0, _math.createNegateFun)(),
  6267. $invert: (0, _math.createInvertFun)(),
  6268. $max: (0, _math.createMaxFun)(),
  6269. $min: (0, _math.createMinFun)()
  6270. },
  6271. $ioLib: {
  6272. $read: (0, _io.createInputFun)(),
  6273. $write: (0, _io.createOutputFun)()
  6274. },
  6275. $strLib: {
  6276. $substring: (0, _strings.createSubstringFun)(),
  6277. $length: (0, _strings.createLengthFun)(),
  6278. $uppercase: (0, _strings.createUppercaseFun)(),
  6279. $lowercase: (0, _strings.createLowercaseFun)(),
  6280. $charAt: (0, _strings.createrCharAtFun)()
  6281. },
  6282. $arrayLib: {
  6283. $numElements: (0, _arrays.createNumElementsFun)(),
  6284. $matrixLines: (0, _arrays.createMatrixLinesFun)(),
  6285. $matrixColumns: (0, _arrays.createMatrixColumnsFun)()
  6286. },
  6287. $langLib: {
  6288. $isReal: (0, _lang.createIsRealFun)(),
  6289. $isInt: (0, _lang.createIsIntFun)(),
  6290. $isBool: (0, _lang.createIsBoolFun)(),
  6291. $castReal: (0, _lang.createCastRealFun)(),
  6292. $castInt: (0, _lang.createCastIntFun)(),
  6293. $castBool: (0, _lang.createCastBoolFun)(),
  6294. $castString: (0, _lang.createCastStringFun)()
  6295. }
  6296. };
  6297. var funcsObject = concatObjects(libsObject.$ioLib, libsObject.$langLib, libsObject.$strLib, libsObject.$arrayLib);
  6298. var LanguageDefinedFunction = exports.LanguageDefinedFunction = Object.freeze({
  6299. getMainFunctionName: function getMainFunctionName() {
  6300. return _languageService.LanguageService.getCurrentLangFuncs().main_function;
  6301. },
  6302. getInternalName: function getInternalName(localName) {
  6303. if (localName.indexOf(".") !== -1) {
  6304. var names = localName.split(".");
  6305. var lib = valueToKey(names[0], _languageService.LanguageService.getCurrentLangLibs());
  6306. var internalName = valueToKey(names[1], _languageService.LanguageService.getCurrentLangFuncs());
  6307. if (lib === null || internalName === null) {
  6308. return null;
  6309. }
  6310. return lib + "." + internalName;
  6311. }
  6312. var funcName = valueToKey(localName, _languageService.LanguageService.getCurrentLangFuncs());
  6313. if (funcName !== null) {
  6314. if (funcsObject[funcName]) {
  6315. return funcName;
  6316. }
  6317. }
  6318. return null;
  6319. },
  6320. getFunction: function getFunction(internalName) {
  6321. if (internalName.indexOf(".") !== -1) {
  6322. var names = internalName.split(".");
  6323. var libName = names[0];
  6324. var funName = names[1];
  6325. return libsObject[libName][funName];
  6326. }
  6327. return funcsObject[internalName];
  6328. },
  6329. getLocalName: function getLocalName(internalName) {
  6330. if (internalName.indexOf(".") !== -1) {
  6331. var names = internalName.split(".");
  6332. var libName = _languageService.LanguageService.getCurrentLangLibs()[names[0]];
  6333. var funName = _languageService.LanguageService.getCurrentLangFuncs()[names[1]];
  6334. return libName + '.' + funName;
  6335. } else if (_languageService.LanguageService.getCurrentLangFuncs()[internalName]) {
  6336. return _languageService.LanguageService.getCurrentLangFuncs()[internalName];
  6337. } else {
  6338. return internalName;
  6339. }
  6340. }
  6341. });
  6342. /***/ }),
  6343. /***/ "./js/processor/error/processorErrorFactory.js":
  6344. /*!*****************************************************!*\
  6345. !*** ./js/processor/error/processorErrorFactory.js ***!
  6346. \*****************************************************/
  6347. /*! no static exports found */
  6348. /***/ (function(module, exports, __webpack_require__) {
  6349. "use strict";
  6350. Object.defineProperty(exports, "__esModule", {
  6351. value: true
  6352. });
  6353. exports.ProcessorErrorFactory = undefined;
  6354. var _runtimeError = __webpack_require__(/*! ./runtimeError */ "./js/processor/error/runtimeError.js");
  6355. var _semanticError = __webpack_require__(/*! ./semanticError */ "./js/processor/error/semanticError.js");
  6356. var _localizedStringsService = __webpack_require__(/*! ./../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  6357. var _operators = __webpack_require__(/*! ../../ast/operators */ "./js/ast/operators.js");
  6358. function translateType(type, dim) {
  6359. switch (dim) {
  6360. case 0:
  6361. return _localizedStringsService.LocalizedStrings.getUI(type);
  6362. default:
  6363. var transType = _localizedStringsService.LocalizedStrings.getUI(type);
  6364. if (dim === 1) return _localizedStringsService.LocalizedStrings.getUI("vector_string", [transType]);else return _localizedStringsService.LocalizedStrings.getUI("matrix_string", [transType]);
  6365. }
  6366. }
  6367. function translateOp(op) {
  6368. switch (op.ord) {
  6369. case _operators.Operators.AND.ord:
  6370. case _operators.Operators.OR.ord:
  6371. case _operators.Operators.NOT.ord:
  6372. return _localizedStringsService.LocalizedStrings.getUI(op.value);
  6373. default:
  6374. return op.value;
  6375. }
  6376. }
  6377. var ProcessorErrorFactory = exports.ProcessorErrorFactory = Object.freeze({
  6378. symbol_not_found_full: function symbol_not_found_full(id, sourceInfo) {
  6379. if (sourceInfo) {
  6380. var context = [id, sourceInfo.line, sourceInfo.column];
  6381. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("symbol_not_found_full", context));
  6382. } else {
  6383. return ProcessorErrorFactory.symbol_not_found(id);
  6384. }
  6385. },
  6386. symbol_not_found: function symbol_not_found(id) {
  6387. var context = [id];
  6388. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("symbol_not_found", context));
  6389. },
  6390. function_missing_full: function function_missing_full(id, sourceInfo) {
  6391. if (sourceInfo) {
  6392. var context = [id, sourceInfo.line, sourceInfo.column];
  6393. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("function_missing_full", context));
  6394. } else {
  6395. return ProcessorErrorFactory.function_missing(id);
  6396. }
  6397. },
  6398. function_missing: function function_missing(id) {
  6399. var context = [id];
  6400. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("function_missing", context));
  6401. },
  6402. main_missing: function main_missing() {
  6403. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("main_missing"));
  6404. }, // TODO: better urgent error message
  6405. array_dimension_not_int_full: function array_dimension_not_int_full(sourceInfo) {
  6406. if (sourceInfo) {
  6407. var context = [sourceInfo.line];
  6408. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("array_dimension_not_int_full", context));
  6409. } else {
  6410. return ProcessorErrorFactory.array_dimension_not_int();
  6411. }
  6412. },
  6413. array_dimension_not_int: function array_dimension_not_int() {
  6414. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("array_dimension_not_int"));
  6415. },
  6416. unknown_command_full: function unknown_command_full(sourceInfo) {
  6417. if (sourceInfo) {
  6418. var context = [sourceInfo.line];
  6419. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("unknown_command_full", context));
  6420. } else {
  6421. return ProcessorErrorFactory.unknown_command();
  6422. }
  6423. },
  6424. unknown_command: function unknown_command() {
  6425. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("unknown_command"));
  6426. },
  6427. incompatible_types_full: function incompatible_types_full(type, dim, sourceInfo) {
  6428. if (sourceInfo) {
  6429. var context = [translateType(type, dim), sourceInfo.line, sourceInfo.column];
  6430. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("incompatible_types_full", context));
  6431. } else {
  6432. return ProcessorErrorFactory.incompatible_types(type, dim);
  6433. }
  6434. },
  6435. incompatible_types: function incompatible_types(type, dim) {
  6436. var context = [translateType(type, dim)];
  6437. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("incompatible_types", context));
  6438. },
  6439. incompatible_types_array_full: function incompatible_types_array_full(exp, type, dim, sourceInfo) {
  6440. if (sourceInfo) {
  6441. var context = [exp, translateType(type, dim), sourceInfo.line, sourceInfo.column];
  6442. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("incompatible_types_array_full", context));
  6443. } else {
  6444. return ProcessorErrorFactory.incompatible_types_array(exp, type, dim);
  6445. }
  6446. },
  6447. incompatible_types_array: function incompatible_types_array(exp, type, dim) {
  6448. var context = [exp, translateType(type, dim)];
  6449. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("incompatible_types_array", context));
  6450. },
  6451. loop_condition_type_full: function loop_condition_type_full(sourceInfo) {
  6452. if (sourceInfo) {
  6453. var context = [sourceInfo.line, sourceInfo.column];
  6454. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("loop_condition_type_full", context));
  6455. } else {
  6456. return ProcessorErrorFactory.loop_condition_type();
  6457. }
  6458. },
  6459. loop_condition_type: function loop_condition_type() {
  6460. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("loop_condition_type"));
  6461. },
  6462. endless_loop_full: function endless_loop_full(sourceInfo) {
  6463. if (sourceInfo) {
  6464. var context = [sourceInfo.line];
  6465. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("endless_loop_full", context));
  6466. } else {
  6467. return ProcessorErrorFactory.endless_loop();
  6468. }
  6469. },
  6470. endless_loop: function endless_loop() {
  6471. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("endless_loop"));
  6472. },
  6473. for_condition_type_full: function for_condition_type_full(sourceInfo) {
  6474. if (sourceInfo) {
  6475. var context = [sourceInfo.line, sourceInfo.column];
  6476. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("for_condition_type_full", context));
  6477. } else {
  6478. return ProcessorErrorFactory.for_condition_type();
  6479. }
  6480. },
  6481. for_condition_type: function for_condition_type() {
  6482. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("for_condition_type"));
  6483. },
  6484. if_condition_type_full: function if_condition_type_full(sourceInfo) {
  6485. if (sourceInfo) {
  6486. var context = [sourceInfo.line, sourceInfo.column];
  6487. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("if_condition_type_full", context));
  6488. } else {
  6489. return ProcessorErrorFactory.if_condition_type();
  6490. }
  6491. },
  6492. if_condition_type: function if_condition_type() {
  6493. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("if_condition_type"));
  6494. },
  6495. invalid_global_var: function invalid_global_var() {
  6496. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_global_var"));
  6497. },
  6498. not_implemented: function not_implemented(id) {
  6499. var context = [id];
  6500. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("not_implemented", context));
  6501. },
  6502. invalid_case_type_full: function invalid_case_type_full(exp, type, dim, sourceInfo) {
  6503. if (sourceInfo) {
  6504. var context = [exp, translateType(type, dim), sourceInfo.line, sourceInfo.column];
  6505. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_case_type_full", context));
  6506. } else {
  6507. return ProcessorErrorFactory.invalid_case_type(exp, type, dim);
  6508. }
  6509. },
  6510. invalid_case_type: function invalid_case_type(exp, type, dim) {
  6511. var context = [exp, translateType(type, dim)];
  6512. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_case_type", context));
  6513. },
  6514. void_in_expression_full: function void_in_expression_full(id, sourceInfo) {
  6515. if (sourceInfo) {
  6516. var context = [sourceInfo.line, sourceInfo.column, id];
  6517. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("void_in_expression_full", context));
  6518. } else {
  6519. return ProcessorErrorFactory.void_in_expression(id);
  6520. }
  6521. },
  6522. void_in_expression: function void_in_expression(id) {
  6523. var context = [id];
  6524. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("void_in_expression", context));
  6525. },
  6526. invalid_array_access_full: function invalid_array_access_full(id, sourceInfo) {
  6527. if (sourceInfo) {
  6528. var context = [id, sourceInfo.line, sourceInfo.column];
  6529. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_array_access_full", context));
  6530. } else {
  6531. return ProcessorErrorFactory.invalid_array_access(id);
  6532. }
  6533. },
  6534. invalid_array_access: function invalid_array_access(id) {
  6535. var context = [id];
  6536. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_array_access", context));
  6537. },
  6538. invalid_matrix_access_full: function invalid_matrix_access_full(id, sourceInfo) {
  6539. if (sourceInfo) {
  6540. var context = [id, sourceInfo.line, sourceInfo.column];
  6541. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_matrix_access_full", context));
  6542. } else {
  6543. return ProcessorErrorFactory.invalid_matrix_access(id);
  6544. }
  6545. },
  6546. invalid_matrix_access: function invalid_matrix_access(id) {
  6547. var context = [id];
  6548. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_matrix_access", context));
  6549. },
  6550. matrix_column_outbounds_full: function matrix_column_outbounds_full(id, value, columns, sourceInfo) {
  6551. if (sourceInfo) {
  6552. var context = [sourceInfo.line, value, id, columns];
  6553. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("matrix_column_outbounds_full", context));
  6554. } else {
  6555. return ProcessorErrorFactory.matrix_column_outbounds(id, value, columns);
  6556. }
  6557. },
  6558. matrix_column_outbounds: function matrix_column_outbounds(id, value, columns) {
  6559. var context = [value, id, columns];
  6560. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("matrix_column_outbounds", context));
  6561. },
  6562. matrix_line_outbounds_full: function matrix_line_outbounds_full(id, value, lines, sourceInfo) {
  6563. if (sourceInfo) {
  6564. var context = [sourceInfo.line, value, id, lines];
  6565. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("matrix_line_outbounds_full", context));
  6566. } else {
  6567. return ProcessorErrorFactory.matrix_line_outbounds(id, value, lines);
  6568. }
  6569. },
  6570. matrix_line_outbounds: function matrix_line_outbounds(id, value, lines) {
  6571. var context = [value, id, lines];
  6572. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("matrix_line_outbounds", context));
  6573. },
  6574. vector_line_outbounds_full: function vector_line_outbounds_full(id, value, lines, sourceInfo) {
  6575. if (sourceInfo) {
  6576. var context = [sourceInfo.line, value, id, lines];
  6577. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("vector_line_outbounds_full", context));
  6578. } else {
  6579. return ProcessorErrorFactory.vector_line_outbounds(id, value, lines);
  6580. }
  6581. },
  6582. vector_line_outbounds: function vector_line_outbounds(id, value, lines) {
  6583. var context = [value, id, lines];
  6584. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("vector_line_outbounds", context));
  6585. },
  6586. vector_not_matrix_full: function vector_not_matrix_full(id, sourceInfo) {
  6587. if (sourceInfo) {
  6588. var context = [sourceInfo.line, id];
  6589. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("vector_not_matrix_full", context));
  6590. } else {
  6591. return ProcessorErrorFactory.vector_not_matrix(id);
  6592. }
  6593. },
  6594. vector_not_matrix: function vector_not_matrix(id) {
  6595. var context = [id];
  6596. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("vector_not_matrix", context));
  6597. },
  6598. function_no_return: function function_no_return(id) {
  6599. var context = [id];
  6600. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("function_no_return", context));
  6601. },
  6602. invalid_void_return_full: function invalid_void_return_full(id, type, dim, sourceInfo) {
  6603. if (sourceInfo) {
  6604. var context = [sourceInfo.line, id, translateType(type, dim)];
  6605. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_void_return_full", context));
  6606. } else {
  6607. return ProcessorErrorFactory.invalid_void_return(id, type, dim);
  6608. }
  6609. },
  6610. invalid_void_return: function invalid_void_return(id, type, dim) {
  6611. var context = [id, translateType(type, dim)];
  6612. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_void_return_full", context));
  6613. },
  6614. invalid_return_type_full: function invalid_return_type_full(id, type, dim, sourceInfo) {
  6615. if (sourceInfo) {
  6616. var context = [sourceInfo.line, id, translateType(type, dim)];
  6617. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_return_type_full", context));
  6618. } else {
  6619. return ProcessorErrorFactory.invalid_return_type(id, type, dim);
  6620. }
  6621. },
  6622. invalid_return_type: function invalid_return_type(id, type, dim) {
  6623. var context = [id, translateType(type, dim)];
  6624. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_return_type", context));
  6625. },
  6626. invalid_parameters_size_full: function invalid_parameters_size_full(id, expected, actual, sourceInfo) {
  6627. if (sourceInfo) {
  6628. var context = [sourceInfo.line, id, expected, actual];
  6629. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_parameters_size_full", context));
  6630. } else {
  6631. return ProcessorErrorFactory.invalid_parameters_size(id, expected, actual);
  6632. }
  6633. },
  6634. invalid_parameters_size: function invalid_parameters_size(id, expected, actual) {
  6635. var context = [id, expected, actual];
  6636. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_parameters_size", context));
  6637. },
  6638. invalid_parameter_type_full: function invalid_parameter_type_full(id, exp, sourceInfo) {
  6639. if (sourceInfo) {
  6640. var context = [exp, id, sourceInfo.line];
  6641. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_parameter_type_full", context));
  6642. } else {
  6643. return ProcessorErrorFactory.invalid_parameter_type(id, exp);
  6644. }
  6645. },
  6646. invalid_parameter_type: function invalid_parameter_type(id, exp) {
  6647. var context = [exp, id];
  6648. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_parameter_type_full", context));
  6649. },
  6650. invalid_ref_full: function invalid_ref_full(id, exp, sourceInfo) {
  6651. if (sourceInfo) {
  6652. var context = [exp, id, sourceInfo.line];
  6653. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_ref_full", context));
  6654. } else {
  6655. return ProcessorErrorFactory.invalid_ref(id, exp);
  6656. }
  6657. },
  6658. invalid_ref: function invalid_ref(id, exp) {
  6659. var context = [exp, id];
  6660. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_ref", context));
  6661. },
  6662. unexpected_break_command_full: function unexpected_break_command_full(sourceInfo) {
  6663. if (sourceInfo) {
  6664. var context = [sourceInfo.line];
  6665. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("unexpected_break_command_full", context));
  6666. } else {
  6667. return ProcessorErrorFactory.unexpected_break_command();
  6668. }
  6669. },
  6670. unexpected_break_command: function unexpected_break_command() {
  6671. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("unexpected_break_command"));
  6672. },
  6673. invalid_array_literal_type_full: function invalid_array_literal_type_full(exp, sourceInfo) {
  6674. if (sourceInfo) {
  6675. var context = [sourceInfo.line, exp];
  6676. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_array_literal_type_full", context));
  6677. } else {
  6678. return ProcessorErrorFactory.invalid_array_literal_type(exp);
  6679. }
  6680. },
  6681. invalid_array_literal_type: function invalid_array_literal_type(exp) {
  6682. var context = [exp];
  6683. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_array_literal_type", context));
  6684. },
  6685. invalid_array_literal_line_full: function invalid_array_literal_line_full(expected, actual, sourceInfo) {
  6686. if (sourceInfo) {
  6687. var context = [sourceInfo.line, expected, actual];
  6688. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_array_literal_line_full", context));
  6689. } else {
  6690. return ProcessorErrorFactory.invalid_array_literal_type(expected, actual);
  6691. }
  6692. },
  6693. invalid_array_literal_line: function invalid_array_literal_line(expected, actual) {
  6694. var context = [expected, actual];
  6695. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_array_literal_line", context));
  6696. },
  6697. invalid_array_literal_column_full: function invalid_array_literal_column_full(expected, actual, sourceInfo) {
  6698. if (sourceInfo) {
  6699. var context = [sourceInfo.line, expected, actual];
  6700. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_array_literal_column_full", context));
  6701. } else {
  6702. return ProcessorErrorFactory.invalid_array_literal_column(expected, actual);
  6703. }
  6704. },
  6705. invalid_array_literal_column: function invalid_array_literal_column(expected, actual) {
  6706. var context = [expected, actual];
  6707. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_array_literal_column", context));
  6708. },
  6709. invalid_unary_op_full: function invalid_unary_op_full(opName, type, dim, sourceInfo) {
  6710. if (sourceInfo) {
  6711. var context = [sourceInfo.line, translateOp(opName), translateType(type, dim)];
  6712. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_unary_op_full", context));
  6713. } else {
  6714. return ProcessorErrorFactory.invalid_unary_op(opName, type, dim);
  6715. }
  6716. },
  6717. invalid_unary_op: function invalid_unary_op(opName, type, dim) {
  6718. var context = [translateOp(opName), translateType(type, dim)];
  6719. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_unary_op", context));
  6720. },
  6721. invalid_infix_op_full: function invalid_infix_op_full(opName, typeLeft, dimLeft, typeRight, dimRight, sourceInfo) {
  6722. if (sourceInfo) {
  6723. var context = [sourceInfo.line, translateOp(opName), translateType(typeLeft, dimLeft), translateType(typeRight, dimRight)];
  6724. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_infix_op_full", context));
  6725. } else {
  6726. return ProcessorErrorFactory.invalid_infix_op(opName, typeLeft, dimLeft, typeRight, dimRight);
  6727. }
  6728. },
  6729. invalid_infix_op: function invalid_infix_op(opName, typeLeft, dimLeft, typeRight, dimRight) {
  6730. var context = [translateOp(opName), translateType(typeLeft, dimLeft), translateType(typeRight, dimRight)];
  6731. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_infix_op", context));
  6732. },
  6733. array_dimension_not_positive_full: function array_dimension_not_positive_full(sourceInfo) {
  6734. if (sourceInfo) {
  6735. var context = [sourceInfo.line];
  6736. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("array_dimension_not_positive_full", context));
  6737. } else {
  6738. return ProcessorErrorFactory.array_dimension_not_positive();
  6739. }
  6740. },
  6741. array_dimension_not_positive: function array_dimension_not_positive() {
  6742. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("array_dimension_not_positive"));
  6743. }
  6744. });
  6745. /***/ }),
  6746. /***/ "./js/processor/error/runtimeError.js":
  6747. /*!********************************************!*\
  6748. !*** ./js/processor/error/runtimeError.js ***!
  6749. \********************************************/
  6750. /*! no static exports found */
  6751. /***/ (function(module, exports, __webpack_require__) {
  6752. "use strict";
  6753. Object.defineProperty(exports, "__esModule", {
  6754. value: true
  6755. });
  6756. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6757. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  6758. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  6759. var RuntimeError = exports.RuntimeError = function (_Error) {
  6760. _inherits(RuntimeError, _Error);
  6761. function RuntimeError() {
  6762. var _ref;
  6763. _classCallCheck(this, RuntimeError);
  6764. for (var _len = arguments.length, msg = Array(_len), _key = 0; _key < _len; _key++) {
  6765. msg[_key] = arguments[_key];
  6766. }
  6767. var _this = _possibleConstructorReturn(this, (_ref = RuntimeError.__proto__ || Object.getPrototypeOf(RuntimeError)).call.apply(_ref, [this].concat(msg)));
  6768. if (Error.captureStackTrace) Error.captureStackTrace(_this, RuntimeError);
  6769. return _this;
  6770. }
  6771. return RuntimeError;
  6772. }(Error);
  6773. /***/ }),
  6774. /***/ "./js/processor/error/semanticError.js":
  6775. /*!*********************************************!*\
  6776. !*** ./js/processor/error/semanticError.js ***!
  6777. \*********************************************/
  6778. /*! no static exports found */
  6779. /***/ (function(module, exports, __webpack_require__) {
  6780. "use strict";
  6781. Object.defineProperty(exports, "__esModule", {
  6782. value: true
  6783. });
  6784. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6785. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  6786. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  6787. var SemanticError = exports.SemanticError = function (_Error) {
  6788. _inherits(SemanticError, _Error);
  6789. function SemanticError() {
  6790. var _ref;
  6791. _classCallCheck(this, SemanticError);
  6792. for (var _len = arguments.length, msg = Array(_len), _key = 0; _key < _len; _key++) {
  6793. msg[_key] = arguments[_key];
  6794. }
  6795. var _this = _possibleConstructorReturn(this, (_ref = SemanticError.__proto__ || Object.getPrototypeOf(SemanticError)).call.apply(_ref, [this].concat(msg)));
  6796. if (Error.captureStackTrace) Error.captureStackTrace(_this, SemanticError);
  6797. return _this;
  6798. }
  6799. return SemanticError;
  6800. }(Error);
  6801. /***/ }),
  6802. /***/ "./js/processor/ivprogProcessor.js":
  6803. /*!*****************************************!*\
  6804. !*** ./js/processor/ivprogProcessor.js ***!
  6805. \*****************************************/
  6806. /*! no static exports found */
  6807. /***/ (function(module, exports, __webpack_require__) {
  6808. "use strict";
  6809. Object.defineProperty(exports, "__esModule", {
  6810. value: true
  6811. });
  6812. exports.IVProgProcessor = undefined;
  6813. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  6814. var _store = __webpack_require__(/*! ./store/store */ "./js/processor/store/store.js");
  6815. var _storeObject = __webpack_require__(/*! ./store/storeObject */ "./js/processor/store/storeObject.js");
  6816. var _storeObjectArray = __webpack_require__(/*! ./store/storeObjectArray */ "./js/processor/store/storeObjectArray.js");
  6817. var _storeObjectRef = __webpack_require__(/*! ./store/storeObjectRef */ "./js/processor/store/storeObjectRef.js");
  6818. var _modes = __webpack_require__(/*! ./modes */ "./js/processor/modes.js");
  6819. var _context = __webpack_require__(/*! ./context */ "./js/processor/context.js");
  6820. var _types = __webpack_require__(/*! ./../typeSystem/types */ "./js/typeSystem/types.js");
  6821. var _operators = __webpack_require__(/*! ./../ast/operators */ "./js/ast/operators.js");
  6822. var _definedFunctions = __webpack_require__(/*! ./definedFunctions */ "./js/processor/definedFunctions.js");
  6823. var _compatibilityTable = __webpack_require__(/*! ./compatibilityTable */ "./js/processor/compatibilityTable.js");
  6824. var _commands = __webpack_require__(/*! ./../ast/commands/ */ "./js/ast/commands/index.js");
  6825. var Commands = _interopRequireWildcard(_commands);
  6826. var _expressions = __webpack_require__(/*! ./../ast/expressions/ */ "./js/ast/expressions/index.js");
  6827. var Expressions = _interopRequireWildcard(_expressions);
  6828. var _storeObjectArrayAddress = __webpack_require__(/*! ./store/storeObjectArrayAddress */ "./js/processor/store/storeObjectArrayAddress.js");
  6829. var _storeObjectArrayAddressRef = __webpack_require__(/*! ./store/storeObjectArrayAddressRef */ "./js/processor/store/storeObjectArrayAddressRef.js");
  6830. var _compoundType = __webpack_require__(/*! ./../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  6831. var _parsers = __webpack_require__(/*! ../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  6832. var _config = __webpack_require__(/*! ../util/config */ "./js/util/config.js");
  6833. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  6834. var _decimal2 = _interopRequireDefault(_decimal);
  6835. var _processorErrorFactory = __webpack_require__(/*! ./error/processorErrorFactory */ "./js/processor/error/processorErrorFactory.js");
  6836. var _runtimeError = __webpack_require__(/*! ./error/runtimeError */ "./js/processor/error/runtimeError.js");
  6837. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6838. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  6839. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6840. var IVProgProcessor = exports.IVProgProcessor = function () {
  6841. _createClass(IVProgProcessor, null, [{
  6842. key: 'LOOP_TIMEOUT',
  6843. get: function get() {
  6844. return _config.Config.loopTimeout;
  6845. },
  6846. set: function set(ms) {
  6847. _config.Config.setConfig({ loopTimeout: ms });
  6848. }
  6849. }, {
  6850. key: 'MAIN_INTERNAL_ID',
  6851. get: function get() {
  6852. return "$main";
  6853. }
  6854. }]);
  6855. function IVProgProcessor(ast) {
  6856. _classCallCheck(this, IVProgProcessor);
  6857. this.ast = ast;
  6858. this.globalStore = new _store.Store("$global");
  6859. this.stores = [this.globalStore];
  6860. this.context = [_context.Context.BASE];
  6861. this.input = null;
  6862. this.forceKill = false;
  6863. this.loopTimers = [];
  6864. this.output = null;
  6865. }
  6866. _createClass(IVProgProcessor, [{
  6867. key: 'registerInput',
  6868. value: function registerInput(input) {
  6869. if (this.input !== null) this.input = null;
  6870. this.input = input;
  6871. }
  6872. }, {
  6873. key: 'registerOutput',
  6874. value: function registerOutput(output) {
  6875. if (this.output !== null) this.output = null;
  6876. this.output = output;
  6877. }
  6878. }, {
  6879. key: 'checkContext',
  6880. value: function checkContext(context) {
  6881. return this.context[this.context.length - 1] === context;
  6882. }
  6883. }, {
  6884. key: 'ignoreSwitchCases',
  6885. value: function ignoreSwitchCases(store) {
  6886. if (store.mode === _modes.Modes.RETURN) {
  6887. return true;
  6888. } else if (store.mode === _modes.Modes.BREAK) {
  6889. return true;
  6890. } else {
  6891. return false;
  6892. }
  6893. }
  6894. }, {
  6895. key: 'prepareState',
  6896. value: function prepareState() {
  6897. if (this.stores !== null) {
  6898. for (var i = 0; i < this.stores.length; i++) {
  6899. delete this.stores[i];
  6900. }
  6901. this.stores = null;
  6902. }
  6903. if (this.globalStore !== null) this.globalStore = null;
  6904. this.globalStore = new _store.Store("$global");
  6905. this.stores = [this.globalStore];
  6906. this.context = [_context.Context.BASE];
  6907. }
  6908. }, {
  6909. key: 'interpretAST',
  6910. value: function interpretAST() {
  6911. this.prepareState();
  6912. this.initGlobal();
  6913. var mainFunc = this.findMainFunction();
  6914. if (mainFunc === null) {
  6915. throw _processorErrorFactory.ProcessorErrorFactory.main_missing();
  6916. }
  6917. return this.runFunction(mainFunc, [], this.globalStore);
  6918. }
  6919. }, {
  6920. key: 'initGlobal',
  6921. value: function initGlobal() {
  6922. var _this = this;
  6923. if (!this.checkContext(_context.Context.BASE)) {
  6924. throw _processorErrorFactory.ProcessorErrorFactory.invalid_global_var();
  6925. }
  6926. this.ast.global.forEach(function (decl) {
  6927. _this.executeCommand(_this.globalStore, decl).then(function (sto) {
  6928. return _this.globalStore = sto;
  6929. });
  6930. });
  6931. }
  6932. }, {
  6933. key: 'findMainFunction',
  6934. value: function findMainFunction() {
  6935. return this.ast.functions.find(function (v) {
  6936. return v.isMain;
  6937. });
  6938. }
  6939. }, {
  6940. key: 'findFunction',
  6941. value: function findFunction(name) {
  6942. if (name.match(/^\$.+$/)) {
  6943. var fun = _definedFunctions.LanguageDefinedFunction.getFunction(name);
  6944. if (!!!fun) {
  6945. throw _processorErrorFactory.ProcessorErrorFactory.not_implemented(name);
  6946. }
  6947. return fun;
  6948. } else {
  6949. var val = this.ast.functions.find(function (v) {
  6950. return v.name === name;
  6951. });
  6952. if (!!!val) {
  6953. // TODO: better error message;
  6954. throw _processorErrorFactory.ProcessorErrorFactory.function_missing(name);
  6955. }
  6956. return val;
  6957. }
  6958. }
  6959. }, {
  6960. key: 'runFunction',
  6961. value: function runFunction(func, actualParameters, store) {
  6962. var _this2 = this;
  6963. var funcName = func.isMain ? IVProgProcessor.MAIN_INTERNAL_ID : func.name;
  6964. var funcStore = new _store.Store(funcName);
  6965. funcStore.extendStore(this.globalStore);
  6966. var returnStoreObject = null;
  6967. if (func.returnType instanceof _compoundType.CompoundType) {
  6968. if (func.returnType.dimensions > 1) {
  6969. returnStoreObject = new _storeObjectArray.StoreObjectArray(func.returnType, -1, -1, [[]]);
  6970. } else {
  6971. returnStoreObject = new _storeObjectArray.StoreObjectArray(func.returnType, -1, null, []);
  6972. }
  6973. } else {
  6974. returnStoreObject = new _storeObject.StoreObject(func.returnType, null);
  6975. }
  6976. funcStore.insertStore('$', returnStoreObject);
  6977. var newFuncStore$ = this.associateParameters(func.formalParameters, actualParameters, store, funcStore);
  6978. return newFuncStore$.then(function (sto) {
  6979. _this2.context.push(_context.Context.FUNCTION);
  6980. _this2.stores.push(sto);
  6981. return _this2.executeCommands(sto, func.variablesDeclarations).then(function (stoWithVars) {
  6982. return _this2.executeCommands(stoWithVars, func.commands);
  6983. }).then(function (finalSto) {
  6984. _this2.stores.pop();
  6985. _this2.context.pop();
  6986. return finalSto;
  6987. });
  6988. });
  6989. }
  6990. }, {
  6991. key: 'associateParameters',
  6992. value: function associateParameters(formalList, actualList, callerStore, calleeStore) {
  6993. var _this3 = this;
  6994. var funcName = calleeStore.name === IVProgProcessor.MAIN_INTERNAL_ID ? _definedFunctions.LanguageDefinedFunction.getMainFunctionName() : calleeStore.name;
  6995. if (formalList.length != actualList.length) {
  6996. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameters_size(funcName, formalList.length, actualList.length);
  6997. }
  6998. var promises$ = actualList.map(function (actualParameter) {
  6999. return _this3.evaluateExpression(callerStore, actualParameter);
  7000. });
  7001. return Promise.all(promises$).then(function (values) {
  7002. for (var i = 0; i < values.length; i++) {
  7003. var stoObj = values[i];
  7004. var exp = actualList[i];
  7005. var formalParameter = formalList[i];
  7006. if (formalParameter.type.isCompatible(stoObj.type)) {
  7007. if (formalParameter.byRef && !stoObj.inStore) {
  7008. throw _processorErrorFactory.ProcessorErrorFactory.invalid_ref(funcName, exp.toString());
  7009. }
  7010. if (formalParameter.byRef) {
  7011. var ref = null;
  7012. if (stoObj instanceof _storeObjectArrayAddress.StoreObjectArrayAddress) {
  7013. ref = new _storeObjectArrayAddressRef.StoreObjectArrayAddressRef(stoObj);
  7014. } else {
  7015. ref = new _storeObjectRef.StoreObjectRef(stoObj.id, callerStore);
  7016. }
  7017. calleeStore.insertStore(formalParameter.id, ref);
  7018. } else {
  7019. var realValue = _this3.parseStoreObjectValue(stoObj);
  7020. calleeStore.insertStore(formalParameter.id, realValue);
  7021. }
  7022. } else {
  7023. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameter_type(funcName, exp.toString());
  7024. }
  7025. }
  7026. return calleeStore;
  7027. });
  7028. }
  7029. }, {
  7030. key: 'executeCommands',
  7031. value: function executeCommands(store, cmds) {
  7032. // helper to partially apply a function, in this case executeCommand
  7033. var outerRef = this;
  7034. var partial = function partial(fun, cmd) {
  7035. return function (sto) {
  7036. return fun(sto, cmd);
  7037. };
  7038. };
  7039. return cmds.reduce(function (lastCommand, next) {
  7040. var nextCommand = partial(outerRef.executeCommand.bind(outerRef), next);
  7041. return lastCommand.then(nextCommand);
  7042. }, Promise.resolve(store));
  7043. }
  7044. }, {
  7045. key: 'executeCommand',
  7046. value: function executeCommand(store, cmd) {
  7047. if (this.forceKill) {
  7048. return Promise.reject("FORCED_KILL!");
  7049. } else if (store.mode === _modes.Modes.PAUSE) {
  7050. return Promise.resolve(this.executeCommand(store, cmd));
  7051. } else if (store.mode === _modes.Modes.RETURN) {
  7052. return Promise.resolve(store);
  7053. } else if (this.checkContext(_context.Context.BREAKABLE) && store.mode === _modes.Modes.BREAK) {
  7054. return Promise.resolve(store);
  7055. }
  7056. if (cmd instanceof Commands.Declaration) {
  7057. return this.executeDeclaration(store, cmd);
  7058. } else if (cmd instanceof Commands.ArrayIndexAssign) {
  7059. return this.executeArrayIndexAssign(store, cmd);
  7060. } else if (cmd instanceof Commands.Assign) {
  7061. return this.executeAssign(store, cmd);
  7062. } else if (cmd instanceof Commands.Break) {
  7063. return this.executeBreak(store, cmd);
  7064. } else if (cmd instanceof Commands.Return) {
  7065. return this.executeReturn(store, cmd);
  7066. } else if (cmd instanceof Commands.IfThenElse) {
  7067. return this.executeIfThenElse(store, cmd);
  7068. } else if (cmd instanceof Commands.While) {
  7069. return this.executeWhile(store, cmd);
  7070. } else if (cmd instanceof Commands.DoWhile) {
  7071. return this.executeDoWhile(store, cmd);
  7072. } else if (cmd instanceof Commands.For) {
  7073. return this.executeFor(store, cmd);
  7074. } else if (cmd instanceof Commands.Switch) {
  7075. return this.executeSwitch(store, cmd);
  7076. } else if (cmd instanceof Expressions.FunctionCall) {
  7077. return this.executeFunctionCall(store, cmd);
  7078. } else if (cmd instanceof Commands.SysCall) {
  7079. return this.executeSysCall(store, cmd);
  7080. } else {
  7081. throw _processorErrorFactory.ProcessorErrorFactory.unknown_command(cmd.sourceInfo);
  7082. }
  7083. }
  7084. }, {
  7085. key: 'executeSysCall',
  7086. value: function executeSysCall(store, cmd) {
  7087. var func = cmd.langFunc.bind(this);
  7088. return func(store, cmd);
  7089. }
  7090. }, {
  7091. key: 'executeFunctionCall',
  7092. value: function executeFunctionCall(store, cmd) {
  7093. var func = null;
  7094. if (cmd.isMainCall) {
  7095. func = this.findMainFunction();
  7096. } else {
  7097. func = this.findFunction(cmd.id);
  7098. }
  7099. return this.runFunction(func, cmd.actualParameters, store).then(function (sto) {
  7100. if (!_types.Types.VOID.isCompatible(func.returnType) && sto.mode !== _modes.Modes.RETURN) {
  7101. var funcName = func.name === IVProgProcessor.MAIN_INTERNAL_ID ? _definedFunctions.LanguageDefinedFunction.getMainFunctionName() : func.name;
  7102. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.function_no_return(funcName));
  7103. } else {
  7104. return store;
  7105. }
  7106. });
  7107. }
  7108. }, {
  7109. key: 'executeSwitch',
  7110. value: function executeSwitch(store, cmd) {
  7111. var _this4 = this;
  7112. this.context.push(_context.Context.BREAKABLE);
  7113. var auxCaseFun = function auxCaseFun(promise, switchExp, aCase) {
  7114. return promise.then(function (result) {
  7115. var sto = result.sto;
  7116. if (_this4.ignoreSwitchCases(sto)) {
  7117. return Promise.resolve(result);
  7118. } else if (result.wasTrue || aCase.isDefault) {
  7119. var $newSto = _this4.executeCommands(result.sto, aCase.commands);
  7120. return $newSto.then(function (nSto) {
  7121. return Promise.resolve({ wasTrue: true, sto: nSto });
  7122. });
  7123. } else {
  7124. var $value = _this4.evaluateExpression(sto, new Expressions.InfixApp(_operators.Operators.EQ, switchExp, aCase.expression));
  7125. return $value.then(function (vl) {
  7126. if (vl.value) {
  7127. var _$newSto = _this4.executeCommands(result.sto, aCase.commands);
  7128. return _$newSto.then(function (nSto) {
  7129. return Promise.resolve({ wasTrue: true, sto: nSto });
  7130. });
  7131. } else {
  7132. return Promise.resolve({ wasTrue: false, sto: sto });
  7133. }
  7134. });
  7135. }
  7136. });
  7137. };
  7138. try {
  7139. var breakLoop = false;
  7140. var $result = Promise.resolve({ wasTrue: false, sto: store });
  7141. for (var index = 0; index < cmd.cases.length && !breakLoop; index++) {
  7142. var aCase = cmd.cases[index];
  7143. $result = auxCaseFun($result, cmd.expression, aCase);
  7144. $result.then(function (r) {
  7145. return breakLoop = _this4.ignoreSwitchCases(r.sto);
  7146. });
  7147. }
  7148. return $result.then(function (r) {
  7149. _this4.context.pop();
  7150. if (r.sto.mode === _modes.Modes.BREAK) {
  7151. r.sto.mode = _modes.Modes.RUN;
  7152. }
  7153. return r.sto;
  7154. });
  7155. } catch (error) {
  7156. return Promise.reject(error);
  7157. }
  7158. }
  7159. }, {
  7160. key: 'executeFor',
  7161. value: function executeFor(store, cmd) {
  7162. try {
  7163. //BEGIN for -> while rewrite
  7164. var initCmd = cmd.assignment;
  7165. var condition = cmd.condition;
  7166. var increment = cmd.increment;
  7167. var whileBlock = new Commands.CommandBlock([], cmd.commands.concat(increment));
  7168. var forAsWhile = new Commands.While(condition, whileBlock);
  7169. //END for -> while rewrite
  7170. var newCmdList = [initCmd, forAsWhile];
  7171. return this.executeCommands(store, newCmdList);
  7172. } catch (error) {
  7173. return Promise.reject(error);
  7174. }
  7175. }
  7176. }, {
  7177. key: 'executeDoWhile',
  7178. value: function executeDoWhile(store, cmd) {
  7179. var outerRef = this;
  7180. try {
  7181. outerRef.loopTimers.push(Date.now());
  7182. outerRef.context.push(_context.Context.BREAKABLE);
  7183. var $newStore = outerRef.executeCommands(store, cmd.commands);
  7184. return $newStore.then(function (sto) {
  7185. if (sto.mode === _modes.Modes.BREAK) {
  7186. outerRef.context.pop();
  7187. sto.mode = _modes.Modes.RUN;
  7188. outerRef.loopTimers.pop();
  7189. return sto;
  7190. }
  7191. var $value = outerRef.evaluateExpression(sto, cmd.expression);
  7192. return $value.then(function (vl) {
  7193. if (!vl.type.isCompatible(_types.Types.BOOLEAN)) {
  7194. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.loop_condition_type_full(cmd.sourceInfo));
  7195. }
  7196. if (vl.value) {
  7197. outerRef.context.pop();
  7198. for (var i = 0; i < outerRef.loopTimers.length; i++) {
  7199. var time = outerRef.loopTimers[i];
  7200. if (Date.now() - time >= IVProgProcessor.LOOP_TIMEOUT) {
  7201. outerRef.forceKill = true;
  7202. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.endless_loop_full(cmd.sourceInfo));
  7203. }
  7204. }
  7205. return outerRef.executeCommand(sto, cmd);
  7206. } else {
  7207. outerRef.context.pop();
  7208. outerRef.loopTimers.pop();
  7209. return sto;
  7210. }
  7211. });
  7212. });
  7213. } catch (error) {
  7214. return Promise.reject(error);
  7215. }
  7216. }
  7217. }, {
  7218. key: 'executeWhile',
  7219. value: function executeWhile(store, cmd) {
  7220. var outerRef = this;
  7221. try {
  7222. outerRef.loopTimers.push(Date.now());
  7223. outerRef.context.push(_context.Context.BREAKABLE);
  7224. var $value = outerRef.evaluateExpression(store, cmd.expression);
  7225. return $value.then(function (vl) {
  7226. if (vl.type.isCompatible(_types.Types.BOOLEAN)) {
  7227. if (vl.value) {
  7228. var $newStore = outerRef.executeCommands(store, cmd.commands);
  7229. return $newStore.then(function (sto) {
  7230. outerRef.context.pop();
  7231. if (sto.mode === _modes.Modes.BREAK) {
  7232. outerRef.loopTimers.pop();
  7233. sto.mode = _modes.Modes.RUN;
  7234. return sto;
  7235. }
  7236. for (var i = 0; i < outerRef.loopTimers.length; i++) {
  7237. var time = outerRef.loopTimers[i];
  7238. if (Date.now() - time >= IVProgProcessor.LOOP_TIMEOUT) {
  7239. outerRef.forceKill = true;
  7240. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.endless_loop_full(cmd.sourceInfo));
  7241. }
  7242. }
  7243. return outerRef.executeCommand(sto, cmd);
  7244. });
  7245. } else {
  7246. outerRef.context.pop();
  7247. outerRef.loopTimers.pop();
  7248. return store;
  7249. }
  7250. } else {
  7251. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.loop_condition_type_full(cmd.sourceInfo));
  7252. }
  7253. });
  7254. } catch (error) {
  7255. return Promise.reject(error);
  7256. }
  7257. }
  7258. }, {
  7259. key: 'executeIfThenElse',
  7260. value: function executeIfThenElse(store, cmd) {
  7261. var _this5 = this;
  7262. try {
  7263. var $value = this.evaluateExpression(store, cmd.condition);
  7264. return $value.then(function (vl) {
  7265. if (vl.type.isCompatible(_types.Types.BOOLEAN)) {
  7266. if (vl.value) {
  7267. return _this5.executeCommands(store, cmd.ifTrue.commands);
  7268. } else if (cmd.ifFalse !== null) {
  7269. if (cmd.ifFalse instanceof Commands.IfThenElse) {
  7270. return _this5.executeCommand(store, cmd.ifFalse);
  7271. } else {
  7272. return _this5.executeCommands(store, cmd.ifFalse.commands);
  7273. }
  7274. } else {
  7275. return Promise.resolve(store);
  7276. }
  7277. } else {
  7278. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.if_condition_type_full(cmd.sourceInfo));
  7279. }
  7280. });
  7281. } catch (error) {
  7282. return Promise.reject(error);
  7283. }
  7284. }
  7285. }, {
  7286. key: 'executeReturn',
  7287. value: function executeReturn(store, cmd) {
  7288. var _this6 = this;
  7289. try {
  7290. var funcType = store.applyStore('$').type;
  7291. var $value = this.evaluateExpression(store, cmd.expression);
  7292. var funcName = store.name === IVProgProcessor.MAIN_INTERNAL_ID ? _definedFunctions.LanguageDefinedFunction.getMainFunctionName() : store.name;
  7293. return $value.then(function (vl) {
  7294. if (vl === null && funcType.isCompatible(_types.Types.VOID)) {
  7295. return Promise.resolve(store);
  7296. }
  7297. if (vl === null || !funcType.isCompatible(vl.type)) {
  7298. var stringInfo = funcType.stringInfo();
  7299. var info = stringInfo[0];
  7300. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_return_type_full(funcName, info.type, info.dim, cmd.sourceInfo));
  7301. } else {
  7302. var realValue = _this6.parseStoreObjectValue(vl);
  7303. store.updateStore('$', realValue);
  7304. store.mode = _modes.Modes.RETURN;
  7305. return Promise.resolve(store);
  7306. }
  7307. });
  7308. } catch (error) {
  7309. return Promise.reject(error);
  7310. }
  7311. }
  7312. }, {
  7313. key: 'executeBreak',
  7314. value: function executeBreak(store, cmd) {
  7315. if (this.checkContext(_context.Context.BREAKABLE)) {
  7316. store.mode = _modes.Modes.BREAK;
  7317. return Promise.resolve(store);
  7318. } else {
  7319. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.unexpected_break_command_full(cmd.sourceInfo));
  7320. }
  7321. }
  7322. }, {
  7323. key: 'executeAssign',
  7324. value: function executeAssign(store, cmd) {
  7325. var _this7 = this;
  7326. try {
  7327. var $value = this.evaluateExpression(store, cmd.expression);
  7328. return $value.then(function (vl) {
  7329. var realValue = _this7.parseStoreObjectValue(vl);
  7330. store.updateStore(cmd.id, realValue);
  7331. return store;
  7332. });
  7333. } catch (error) {
  7334. return Promise.reject(error);
  7335. }
  7336. }
  7337. }, {
  7338. key: 'executeArrayIndexAssign',
  7339. value: function executeArrayIndexAssign(store, cmd) {
  7340. var _this8 = this;
  7341. var mustBeArray = store.applyStore(cmd.id);
  7342. if (!(mustBeArray.type instanceof _compoundType.CompoundType)) {
  7343. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_array_access_full(cmd.id, cmd.sourceInfo));
  7344. }
  7345. var line$ = this.evaluateExpression(store, cmd.line);
  7346. var column$ = this.evaluateExpression(store, cmd.column);
  7347. var value$ = this.evaluateExpression(store, cmd.expression);
  7348. return Promise.all([line$, column$, value$]).then(function (results) {
  7349. var lineSO = results[0];
  7350. if (!_types.Types.INTEGER.isCompatible(lineSO.type)) {
  7351. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo));
  7352. }
  7353. var line = lineSO.number;
  7354. var columnSO = results[1];
  7355. var column = null;
  7356. if (columnSO !== null) {
  7357. if (!_types.Types.INTEGER.isCompatible(columnSO.type)) {
  7358. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo));
  7359. }
  7360. column = columnSO.number;
  7361. }
  7362. var value = _this8.parseStoreObjectValue(results[2]);
  7363. if (line >= mustBeArray.lines) {
  7364. if (mustBeArray.isVector) {
  7365. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.vector_line_outbounds_full(cmd.id, line, mustBeArray.lines, cmd.sourceInfo));
  7366. } else {
  7367. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.matrix_line_outbounds_full(cmd.id, line, mustBeArray.lines, cmd.sourceInfo));
  7368. }
  7369. } else if (line < 0) {
  7370. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(cmd.sourceInfo);
  7371. }
  7372. if (column !== null && mustBeArray.columns === null) {
  7373. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.vector_not_matrix_full(cmd.id, cmd.sourceInfo));
  7374. }
  7375. if (column !== null) {
  7376. if (column >= mustBeArray.columns) {
  7377. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.matrix_column_outbounds_full(cmd.id, column, mustBeArray.columns, cmd.sourceInfo));
  7378. } else if (column < 0) {
  7379. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(cmd.sourceInfo);
  7380. }
  7381. }
  7382. var newArray = Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null), mustBeArray);
  7383. if (column !== null) {
  7384. if (value.type instanceof _compoundType.CompoundType) {
  7385. var type = mustBeArray.type.innerType;
  7386. var stringInfo = type.stringInfo();
  7387. var info = stringInfo[0];
  7388. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.incompatible_types_full(info.type, info.dim, cmd.sourceInfo));
  7389. }
  7390. newArray.value[line].value[column] = value;
  7391. store.updateStore(cmd.id, newArray);
  7392. } else {
  7393. if (mustBeArray.columns !== null && value.type instanceof _compoundType.CompoundType) {
  7394. var _type = mustBeArray.type;
  7395. var _stringInfo = _type.stringInfo();
  7396. var _info = _stringInfo[0];
  7397. var exp = cmd.expression.toString();
  7398. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.incompatible_types_array_full(exp, _info.type, _info.dim - 1, cmd.sourceInfo));
  7399. }
  7400. newArray.value[line] = value;
  7401. store.updateStore(cmd.id, newArray);
  7402. }
  7403. return store;
  7404. });
  7405. }
  7406. }, {
  7407. key: 'executeDeclaration',
  7408. value: function executeDeclaration(store, cmd) {
  7409. try {
  7410. var $value = this.evaluateExpression(store, cmd.initial);
  7411. if (cmd instanceof Commands.ArrayDeclaration) {
  7412. var $lines = this.evaluateExpression(store, cmd.lines);
  7413. var $columns = cmd.columns === null ? null : this.evaluateExpression(store, cmd.columns);
  7414. return Promise.all([$lines, $columns, $value]).then(function (values) {
  7415. var lineSO = values[0];
  7416. if (!_types.Types.INTEGER.isCompatible(lineSO.type)) {
  7417. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo));
  7418. }
  7419. var line = lineSO.number;
  7420. if (line < 0) {
  7421. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(cmd.sourceInfo);
  7422. }
  7423. var columnSO = values[1];
  7424. var column = null;
  7425. if (columnSO !== null) {
  7426. if (!_types.Types.INTEGER.isCompatible(columnSO.type)) {
  7427. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo));
  7428. }
  7429. column = columnSO.number;
  7430. if (column < 0) {
  7431. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(cmd.sourceInfo);
  7432. }
  7433. }
  7434. var value = values[2];
  7435. var temp = new _storeObjectArray.StoreObjectArray(cmd.type, line, column, null);
  7436. store.insertStore(cmd.id, temp);
  7437. var realValue = value;
  7438. if (value !== null) {
  7439. if (value instanceof _storeObjectArrayAddress.StoreObjectArrayAddress) {
  7440. if (value.type instanceof _compoundType.CompoundType) {
  7441. realValue = Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null), value.refValue);
  7442. } else {
  7443. realValue = Object.assign(new _storeObject.StoreObject(null, null), value.refValue);
  7444. }
  7445. }
  7446. } else {
  7447. realValue = new _storeObjectArray.StoreObjectArray(cmd.type, line, column, []);
  7448. if (column !== null) {
  7449. for (var i = 0; i < line; i++) {
  7450. realValue.value.push(new _storeObjectArray.StoreObjectArray(new _compoundType.CompoundType(cmd.type.innerType, 1), column, null, []));
  7451. }
  7452. }
  7453. }
  7454. realValue.readOnly = cmd.isConst;
  7455. store.updateStore(cmd.id, realValue);
  7456. return store;
  7457. });
  7458. } else {
  7459. var temp = new _storeObject.StoreObject(cmd.type, null);
  7460. store.insertStore(cmd.id, temp);
  7461. return $value.then(function (vl) {
  7462. var realValue = vl;
  7463. if (vl !== null) {
  7464. if (vl instanceof _storeObjectArrayAddress.StoreObjectArrayAddress) {
  7465. if (vl.type instanceof _compoundType.CompoundType) {
  7466. realValue = Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null), vl.refValue);
  7467. } else {
  7468. realValue = Object.assign(new _storeObject.StoreObject(null, null), vl.refValue);
  7469. }
  7470. }
  7471. } else {
  7472. realValue = new _storeObject.StoreObject(cmd.type, 0);
  7473. }
  7474. realValue.readOnly = cmd.isConst;
  7475. store.updateStore(cmd.id, realValue);
  7476. return store;
  7477. });
  7478. }
  7479. } catch (e) {
  7480. return Promise.reject(e);
  7481. }
  7482. }
  7483. }, {
  7484. key: 'evaluateExpression',
  7485. value: function evaluateExpression(store, exp) {
  7486. if (exp instanceof Expressions.UnaryApp) {
  7487. return this.evaluateUnaryApp(store, exp);
  7488. } else if (exp instanceof Expressions.InfixApp) {
  7489. return this.evaluateInfixApp(store, exp);
  7490. } else if (exp instanceof Expressions.ArrayAccess) {
  7491. return this.evaluateArrayAccess(store, exp);
  7492. } else if (exp instanceof Expressions.VariableLiteral) {
  7493. return this.evaluateVariableLiteral(store, exp);
  7494. } else if (exp instanceof Expressions.IntLiteral) {
  7495. return this.evaluateLiteral(store, exp);
  7496. } else if (exp instanceof Expressions.RealLiteral) {
  7497. return this.evaluateLiteral(store, exp);
  7498. } else if (exp instanceof Expressions.BoolLiteral) {
  7499. return this.evaluateLiteral(store, exp);
  7500. } else if (exp instanceof Expressions.StringLiteral) {
  7501. return this.evaluateLiteral(store, exp);
  7502. } else if (exp instanceof Expressions.ArrayLiteral) {
  7503. return this.evaluateArrayLiteral(store, exp);
  7504. } else if (exp instanceof Expressions.FunctionCall) {
  7505. return this.evaluateFunctionCall(store, exp);
  7506. }
  7507. return Promise.resolve(null);
  7508. }
  7509. }, {
  7510. key: 'evaluateFunctionCall',
  7511. value: function evaluateFunctionCall(store, exp) {
  7512. if (exp.isMainCall) {
  7513. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.void_in_expression_full(_definedFunctions.LanguageDefinedFunction.getMainFunctionName(), exp.sourceInfo));
  7514. }
  7515. var func = this.findFunction(exp.id);
  7516. if (_types.Types.VOID.isCompatible(func.returnType)) {
  7517. // TODO: better error message
  7518. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.void_in_expression_full(exp.id, exp.sourceInfo));
  7519. }
  7520. var $newStore = this.runFunction(func, exp.actualParameters, store);
  7521. return $newStore.then(function (sto) {
  7522. if (sto.mode !== _modes.Modes.RETURN) {
  7523. return Promise.reject(new Error("The function that was called did not had a return command: " + exp.id));
  7524. }
  7525. var val = sto.applyStore('$');
  7526. if (val instanceof _storeObjectArray.StoreObjectArray) {
  7527. return Promise.resolve(Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null, null, null), val));
  7528. } else {
  7529. return Promise.resolve(Object.assign(new _storeObject.StoreObject(null, null), val));
  7530. }
  7531. });
  7532. }
  7533. }, {
  7534. key: 'evaluateArrayLiteral',
  7535. value: function evaluateArrayLiteral(store, exp) {
  7536. var errorHelperFunction = function errorHelperFunction(validationResult, exp) {
  7537. var errorCode = validationResult[0];
  7538. switch (errorCode) {
  7539. case _storeObjectArray.StoreObjectArray.WRONG_COLUMN_NUMBER:
  7540. {
  7541. var columnValue = validationResult[1];
  7542. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_array_literal_column_full(arr.columns, columnValue, exp.sourceInfo));
  7543. }
  7544. case _storeObjectArray.StoreObjectArray.WRONG_LINE_NUMBER:
  7545. {
  7546. var lineValue = validationResult[1];
  7547. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_array_literal_line_full(arr.lines, lineValue, exp.sourceInfo));
  7548. }
  7549. case _storeObjectArray.StoreObjectArray.WRONG_TYPE:
  7550. {
  7551. var line = null;
  7552. var strExp = null;
  7553. if (validationResult.length > 2) {
  7554. line = validationResult[1];
  7555. var column = validationResult[2];
  7556. strExp = exp.value[line].value[column].toString();
  7557. } else {
  7558. line = validationResult[1];
  7559. strExp = exp.value[line].toString();
  7560. }
  7561. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_array_literal_type_full(strExp, exp.sourceInfo));
  7562. }
  7563. }
  7564. };
  7565. if (!exp.isVector) {
  7566. var $matrix = this.evaluateMatrix(store, exp.value);
  7567. return $matrix.then(function (list) {
  7568. var type = new _compoundType.CompoundType(list[0].type.innerType, 2);
  7569. var arr = new _storeObjectArray.StoreObjectArray(type, list.length, list[0].lines, list);
  7570. var checkResult = arr.isValid;
  7571. if (checkResult.length == 0) return Promise.resolve(arr);else {
  7572. return errorHelperFunction(checkResult, exp);
  7573. }
  7574. });
  7575. } else {
  7576. return this.evaluateVector(store, exp.value).then(function (list) {
  7577. var type = new _compoundType.CompoundType(list[0].type, 1);
  7578. var stoArray = new _storeObjectArray.StoreObjectArray(type, list.length, null, list);
  7579. var checkResult = stoArray.isValid;
  7580. if (checkResult.length == 0) return Promise.resolve(stoArray);else {
  7581. return errorHelperFunction(checkResult, exp);
  7582. }
  7583. });
  7584. }
  7585. }
  7586. }, {
  7587. key: 'evaluateVector',
  7588. value: function evaluateVector(store, exps) {
  7589. var _this9 = this;
  7590. return Promise.all(exps.map(function (exp) {
  7591. return _this9.evaluateExpression(store, exp);
  7592. }));
  7593. }
  7594. }, {
  7595. key: 'evaluateMatrix',
  7596. value: function evaluateMatrix(store, exps) {
  7597. var _this10 = this;
  7598. return Promise.all(exps.map(function (vector) {
  7599. var $vector = _this10.evaluateVector(store, vector.value);
  7600. return $vector.then(function (list) {
  7601. var type = new _compoundType.CompoundType(list[0].type, 1);
  7602. return new _storeObjectArray.StoreObjectArray(type, list.length, null, list);
  7603. });
  7604. }));
  7605. }
  7606. }, {
  7607. key: 'evaluateLiteral',
  7608. value: function evaluateLiteral(_, exp) {
  7609. return Promise.resolve(new _storeObject.StoreObject(exp.type, exp.value));
  7610. }
  7611. }, {
  7612. key: 'evaluateVariableLiteral',
  7613. value: function evaluateVariableLiteral(store, exp) {
  7614. try {
  7615. var val = store.applyStore(exp.id);
  7616. if (val instanceof _storeObjectArray.StoreObjectArray) {
  7617. return Promise.resolve(Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null, null), val));
  7618. } else {
  7619. return Promise.resolve(Object.assign(new _storeObject.StoreObject(null, null), val));
  7620. }
  7621. } catch (error) {
  7622. return Promise.reject(error);
  7623. }
  7624. }
  7625. }, {
  7626. key: 'evaluateArrayAccess',
  7627. value: function evaluateArrayAccess(store, exp) {
  7628. var mustBeArray = store.applyStore(exp.id);
  7629. if (!(mustBeArray.type instanceof _compoundType.CompoundType)) {
  7630. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_array_access_full(exp.id, exp.sourceInfo));
  7631. }
  7632. var $line = this.evaluateExpression(store, exp.line);
  7633. var $column = this.evaluateExpression(store, exp.column);
  7634. return Promise.all([$line, $column]).then(function (values) {
  7635. var lineSO = values[0];
  7636. var columnSO = values[1];
  7637. if (!_types.Types.INTEGER.isCompatible(lineSO.type)) {
  7638. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(exp.sourceInfo));
  7639. }
  7640. var line = lineSO.number;
  7641. var column = null;
  7642. if (columnSO !== null) {
  7643. if (!_types.Types.INTEGER.isCompatible(columnSO.type)) {
  7644. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(exp.sourceInfo));
  7645. }
  7646. column = columnSO.number;
  7647. }
  7648. if (line >= mustBeArray.lines) {
  7649. if (mustBeArray.isVector) {
  7650. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.vector_line_outbounds_full(exp.id, line, mustBeArray.lines, exp.sourceInfo));
  7651. } else {
  7652. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.matrix_line_outbounds_full(exp.id, line, mustBeArray.lines, exp.sourceInfo));
  7653. }
  7654. } else if (line < 0) {
  7655. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(exp.sourceInfo);
  7656. }
  7657. if (column !== null && mustBeArray.columns === null) {
  7658. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.vector_not_matrix_full(exp.id, exp.sourceInfo));
  7659. }
  7660. if (column !== null) {
  7661. if (column >= mustBeArray.columns) {
  7662. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.matrix_column_outbounds_full(exp.id, column, mustBeArray.columns, exp.sourceInfo));
  7663. } else if (column < 0) {
  7664. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(exp.sourceInfo);
  7665. }
  7666. }
  7667. return Promise.resolve(new _storeObjectArrayAddress.StoreObjectArrayAddress(mustBeArray.id, line, column, store));
  7668. });
  7669. }
  7670. }, {
  7671. key: 'evaluateUnaryApp',
  7672. value: function evaluateUnaryApp(store, unaryApp) {
  7673. var $left = this.evaluateExpression(store, unaryApp.left);
  7674. return $left.then(function (left) {
  7675. var resultType = (0, _compatibilityTable.resultTypeAfterUnaryOp)(unaryApp.op, left.type);
  7676. if (_types.Types.UNDEFINED.isCompatible(resultType)) {
  7677. var stringInfo = left.type.stringInfo();
  7678. var info = stringInfo[0];
  7679. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_unary_op_full(unaryApp.op, info.type, info.dim, unaryApp.sourceInfo));
  7680. }
  7681. switch (unaryApp.op.ord) {
  7682. case _operators.Operators.ADD.ord:
  7683. return new _storeObject.StoreObject(resultType, left.value);
  7684. case _operators.Operators.SUB.ord:
  7685. return new _storeObject.StoreObject(resultType, left.value.negated());
  7686. case _operators.Operators.NOT.ord:
  7687. return new _storeObject.StoreObject(resultType, !left.value);
  7688. default:
  7689. return Promise.reject(new _runtimeError.RuntimeError('!!!Critical Invalid UnaryApp ' + unaryApp.op));
  7690. }
  7691. });
  7692. }
  7693. }, {
  7694. key: 'evaluateInfixApp',
  7695. value: function evaluateInfixApp(store, infixApp) {
  7696. var $left = this.evaluateExpression(store, infixApp.left);
  7697. var $right = this.evaluateExpression(store, infixApp.right);
  7698. return Promise.all([$left, $right]).then(function (values) {
  7699. var left = values[0];
  7700. var right = values[1];
  7701. var resultType = (0, _compatibilityTable.resultTypeAfterInfixOp)(infixApp.op, left.type, right.type);
  7702. if (_types.Types.UNDEFINED.isCompatible(resultType)) {
  7703. var stringInfoLeft = left.type.stringInfo();
  7704. var infoLeft = stringInfoLeft[0];
  7705. var stringInfoRight = right.type.stringInfo();
  7706. var infoRight = stringInfoRight[0];
  7707. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_infix_op_full(infixApp.op, infoLeft.type, infoLeft.dim, infoRight.type, infoRight.dim, infixApp.sourceInfo));
  7708. }
  7709. var result = null;
  7710. switch (infixApp.op.ord) {
  7711. case _operators.Operators.ADD.ord:
  7712. {
  7713. if (_types.Types.STRING.isCompatible(left.type)) {
  7714. var rightStr = (0, _parsers.convertToString)(right.value, right.type);
  7715. return new _storeObject.StoreObject(resultType, left.value + rightStr);
  7716. } else if (_types.Types.STRING.isCompatible(right.type)) {
  7717. var leftStr = (0, _parsers.convertToString)(left.value, left.type);
  7718. return new _storeObject.StoreObject(resultType, leftStr + right.value);
  7719. } else {
  7720. return new _storeObject.StoreObject(resultType, left.value.plus(right.value));
  7721. }
  7722. }
  7723. case _operators.Operators.SUB.ord:
  7724. return new _storeObject.StoreObject(resultType, left.value.minus(right.value));
  7725. case _operators.Operators.MULT.ord:
  7726. {
  7727. result = left.value.times(right.value);
  7728. if (result.dp() > _config.Config.decimalPlaces) {
  7729. result = new _decimal2.default(result.toFixed(_config.Config.decimalPlaces));
  7730. }
  7731. return new _storeObject.StoreObject(resultType, result);
  7732. }
  7733. case _operators.Operators.DIV.ord:
  7734. {
  7735. if (_types.Types.INTEGER.isCompatible(resultType)) result = left.value.divToInt(right.value);else result = left.value.div(right.value);
  7736. if (result.dp() > _config.Config.decimalPlaces) {
  7737. result = new _decimal2.default(result.toFixed(_config.Config.decimalPlaces));
  7738. }
  7739. return new _storeObject.StoreObject(resultType, result);
  7740. }
  7741. case _operators.Operators.MOD.ord:
  7742. {
  7743. result = left.value.modulo(right.value);
  7744. if (result.dp() > _config.Config.decimalPlaces) {
  7745. result = new _decimal2.default(result.toFixed(_config.Config.decimalPlaces));
  7746. }
  7747. return new _storeObject.StoreObject(resultType, result);
  7748. }
  7749. case _operators.Operators.GT.ord:
  7750. {
  7751. if (_types.Types.STRING.isCompatible(left.type)) {
  7752. result = left.value.length > right.value.length;
  7753. } else {
  7754. result = left.value.gt(right.value);
  7755. }
  7756. return new _storeObject.StoreObject(resultType, result);
  7757. }
  7758. case _operators.Operators.GE.ord:
  7759. {
  7760. if (_types.Types.STRING.isCompatible(left.type)) {
  7761. result = left.value.length >= right.value.length;
  7762. } else {
  7763. result = left.value.gte(right.value);
  7764. }
  7765. return new _storeObject.StoreObject(resultType, result);
  7766. }
  7767. case _operators.Operators.LT.ord:
  7768. {
  7769. if (_types.Types.STRING.isCompatible(left.type)) {
  7770. result = left.value.length < right.value.length;
  7771. } else {
  7772. result = left.value.lt(right.value);
  7773. }
  7774. return new _storeObject.StoreObject(resultType, result);
  7775. }
  7776. case _operators.Operators.LE.ord:
  7777. {
  7778. if (_types.Types.STRING.isCompatible(left.type)) {
  7779. result = left.value.length <= right.value.length;
  7780. } else {
  7781. result = left.value.lte(right.value);
  7782. }
  7783. return new _storeObject.StoreObject(resultType, result);
  7784. }
  7785. case _operators.Operators.EQ.ord:
  7786. {
  7787. if (_types.Types.INTEGER.isCompatible(left.type) || _types.Types.REAL.isCompatible(left.type)) {
  7788. result = left.value.eq(right.value);
  7789. } else {
  7790. result = left.value === right.value;
  7791. }
  7792. return new _storeObject.StoreObject(resultType, result);
  7793. }
  7794. case _operators.Operators.NEQ.ord:
  7795. {
  7796. if (_types.Types.INTEGER.isCompatible(left.type) || _types.Types.REAL.isCompatible(left.type)) {
  7797. result = !left.value.eq(right.value);
  7798. } else {
  7799. result = left.value !== right.value;
  7800. }
  7801. return new _storeObject.StoreObject(resultType, result);
  7802. }
  7803. case _operators.Operators.AND.ord:
  7804. return new _storeObject.StoreObject(resultType, left.value && right.value);
  7805. case _operators.Operators.OR.ord:
  7806. return new _storeObject.StoreObject(resultType, left.value || right.value);
  7807. default:
  7808. return Promise.reject(new _runtimeError.RuntimeError('!!!Critical Invalid InfixApp ' + infixApp.op));
  7809. }
  7810. });
  7811. }
  7812. }, {
  7813. key: 'parseStoreObjectValue',
  7814. value: function parseStoreObjectValue(vl) {
  7815. var realValue = vl;
  7816. if (vl instanceof _storeObjectArrayAddress.StoreObjectArrayAddress) {
  7817. if (vl.type instanceof _compoundType.CompoundType) {
  7818. switch (vl.type.dimensions) {
  7819. case 1:
  7820. {
  7821. realValue = new _storeObjectArray.StoreObjectArray(vl.type, vl.value);
  7822. break;
  7823. }
  7824. default:
  7825. {
  7826. throw new _runtimeError.RuntimeError("Three dimensional array address...");
  7827. }
  7828. }
  7829. } else {
  7830. realValue = new _storeObject.StoreObject(vl.type, vl.value);
  7831. }
  7832. }
  7833. return realValue;
  7834. }
  7835. }]);
  7836. return IVProgProcessor;
  7837. }();
  7838. /***/ }),
  7839. /***/ "./js/processor/lib/arrays.js":
  7840. /*!************************************!*\
  7841. !*** ./js/processor/lib/arrays.js ***!
  7842. \************************************/
  7843. /*! no static exports found */
  7844. /***/ (function(module, exports, __webpack_require__) {
  7845. "use strict";
  7846. Object.defineProperty(exports, "__esModule", {
  7847. value: true
  7848. });
  7849. exports.createNumElementsFun = createNumElementsFun;
  7850. exports.createMatrixLinesFun = createMatrixLinesFun;
  7851. exports.createMatrixColumnsFun = createMatrixColumnsFun;
  7852. var _storeObject = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js");
  7853. var _commands = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  7854. var Commands = _interopRequireWildcard(_commands);
  7855. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  7856. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  7857. var _compoundType = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  7858. var _modes = __webpack_require__(/*! ../modes */ "./js/processor/modes.js");
  7859. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  7860. /**
  7861. * num_elements
  7862. * matrix_lines
  7863. * matrix_columns
  7864. */
  7865. function createNumElementsFun() {
  7866. var numElementsFun = function numElementsFun(sto, _) {
  7867. var vector = sto.applyStore("vector");
  7868. var temp = new _storeObject.StoreObject(_types.Types.INTEGER, (0, _parsers.toInt)(vector.lines));
  7869. sto.mode = _modes.Modes.RETURN;
  7870. return Promise.resolve(sto.updateStore("$", temp));
  7871. };
  7872. var block = new Commands.CommandBlock([], [new Commands.SysCall(numElementsFun)]);
  7873. var func = new Commands.Function('$numElements', _types.Types.INTEGER, [new Commands.FormalParameter(new _compoundType.CompoundType(_types.Types.ALL, 1), 'vector', false)], block);
  7874. return func;
  7875. }
  7876. function createMatrixLinesFun() {
  7877. var matrixLinesFun = function matrixLinesFun(sto, _) {
  7878. var matrix = sto.applyStore("matrix");
  7879. var temp = new _storeObject.StoreObject(_types.Types.INTEGER, (0, _parsers.toInt)(matrix.lines));
  7880. sto.mode = _modes.Modes.RETURN;
  7881. return Promise.resolve(sto.updateStore("$", temp));
  7882. };
  7883. var block = new Commands.CommandBlock([], [new Commands.SysCall(matrixLinesFun)]);
  7884. var func = new Commands.Function('$matrixLines', _types.Types.INTEGER, [new Commands.FormalParameter(new _compoundType.CompoundType(_types.Types.ALL, 2), 'matrix', false)], block);
  7885. return func;
  7886. }
  7887. function createMatrixColumnsFun() {
  7888. var matrixColumnsFun = function matrixColumnsFun(sto, _) {
  7889. var matrix = sto.applyStore("matrix");
  7890. var temp = new _storeObject.StoreObject(_types.Types.INTEGER, (0, _parsers.toInt)(matrix.columns));
  7891. sto.mode = _modes.Modes.RETURN;
  7892. return Promise.resolve(sto.updateStore("$", temp));
  7893. };
  7894. var block = new Commands.CommandBlock([], [new Commands.SysCall(matrixColumnsFun)]);
  7895. var func = new Commands.Function('$matrixColumns', _types.Types.INTEGER, [new Commands.FormalParameter(new _compoundType.CompoundType(_types.Types.ALL, 2), 'matrix', false)], block);
  7896. return func;
  7897. }
  7898. /***/ }),
  7899. /***/ "./js/processor/lib/io.js":
  7900. /*!********************************!*\
  7901. !*** ./js/processor/lib/io.js ***!
  7902. \********************************/
  7903. /*! no static exports found */
  7904. /***/ (function(module, exports, __webpack_require__) {
  7905. "use strict";
  7906. Object.defineProperty(exports, "__esModule", {
  7907. value: true
  7908. });
  7909. exports.createOutputFun = createOutputFun;
  7910. exports.createInputFun = createInputFun;
  7911. var _storeObject = __webpack_require__(/*! ./../store/storeObject */ "./js/processor/store/storeObject.js");
  7912. var _commands = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  7913. var Commands = _interopRequireWildcard(_commands);
  7914. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  7915. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  7916. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  7917. function createOutputFun() {
  7918. var writeFunction = function writeFunction(store, _) {
  7919. var val = store.applyStore('p1');
  7920. if (val.type.isCompatible(_types.Types.INTEGER)) {
  7921. this.output.sendOutput(val.value.toString());
  7922. } else if (val.type.isCompatible(_types.Types.REAL)) {
  7923. if (val.value.dp() <= 0) {
  7924. this.output.sendOutput(val.value.toFixed(1));
  7925. } else {
  7926. this.output.sendOutput(val.value.toString());
  7927. }
  7928. } else {
  7929. this.output.sendOutput(val.value);
  7930. }
  7931. return Promise.resolve(store);
  7932. };
  7933. var block = new Commands.CommandBlock([], [new Commands.SysCall(writeFunction)]);
  7934. var func = new Commands.Function('$write', _types.Types.VOID, [new Commands.FormalParameter(_types.Types.ALL, 'p1', false)], block);
  7935. return func;
  7936. }
  7937. function createInputFun() {
  7938. var readFunction = function readFunction(store, _) {
  7939. var _this = this;
  7940. var request = new Promise(function (resolve, _) {
  7941. _this.input.requestInput(resolve);
  7942. });
  7943. return request.then(function (text) {
  7944. var typeToConvert = store.applyStore('p1').type;
  7945. var stoObj = null;
  7946. if (typeToConvert.isCompatible(_types.Types.INTEGER)) {
  7947. var val = (0, _parsers.toInt)(text);
  7948. stoObj = new _storeObject.StoreObject(_types.Types.INTEGER, val);
  7949. } else if (typeToConvert.isCompatible(_types.Types.REAL)) {
  7950. stoObj = new _storeObject.StoreObject(_types.Types.REAL, (0, _parsers.toReal)(text));
  7951. } else if (typeToConvert.isCompatible(_types.Types.BOOLEAN)) {
  7952. stoObj = new _storeObject.StoreObject(_types.Types.BOOLEAN, (0, _parsers.toBool)(text));
  7953. } else if (typeToConvert.isCompatible(_types.Types.STRING)) {
  7954. stoObj = new _storeObject.StoreObject(_types.Types.STRING, (0, _parsers.toString)(text));
  7955. }
  7956. _this.loopTimers.splice(0, _this.loopTimers.length);
  7957. store.updateStore('p1', stoObj);
  7958. return Promise.resolve(store);
  7959. });
  7960. };
  7961. var block = new Commands.CommandBlock([], [new Commands.SysCall(readFunction)]);
  7962. var func = new Commands.Function('$read', _types.Types.VOID, [new Commands.FormalParameter(_types.Types.ALL, 'p1', true)], block);
  7963. return func;
  7964. }
  7965. /***/ }),
  7966. /***/ "./js/processor/lib/lang.js":
  7967. /*!**********************************!*\
  7968. !*** ./js/processor/lib/lang.js ***!
  7969. \**********************************/
  7970. /*! no static exports found */
  7971. /***/ (function(module, exports, __webpack_require__) {
  7972. "use strict";
  7973. Object.defineProperty(exports, "__esModule", {
  7974. value: true
  7975. });
  7976. exports.createIsRealFun = createIsRealFun;
  7977. exports.createIsIntFun = createIsIntFun;
  7978. exports.createIsBoolFun = createIsBoolFun;
  7979. exports.createCastRealFun = createCastRealFun;
  7980. exports.createCastIntFun = createCastIntFun;
  7981. exports.createCastBoolFun = createCastBoolFun;
  7982. exports.createCastStringFun = createCastStringFun;
  7983. var _storeObject = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js");
  7984. var _commands = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  7985. var Commands = _interopRequireWildcard(_commands);
  7986. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  7987. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  7988. var _ivprogParser = __webpack_require__(/*! ../../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  7989. var _expressions = __webpack_require__(/*! ../../ast/expressions */ "./js/ast/expressions/index.js");
  7990. var _modes = __webpack_require__(/*! ../modes */ "./js/processor/modes.js");
  7991. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  7992. /**
  7993. *
  7994. * is_real
  7995. * is_int
  7996. * is_bool
  7997. * cast_real
  7998. * cast_int
  7999. * cast_bool
  8000. * cast_string
  8001. */
  8002. function createIsRealFun() {
  8003. var isRealFun = function isRealFun(sto, _) {
  8004. var str = sto.applyStore("str");
  8005. var parser = _ivprogParser.IVProgParser.createParser(str.value);
  8006. var result = false;
  8007. try {
  8008. var val = parser.parseTerm();
  8009. if (val instanceof _expressions.RealLiteral) {
  8010. result = true;
  8011. }
  8012. } catch (error) {}
  8013. var temp = new _storeObject.StoreObject(_types.Types.BOOLEAN, result);
  8014. sto.mode = _modes.Modes.RETURN;
  8015. return Promise.resolve(sto.updateStore("$", temp));
  8016. };
  8017. var block = new Commands.CommandBlock([], [new Commands.SysCall(isRealFun)]);
  8018. var func = new Commands.Function('$isReal', _types.Types.BOOLEAN, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  8019. return func;
  8020. }
  8021. function createIsIntFun() {
  8022. var isIntFun = function isIntFun(sto, _) {
  8023. var str = sto.applyStore("str");
  8024. var parser = _ivprogParser.IVProgParser.createParser(str.value);
  8025. var result = false;
  8026. try {
  8027. var val = parser.parseTerm();
  8028. if (val instanceof _expressions.IntLiteral) {
  8029. result = true;
  8030. }
  8031. } catch (error) {}
  8032. var temp = new _storeObject.StoreObject(_types.Types.BOOLEAN, result);
  8033. sto.mode = _modes.Modes.RETURN;
  8034. return Promise.resolve(sto.updateStore("$", temp));
  8035. };
  8036. var block = new Commands.CommandBlock([], [new Commands.SysCall(isIntFun)]);
  8037. var func = new Commands.Function('$isInt', _types.Types.BOOLEAN, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  8038. return func;
  8039. }
  8040. function createIsBoolFun() {
  8041. var isBoolFun = function isBoolFun(sto, _) {
  8042. var str = sto.applyStore("str");
  8043. var parser = _ivprogParser.IVProgParser.createParser(str.value);
  8044. var result = false;
  8045. try {
  8046. var val = parser.parseTerm();
  8047. if (val instanceof _expressions.BoolLiteral) {
  8048. result = true;
  8049. }
  8050. } catch (error) {}
  8051. var temp = new _storeObject.StoreObject(_types.Types.BOOLEAN, result);
  8052. sto.mode = _modes.Modes.RETURN;
  8053. return Promise.resolve(sto.updateStore("$", temp));
  8054. };
  8055. var block = new Commands.CommandBlock([], [new Commands.SysCall(isBoolFun)]);
  8056. var func = new Commands.Function('$isBool', _types.Types.BOOLEAN, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  8057. return func;
  8058. }
  8059. function createCastRealFun() {
  8060. var castRealFun = function castRealFun(sto, _) {
  8061. var val = sto.applyStore("val");
  8062. switch (val.type.ord) {
  8063. case _types.Types.INTEGER.ord:
  8064. {
  8065. var temp = new _storeObject.StoreObject(_types.Types.REAL, (0, _parsers.toReal)(val.number));
  8066. sto.mode = _modes.Modes.RETURN;
  8067. return Promise.resolve(sto.updateStore("$", temp));
  8068. }
  8069. case _types.Types.STRING.ord:
  8070. {
  8071. var parser = _ivprogParser.IVProgParser.createParser(val.value);
  8072. try {
  8073. var result = parser.parseTerm();
  8074. if (result instanceof _expressions.RealLiteral) {
  8075. var _temp = new _storeObject.StoreObject(_types.Types.REAL, result.value);
  8076. sto.mode = _modes.Modes.RETURN;
  8077. return Promise.resolve(sto.updateStore("$", _temp));
  8078. }
  8079. } catch (error) {
  8080. return Promise.reject("cannot convert string to real");
  8081. }
  8082. }
  8083. }
  8084. };
  8085. var block = new Commands.CommandBlock([], [new Commands.SysCall(castRealFun)]);
  8086. var func = new Commands.Function('$castReal', _types.Types.REAL, [new Commands.FormalParameter(_types.Types.ALL, 'val', false)], block);
  8087. return func;
  8088. }
  8089. function createCastIntFun() {
  8090. var castIntFun = function castIntFun(sto, _) {
  8091. var val = sto.applyStore("val");
  8092. switch (val.type.ord) {
  8093. case _types.Types.REAL.ord:
  8094. {
  8095. var temp = new _storeObject.StoreObject(_types.Types.INTEGER, Math.floor(val.number));
  8096. sto.mode = _modes.Modes.RETURN;
  8097. return Promise.resolve(sto.updateStore("$", temp));
  8098. }
  8099. case _types.Types.STRING.ord:
  8100. {
  8101. var parser = _ivprogParser.IVProgParser.createParser(val.value);
  8102. try {
  8103. var result = parser.parseTerm();
  8104. if (result instanceof _expressions.IntLiteral) {
  8105. var _temp2 = new _storeObject.StoreObject(_types.Types.INTEGER, result.value);
  8106. sto.mode = _modes.Modes.RETURN;
  8107. return Promise.resolve(sto.updateStore("$", _temp2));
  8108. }
  8109. } catch (error) {
  8110. return Promise.reject("cannot convert string to real");
  8111. }
  8112. }
  8113. }
  8114. };
  8115. var block = new Commands.CommandBlock([], [new Commands.SysCall(castIntFun)]);
  8116. var func = new Commands.Function('$castInt', _types.Types.INTEGER, [new Commands.FormalParameter(_types.Types.ALL, 'val', false)], block);
  8117. return func;
  8118. }
  8119. function createCastBoolFun() {
  8120. var castBoolFun = function castBoolFun(sto, _) {
  8121. var str = sto.applyStore("str");
  8122. var parser = _ivprogParser.IVProgParser.createParser(str.value);
  8123. try {
  8124. var val = parser.parseTerm();
  8125. if (val instanceof _expressions.BoolLiteral) {
  8126. var temp = new _storeObject.StoreObject(_types.Types.BOOLEAN, val.value);
  8127. sto.mode = _modes.Modes.RETURN;
  8128. return Promise.resolve(sto.updateStore("$", temp));
  8129. }
  8130. } catch (error) {}
  8131. return Promise.reject("cannot convert " + str.value + " to boolean");
  8132. };
  8133. var block = new Commands.CommandBlock([], [new Commands.SysCall(castBoolFun)]);
  8134. var func = new Commands.Function('$castBool', _types.Types.BOOLEAN, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  8135. return func;
  8136. }
  8137. function createCastStringFun() {
  8138. var castStringFun = function castStringFun(store, _) {
  8139. var val = store.applyStore('str');
  8140. var result = (0, _parsers.convertToString)(val);
  8141. var temp = new _storeObject.StoreObject(_types.Types.STRING, result);
  8142. sto.mode = _modes.Modes.RETURN;
  8143. return Promise.resolve(sto.updateStore("$", temp));
  8144. };
  8145. var block = new Commands.CommandBlock([], [new Commands.SysCall(castStringFun)]);
  8146. var func = new Commands.Function('$castString', _types.Types.STRING, [new Commands.FormalParameter(_types.Types.ALL, 'str', false)], block);
  8147. return func;
  8148. }
  8149. /***/ }),
  8150. /***/ "./js/processor/lib/math.js":
  8151. /*!**********************************!*\
  8152. !*** ./js/processor/lib/math.js ***!
  8153. \**********************************/
  8154. /*! no static exports found */
  8155. /***/ (function(module, exports, __webpack_require__) {
  8156. "use strict";
  8157. Object.defineProperty(exports, "__esModule", {
  8158. value: true
  8159. });
  8160. exports.createSinFun = createSinFun;
  8161. exports.createCosFun = createCosFun;
  8162. exports.createTanFun = createTanFun;
  8163. exports.createSqrtFun = createSqrtFun;
  8164. exports.createPowFun = createPowFun;
  8165. exports.createLogFun = createLogFun;
  8166. exports.createAbsFun = createAbsFun;
  8167. exports.createNegateFun = createNegateFun;
  8168. exports.createInvertFun = createInvertFun;
  8169. exports.createMaxFun = createMaxFun;
  8170. exports.createMinFun = createMinFun;
  8171. var _storeObject = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js");
  8172. var _commands = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  8173. var Commands = _interopRequireWildcard(_commands);
  8174. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  8175. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  8176. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  8177. var _multiType = __webpack_require__(/*! ../../typeSystem/multiType */ "./js/typeSystem/multiType.js");
  8178. var _compoundType = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  8179. var _modes = __webpack_require__(/*! ../modes */ "./js/processor/modes.js");
  8180. var _config = __webpack_require__(/*! ../../util/config */ "./js/util/config.js");
  8181. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  8182. function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
  8183. /**
  8184. * sin
  8185. * cos
  8186. * tan
  8187. * sqrt
  8188. * pow
  8189. * log
  8190. * abs
  8191. * negate
  8192. * invert
  8193. * max
  8194. * min
  8195. */
  8196. function convertToRadians(degrees) {
  8197. return degrees.times(_decimal.Decimal.acos(-1)).div(180);
  8198. }
  8199. function createSinFun() {
  8200. var sinFun = function sinFun(sto, _) {
  8201. var x = sto.applyStore('x');
  8202. var angle = x.value.mod(360);
  8203. var result = null;
  8204. if (angle.eq(90)) {
  8205. result = new _decimal.Decimal(1);
  8206. } else if (angle.eq(180)) {
  8207. result = new _decimal.Decimal(0);
  8208. } else if (angle.eq(270)) {
  8209. result = new _decimal.Decimal(-1);
  8210. } else {
  8211. result = _decimal.Decimal.sin(convertToRadians(angle));
  8212. }
  8213. if (result.dp() > _config.Config.decimalPlaces) {
  8214. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  8215. }
  8216. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  8217. sto.mode = _modes.Modes.RETURN;
  8218. return Promise.resolve(sto.updateStore('$', temp));
  8219. };
  8220. var block = new Commands.CommandBlock([], [new Commands.SysCall(sinFun)]);
  8221. var func = new Commands.Function('$sin', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  8222. return func;
  8223. }
  8224. function createCosFun() {
  8225. var cosFun = function cosFun(sto, _) {
  8226. var x = sto.applyStore('x');
  8227. var angle = x.value.mod(360);
  8228. var result = null;
  8229. if (angle.eq(90)) {
  8230. result = new _decimal.Decimal(0);
  8231. } else if (angle.eq(180)) {
  8232. result = new _decimal.Decimal(-1);
  8233. } else if (angle.eq(270)) {
  8234. result = new _decimal.Decimal(0);
  8235. }
  8236. result = _decimal.Decimal.cos(convertToRadians(angle));
  8237. if (result.dp() > _config.Config.decimalPlaces) {
  8238. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  8239. }
  8240. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  8241. sto.mode = _modes.Modes.RETURN;
  8242. return Promise.resolve(sto.updateStore('$', temp));
  8243. };
  8244. var block = new Commands.CommandBlock([], [new Commands.SysCall(cosFun)]);
  8245. var func = new Commands.Function('$cos', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  8246. return func;
  8247. }
  8248. function createTanFun() {
  8249. var tanFun = function tanFun(sto, _) {
  8250. var x = sto.applyStore('x');
  8251. var angle = x.value.mod(360);
  8252. if (angle.eq(90) || angle.eq(270)) {
  8253. return Promise.reject("Tangent of " + x.value.toNumber() + "° is undefined.");
  8254. }
  8255. var result = _decimal.Decimal.tan(convertToRadians(angle));
  8256. if (result.dp() > _config.Config.decimalPlaces) {
  8257. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  8258. }
  8259. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  8260. sto.mode = _modes.Modes.RETURN;
  8261. return Promise.resolve(sto.updateStore('$', temp));
  8262. };
  8263. var block = new Commands.CommandBlock([], [new Commands.SysCall(tanFun)]);
  8264. var func = new Commands.Function('$tan', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  8265. return func;
  8266. }
  8267. function createSqrtFun() {
  8268. var sqrtFun = function sqrtFun(sto, _) {
  8269. var x = sto.applyStore('x');
  8270. var result = x.value.sqrt();
  8271. if (result.dp() > _config.Config.decimalPlaces) {
  8272. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  8273. }
  8274. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  8275. sto.mode = _modes.Modes.RETURN;
  8276. return Promise.resolve(sto.updateStore('$', temp));
  8277. };
  8278. var block = new Commands.CommandBlock([], [new Commands.SysCall(sqrtFun)]);
  8279. var func = new Commands.Function('$sqrt', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  8280. return func;
  8281. }
  8282. function createPowFun() {
  8283. var powFun = function powFun(sto, _) {
  8284. var x = sto.applyStore('x');
  8285. var y = sto.applyStore('y');
  8286. var result = x.value.pow(y.value);
  8287. if (result.dp() > _config.Config.decimalPlaces) {
  8288. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  8289. }
  8290. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  8291. sto.mode = _modes.Modes.RETURN;
  8292. return Promise.resolve(sto.updateStore('$', temp));
  8293. };
  8294. var block = new Commands.CommandBlock([], [new Commands.SysCall(powFun)]);
  8295. var func = new Commands.Function('$pow', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false), new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'y', false)], block);
  8296. return func;
  8297. }
  8298. function createLogFun() {
  8299. var logFun = function logFun(sto, _) {
  8300. var x = sto.applyStore('x');
  8301. if (x.value.isNegative()) {
  8302. return Promise.reject("the value passed to log function cannot be negative");
  8303. }
  8304. var result = _decimal.Decimal.log10(x.value);
  8305. if (result.dp() > _config.Config.decimalPlaces) {
  8306. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  8307. }
  8308. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  8309. sto.mode = _modes.Modes.RETURN;
  8310. return Promise.resolve(sto.updateStore('$', temp));
  8311. };
  8312. var block = new Commands.CommandBlock([], [new Commands.SysCall(logFun)]);
  8313. var func = new Commands.Function('$log', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  8314. return func;
  8315. }
  8316. function createAbsFun() {
  8317. var absFun = function absFun(sto, _) {
  8318. var x = sto.applyStore('x');
  8319. var result = x.value.abs();
  8320. var temp = new _storeObject.StoreObject(x.type, result);
  8321. sto.mode = _modes.Modes.RETURN;
  8322. return Promise.resolve(sto.updateStore('$', temp));
  8323. };
  8324. var block = new Commands.CommandBlock([], [new Commands.SysCall(absFun)]);
  8325. var func = new Commands.Function('$abs', new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  8326. return func;
  8327. }
  8328. function createNegateFun() {
  8329. var negateFun = function negateFun(sto, _) {
  8330. var x = sto.applyStore('x');
  8331. var result = x.value.negated();
  8332. var temp = new _storeObject.StoreObject(x.type, result);
  8333. sto.mode = _modes.Modes.RETURN;
  8334. return Promise.resolve(sto.updateStore('$', temp));
  8335. };
  8336. var block = new Commands.CommandBlock([], [new Commands.SysCall(negateFun)]);
  8337. var func = new Commands.Function('$negate', new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  8338. return func;
  8339. }
  8340. function createInvertFun() {
  8341. var invertFun = function invertFun(sto, _) {
  8342. var x = sto.applyStore('x');
  8343. var result = (0, _parsers.toReal)(1).dividedBy(x.value);
  8344. if (result.dp() > _config.Config.decimalPlaces) {
  8345. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  8346. }
  8347. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  8348. sto.mode = _modes.Modes.RETURN;
  8349. return Promise.resolve(sto.updateStore('$', temp));
  8350. };
  8351. var block = new Commands.CommandBlock([], [new Commands.SysCall(invertFun)]);
  8352. var func = new Commands.Function('$invert', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  8353. return func;
  8354. }
  8355. function createMaxFun() {
  8356. var maxFun = function maxFun(sto, _) {
  8357. var x = sto.applyStore('x');
  8358. var numbers = x.value.map(function (stoObj) {
  8359. return stoObj.value;
  8360. });
  8361. var result = _decimal.Decimal.max.apply(_decimal.Decimal, _toConsumableArray(numbers));
  8362. var temp = new _storeObject.StoreObject(x.type.innerType, result);
  8363. sto.mode = _modes.Modes.RETURN;
  8364. return Promise.resolve(sto.updateStore('$', temp));
  8365. };
  8366. var paramType = new _compoundType.CompoundType(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 1);
  8367. var block = new Commands.CommandBlock([], [new Commands.SysCall(maxFun)]);
  8368. var func = new Commands.Function('$max', new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), [new Commands.FormalParameter(paramType, 'x', false)], block);
  8369. return func;
  8370. }
  8371. function createMinFun() {
  8372. var minFun = function minFun(sto, _) {
  8373. var x = sto.applyStore('x');
  8374. var numbers = x.value.map(function (stoObj) {
  8375. return stoObj.value;
  8376. });
  8377. var result = _decimal.Decimal.min.apply(_decimal.Decimal, _toConsumableArray(numbers));
  8378. var temp = new _storeObject.StoreObject(x.type.innerType, result);
  8379. sto.mode = _modes.Modes.RETURN;
  8380. return Promise.resolve(sto.updateStore('$', temp));
  8381. };
  8382. var paramType = new _compoundType.CompoundType(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 1);
  8383. var block = new Commands.CommandBlock([], [new Commands.SysCall(minFun)]);
  8384. var func = new Commands.Function('$min', new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), [new Commands.FormalParameter(paramType, 'x', false)], block);
  8385. return func;
  8386. }
  8387. /***/ }),
  8388. /***/ "./js/processor/lib/strings.js":
  8389. /*!*************************************!*\
  8390. !*** ./js/processor/lib/strings.js ***!
  8391. \*************************************/
  8392. /*! no static exports found */
  8393. /***/ (function(module, exports, __webpack_require__) {
  8394. "use strict";
  8395. Object.defineProperty(exports, "__esModule", {
  8396. value: true
  8397. });
  8398. exports.createSubstringFun = createSubstringFun;
  8399. exports.createLengthFun = createLengthFun;
  8400. exports.createUppercaseFun = createUppercaseFun;
  8401. exports.createLowercaseFun = createLowercaseFun;
  8402. exports.createrCharAtFun = createrCharAtFun;
  8403. var _storeObject = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js");
  8404. var _commands = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  8405. var Commands = _interopRequireWildcard(_commands);
  8406. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  8407. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  8408. var _modes = __webpack_require__(/*! ../modes */ "./js/processor/modes.js");
  8409. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  8410. /*
  8411. * substring
  8412. * length
  8413. * uppercase
  8414. * lowercase
  8415. * charAt
  8416. **/
  8417. function createSubstringFun() {
  8418. var substringFun = function substringFun(sto, _) {
  8419. var str = sto.applyStore("str");
  8420. var start = sto.applyStore("start");
  8421. var end = sto.applyStore("end");
  8422. var result = str.value.substring(start.value, end.value);
  8423. var temp = new _storeObject.StoreObject(_types.Types.STRING, result);
  8424. sto.mode = _modes.Modes.RETURN;
  8425. return Promise.resolve(sto.updateStore("$", temp));
  8426. };
  8427. var block = new Commands.CommandBlock([], [new Commands.SysCall(substringFun)]);
  8428. var func = new Commands.Function('$substring', _types.Types.STRING, [new Commands.FormalParameter(_types.Types.STRING, 'str', false), new Commands.FormalParameter(_types.Types.INTEGER, 'start', false), new Commands.FormalParameter(_types.Types.INTEGER, 'end', false)], block);
  8429. return func;
  8430. }
  8431. function createLengthFun() {
  8432. var lengthFun = function lengthFun(sto, _) {
  8433. var str = sto.applyStore("str");
  8434. var temp = new _storeObject.StoreObject(_types.Types.INTEGER, (0, _parsers.toInt)(str.value.length));
  8435. sto.mode = _modes.Modes.RETURN;
  8436. return Promise.resolve(sto.updateStore("$", temp));
  8437. };
  8438. var block = new Commands.CommandBlock([], [new Commands.SysCall(lengthFun)]);
  8439. var func = new Commands.Function('$length', _types.Types.INTEGER, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  8440. return func;
  8441. }
  8442. function createUppercaseFun() {
  8443. var uppercaseFun = function uppercaseFun(sto, _) {
  8444. var str = sto.applyStore("str");
  8445. var temp = new _storeObject.StoreObject(_types.Types.STRING, str.value.toUpperCase());
  8446. sto.mode = _modes.Modes.RETURN;
  8447. return Promise.resolve(sto.updateStore("$", temp));
  8448. };
  8449. var block = new Commands.CommandBlock([], [new Commands.SysCall(uppercaseFun)]);
  8450. var func = new Commands.Function('$uppercase', _types.Types.STRING, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  8451. return func;
  8452. }
  8453. function createLowercaseFun() {
  8454. var lowercaseFun = function lowercaseFun(sto, _) {
  8455. var str = sto.applyStore("str");
  8456. var temp = new _storeObject.StoreObject(_types.Types.STRING, str.value.toLowerCase());
  8457. sto.mode = _modes.Modes.RETURN;
  8458. return Promise.resolve(sto.updateStore("$", temp));
  8459. };
  8460. var block = new Commands.CommandBlock([], [new Commands.SysCall(lowercaseFun)]);
  8461. var func = new Commands.Function('$lowercase', _types.Types.STRING, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  8462. return func;
  8463. }
  8464. function createrCharAtFun() {
  8465. var charAtFun = function charAtFun(sto, _) {
  8466. var str = sto.applyStore("str");
  8467. var idx = sto.applyStore("index");
  8468. if (idx.value.toNumber() < 0 || idx.value.toNumber() >= str.value.length) {
  8469. return Promise.reject(new Error("invalid string position"));
  8470. }
  8471. var temp = new _storeObject.StoreObject(_types.Types.STRING, str.value.charAt(idx.value.toNumber()));
  8472. sto.mode = _modes.Modes.RETURN;
  8473. return Promise.resolve(sto.updateStore("$", temp));
  8474. };
  8475. var block = new Commands.CommandBlock([], [new Commands.SysCall(charAtFun)]);
  8476. var func = new Commands.Function('$charAt', _types.Types.STRING, [new Commands.FormalParameter(_types.Types.STRING, 'str', false), new Commands.FormalParameter(_types.Types.INTEGER, 'index', false)], block);
  8477. return func;
  8478. }
  8479. /***/ }),
  8480. /***/ "./js/processor/modes.js":
  8481. /*!*******************************!*\
  8482. !*** ./js/processor/modes.js ***!
  8483. \*******************************/
  8484. /*! no static exports found */
  8485. /***/ (function(module, exports, __webpack_require__) {
  8486. "use strict";
  8487. Object.defineProperty(exports, "__esModule", {
  8488. value: true
  8489. });
  8490. var Modes = exports.Modes = Object.freeze({
  8491. RETURN: Symbol('mode:return'),
  8492. BREAK: Symbol('mode:break'),
  8493. PAUSE: Symbol('mode:pause'),
  8494. RUN: Symbol('mode:run')
  8495. });
  8496. /***/ }),
  8497. /***/ "./js/processor/semantic/semanticAnalyser.js":
  8498. /*!***************************************************!*\
  8499. !*** ./js/processor/semantic/semanticAnalyser.js ***!
  8500. \***************************************************/
  8501. /*! no static exports found */
  8502. /***/ (function(module, exports, __webpack_require__) {
  8503. "use strict";
  8504. Object.defineProperty(exports, "__esModule", {
  8505. value: true
  8506. });
  8507. exports.SemanticAnalyser = undefined;
  8508. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8509. var _processorErrorFactory = __webpack_require__(/*! ./../error/processorErrorFactory */ "./js/processor/error/processorErrorFactory.js");
  8510. var _definedFunctions = __webpack_require__(/*! ./../definedFunctions */ "./js/processor/definedFunctions.js");
  8511. var _languageService = __webpack_require__(/*! ./../../services/languageService */ "./js/services/languageService.js");
  8512. var _commands = __webpack_require__(/*! ../../ast/commands */ "./js/ast/commands/index.js");
  8513. var _expressions = __webpack_require__(/*! ../../ast/expressions */ "./js/ast/expressions/index.js");
  8514. var _literal = __webpack_require__(/*! ../../ast/expressions/literal */ "./js/ast/expressions/literal.js");
  8515. var _compatibilityTable = __webpack_require__(/*! ../compatibilityTable */ "./js/processor/compatibilityTable.js");
  8516. var _types = __webpack_require__(/*! ../../typeSystem/types */ "./js/typeSystem/types.js");
  8517. var _compoundType = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  8518. var _multiType = __webpack_require__(/*! ../../typeSystem/multiType */ "./js/typeSystem/multiType.js");
  8519. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8520. var SemanticAnalyser = exports.SemanticAnalyser = function () {
  8521. function SemanticAnalyser(ast) {
  8522. _classCallCheck(this, SemanticAnalyser);
  8523. this.ast = ast;
  8524. this.lexerClass = _languageService.LanguageService.getCurrentLexer();
  8525. var lexer = new this.lexerClass(null);
  8526. this.literalNames = lexer.literalNames;
  8527. this.symbolMap = null;
  8528. this.currentFunction = null;
  8529. }
  8530. _createClass(SemanticAnalyser, [{
  8531. key: 'pushMap',
  8532. value: function pushMap() {
  8533. if (this.symbolMap === null) {
  8534. this.symbolMap = { map: {}, next: null };
  8535. } else {
  8536. var n = { map: {}, next: this.symbolMap };
  8537. this.symbolMap = n;
  8538. }
  8539. }
  8540. }, {
  8541. key: 'popMap',
  8542. value: function popMap() {
  8543. if (this.symbolMap !== null) {
  8544. this.symbolMap = this.symbolMap.next;
  8545. }
  8546. }
  8547. }, {
  8548. key: 'insertSymbol',
  8549. value: function insertSymbol(id, typeInfo) {
  8550. this.symbolMap.map[id] = typeInfo;
  8551. }
  8552. }, {
  8553. key: 'findSymbol',
  8554. value: function findSymbol(id, symMap) {
  8555. if (!symMap.map[id]) {
  8556. if (symMap.next) {
  8557. return this.findSymbol(id, symMap.next);
  8558. }
  8559. return null;
  8560. } else {
  8561. return symMap.map[id];
  8562. }
  8563. }
  8564. }, {
  8565. key: 'getMainFunction',
  8566. value: function getMainFunction() {
  8567. return this.ast.functions.find(function (v) {
  8568. return v.isMain;
  8569. });
  8570. }
  8571. }, {
  8572. key: 'findFunction',
  8573. value: function findFunction(name) {
  8574. if (name.match(/^\$.+$/)) {
  8575. var fun = _definedFunctions.LanguageDefinedFunction.getFunction(name);
  8576. if (!!!fun) {
  8577. throw _processorErrorFactory.ProcessorErrorFactory.not_implemented(name);
  8578. }
  8579. return fun;
  8580. } else {
  8581. var val = this.ast.functions.find(function (v) {
  8582. return v.name === name;
  8583. });
  8584. if (!!!val) {
  8585. return null;
  8586. }
  8587. return val;
  8588. }
  8589. }
  8590. }, {
  8591. key: 'analyseTree',
  8592. value: function analyseTree() {
  8593. var globalVars = this.ast.global;
  8594. this.pushMap();
  8595. this.assertDeclarations(globalVars);
  8596. var functions = this.ast.functions;
  8597. var mainFunc = functions.filter(function (f) {
  8598. return f.name === null;
  8599. });
  8600. if (mainFunc.length <= 0) {
  8601. throw _processorErrorFactory.ProcessorErrorFactory.main_missing();
  8602. }
  8603. for (var i = 0; i < functions.length; i++) {
  8604. var fun = functions[i];
  8605. this.assertFunction(fun);
  8606. }
  8607. return this.ast;
  8608. }
  8609. }, {
  8610. key: 'assertDeclarations',
  8611. value: function assertDeclarations(list) {
  8612. for (var i = 0; i < list.length; i++) {
  8613. this.assertDeclaration(list[i]);
  8614. }
  8615. }
  8616. }, {
  8617. key: 'assertDeclaration',
  8618. value: function assertDeclaration(declaration) {
  8619. if (declaration instanceof _commands.ArrayDeclaration) {
  8620. if (declaration.initial === null) {
  8621. var lineType = this.evaluateExpressionType(declaration.lines);
  8622. if (!lineType.isCompatible(_types.Types.INTEGER)) {
  8623. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(declaration.sourceInfo);
  8624. }
  8625. if (declaration.columns !== null) {
  8626. var columnType = this.evaluateExpressionType(declaration.columns);
  8627. if (!columnType.isCompatible(_types.Types.INTEGER)) {
  8628. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(declaration.sourceInfo);
  8629. }
  8630. }
  8631. this.insertSymbol(declaration.id, { id: declaration.id, lines: declaration.lines, columns: declaration.columns, type: declaration.type });
  8632. return;
  8633. }
  8634. this.evaluateArrayLiteral(declaration.id, declaration.lines, declaration.columns, declaration.type, declaration.initial);
  8635. this.insertSymbol(declaration.id, { id: declaration.id, lines: declaration.lines, columns: declaration.columns, type: declaration.type });
  8636. } else {
  8637. if (declaration.initial === null) {
  8638. this.insertSymbol(declaration.id, { id: declaration.id, type: declaration.type });
  8639. return;
  8640. }
  8641. var resultType = this.evaluateExpressionType(declaration.initial);
  8642. if (resultType instanceof _multiType.MultiType) {
  8643. if (!resultType.isCompatible(declaration.type)) {
  8644. var stringInfo = declaration.type.stringInfo();
  8645. var info = stringInfo[0];
  8646. throw _processorErrorFactory.ProcessorErrorFactory.incompatible_types_full(info.type, info.dim, declaration.sourceInfo);
  8647. }
  8648. this.insertSymbol(declaration.id, { id: declaration.id, type: declaration.type });
  8649. } else if (!declaration.type.isCompatible(resultType)) {
  8650. var _stringInfo = declaration.type.stringInfo();
  8651. var _info = _stringInfo[0];
  8652. throw _processorErrorFactory.ProcessorErrorFactory.incompatible_types_full(_info.type, _info.dim, declaration.sourceInfo);
  8653. } else {
  8654. this.insertSymbol(declaration.id, { id: declaration.id, type: declaration.type });
  8655. }
  8656. }
  8657. }
  8658. }, {
  8659. key: 'evaluateExpressionType',
  8660. value: function evaluateExpressionType(expression) {
  8661. if (expression instanceof _expressions.UnaryApp) {
  8662. var op = expression.op;
  8663. var resultType = this.evaluateExpressionType(expression.left);
  8664. return (0, _compatibilityTable.resultTypeAfterUnaryOp)(op, resultType);
  8665. } else if (expression instanceof _expressions.InfixApp) {
  8666. var _op = expression.op;
  8667. var resultTypeLeft = this.evaluateExpressionType(expression.left);
  8668. var resultTypeRight = this.evaluateExpressionType(expression.right);
  8669. return (0, _compatibilityTable.resultTypeAfterInfixOp)(_op, resultTypeLeft, resultTypeRight);
  8670. } else if (expression instanceof _literal.Literal) {
  8671. return this.evaluateLiteralType(expression);
  8672. } else if (expression instanceof _expressions.FunctionCall) {
  8673. if (expression.isMainCall) {
  8674. throw _processorErrorFactory.ProcessorErrorFactory.void_in_expression_full(_definedFunctions.LanguageDefinedFunction.getMainFunctionName(), expression.sourceInfo);
  8675. }
  8676. var fun = this.findFunction(expression.id);
  8677. if (fun === null) {
  8678. throw _processorErrorFactory.ProcessorErrorFactory.function_missing_full(expression.id, expression.sourceInfo);
  8679. }
  8680. if (fun.returnType.isCompatible(_types.Types.VOID)) {
  8681. throw _processorErrorFactory.ProcessorErrorFactory.void_in_expression_full(expression.id, expression.sourceInfo);
  8682. }
  8683. this.assertParameters(fun, expression.actualParameters);
  8684. return fun.returnType;
  8685. } else if (expression instanceof _expressions.ArrayAccess) {
  8686. var arrayTypeInfo = this.findSymbol(expression.id, this.symbolMap);
  8687. if (arrayTypeInfo === null) {
  8688. throw _processorErrorFactory.ProcessorErrorFactory.symbol_not_found_full(expression.id, expression.sourceInfo);
  8689. }
  8690. if (!(arrayTypeInfo.type instanceof _compoundType.CompoundType)) {
  8691. throw _processorErrorFactory.ProcessorErrorFactory.invalid_array_access_full(expression.id, expression.sourceInfo);
  8692. }
  8693. var lineType = this.evaluateExpressionType(expression.line);
  8694. if (!lineType.isCompatible(_types.Types.INTEGER)) {
  8695. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(expression.sourceInfo);
  8696. }
  8697. if (expression.column !== null) {
  8698. if (arrayTypeInfo.columns === null) {
  8699. throw _processorErrorFactory.ProcessorErrorFactory.invalid_matrix_access_full(expression.id, expression.sourceInfo);
  8700. }
  8701. var columnType = this.evaluateExpressionType(expression.column);
  8702. if (!columnType.isCompatible(_types.Types.INTEGER)) {
  8703. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(expression.sourceInfo);
  8704. }
  8705. }
  8706. var arrType = arrayTypeInfo.type;
  8707. if (expression.column !== null) {
  8708. // indexing matrix
  8709. return arrType.innerType;
  8710. } else {
  8711. if (arrayTypeInfo.columns === null) {
  8712. return arrType.innerType;
  8713. }
  8714. return new _compoundType.CompoundType(arrType.innerType, 1);
  8715. }
  8716. }
  8717. }
  8718. }, {
  8719. key: 'evaluateLiteralType',
  8720. value: function evaluateLiteralType(literal) {
  8721. if (literal instanceof _expressions.IntLiteral) {
  8722. return literal.type;
  8723. } else if (literal instanceof _expressions.RealLiteral) {
  8724. return literal.type;
  8725. } else if (literal instanceof _expressions.StringLiteral) {
  8726. return literal.type;
  8727. } else if (literal instanceof _expressions.BoolLiteral) {
  8728. return literal.type;
  8729. } else if (literal instanceof _expressions.VariableLiteral) {
  8730. var typeInfo = this.findSymbol(literal.id, this.symbolMap);
  8731. if (typeInfo === null) {
  8732. throw _processorErrorFactory.ProcessorErrorFactory.symbol_not_found_full(literal.id, literal.sourceInfo);
  8733. }
  8734. if (typeInfo.type instanceof _compoundType.CompoundType) {
  8735. return typeInfo.type;
  8736. }
  8737. return typeInfo.type;
  8738. } else {
  8739. console.warn("Evaluating type only for an array literal...");
  8740. var last = null;
  8741. if (literal.value.length === 1) {
  8742. last = this.evaluateExpressionType(literal.value[0]);
  8743. } else {
  8744. for (var i = 0; i < literal.value.length; i++) {
  8745. var e = this.evaluateExpressionType(literal.value[i]);
  8746. if (last === null) {
  8747. last = e;
  8748. } else if (!last.isCompatible(e)) {
  8749. var strInfo = last.stringInfo();
  8750. var info = strInfo[0];
  8751. var strExp = literal.toString();
  8752. throw _processorErrorFactory.ProcessorErrorFactory.incompatible_types_array_full(strExp, info.type, info.dim, literal.sourceInfo);
  8753. }
  8754. }
  8755. }
  8756. if (last instanceof _compoundType.CompoundType) {
  8757. return new _compoundType.CompoundType(last.innerType, last.dimensions + 1);
  8758. }
  8759. return new _compoundType.CompoundType(last, 1);
  8760. }
  8761. }
  8762. }, {
  8763. key: 'evaluateArrayLiteral',
  8764. value: function evaluateArrayLiteral(id, lines, columns, type, literal) {
  8765. var _this = this;
  8766. if (literal instanceof _expressions.ArrayLiteral) {
  8767. if (columns === null) {
  8768. // it's a vector...
  8769. var dimType = this.evaluateExpressionType(lines);
  8770. if (!dimType.isCompatible(_types.Types.INTEGER)) {
  8771. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(literal.sourceInfo);
  8772. }
  8773. if (lines instanceof _expressions.IntLiteral) {
  8774. if (!lines.value.eq(literal.value.length)) {
  8775. if (type.dimensions > 1) {
  8776. throw _processorErrorFactory.ProcessorErrorFactory.matrix_line_outbounds_full(id, literal.value.length, lines.values.toNumber(), literal.sourceInfo);
  8777. } else {
  8778. throw _processorErrorFactory.ProcessorErrorFactory.vector_line_outbounds_full(id, literal.value.length, lines.values.toNumber(), literal.sourceInfo);
  8779. }
  8780. } else if (line.value.isNeg()) {
  8781. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(literal.sourceInfo);
  8782. }
  8783. }
  8784. literal.value.reduce(function (last, next) {
  8785. var eType = _this.evaluateExpressionType(next);
  8786. if (!last.canAccept(eType)) {
  8787. var strInfo = last.stringInfo();invalid;
  8788. var info = strInfo[0];
  8789. var strExp = literal.toString();
  8790. throw _processorErrorFactory.ProcessorErrorFactory.incompatible_types_array_full(strExp, info.type, info.dim, literal.sourceInfo);
  8791. }
  8792. return last;
  8793. }, type);
  8794. return true;
  8795. } else {
  8796. var _dimType = this.evaluateExpressionType(columns);
  8797. if (!_dimType.isCompatible(_types.Types.INTEGER)) {
  8798. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(literal.sourceInfo);
  8799. }
  8800. if (columns instanceof _expressions.IntLiteral) {
  8801. if (!columns.value.eq(literal.value.length)) {
  8802. if (type.dimensions > 1) {
  8803. throw _processorErrorFactory.ProcessorErrorFactory.matrix_column_outbounds_full(id, literal.value.length, columns.values.toNumber(), literal.sourceInfo);
  8804. } else {
  8805. throw _processorErrorFactory.ProcessorErrorFactory.invalid_matrix_access_full(id, literal.sourceInfo);
  8806. }
  8807. } else if (columns.value.isNeg()) {
  8808. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(literal.sourceInfo);
  8809. }
  8810. }
  8811. for (var i = 0; i < columns; i++) {
  8812. var anotherArray = literal.value[i];
  8813. this.evaluateArrayLiteral(id, lines, null, type, anotherArray);
  8814. }
  8815. }
  8816. } else {
  8817. var resultType = this.evaluateExpressionType(literal);
  8818. if (!(resultType instanceof _compoundType.CompoundType)) {
  8819. var strInfo = type.stringInfo();
  8820. var info = strInfo[0];
  8821. var strExp = literal.toString();
  8822. throw _processorErrorFactory.ProcessorErrorFactory.incompatible_types_array_full(strExp, info.type, info.dim, literal.sourceInfo);
  8823. }
  8824. if (!type.isCompatible(resultType)) {
  8825. var _strInfo = type.stringInfo();
  8826. var _info2 = _strInfo[0];
  8827. var _strExp = literal.toString();
  8828. throw _processorErrorFactory.ProcessorErrorFactory.incompatible_types_array_full(_strExp, _info2.type, _info2.dim, literal.sourceInfo);
  8829. }
  8830. return true;
  8831. }
  8832. }
  8833. }, {
  8834. key: 'assertFunction',
  8835. value: function assertFunction(fun) {
  8836. var _this2 = this;
  8837. this.pushMap();
  8838. this.currentFunction = fun;
  8839. fun.formalParameters.forEach(function (formalParam) {
  8840. if (formalParam.type instanceof _compoundType.CompoundType) {
  8841. if (formalParam.type.dimensions > 1) {
  8842. _this2.insertSymbol(formalParam.id, { id: formalParam.id, lines: -1, columns: -1, type: formalParam.type });
  8843. } else {
  8844. _this2.insertSymbol(formalParam.id, { id: formalParam.id, lines: -1, columns: null, type: formalParam.type });
  8845. }
  8846. } else {
  8847. _this2.insertSymbol(formalParam.id, { id: formalParam.id, type: formalParam.type });
  8848. }
  8849. });
  8850. this.assertDeclarations(fun.variablesDeclarations);
  8851. var optional = fun.returnType.isCompatible(_types.Types.VOID);
  8852. var valid = this.assertReturn(fun, optional);
  8853. if (!valid) {
  8854. throw _processorErrorFactory.ProcessorErrorFactory.function_no_return(fun.name);
  8855. }
  8856. this.popMap();
  8857. }
  8858. }, {
  8859. key: 'assertReturn',
  8860. value: function assertReturn(fun, optional) {
  8861. var _this3 = this;
  8862. return fun.commands.reduce(function (last, next) {
  8863. return _this3.checkCommand(fun.returnType, next, optional) || last;
  8864. }, optional);
  8865. }
  8866. }, {
  8867. key: 'checkCommand',
  8868. value: function checkCommand(type, cmd, optional) {
  8869. if (cmd instanceof _commands.While) {
  8870. var resultType = this.evaluateExpressionType(cmd.expression);
  8871. if (!resultType.isCompatible(_types.Types.BOOLEAN)) {
  8872. throw _processorErrorFactory.ProcessorErrorFactory.loop_condition_type_full(cmd.sourceInfo);
  8873. }
  8874. this.checkCommands(type, cmd.commands, optional);
  8875. return false;
  8876. } else if (cmd instanceof _commands.For) {
  8877. this.checkCommand(type, cmd.assignment, optional);
  8878. var _resultType = this.evaluateExpressionType(cmd.condition);
  8879. if (!_resultType.isCompatible(_types.Types.BOOLEAN)) {
  8880. throw _processorErrorFactory.ProcessorErrorFactory.for_condition_type_full(cmd.sourceInfo);
  8881. }
  8882. this.checkCommand(type, cmd.increment, optional);
  8883. this.checkCommands(type, cmd.commands, optional);
  8884. return false;
  8885. } else if (cmd instanceof _commands.Switch) {
  8886. var sType = this.evaluateExpressionType(cmd.expression);
  8887. var result = optional;
  8888. var hasDefault = false;
  8889. for (var i = 0; i < cmd.cases.length; i++) {
  8890. var aCase = cmd.cases[i];
  8891. if (aCase.expression !== null) {
  8892. var caseType = this.evaluateExpressionType(aCase.expression);
  8893. if (!sType.isCompatible(caseType)) {
  8894. var strInfo = sType.stringInfo();
  8895. var info = strInfo[0];
  8896. var strExp = aCase.expression.toString();
  8897. throw _processorErrorFactory.ProcessorErrorFactory.invalid_case_type_full(strExp, info.type, info.dim, aCase.sourceInfo);
  8898. }
  8899. } else {
  8900. hasDefault = true;
  8901. }
  8902. result = result && this.checkCommands(type, aCase.commands, result);
  8903. }
  8904. return result && hasDefault;
  8905. } else if (cmd instanceof _commands.ArrayIndexAssign) {
  8906. var typeInfo = this.findSymbol(cmd.id, this.symbolMap);
  8907. if (typeInfo === null) {
  8908. throw _processorErrorFactory.ProcessorErrorFactory.symbol_not_found_full(cmd.id, cmd.sourceInfo);
  8909. }
  8910. if (!(typeInfo.type instanceof _compoundType.CompoundType)) {
  8911. throw _processorErrorFactory.ProcessorErrorFactory.invalid_array_access_full(cmd.id, cmd.sourceInfo);
  8912. }
  8913. var exp = cmd.expression;
  8914. var lineExp = cmd.line;
  8915. var lineType = this.evaluateExpressionType(lineExp);
  8916. if (!lineType.isCompatible(_types.Types.INTEGER)) {
  8917. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo);
  8918. }
  8919. var columnExp = cmd.column;
  8920. if (typeInfo.columns === null && columnExp !== null) {
  8921. throw _processorErrorFactory.ProcessorErrorFactory.invalid_matrix_access_full(cmd.id, cmd.sourceInfo);
  8922. } else if (columnExp !== null) {
  8923. var columnType = this.evaluateExpressionType(columnExp);
  8924. if (!columnType.isCompatible(_types.Types.INTEGER)) {
  8925. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo);
  8926. }
  8927. }
  8928. // exp can be a arrayLiteral, a single value exp or an array access
  8929. if (exp instanceof _expressions.ArrayLiteral) {
  8930. this.evaluateArrayLiteral(cmd.id, typeInfo.lines, columnExp ? typeInfo.columns : null, typeInfo.type, exp);
  8931. } else {
  8932. // cannot properly evaluate since type system is poorly constructed
  8933. }
  8934. return optional;
  8935. } else if (cmd instanceof _commands.Assign) {
  8936. var _typeInfo = this.findSymbol(cmd.id, this.symbolMap);
  8937. if (_typeInfo === null) {
  8938. throw _processorErrorFactory.ProcessorErrorFactory.symbol_not_found_full(cmd.id, cmd.sourceInfo);
  8939. }
  8940. var _exp = cmd.expression;
  8941. if (_exp instanceof _expressions.ArrayLiteral) {
  8942. if (!(_typeInfo.type instanceof _compoundType.CompoundType)) {
  8943. var stringInfo = _typeInfo.type.stringInfo();
  8944. var _info3 = stringInfo[0];
  8945. throw _processorErrorFactory.ProcessorErrorFactory.incompatible_types_full(_info3.type, _info3.dim, cmd.sourceInfo);
  8946. }
  8947. this.evaluateArrayLiteral(cmd.id, _typeInfo.lines, _typeInfo.columns, _typeInfo.type, _exp);
  8948. } else {
  8949. var _resultType2 = this.evaluateExpressionType(_exp);
  8950. if (!_resultType2.isCompatible(_typeInfo.type)) {
  8951. var _stringInfo2 = _typeInfo.type.stringInfo();
  8952. var _info4 = _stringInfo2[0];
  8953. throw _processorErrorFactory.ProcessorErrorFactory.incompatible_types_full(_info4.type, _info4.dim, cmd.sourceInfo);
  8954. }
  8955. }
  8956. return optional;
  8957. } else if (cmd instanceof _commands.Break) {
  8958. return optional;
  8959. } else if (cmd instanceof _commands.IfThenElse) {
  8960. var _resultType3 = this.evaluateExpressionType(cmd.condition);
  8961. if (!_resultType3.isCompatible(_types.Types.BOOLEAN)) {
  8962. throw _processorErrorFactory.ProcessorErrorFactory.if_condition_type_full(cmd.sourceInfo);
  8963. }
  8964. if (cmd.ifFalse instanceof _commands.IfThenElse) {
  8965. return this.checkCommands(type, cmd.ifTrue.commands, optional) && this.checkCommand(type, cmd.ifFalse, optional);
  8966. } else {
  8967. return this.checkCommands(type, cmd.ifTrue.commands, optional) && this.checkCommands(type, cmd.ifFalse.commands, optional);
  8968. }
  8969. } else if (cmd instanceof _expressions.FunctionCall) {
  8970. var fun = null;
  8971. if (cmd.isMainCall) {
  8972. fun = this.getMainFunction();
  8973. } else {
  8974. fun = this.findFunction(cmd.id);
  8975. }
  8976. if (fun === null) {
  8977. throw _processorErrorFactory.ProcessorErrorFactory.function_missing_full(cmd.id, cmd.sourceInfo);
  8978. }
  8979. this.assertParameters(fun, cmd.actualParameters);
  8980. return optional;
  8981. } else if (cmd instanceof _commands.Return) {
  8982. var funcName = this.currentFunction.isMain ? _definedFunctions.LanguageDefinedFunction.getMainFunctionName() : this.currentFunction.name;
  8983. if (cmd.expression === null && !type.isCompatible(_types.Types.VOID)) {
  8984. var _stringInfo3 = type.stringInfo();
  8985. var _info5 = _stringInfo3[0];
  8986. throw _processorErrorFactory.ProcessorErrorFactory.invalid_void_return_full(funcName, _info5.type, _info5.dim, cmd.sourceInfo);
  8987. } else if (cmd.expression !== null) {
  8988. var _resultType4 = this.evaluateExpressionType(cmd.expression);
  8989. if (!type.isCompatible(_resultType4)) {
  8990. var _stringInfo4 = type.stringInfo();
  8991. var _info6 = _stringInfo4[0];
  8992. throw _processorErrorFactory.ProcessorErrorFactory.invalid_return_type_full(funcName, _info6.type, _info6.dim, cmd.sourceInfo);
  8993. } else {
  8994. return true;
  8995. }
  8996. } else {
  8997. return true;
  8998. }
  8999. }
  9000. }
  9001. }, {
  9002. key: 'checkCommands',
  9003. value: function checkCommands(type, cmds, optional) {
  9004. var _this4 = this;
  9005. return cmds.reduce(function (last, next) {
  9006. return _this4.checkCommand(type, next, optional) || last;
  9007. }, optional);
  9008. }
  9009. }, {
  9010. key: 'assertParameters',
  9011. value: function assertParameters(fun, actualParametersList) {
  9012. if (fun.formalParameters.length !== actualParametersList.length) {
  9013. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameters_size_full(fun.name, actualParametersList.length, fun.formalParameters.length, null);
  9014. }
  9015. for (var i = 0; i < actualParametersList.length; i++) {
  9016. var param = actualParametersList[i];
  9017. var formalParam = fun.formalParameters[i];
  9018. if (formalParam.byRef) {
  9019. if (!(param instanceof _expressions.VariableLiteral || param instanceof _expressions.ArrayAccess)) {
  9020. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameter_type_full(id, param.toString(), param.sourceInfo);
  9021. }
  9022. }
  9023. var resultType = this.evaluateExpressionType(param);
  9024. if (resultType instanceof _multiType.MultiType && formalParam.type instanceof _multiType.MultiType) {
  9025. var shared = 0;
  9026. for (var j = 0; j < resultType.types.length; j++) {
  9027. var element = resultType.types[j];
  9028. if (formalParam.type.types.indexOf(element) !== -1) {
  9029. shared++;
  9030. }
  9031. }
  9032. if (shared <= 0) {
  9033. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameter_type_full(id, param.toString(), param.sourceInfo);
  9034. }
  9035. } else if (resultType instanceof _multiType.MultiType) {
  9036. if (!resultType.isCompatible(formalParam.type)) {
  9037. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameter_type_full(id, param.toString(), param.sourceInfo);
  9038. }
  9039. } else if (!formalParam.type.isCompatible(resultType)) {
  9040. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameter_type_full(id, param.toString(), param.sourceInfo);
  9041. }
  9042. }
  9043. }
  9044. }]);
  9045. return SemanticAnalyser;
  9046. }();
  9047. /***/ }),
  9048. /***/ "./js/processor/store/store.js":
  9049. /*!*************************************!*\
  9050. !*** ./js/processor/store/store.js ***!
  9051. \*************************************/
  9052. /*! no static exports found */
  9053. /***/ (function(module, exports, __webpack_require__) {
  9054. "use strict";
  9055. Object.defineProperty(exports, "__esModule", {
  9056. value: true
  9057. });
  9058. exports.Store = undefined;
  9059. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  9060. var _modes = __webpack_require__(/*! ./../modes */ "./js/processor/modes.js");
  9061. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9062. var Store = exports.Store = function () {
  9063. function Store(name) {
  9064. _classCallCheck(this, Store);
  9065. this.name = name;
  9066. this.store = {};
  9067. this.nextStore = null;
  9068. this.mode = _modes.Modes.RUN;
  9069. }
  9070. _createClass(Store, [{
  9071. key: "extendStore",
  9072. value: function extendStore(nextStore) {
  9073. this.nextStore = nextStore;
  9074. }
  9075. }, {
  9076. key: "applyStore",
  9077. value: function applyStore(id) {
  9078. if (!this.store[id]) {
  9079. if (this.nextStore !== null) {
  9080. return this.nextStore.applyStore(id);
  9081. } else {
  9082. // TODO: better error message
  9083. throw new Error("Variable " + id + " not found.");
  9084. }
  9085. }
  9086. var val = this.store[id];
  9087. if (val.isRef) {
  9088. return val.getRefObj();
  9089. }
  9090. return this.store[id];
  9091. }
  9092. }, {
  9093. key: "updateStore",
  9094. value: function updateStore(id, stoObj) {
  9095. if (!this.store[id]) {
  9096. if (this.nextStore !== null) {
  9097. this.nextStore.updateStore(id, stoObj);
  9098. return this;
  9099. } else {
  9100. // TODO: better error message
  9101. throw new Error("Variable " + id + " not found.");
  9102. }
  9103. } else {
  9104. var oldObj = this.store[id];
  9105. if (oldObj.readOnly) {
  9106. // TODO: better error message
  9107. throw new Error("Cannot change value of a read only variable: " + id);
  9108. }
  9109. if (oldObj.isRef) {
  9110. oldObj.updateRef(stoObj);
  9111. return this;
  9112. } else if (oldObj.isCompatible(stoObj)) {
  9113. stoObj.setID(id);
  9114. this.store[id] = Object.freeze(stoObj);
  9115. return this;
  9116. } else {
  9117. var oldType = oldObj.type;
  9118. var stoType = stoObj.type;
  9119. // TODO: better error message
  9120. throw new Error(oldType + " is not compatible with type " + stoType + " given");
  9121. }
  9122. }
  9123. }
  9124. //In case of future use of ref, it needs to have a special function to update the storeRefObject
  9125. // and no the StoreObject refferenced by it
  9126. // updateStoreRef(id, stoObjAddress) {...}
  9127. }, {
  9128. key: "insertStore",
  9129. value: function insertStore(id, stoObj) {
  9130. if (this.store[id]) {
  9131. // TODO: better error message
  9132. throw new Error(id + " is already defined");
  9133. }
  9134. stoObj.setID(id);
  9135. this.store[id] = Object.freeze(stoObj);
  9136. return this;
  9137. }
  9138. }]);
  9139. return Store;
  9140. }();
  9141. /***/ }),
  9142. /***/ "./js/processor/store/storeObject.js":
  9143. /*!*******************************************!*\
  9144. !*** ./js/processor/store/storeObject.js ***!
  9145. \*******************************************/
  9146. /*! no static exports found */
  9147. /***/ (function(module, exports, __webpack_require__) {
  9148. "use strict";
  9149. Object.defineProperty(exports, "__esModule", {
  9150. value: true
  9151. });
  9152. exports.StoreObject = undefined;
  9153. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  9154. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  9155. var _decimal2 = _interopRequireDefault(_decimal);
  9156. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9157. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9158. var StoreObject = exports.StoreObject = function () {
  9159. function StoreObject(type, value) {
  9160. var readOnly = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  9161. _classCallCheck(this, StoreObject);
  9162. this._type = type;
  9163. this._value = value;
  9164. this._readOnly = readOnly;
  9165. this._id = null;
  9166. }
  9167. _createClass(StoreObject, [{
  9168. key: 'setID',
  9169. value: function setID(id) {
  9170. this._id = id;
  9171. }
  9172. }, {
  9173. key: 'isCompatible',
  9174. value: function isCompatible(another) {
  9175. if (another instanceof StoreObject) {
  9176. return this.type.isCompatible(another.type);
  9177. }
  9178. return false;
  9179. }
  9180. }, {
  9181. key: 'id',
  9182. get: function get() {
  9183. return this._id;
  9184. }
  9185. }, {
  9186. key: 'inStore',
  9187. get: function get() {
  9188. return this.id !== null;
  9189. }
  9190. }, {
  9191. key: 'type',
  9192. get: function get() {
  9193. return this._type;
  9194. }
  9195. }, {
  9196. key: 'value',
  9197. get: function get() {
  9198. return this._value;
  9199. }
  9200. }, {
  9201. key: 'number',
  9202. get: function get() {
  9203. if (this._value instanceof _decimal2.default) {
  9204. return this._value.toNumber();
  9205. } else {
  9206. return null;
  9207. }
  9208. }
  9209. }, {
  9210. key: 'readOnly',
  9211. get: function get() {
  9212. return this._readOnly;
  9213. },
  9214. set: function set(value) {
  9215. this._readOnly = value;
  9216. }
  9217. }]);
  9218. return StoreObject;
  9219. }();
  9220. /***/ }),
  9221. /***/ "./js/processor/store/storeObjectArray.js":
  9222. /*!************************************************!*\
  9223. !*** ./js/processor/store/storeObjectArray.js ***!
  9224. \************************************************/
  9225. /*! no static exports found */
  9226. /***/ (function(module, exports, __webpack_require__) {
  9227. "use strict";
  9228. Object.defineProperty(exports, "__esModule", {
  9229. value: true
  9230. });
  9231. exports.StoreObjectArray = undefined;
  9232. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  9233. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  9234. var _storeObject = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  9235. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9236. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  9237. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  9238. var StoreObjectArray = exports.StoreObjectArray = function (_StoreObject) {
  9239. _inherits(StoreObjectArray, _StoreObject);
  9240. _createClass(StoreObjectArray, null, [{
  9241. key: 'WRONG_LINE_NUMBER',
  9242. get: function get() {
  9243. return 1;
  9244. }
  9245. }, {
  9246. key: 'WRONG_TYPE',
  9247. get: function get() {
  9248. return 2;
  9249. }
  9250. }, {
  9251. key: 'WRONG_COLUMN_NUMBER',
  9252. get: function get() {
  9253. return 3;
  9254. }
  9255. }]);
  9256. function StoreObjectArray(type, lines, columns) {
  9257. var value = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  9258. var readOnly = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  9259. _classCallCheck(this, StoreObjectArray);
  9260. var _this = _possibleConstructorReturn(this, (StoreObjectArray.__proto__ || Object.getPrototypeOf(StoreObjectArray)).call(this, type, value, readOnly));
  9261. _this._lines = lines;
  9262. _this._columns = columns;
  9263. return _this;
  9264. }
  9265. _createClass(StoreObjectArray, [{
  9266. key: 'isCompatible',
  9267. value: function isCompatible(another) {
  9268. if (another instanceof _storeObject.StoreObject) {
  9269. if (this.lines === -1 && another.lines > 0 || this.lines === another.lines) {
  9270. if (this.columns === -1 && another.columns > 0 || this.columns === another.columns) {
  9271. return _get(StoreObjectArray.prototype.__proto__ || Object.getPrototypeOf(StoreObjectArray.prototype), 'isCompatible', this).call(this, another);
  9272. }
  9273. }
  9274. }
  9275. return false;
  9276. }
  9277. }, {
  9278. key: 'lines',
  9279. get: function get() {
  9280. return this._lines;
  9281. }
  9282. }, {
  9283. key: 'columns',
  9284. get: function get() {
  9285. return this._columns;
  9286. }
  9287. }, {
  9288. key: 'isVector',
  9289. get: function get() {
  9290. return this.type.dimensions === 1;
  9291. }
  9292. }, {
  9293. key: 'isValid',
  9294. get: function get() {
  9295. var _this2 = this;
  9296. if (this.value !== null) {
  9297. if (this.isVector) {
  9298. if (this.value.length !== this.lines) {
  9299. return [StoreObjectArray.WRONG_LINE_NUMBER, this.value.length];;
  9300. }
  9301. var mustBeNull = this.value.find(function (v) {
  9302. return !_this2.type.canAccept(v.type);
  9303. });
  9304. if (!!mustBeNull) {
  9305. return [StoreObjectArray.WRONG_TYPE, this.value.indexOf(mustBeNull)];;
  9306. }
  9307. }
  9308. return [];
  9309. } else {
  9310. if (this.lines !== this.value.length) {
  9311. return [StoreObjectArray.WRONG_LINE_NUMBER, this.value.length];
  9312. }
  9313. for (var i = 0; i < this.lines; i++) {
  9314. for (var j = 0; j < this.columns; j++) {
  9315. var arr = this.value[i];
  9316. if (arr.length !== this.columns) {
  9317. return [StoreObjectArray.WRONG_COLUMN_NUMBER, arr.length];
  9318. }
  9319. var _mustBeNull = arr.find(function (v) {
  9320. return !_this2.type.canAccept(v.type);
  9321. });
  9322. if (!!_mustBeNull) {
  9323. return [StoreObjectArray.WRONG_TYPE, i, arr.indexOf(_mustBeNull)];
  9324. }
  9325. }
  9326. }
  9327. return [];
  9328. }
  9329. }
  9330. }]);
  9331. return StoreObjectArray;
  9332. }(_storeObject.StoreObject);
  9333. /***/ }),
  9334. /***/ "./js/processor/store/storeObjectArrayAddress.js":
  9335. /*!*******************************************************!*\
  9336. !*** ./js/processor/store/storeObjectArrayAddress.js ***!
  9337. \*******************************************************/
  9338. /*! no static exports found */
  9339. /***/ (function(module, exports, __webpack_require__) {
  9340. "use strict";
  9341. Object.defineProperty(exports, "__esModule", {
  9342. value: true
  9343. });
  9344. exports.StoreObjectArrayAddress = undefined;
  9345. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  9346. var _storeObject = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  9347. var _storeObjectArray = __webpack_require__(/*! ./storeObjectArray */ "./js/processor/store/storeObjectArray.js");
  9348. var _compoundType = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  9349. var _processorErrorFactory = __webpack_require__(/*! ../error/processorErrorFactory */ "./js/processor/error/processorErrorFactory.js");
  9350. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9351. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  9352. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  9353. var StoreObjectArrayAddress = exports.StoreObjectArrayAddress = function (_StoreObject) {
  9354. _inherits(StoreObjectArrayAddress, _StoreObject);
  9355. function StoreObjectArrayAddress(refID, line, column, store) {
  9356. _classCallCheck(this, StoreObjectArrayAddress);
  9357. var _this = _possibleConstructorReturn(this, (StoreObjectArrayAddress.__proto__ || Object.getPrototypeOf(StoreObjectArrayAddress)).call(this, null, null, false));
  9358. _this.refID = refID;
  9359. _this.store = store;
  9360. _this.line = line;
  9361. _this.column = column;
  9362. return _this;
  9363. }
  9364. _createClass(StoreObjectArrayAddress, [{
  9365. key: 'getArrayObject',
  9366. value: function getArrayObject() {
  9367. return this.store.applyStore(this.refID);
  9368. }
  9369. }, {
  9370. key: 'updateArrayObject',
  9371. value: function updateArrayObject(stoObj) {
  9372. var anArray = this.getArrayObject();
  9373. var newArray = Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null), anArray);
  9374. if (!stoObj.type.isCompatible(this.type)) {
  9375. throw new Error('Invalid operation: cannot assign the value given to ' + this.refID);
  9376. } else if (this.type instanceof _compoundType.CompoundType && this.type.canAccept(stoObj.type)) {
  9377. throw new Error('Invalid operation: cannot assign the value given to ' + this.refID);
  9378. }
  9379. if (this.column !== null) {
  9380. newArray.value[this.line].value[this.column] = stoObj;
  9381. return newArray;
  9382. } else {
  9383. newArray.value[this.line] = stoObj;
  9384. return newArray;
  9385. }
  9386. }
  9387. }, {
  9388. key: 'isCompatible',
  9389. value: function isCompatible(another) {
  9390. if (this.type.isCompatible(another.type)) {
  9391. if (another.type instanceof _compoundType.CompoundType) {
  9392. return this.lines === another.lines && this.columns === another.columns;
  9393. } else {
  9394. this.refValue.isCompatible(another);
  9395. }
  9396. }
  9397. }
  9398. }, {
  9399. key: 'isRef',
  9400. get: function get() {
  9401. return false;
  9402. }
  9403. }, {
  9404. key: 'inStore',
  9405. get: function get() {
  9406. return true;
  9407. }
  9408. }, {
  9409. key: 'refValue',
  9410. get: function get() {
  9411. var refLine = this.store.applyStore(this.refID).value[this.line];
  9412. if (!refLine) {
  9413. if (this.getArrayObject().isVector) {
  9414. throw _processorErrorFactory.ProcessorErrorFactory.vector_line_outbounds(this.refID, this.line, this.getArrayObject().lines);
  9415. } else {
  9416. throw _processorErrorFactory.ProcessorErrorFactory.matrix_line_outbounds(this.refID, this.line, this.getArrayObject().lines);
  9417. }
  9418. }
  9419. if (this.column !== null) {
  9420. var refColumn = refLine.value[this.column];
  9421. if (!refColumn) {
  9422. if (this.getArrayObject().isVector) {
  9423. throw _processorErrorFactory.ProcessorErrorFactory.vector_not_matrix(this.refID);
  9424. } else {
  9425. throw _processorErrorFactory.ProcessorErrorFactory.matrix_column_outbounds(this.refID, this.column, this.getArrayObject().columns);
  9426. }
  9427. }
  9428. return refColumn;
  9429. }
  9430. return refLine;
  9431. }
  9432. }, {
  9433. key: 'value',
  9434. get: function get() {
  9435. return this.refValue.value;
  9436. }
  9437. }, {
  9438. key: 'type',
  9439. get: function get() {
  9440. return this.refValue.type;
  9441. }
  9442. }, {
  9443. key: 'lines',
  9444. get: function get() {
  9445. if (!(this.type instanceof _compoundType.CompoundType)) {
  9446. return null;
  9447. }
  9448. return this.refValue.value.length;
  9449. }
  9450. }, {
  9451. key: 'columns',
  9452. get: function get() {
  9453. switch (this.type.dimensions) {
  9454. case 2:
  9455. return this.refValue.value[0].value.length;
  9456. default:
  9457. return null;
  9458. }
  9459. }
  9460. }]);
  9461. return StoreObjectArrayAddress;
  9462. }(_storeObject.StoreObject);
  9463. /***/ }),
  9464. /***/ "./js/processor/store/storeObjectArrayAddressRef.js":
  9465. /*!**********************************************************!*\
  9466. !*** ./js/processor/store/storeObjectArrayAddressRef.js ***!
  9467. \**********************************************************/
  9468. /*! no static exports found */
  9469. /***/ (function(module, exports, __webpack_require__) {
  9470. "use strict";
  9471. Object.defineProperty(exports, "__esModule", {
  9472. value: true
  9473. });
  9474. exports.StoreObjectArrayAddressRef = undefined;
  9475. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  9476. var _storeObject = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  9477. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  9478. var _decimal2 = _interopRequireDefault(_decimal);
  9479. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9480. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9481. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  9482. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  9483. var StoreObjectArrayAddressRef = exports.StoreObjectArrayAddressRef = function (_StoreObject) {
  9484. _inherits(StoreObjectArrayAddressRef, _StoreObject);
  9485. function StoreObjectArrayAddressRef(address) {
  9486. _classCallCheck(this, StoreObjectArrayAddressRef);
  9487. var _this = _possibleConstructorReturn(this, (StoreObjectArrayAddressRef.__proto__ || Object.getPrototypeOf(StoreObjectArrayAddressRef)).call(this, null, null, false));
  9488. _this.address = address;
  9489. return _this;
  9490. }
  9491. _createClass(StoreObjectArrayAddressRef, [{
  9492. key: 'getRefObj',
  9493. value: function getRefObj() {
  9494. return this.address.refValue;
  9495. }
  9496. }, {
  9497. key: 'updateRef',
  9498. value: function updateRef(stoObj) {
  9499. var newArray = this.address.updateArrayObject(stoObj);
  9500. this.address.store.updateStore(this.address.refID, newArray);
  9501. }
  9502. }, {
  9503. key: 'isCompatible',
  9504. value: function isCompatible(another) {
  9505. return this.address.isCompatible(another);
  9506. }
  9507. }, {
  9508. key: 'isRef',
  9509. get: function get() {
  9510. return true;
  9511. }
  9512. }, {
  9513. key: 'type',
  9514. get: function get() {
  9515. return this.address.type;
  9516. }
  9517. }, {
  9518. key: 'value',
  9519. get: function get() {
  9520. return this.address.value;
  9521. }
  9522. }, {
  9523. key: 'number',
  9524. get: function get() {
  9525. if (this.value instanceof _decimal2.default) {
  9526. return this.value.toNumber();
  9527. } else {
  9528. return null;
  9529. }
  9530. }
  9531. }]);
  9532. return StoreObjectArrayAddressRef;
  9533. }(_storeObject.StoreObject);
  9534. /***/ }),
  9535. /***/ "./js/processor/store/storeObjectRef.js":
  9536. /*!**********************************************!*\
  9537. !*** ./js/processor/store/storeObjectRef.js ***!
  9538. \**********************************************/
  9539. /*! no static exports found */
  9540. /***/ (function(module, exports, __webpack_require__) {
  9541. "use strict";
  9542. Object.defineProperty(exports, "__esModule", {
  9543. value: true
  9544. });
  9545. exports.StoreObjectRef = undefined;
  9546. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  9547. var _storeObject = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  9548. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  9549. var _decimal2 = _interopRequireDefault(_decimal);
  9550. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9551. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9552. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  9553. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  9554. var StoreObjectRef = exports.StoreObjectRef = function (_StoreObject) {
  9555. _inherits(StoreObjectRef, _StoreObject);
  9556. function StoreObjectRef(refID, store) {
  9557. _classCallCheck(this, StoreObjectRef);
  9558. var _this = _possibleConstructorReturn(this, (StoreObjectRef.__proto__ || Object.getPrototypeOf(StoreObjectRef)).call(this, null, null, false));
  9559. _this.refID = refID;
  9560. _this.store = store;
  9561. return _this;
  9562. }
  9563. _createClass(StoreObjectRef, [{
  9564. key: 'getRefObj',
  9565. value: function getRefObj() {
  9566. return this.store.applyStore(this.refID);
  9567. }
  9568. }, {
  9569. key: 'updateRef',
  9570. value: function updateRef(stoObj) {
  9571. this.store.updateStore(this.refID, stoObj);
  9572. }
  9573. }, {
  9574. key: 'isCompatible',
  9575. value: function isCompatible(another) {
  9576. return this.store.applyStore(this.refID).isCompatible(another);
  9577. }
  9578. }, {
  9579. key: 'isRef',
  9580. get: function get() {
  9581. return true;
  9582. }
  9583. }, {
  9584. key: 'type',
  9585. get: function get() {
  9586. return this.store.applyStore(this.refID).type;
  9587. }
  9588. }, {
  9589. key: 'value',
  9590. get: function get() {
  9591. return this.store.applyStore(this.refID).value;
  9592. }
  9593. }, {
  9594. key: 'number',
  9595. get: function get() {
  9596. if (this.value instanceof _decimal2.default) {
  9597. return this.value.toNumber();
  9598. } else {
  9599. return null;
  9600. }
  9601. }
  9602. }]);
  9603. return StoreObjectRef;
  9604. }(_storeObject.StoreObject);
  9605. /***/ }),
  9606. /***/ "./js/runner.js":
  9607. /*!**********************!*\
  9608. !*** ./js/runner.js ***!
  9609. \**********************/
  9610. /*! no static exports found */
  9611. /***/ (function(module, exports, __webpack_require__) {
  9612. "use strict";
  9613. Object.defineProperty(exports, "__esModule", {
  9614. value: true
  9615. });
  9616. exports.runner = runner;
  9617. var _ivprogParser = __webpack_require__(/*! ./ast/ivprogParser */ "./js/ast/ivprogParser.js");
  9618. var _ivprogProcessor = __webpack_require__(/*! ./processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  9619. var _domConsole = __webpack_require__(/*! ./io/domConsole */ "./js/io/domConsole.js");
  9620. var _languageService = __webpack_require__(/*! ./services/languageService */ "./js/services/languageService.js");
  9621. var _semanticAnalyser = __webpack_require__(/*! ./processor/semantic/semanticAnalyser */ "./js/processor/semantic/semanticAnalyser.js");
  9622. function runner() {
  9623. var ivprogLexer = _languageService.LanguageService.getCurrentLexer();
  9624. // const lexer = new ivprogLexer(new InputStream(input));
  9625. // const stream = new CommonTokenStream(lexer);
  9626. // stream.fill();
  9627. // let i = 1;
  9628. // let token = null;
  9629. // while ((token = stream.LT(i)).type !== ivprogLexer.EOF && token.type !== ivprogLexer.WHITESPACE) {
  9630. // console.log(`${token.type}-${token.text}`);
  9631. // console.log('\n')
  9632. // i++;
  9633. // }
  9634. // const anaSin = new IVProgParser(input, ivprogLexer);
  9635. var editor = new JsonEditor('#json-renderer', {});
  9636. var domConsole = new _domConsole.DOMConsole("#console");
  9637. // proc.interpretAST().then( sto => {
  9638. // console.log(sto.applyStore('a'));
  9639. // }).catch(e => console.log(e));
  9640. try {
  9641. $('#btn').click(function () {
  9642. var input = $('#input').val();
  9643. var analiser = new _ivprogParser.IVProgParser(input, ivprogLexer);
  9644. try {
  9645. var data = analiser.parseTree();
  9646. var semAna = new _semanticAnalyser.SemanticAnalyser(data);
  9647. var proc = new _ivprogProcessor.IVProgProcessor(semAna.analyseTree());
  9648. proc.registerInput(domConsole);
  9649. domConsole.clear();
  9650. proc.registerOutput(domConsole);
  9651. proc.interpretAST().then(function (sto) {
  9652. return editor.load(sto.store);
  9653. }).catch(function (e) {
  9654. alert(e);console.log(e);
  9655. });
  9656. } catch (error) {
  9657. alert(error);
  9658. console.log(error);
  9659. }
  9660. });
  9661. } catch (a) {
  9662. console.log(a);
  9663. }
  9664. }
  9665. /***/ }),
  9666. /***/ "./js/semantic/semantic.min.js":
  9667. /*!*************************************!*\
  9668. !*** ./js/semantic/semantic.min.js ***!
  9669. \*************************************/
  9670. /*! no static exports found */
  9671. /***/ (function(module, exports, __webpack_require__) {
  9672. "use strict";
  9673. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  9674. /*
  9675. * # Semantic UI - 2.3.3
  9676. * https://github.com/Semantic-Org/Semantic-UI
  9677. * http://www.semantic-ui.com/
  9678. *
  9679. * Copyright 2014 Contributors
  9680. * Released under the MIT license
  9681. * http://opensource.org/licenses/MIT
  9682. *
  9683. */
  9684. !function (e, t, n, i) {
  9685. e.site = e.fn.site = function (o) {
  9686. var a,
  9687. r,
  9688. s = new Date().getTime(),
  9689. l = [],
  9690. c = arguments[0],
  9691. u = "string" == typeof c,
  9692. d = [].slice.call(arguments, 1),
  9693. f = e.isPlainObject(o) ? e.extend(!0, {}, e.site.settings, o) : e.extend({}, e.site.settings),
  9694. m = f.namespace,
  9695. g = f.error,
  9696. p = "module-" + m,
  9697. h = e(n),
  9698. v = this,
  9699. b = h.data(p);return a = { initialize: function initialize() {
  9700. a.instantiate();
  9701. }, instantiate: function instantiate() {
  9702. a.verbose("Storing instance of site", a), b = a, h.data(p, a);
  9703. }, normalize: function normalize() {
  9704. a.fix.console(), a.fix.requestAnimationFrame();
  9705. }, fix: { console: function (_console) {
  9706. function console() {
  9707. return _console.apply(this, arguments);
  9708. }
  9709. console.toString = function () {
  9710. return _console.toString();
  9711. };
  9712. return console;
  9713. }(function () {
  9714. 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 () {});
  9715. }), consoleClear: function consoleClear() {
  9716. a.debug("Disabling programmatic console clearing"), t.console.clear = function () {};
  9717. }, requestAnimationFrame: function requestAnimationFrame() {
  9718. 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) {
  9719. setTimeout(e, 0);
  9720. });
  9721. } }, moduleExists: function moduleExists(t) {
  9722. return e.fn[t] !== i && e.fn[t].settings !== i;
  9723. }, enabled: { modules: function modules(t) {
  9724. var n = [];return t = t || f.modules, e.each(t, function (e, t) {
  9725. a.moduleExists(t) && n.push(t);
  9726. }), n;
  9727. } }, disabled: { modules: function modules(t) {
  9728. var n = [];return t = t || f.modules, e.each(t, function (e, t) {
  9729. a.moduleExists(t) || n.push(t);
  9730. }), n;
  9731. } }, change: { setting: function setting(t, n, o, r) {
  9732. o = "string" == typeof o ? "all" === o ? f.modules : [o] : o || f.modules, r = r === i || r, e.each(o, function (i, o) {
  9733. var s,
  9734. l = !a.moduleExists(o) || e.fn[o].settings.namespace || !1;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)));
  9735. });
  9736. }, settings: function settings(t, n, o) {
  9737. n = "string" == typeof n ? [n] : n || f.modules, o = o === i || o, e.each(n, function (n, i) {
  9738. var r;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)));
  9739. });
  9740. } }, enable: { console: function console() {
  9741. a.console(!0);
  9742. }, debug: function debug(e, t) {
  9743. e = e || f.modules, a.debug("Enabling debug for modules", e), a.change.setting("debug", !0, e, t);
  9744. }, verbose: function verbose(e, t) {
  9745. e = e || f.modules, a.debug("Enabling verbose debug for modules", e), a.change.setting("verbose", !0, e, t);
  9746. } }, disable: { console: function console() {
  9747. a.console(!1);
  9748. }, debug: function debug(e, t) {
  9749. e = e || f.modules, a.debug("Disabling debug for modules", e), a.change.setting("debug", !1, e, t);
  9750. }, verbose: function verbose(e, t) {
  9751. e = e || f.modules, a.debug("Disabling verbose debug for modules", e), a.change.setting("verbose", !1, e, t);
  9752. } }, console: function console(e) {
  9753. if (e) {
  9754. if (b.cache.console === i) return void a.error(g.console);a.debug("Restoring console function"), t.console = b.cache.console;
  9755. } else a.debug("Disabling console function"), b.cache.console = t.console, t.console = { clear: function clear() {}, error: function error() {}, group: function group() {}, groupCollapsed: function groupCollapsed() {}, groupEnd: function groupEnd() {}, info: function info() {}, log: function log() {}, markTimeline: function markTimeline() {}, warn: function warn() {} };
  9756. }, destroy: function destroy() {
  9757. a.verbose("Destroying previous site for", h), h.removeData(p);
  9758. }, cache: {}, setting: function setting(t, n) {
  9759. if (e.isPlainObject(t)) e.extend(!0, f, t);else {
  9760. if (n === i) return f[t];f[t] = n;
  9761. }
  9762. }, internal: function internal(t, n) {
  9763. if (e.isPlainObject(t)) e.extend(!0, a, t);else {
  9764. if (n === i) return a[t];a[t] = n;
  9765. }
  9766. }, debug: function debug() {
  9767. f.debug && (f.performance ? a.performance.log(arguments) : (a.debug = Function.prototype.bind.call(console.info, console, f.name + ":"), a.debug.apply(console, arguments)));
  9768. }, verbose: function verbose() {
  9769. 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)));
  9770. }, error: function error() {
  9771. a.error = Function.prototype.bind.call(console.error, console, f.name + ":"), a.error.apply(console, arguments);
  9772. }, performance: { log: function log(e) {
  9773. var t, n;f.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({ Element: v, Name: e[0], Arguments: [].slice.call(e, 1) || "", "Execution Time": n })), clearTimeout(a.performance.timer), a.performance.timer = setTimeout(a.performance.display, 500);
  9774. }, display: function display() {
  9775. var t = f.name + ":",
  9776. n = 0;s = !1, clearTimeout(a.performance.timer), e.each(l, function (e, t) {
  9777. n += t["Execution Time"];
  9778. }), 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) {
  9779. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  9780. }), console.groupEnd()), l = [];
  9781. } }, invoke: function invoke(t, n, o) {
  9782. var s,
  9783. l,
  9784. c,
  9785. u = b;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) {
  9786. var r = n != s ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(u[r]) && n != s) u = u[r];else {
  9787. if (u[r] !== i) return l = u[r], !1;if (!e.isPlainObject(u[o]) || n == s) return u[o] !== i ? (l = u[o], !1) : (a.error(g.method, t), !1);u = u[o];
  9788. }
  9789. })), 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;
  9790. } }, u ? (b === i && a.initialize(), a.invoke(c)) : (b !== i && a.destroy(), a.initialize()), r !== i ? r : this;
  9791. }, e.site.settings = { name: "Site", namespace: "site", error: { console: "Console cannot be restored, most likely it was overwritten outside of module", method: "The method you called is not defined." }, debug: !1, verbose: !1, performance: !0, modules: ["accordion", "api", "checkbox", "dimmer", "dropdown", "embed", "form", "modal", "nag", "popup", "rating", "shape", "sidebar", "state", "sticky", "tab", "transition", "visit", "visibility"], siteNamespace: "site", namespaceStub: { cache: {}, config: {}, sections: {}, section: {}, utilities: {} } }, e.extend(e.expr[":"], { data: e.expr.createPseudo ? e.expr.createPseudo(function (t) {
  9792. return function (n) {
  9793. return !!e.data(n, t);
  9794. };
  9795. }) : function (t, n, i) {
  9796. return !!e.data(t, i[3]);
  9797. } });
  9798. }(jQuery, window, document), function (e, t, n, i) {
  9799. "use strict";
  9800. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.form = function (t) {
  9801. var o,
  9802. a = e(this),
  9803. r = a.selector || "",
  9804. s = new Date().getTime(),
  9805. l = [],
  9806. c = arguments[0],
  9807. u = arguments[1],
  9808. d = "string" == typeof c,
  9809. f = [].slice.call(arguments, 1);return a.each(function () {
  9810. var m,
  9811. g,
  9812. p,
  9813. h,
  9814. v,
  9815. b,
  9816. y,
  9817. x,
  9818. C,
  9819. w,
  9820. S,
  9821. k,
  9822. T,
  9823. A,
  9824. R,
  9825. P,
  9826. E = e(this),
  9827. F = this,
  9828. O = [],
  9829. D = !1;(P = { initialize: function initialize() {
  9830. 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());
  9831. }, instantiate: function instantiate() {
  9832. P.verbose("Storing instance of module", P), R = P, E.data(T, P);
  9833. }, destroy: function destroy() {
  9834. P.verbose("Destroying previous module", R), P.removeEvents(), E.removeData(T);
  9835. }, refresh: function refresh() {
  9836. 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);
  9837. }, submit: function submit() {
  9838. P.verbose("Submitting form", E), E.submit();
  9839. }, attachEvents: function attachEvents(t, n) {
  9840. n = n || "submit", e(t).on("click" + A, function (e) {
  9841. P[n](), e.preventDefault();
  9842. });
  9843. }, bindEvents: function bindEvents() {
  9844. 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 () {
  9845. var t = e(this),
  9846. n = t.prop("type"),
  9847. i = P.get.changeEvent(n, t);e(this).on(i + A, P.event.field.change);
  9848. });
  9849. }, clear: function clear() {
  9850. m.each(function () {
  9851. var t = e(this),
  9852. n = t.parent(),
  9853. i = t.closest(g),
  9854. o = i.find(x.prompt),
  9855. a = t.data(y.defaultValue) || "",
  9856. r = n.is(x.uiCheckbox),
  9857. s = n.is(x.uiDropdown);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(""));
  9858. });
  9859. }, reset: function reset() {
  9860. m.each(function () {
  9861. var t = e(this),
  9862. n = t.parent(),
  9863. o = t.closest(g),
  9864. a = o.find(x.prompt),
  9865. r = t.data(y.defaultValue),
  9866. s = n.is(x.uiCheckbox),
  9867. l = n.is(x.uiDropdown),
  9868. c = o.hasClass(C.error);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)));
  9869. });
  9870. }, determine: { isValid: function isValid() {
  9871. var t = !0;return e.each(b, function (e, n) {
  9872. P.validate.field(n, e, !0) || (t = !1);
  9873. }), t;
  9874. } }, is: { bracketedRule: function bracketedRule(e) {
  9875. return e.type && e.type.match(v.regExp.bracket);
  9876. }, shorthandFields: function shorthandFields(e) {
  9877. var t = e[Object.keys(e)[0]];return P.is.shorthandRules(t);
  9878. }, shorthandRules: function shorthandRules(t) {
  9879. return "string" == typeof t || e.isArray(t);
  9880. }, empty: function empty(e) {
  9881. return !e || 0 === e.length || (e.is('input[type="checkbox"]') ? !e.is(":checked") : P.is.blank(e));
  9882. }, blank: function blank(t) {
  9883. return "" === e.trim(t.val());
  9884. }, valid: function valid(t) {
  9885. var n = !0;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) {
  9886. P.is.valid(e) || (n = !1);
  9887. }), n);
  9888. } }, removeEvents: function removeEvents() {
  9889. E.off(A), m.off(A), h.off(A), m.off(A);
  9890. }, event: { field: { keydown: function keydown(t) {
  9891. var n = e(this),
  9892. i = t.which,
  9893. o = n.is(x.input),
  9894. a = n.is(x.checkbox),
  9895. r = n.closest(x.uiDropdown).length > 0,
  9896. s = 13;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);
  9897. }, keyup: function keyup() {
  9898. D = !1;
  9899. }, blur: function blur(t) {
  9900. var n = e(this),
  9901. i = n.closest(g),
  9902. o = P.get.validation(n);i.hasClass(C.error) ? (P.debug("Revalidating field", n, o), o && P.validate.field(o)) : "blur" == v.on && o && P.validate.field(o);
  9903. }, change: function change(t) {
  9904. var n = e(this),
  9905. i = n.closest(g),
  9906. o = P.get.validation(n);o && ("change" == v.on || i.hasClass(C.error) && v.revalidate) && (clearTimeout(P.timer), P.timer = setTimeout(function () {
  9907. P.debug("Revalidating field", n, P.get.validation(n)), P.validate.field(o);
  9908. }, v.delay));
  9909. } } }, get: { ancillaryValue: function ancillaryValue(e) {
  9910. return !(!e.type || !e.value && !P.is.bracketedRule(e)) && (e.value !== i ? e.value : e.type.match(v.regExp.bracket)[1] + "");
  9911. }, ruleName: function ruleName(e) {
  9912. return P.is.bracketedRule(e) ? e.type.replace(e.type.match(v.regExp.bracket)[0], "") : e.type;
  9913. }, changeEvent: function changeEvent(e, t) {
  9914. return "checkbox" == e || "radio" == e || "hidden" == e || t.is("select") ? "change" : P.get.inputEvent();
  9915. }, inputEvent: function inputEvent() {
  9916. return n.createElement("input").oninput !== i ? "input" : n.createElement("input").onpropertychange !== i ? "propertychange" : "keyup";
  9917. }, fieldsFromShorthand: function fieldsFromShorthand(t) {
  9918. var n = {};return e.each(t, function (t, i) {
  9919. "string" == typeof i && (i = [i]), n[t] = { rules: [] }, e.each(i, function (e, i) {
  9920. n[t].rules.push({ type: i });
  9921. });
  9922. }), n;
  9923. }, prompt: function prompt(t, n) {
  9924. var i,
  9925. o,
  9926. a = P.get.ruleName(t),
  9927. r = P.get.ancillaryValue(t),
  9928. s = P.get.field(n.identifier),
  9929. l = s.val(),
  9930. c = e.isFunction(t.prompt) ? t.prompt(l) : t.prompt || v.prompt[a] || v.text.unspecifiedRule,
  9931. u = -1 !== c.search("{value}"),
  9932. d = -1 !== c.search("{name}");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;
  9933. }, settings: function settings() {
  9934. if (e.isPlainObject(t)) {
  9935. var n = Object.keys(t);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));
  9936. } else v = e.fn.form.settings, b = e.fn.form.settings.defaults, P.verbose("Using default form validation", b, v);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();
  9937. }, field: function field(t) {
  9938. 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/>");
  9939. }, fields: function fields(t) {
  9940. var n = e();return e.each(t, function (e, t) {
  9941. n = n.add(P.get.field(t));
  9942. }), n;
  9943. }, validation: function validation(t) {
  9944. var n, i;return !!b && (e.each(b, function (e, o) {
  9945. i = o.identifier || e, P.get.field(i)[0] == t[0] && (o.identifier = i, n = o);
  9946. }), n || !1);
  9947. }, value: function value(e) {
  9948. var t = [];return t.push(e), P.get.values.call(F, t)[e];
  9949. }, values: function values(t) {
  9950. var n = {};return (e.isArray(t) ? P.get.fields(t) : m).each(function (t, o) {
  9951. var a = e(o),
  9952. r = (a.prop("type"), a.prop("name")),
  9953. s = a.val(),
  9954. l = a.is(x.checkbox),
  9955. c = a.is(x.radio),
  9956. u = -1 !== r.indexOf("[]"),
  9957. d = !!l && a.is(":checked");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);
  9958. }), n;
  9959. } }, has: { field: function field(e) {
  9960. 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;
  9961. } }, escape: { string: function string(e) {
  9962. return (e = String(e)).replace(w.escape, "\\$&");
  9963. } }, add: { rule: function rule(e, t) {
  9964. P.add.field(e, t);
  9965. }, field: function field(t, n) {
  9966. var i = {};P.is.shorthandRules(n) ? (n = e.isArray(n) ? n : [n], i[t] = { rules: [] }, e.each(n, function (e, n) {
  9967. i[t].rules.push({ type: n });
  9968. })) : i[t] = n, b = e.extend({}, b, i), P.debug("Adding rules", i, b);
  9969. }, fields: function fields(t) {
  9970. var n;n = t && P.is.shorthandFields(t) ? P.get.fieldsFromShorthand(t) : t, b = e.extend({}, b, n);
  9971. }, prompt: function prompt(t, n) {
  9972. var o = P.get.field(t).closest(g),
  9973. a = o.children(x.prompt),
  9974. r = 0 !== a.length;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)));
  9975. }, errors: function errors(e) {
  9976. P.debug("Adding form error messages", e), P.set.error(), p.html(v.templates.error(e));
  9977. } }, remove: { rule: function rule(t, n) {
  9978. var o = e.isArray(n) ? n : [n];if (n == i) return P.debug("Removed all rules"), void (b[t].rules = []);b[t] != i && e.isArray(b[t].rules) && e.each(b[t].rules, function (e, n) {
  9979. -1 !== o.indexOf(n.type) && (P.debug("Removed rule", n.type), b[t].rules.splice(e, 1));
  9980. });
  9981. }, field: function field(t) {
  9982. var n = e.isArray(t) ? t : [t];e.each(n, function (e, t) {
  9983. P.remove.rule(t);
  9984. });
  9985. }, rules: function rules(t, n) {
  9986. e.isArray(t) ? e.each(fields, function (e, t) {
  9987. P.remove.rule(t, n);
  9988. }) : P.remove.rule(t, n);
  9989. }, fields: function fields(e) {
  9990. P.remove.field(e);
  9991. }, prompt: function prompt(t) {
  9992. var n = P.get.field(t).closest(g),
  9993. o = n.children(x.prompt);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 () {
  9994. o.remove();
  9995. }) : o.fadeOut(v.duration, function () {
  9996. o.remove();
  9997. }));
  9998. } }, set: { success: function success() {
  9999. E.removeClass(C.error).addClass(C.success);
  10000. }, defaults: function defaults() {
  10001. m.each(function () {
  10002. var t = e(this),
  10003. n = t.filter(x.checkbox).length > 0 ? t.is(":checked") : t.val();t.data(y.defaultValue, n);
  10004. });
  10005. }, error: function error() {
  10006. E.removeClass(C.success).addClass(C.error);
  10007. }, value: function value(e, t) {
  10008. var n = {};return n[e] = t, P.set.values.call(F, n);
  10009. }, values: function values(t) {
  10010. e.isEmptyObject(t) || e.each(t, function (t, n) {
  10011. var i,
  10012. o = P.get.field(t),
  10013. a = o.parent(),
  10014. r = e.isArray(n),
  10015. s = a.is(x.uiCheckbox),
  10016. l = a.is(x.uiDropdown),
  10017. c = o.is(x.radio) && s;o.length > 0 && (r && s ? (P.verbose("Selecting multiple", n, o), a.checkbox("uncheck"), e.each(n, function (e, t) {
  10018. i = o.filter('[value="' + t + '"]'), a = i.parent(), i.length > 0 && a.checkbox("check");
  10019. })) : 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)));
  10020. });
  10021. } }, validate: { form: function form(e, t) {
  10022. var n = P.get.values();if (D) return !1;if (O = [], P.determine.isValid()) {
  10023. if (P.debug("Form has no validation errors, submitting"), P.set.success(), !0 !== t) return v.onSuccess.call(F, e, n);
  10024. } 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);
  10025. }, field: function field(t, n, o) {
  10026. o = o === i || o, "string" == typeof t && (P.verbose("Validating field", t), n = t, t = b[t]);var a = t.identifier || n,
  10027. r = P.get.field(a),
  10028. s = !!t.depends && P.get.field(t.depends),
  10029. l = !0,
  10030. c = [];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) {
  10031. 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);
  10032. }), 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);
  10033. }, rule: function rule(t, n) {
  10034. var o = P.get.field(t.identifier),
  10035. a = (n.type, o.val()),
  10036. r = P.get.ancillaryValue(n),
  10037. s = P.get.ruleName(n),
  10038. l = v.rules[s];if (e.isFunction(l)) return a = a === i || "" === a || null === a ? "" : e.trim(a + ""), l.call(o, a, r);P.error(S.noRule, s);
  10039. } }, setting: function setting(t, n) {
  10040. if (e.isPlainObject(t)) e.extend(!0, v, t);else {
  10041. if (n === i) return v[t];v[t] = n;
  10042. }
  10043. }, internal: function internal(t, n) {
  10044. if (e.isPlainObject(t)) e.extend(!0, P, t);else {
  10045. if (n === i) return P[t];P[t] = n;
  10046. }
  10047. }, debug: function debug() {
  10048. !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)));
  10049. }, verbose: function verbose() {
  10050. !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)));
  10051. }, error: function error() {
  10052. v.silent || (P.error = Function.prototype.bind.call(console.error, console, v.name + ":"), P.error.apply(console, arguments));
  10053. }, performance: { log: function log(e) {
  10054. var t, n;v.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: F, "Execution Time": n })), clearTimeout(P.performance.timer), P.performance.timer = setTimeout(P.performance.display, 500);
  10055. }, display: function display() {
  10056. var t = v.name + ":",
  10057. n = 0;s = !1, clearTimeout(P.performance.timer), e.each(l, function (e, t) {
  10058. n += t["Execution Time"];
  10059. }), 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) {
  10060. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  10061. }), console.groupEnd()), l = [];
  10062. } }, invoke: function invoke(t, n, a) {
  10063. var r,
  10064. s,
  10065. l,
  10066. c = R;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) {
  10067. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  10068. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);c = c[o];
  10069. }
  10070. })), 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;
  10071. } }).initialize();
  10072. }), o !== i ? o : this;
  10073. }, e.fn.form.settings = { name: "Form", namespace: "form", debug: !1, verbose: !1, performance: !0, fields: !1, keyboardShortcuts: !0, on: "submit", inline: !1, delay: 200, revalidate: !0, transition: "scale", duration: 200, onValid: function onValid() {}, onInvalid: function onInvalid() {}, onSuccess: function onSuccess() {
  10074. return !0;
  10075. }, onFailure: function onFailure() {
  10076. return !1;
  10077. }, metadata: { defaultValue: "default", validate: "validate" }, regExp: { htmlID: /^[a-zA-Z][\w:.-]*$/g, bracket: /\[(.*)\]/i, decimal: /^\d+\.?\d*$/, email: /^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i, escape: /[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, flags: /^\/(.*)\/(.*)?/, integer: /^\-?\d+$/, number: /^\-?\d*(\.\d+)?$/, url: /(https?:\/\/(?:www\.|(?!www))[^\s\.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})/i }, text: { unspecifiedRule: "Please enter a valid value", unspecifiedField: "This field" }, prompt: { empty: "{name} must have a value", checked: "{name} must be checked", email: "{name} must be a valid e-mail", url: "{name} must be a valid url", regExp: "{name} is not formatted correctly", integer: "{name} must be an integer", decimal: "{name} must be a decimal number", number: "{name} must be set to a number", is: '{name} must be "{ruleValue}"', isExactly: '{name} must be exactly "{ruleValue}"', not: '{name} cannot be set to "{ruleValue}"', notExactly: '{name} cannot be set to exactly "{ruleValue}"', contain: '{name} must contain "{ruleValue}"', containExactly: '{name} must contain exactly "{ruleValue}"', doesntContain: '{name} cannot contain "{ruleValue}"', doesntContainExactly: '{name} cannot contain exactly "{ruleValue}"', minLength: "{name} must be at least {ruleValue} characters", length: "{name} must be at least {ruleValue} characters", exactLength: "{name} must be exactly {ruleValue} characters", maxLength: "{name} cannot be longer than {ruleValue} characters", match: "{name} must match {ruleValue} field", different: "{name} must have a different value than {ruleValue} field", creditCard: "{name} must be a valid credit card number", minCount: "{name} must have at least {ruleValue} choices", exactCount: "{name} must have exactly {ruleValue} choices", maxCount: "{name} must have {ruleValue} or less choices" }, selector: { checkbox: 'input[type="checkbox"], input[type="radio"]', clear: ".clear", field: "input, textarea, select", group: ".field", input: "input", message: ".error.message", prompt: ".prompt.label", radio: 'input[type="radio"]', reset: '.reset:not([type="reset"])', submit: '.submit:not([type="submit"])', uiCheckbox: ".ui.checkbox", uiDropdown: ".ui.dropdown" }, className: { error: "error", label: "ui prompt label", pressed: "down", success: "success" }, error: { identifier: "You must specify a string identifier for each field", method: "The method you called is not defined.", noRule: "There is no rule matching the one you specified", oldSyntax: "Starting in 2.0 forms now only take a single settings object. Validation settings converted to new syntax automatically." }, templates: { error: function error(t) {
  10078. var n = '<ul class="list">';return e.each(t, function (e, t) {
  10079. n += "<li>" + t + "</li>";
  10080. }), e(n += "</ul>");
  10081. }, prompt: function prompt(t) {
  10082. return e("<div/>").addClass("ui basic red pointing prompt label").html(t[0]);
  10083. } }, rules: { empty: function empty(t) {
  10084. return !(t === i || "" === t || e.isArray(t) && 0 === t.length);
  10085. }, checked: function checked() {
  10086. return e(this).filter(":checked").length > 0;
  10087. }, email: function email(t) {
  10088. return e.fn.form.settings.regExp.email.test(t);
  10089. }, url: function url(t) {
  10090. return e.fn.form.settings.regExp.url.test(t);
  10091. }, regExp: function regExp(t, n) {
  10092. if (n instanceof RegExp) return t.match(n);var i,
  10093. o = n.match(e.fn.form.settings.regExp.flags);return o && (n = o.length >= 2 ? o[1] : n, i = o.length >= 3 ? o[2] : ""), t.match(new RegExp(n, i));
  10094. }, integer: function integer(t, n) {
  10095. var o,
  10096. a,
  10097. r,
  10098. s = e.fn.form.settings.regExp.integer;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);
  10099. }, decimal: function decimal(t) {
  10100. return e.fn.form.settings.regExp.decimal.test(t);
  10101. }, number: function number(t) {
  10102. return e.fn.form.settings.regExp.number.test(t);
  10103. }, is: function is(e, t) {
  10104. return t = "string" == typeof t ? t.toLowerCase() : t, (e = "string" == typeof e ? e.toLowerCase() : e) == t;
  10105. }, isExactly: function isExactly(e, t) {
  10106. return e == t;
  10107. }, not: function not(e, t) {
  10108. return (e = "string" == typeof e ? e.toLowerCase() : e) != (t = "string" == typeof t ? t.toLowerCase() : t);
  10109. }, notExactly: function notExactly(e, t) {
  10110. return e != t;
  10111. }, contains: function contains(t, n) {
  10112. return n = n.replace(e.fn.form.settings.regExp.escape, "\\$&"), -1 !== t.search(new RegExp(n, "i"));
  10113. }, containsExactly: function containsExactly(t, n) {
  10114. return n = n.replace(e.fn.form.settings.regExp.escape, "\\$&"), -1 !== t.search(new RegExp(n));
  10115. }, doesntContain: function doesntContain(t, n) {
  10116. return n = n.replace(e.fn.form.settings.regExp.escape, "\\$&"), -1 === t.search(new RegExp(n, "i"));
  10117. }, doesntContainExactly: function doesntContainExactly(t, n) {
  10118. return n = n.replace(e.fn.form.settings.regExp.escape, "\\$&"), -1 === t.search(new RegExp(n));
  10119. }, minLength: function minLength(e, t) {
  10120. return e !== i && e.length >= t;
  10121. }, length: function length(e, t) {
  10122. return e !== i && e.length >= t;
  10123. }, exactLength: function exactLength(e, t) {
  10124. return e !== i && e.length == t;
  10125. }, maxLength: function maxLength(e, t) {
  10126. return e !== i && e.length <= t;
  10127. }, match: function match(t, n) {
  10128. var o;e(this);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();
  10129. }, different: function different(t, n) {
  10130. var o;e(this);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();
  10131. }, creditCard: function creditCard(t, n) {
  10132. var i,
  10133. o,
  10134. a = { visa: { pattern: /^4/, length: [16] }, amex: { pattern: /^3[47]/, length: [15] }, mastercard: { pattern: /^5[1-5]/, length: [16] }, discover: { 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)/, length: [16] }, unionPay: { pattern: /^(62|88)/, length: [16, 17, 18, 19] }, jcb: { pattern: /^35(2[89]|[3-8][0-9])/, length: [16] }, maestro: { pattern: /^(5018|5020|5038|6304|6759|676[1-3])/, length: [12, 13, 14, 15, 16, 17, 18, 19] }, dinersClub: { pattern: /^(30[0-5]|^36)/, length: [14] }, laser: { pattern: /^(6304|670[69]|6771)/, length: [16, 17, 18, 19] }, visaElectron: { pattern: /^(4026|417500|4508|4844|491(3|7))/, length: [16] } },
  10135. r = {},
  10136. s = !1,
  10137. l = "string" == typeof n && n.split(",");if ("string" == typeof t && 0 !== t.length) {
  10138. if (t = t.replace(/[\-]/g, ""), l && (e.each(l, function (n, i) {
  10139. (o = a[i]) && (r = { length: -1 !== e.inArray(t.length, o.length), pattern: -1 !== t.search(o.pattern) }).length && r.pattern && (s = !0);
  10140. }), !s)) return !1;if ((i = { number: -1 !== e.inArray(t.length, a.unionPay.length), pattern: -1 !== t.search(a.unionPay.pattern) }).number && i.pattern) return !0;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--;) {
  10141. f += d[u][parseInt(t.charAt(c), 10)], u ^= 1;
  10142. }return f % 10 == 0 && f > 0;
  10143. }
  10144. }, minCount: function minCount(e, t) {
  10145. return 0 == t || (1 == t ? "" !== e : e.split(",").length >= t);
  10146. }, exactCount: function exactCount(e, t) {
  10147. return 0 == t ? "" === e : 1 == t ? "" !== e && -1 === e.search(",") : e.split(",").length == t;
  10148. }, maxCount: function maxCount(e, t) {
  10149. return 0 != t && (1 == t ? -1 === e.search(",") : e.split(",").length <= t);
  10150. } } };
  10151. }(jQuery, window, document), function (e, t, n, i) {
  10152. "use strict";
  10153. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.accordion = function (n) {
  10154. var o,
  10155. a = e(this),
  10156. r = new Date().getTime(),
  10157. s = [],
  10158. l = arguments[0],
  10159. c = "string" == typeof l,
  10160. u = [].slice.call(arguments, 1);t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame;return a.each(function () {
  10161. var d,
  10162. f,
  10163. m = e.isPlainObject(n) ? e.extend(!0, {}, e.fn.accordion.settings, n) : e.extend({}, e.fn.accordion.settings),
  10164. g = m.className,
  10165. p = m.namespace,
  10166. h = m.selector,
  10167. v = m.error,
  10168. b = "." + p,
  10169. y = "module-" + p,
  10170. x = a.selector || "",
  10171. C = e(this),
  10172. w = C.find(h.title),
  10173. S = C.find(h.content),
  10174. k = this,
  10175. T = C.data(y);f = { initialize: function initialize() {
  10176. f.debug("Initializing", C), f.bind.events(), m.observeChanges && f.observeChanges(), f.instantiate();
  10177. }, instantiate: function instantiate() {
  10178. T = f, C.data(y, f);
  10179. }, destroy: function destroy() {
  10180. f.debug("Destroying previous instance", C), C.off(b).removeData(y);
  10181. }, refresh: function refresh() {
  10182. w = C.find(h.title), S = C.find(h.content);
  10183. }, observeChanges: function observeChanges() {
  10184. "MutationObserver" in t && ((d = new MutationObserver(function (e) {
  10185. f.debug("DOM tree modified, updating selector cache"), f.refresh();
  10186. })).observe(k, { childList: !0, subtree: !0 }), f.debug("Setting up mutation observer", d));
  10187. }, bind: { events: function events() {
  10188. f.debug("Binding delegated events"), C.on(m.on + b, h.trigger, f.event.click);
  10189. } }, event: { click: function click() {
  10190. f.toggle.call(this);
  10191. } }, toggle: function toggle(t) {
  10192. var n = t !== i ? "number" == typeof t ? w.eq(t) : e(t).closest(h.title) : e(this).closest(h.title),
  10193. o = n.next(S),
  10194. a = o.hasClass(g.animating),
  10195. r = o.hasClass(g.active),
  10196. s = r && !a,
  10197. l = !r && a;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);
  10198. }, open: function open(t) {
  10199. var n = t !== i ? "number" == typeof t ? w.eq(t) : e(t).closest(h.title) : e(this).closest(h.title),
  10200. o = n.next(S),
  10201. a = o.hasClass(g.animating);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({ animation: "fade in", queue: !1, useFailSafe: !0, debug: m.debug, verbose: m.verbose, duration: m.duration }) : o.children().stop(!0, !0).animate({ opacity: 1 }, m.duration, f.resetOpacity)), o.slideDown(m.duration, m.easing, function () {
  10202. o.removeClass(g.animating).addClass(g.active), f.reset.display.call(this), m.onOpen.call(this), m.onChange.call(this);
  10203. }));
  10204. }, close: function close(t) {
  10205. var n = t !== i ? "number" == typeof t ? w.eq(t) : e(t).closest(h.title) : e(this).closest(h.title),
  10206. o = n.next(S),
  10207. a = o.hasClass(g.animating),
  10208. r = o.hasClass(g.active);!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({ animation: "fade out", queue: !1, useFailSafe: !0, debug: m.debug, verbose: m.verbose, duration: m.duration }) : o.children().stop(!0, !0).animate({ opacity: 0 }, m.duration, f.resetOpacity)), o.slideUp(m.duration, m.easing, function () {
  10209. o.removeClass(g.animating).removeClass(g.active), f.reset.display.call(this), m.onClose.call(this), m.onChange.call(this);
  10210. }));
  10211. }, closeOthers: function closeOthers(t) {
  10212. var n,
  10213. o,
  10214. a,
  10215. r = t !== i ? w.eq(t) : e(this).closest(h.title),
  10216. s = r.parents(h.content).prev(h.title),
  10217. l = r.closest(h.accordion),
  10218. c = h.title + "." + g.active + ":visible",
  10219. u = h.content + "." + g.active + ":visible";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({ animation: "fade out", useFailSafe: !0, debug: m.debug, verbose: m.verbose, duration: m.duration }) : a.children().stop(!0, !0).animate({ opacity: 0 }, m.duration, f.resetOpacity)), a.slideUp(m.duration, m.easing, function () {
  10220. e(this).removeClass(g.active), f.reset.display.call(this);
  10221. }));
  10222. }, reset: { display: function display() {
  10223. f.verbose("Removing inline display from element", this), e(this).css("display", ""), "" === e(this).attr("style") && e(this).attr("style", "").removeAttr("style");
  10224. }, opacity: function opacity() {
  10225. f.verbose("Removing inline opacity from element", this), e(this).css("opacity", ""), "" === e(this).attr("style") && e(this).attr("style", "").removeAttr("style");
  10226. } }, setting: function setting(t, n) {
  10227. if (f.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, m, t);else {
  10228. if (n === i) return m[t];e.isPlainObject(m[t]) ? e.extend(!0, m[t], n) : m[t] = n;
  10229. }
  10230. }, internal: function internal(t, n) {
  10231. if (f.debug("Changing internal", t, n), n === i) return f[t];e.isPlainObject(t) ? e.extend(!0, f, t) : f[t] = n;
  10232. }, debug: function debug() {
  10233. !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)));
  10234. }, verbose: function verbose() {
  10235. !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)));
  10236. }, error: function error() {
  10237. m.silent || (f.error = Function.prototype.bind.call(console.error, console, m.name + ":"), f.error.apply(console, arguments));
  10238. }, performance: { log: function log(e) {
  10239. var t, n;m.performance && (n = (t = new Date().getTime()) - (r || t), r = t, s.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: k, "Execution Time": n })), clearTimeout(f.performance.timer), f.performance.timer = setTimeout(f.performance.display, 500);
  10240. }, display: function display() {
  10241. var t = m.name + ":",
  10242. n = 0;r = !1, clearTimeout(f.performance.timer), e.each(s, function (e, t) {
  10243. n += t["Execution Time"];
  10244. }), 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) {
  10245. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  10246. }), console.groupEnd()), s = [];
  10247. } }, invoke: function invoke(t, n, a) {
  10248. var r,
  10249. s,
  10250. l,
  10251. c = T;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) {
  10252. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  10253. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (f.error(v.method, t), !1);c = c[o];
  10254. }
  10255. })), 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;
  10256. } }, c ? (T === i && f.initialize(), f.invoke(l)) : (T !== i && T.invoke("destroy"), f.initialize());
  10257. }), o !== i ? o : this;
  10258. }, e.fn.accordion.settings = { name: "Accordion", namespace: "accordion", silent: !1, debug: !1, verbose: !1, performance: !0, on: "click", observeChanges: !0, exclusive: !0, collapsible: !0, closeNested: !1, animateChildren: !0, duration: 350, easing: "easeOutQuad", onOpening: function onOpening() {}, onClosing: function onClosing() {}, onChanging: function onChanging() {}, onOpen: function onOpen() {}, onClose: function onClose() {}, onChange: function onChange() {}, error: { method: "The method you called is not defined" }, className: { active: "active", animating: "animating" }, selector: { accordion: ".accordion", title: ".title", trigger: ".title", content: ".content" } }, e.extend(e.easing, { easeOutQuad: function easeOutQuad(e, t, n, i, o) {
  10259. return -i * (t /= o) * (t - 2) + n;
  10260. } });
  10261. }(jQuery, window, document), function (e, t, n, i) {
  10262. "use strict";
  10263. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.checkbox = function (o) {
  10264. var a,
  10265. r = e(this),
  10266. s = r.selector || "",
  10267. l = new Date().getTime(),
  10268. c = [],
  10269. u = arguments[0],
  10270. d = "string" == typeof u,
  10271. f = [].slice.call(arguments, 1);return r.each(function () {
  10272. var r,
  10273. m,
  10274. g = e.extend(!0, {}, e.fn.checkbox.settings, o),
  10275. p = g.className,
  10276. h = g.namespace,
  10277. v = g.selector,
  10278. b = g.error,
  10279. y = "." + h,
  10280. x = "module-" + h,
  10281. C = e(this),
  10282. w = e(this).children(v.label),
  10283. S = e(this).children(v.input),
  10284. k = S[0],
  10285. T = !1,
  10286. A = !1,
  10287. R = C.data(x),
  10288. P = this;m = { initialize: function initialize() {
  10289. m.verbose("Initializing checkbox", g), m.create.label(), m.bind.events(), m.set.tabbable(), m.hide.input(), m.observeChanges(), m.instantiate(), m.setup();
  10290. }, instantiate: function instantiate() {
  10291. m.verbose("Storing instance of module", m), R = m, C.data(x, m);
  10292. }, destroy: function destroy() {
  10293. m.verbose("Destroying module"), m.unbind.events(), m.show.input(), C.removeData(x);
  10294. }, fix: { reference: function reference() {
  10295. C.is(v.input) && (m.debug("Behavior called on <input> adjusting invoked element"), C = C.closest(v.checkbox), m.refresh());
  10296. } }, setup: function setup() {
  10297. 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();
  10298. }, refresh: function refresh() {
  10299. w = C.children(v.label), S = C.children(v.input), k = S[0];
  10300. }, hide: { input: function input() {
  10301. m.verbose("Modifying <input> z-index to be unselectable"), S.addClass(p.hidden);
  10302. } }, show: { input: function input() {
  10303. m.verbose("Modifying <input> z-index to be selectable"), S.removeClass(p.hidden);
  10304. } }, observeChanges: function observeChanges() {
  10305. "MutationObserver" in t && ((r = new MutationObserver(function (e) {
  10306. m.debug("DOM tree modified, updating selector cache"), m.refresh();
  10307. })).observe(P, { childList: !0, subtree: !0 }), m.debug("Setting up mutation observer", r));
  10308. }, attachEvents: function attachEvents(t, n) {
  10309. var i = e(t);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);
  10310. }, event: { click: function click(t) {
  10311. var n = e(t.target);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());
  10312. }, keydown: function keydown(e) {
  10313. var t = e.which,
  10314. n = 13,
  10315. i = 32;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);
  10316. }, keyup: function keyup(e) {
  10317. A && e.preventDefault();
  10318. } }, check: function check() {
  10319. m.should.allowCheck() && (m.debug("Checking checkbox", S), m.set.checked(), m.should.ignoreCallbacks() || (g.onChecked.call(k), g.onChange.call(k)));
  10320. }, uncheck: function uncheck() {
  10321. m.should.allowUncheck() && (m.debug("Unchecking checkbox"), m.set.unchecked(), m.should.ignoreCallbacks() || (g.onUnchecked.call(k), g.onChange.call(k)));
  10322. }, indeterminate: function indeterminate() {
  10323. 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)));
  10324. }, determinate: function determinate() {
  10325. 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)));
  10326. }, enable: function enable() {
  10327. m.is.enabled() ? m.debug("Checkbox is already enabled") : (m.debug("Enabling checkbox"), m.set.enabled(), g.onEnable.call(k), g.onEnabled.call(k));
  10328. }, disable: function disable() {
  10329. m.is.disabled() ? m.debug("Checkbox is already disabled") : (m.debug("Disabling checkbox"), m.set.disabled(), g.onDisable.call(k), g.onDisabled.call(k));
  10330. }, get: { radios: function radios() {
  10331. var t = m.get.name();return e('input[name="' + t + '"]').closest(v.checkbox);
  10332. }, otherRadios: function otherRadios() {
  10333. return m.get.radios().not(C);
  10334. }, name: function name() {
  10335. return S.attr("name");
  10336. } }, is: { initialLoad: function initialLoad() {
  10337. return T;
  10338. }, radio: function radio() {
  10339. return S.hasClass(p.radio) || "radio" == S.attr("type");
  10340. }, indeterminate: function indeterminate() {
  10341. return S.prop("indeterminate") !== i && S.prop("indeterminate");
  10342. }, checked: function checked() {
  10343. return S.prop("checked") !== i && S.prop("checked");
  10344. }, disabled: function disabled() {
  10345. return S.prop("disabled") !== i && S.prop("disabled");
  10346. }, enabled: function enabled() {
  10347. return !m.is.disabled();
  10348. }, determinate: function determinate() {
  10349. return !m.is.indeterminate();
  10350. }, unchecked: function unchecked() {
  10351. return !m.is.checked();
  10352. } }, should: { allowCheck: function allowCheck() {
  10353. 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);
  10354. }, allowUncheck: function allowUncheck() {
  10355. 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);
  10356. }, allowIndeterminate: function allowIndeterminate() {
  10357. 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);
  10358. }, allowDeterminate: function allowDeterminate() {
  10359. 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);
  10360. }, forceCallbacks: function forceCallbacks() {
  10361. return m.is.initialLoad() && g.fireOnInit;
  10362. }, ignoreCallbacks: function ignoreCallbacks() {
  10363. return T && !g.fireOnInit;
  10364. } }, can: { change: function change() {
  10365. return !(C.hasClass(p.disabled) || C.hasClass(p.readOnly) || S.prop("disabled") || S.prop("readonly"));
  10366. }, uncheck: function uncheck() {
  10367. return "boolean" == typeof g.uncheckable ? g.uncheckable : !m.is.radio();
  10368. } }, set: { initialLoad: function initialLoad() {
  10369. T = !0;
  10370. }, checked: function checked() {
  10371. 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");
  10372. }, unchecked: function unchecked() {
  10373. 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");
  10374. }, indeterminate: function indeterminate() {
  10375. 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());
  10376. }, determinate: function determinate() {
  10377. 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));
  10378. }, disabled: function disabled() {
  10379. 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());
  10380. }, enabled: function enabled() {
  10381. 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());
  10382. }, tabbable: function tabbable() {
  10383. m.verbose("Adding tabindex to checkbox"), S.attr("tabindex") === i && S.attr("tabindex", 0);
  10384. } }, remove: { initialLoad: function initialLoad() {
  10385. T = !1;
  10386. } }, trigger: { change: function change() {
  10387. var e = n.createEvent("HTMLEvents"),
  10388. t = S[0];t && (m.verbose("Triggering native change event"), e.initEvent("change", !0, !1), t.dispatchEvent(e));
  10389. } }, create: { label: function label() {
  10390. 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));
  10391. } }, has: { label: function label() {
  10392. return w.length > 0;
  10393. } }, bind: { events: function events() {
  10394. 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);
  10395. } }, unbind: { events: function events() {
  10396. m.debug("Removing events"), C.off(y);
  10397. } }, uncheckOthers: function uncheckOthers() {
  10398. var e = m.get.otherRadios();m.debug("Unchecking other radios", e), e.removeClass(p.checked);
  10399. }, toggle: function toggle() {
  10400. 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");
  10401. }, setting: function setting(t, n) {
  10402. if (m.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, g, t);else {
  10403. if (n === i) return g[t];e.isPlainObject(g[t]) ? e.extend(!0, g[t], n) : g[t] = n;
  10404. }
  10405. }, internal: function internal(t, n) {
  10406. if (e.isPlainObject(t)) e.extend(!0, m, t);else {
  10407. if (n === i) return m[t];m[t] = n;
  10408. }
  10409. }, debug: function debug() {
  10410. !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)));
  10411. }, verbose: function verbose() {
  10412. !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)));
  10413. }, error: function error() {
  10414. g.silent || (m.error = Function.prototype.bind.call(console.error, console, g.name + ":"), m.error.apply(console, arguments));
  10415. }, performance: { log: function log(e) {
  10416. var t, n;g.performance && (n = (t = new Date().getTime()) - (l || t), l = t, c.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: P, "Execution Time": n })), clearTimeout(m.performance.timer), m.performance.timer = setTimeout(m.performance.display, 500);
  10417. }, display: function display() {
  10418. var t = g.name + ":",
  10419. n = 0;l = !1, clearTimeout(m.performance.timer), e.each(c, function (e, t) {
  10420. n += t["Execution Time"];
  10421. }), 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) {
  10422. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  10423. }), console.groupEnd()), c = [];
  10424. } }, invoke: function invoke(t, n, o) {
  10425. var r,
  10426. s,
  10427. l,
  10428. c = R;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) {
  10429. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  10430. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (m.error(b.method, t), !1);c = c[o];
  10431. }
  10432. })), 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;
  10433. } }, d ? (R === i && m.initialize(), m.invoke(u)) : (R !== i && R.invoke("destroy"), m.initialize());
  10434. }), a !== i ? a : this;
  10435. }, e.fn.checkbox.settings = { name: "Checkbox", namespace: "checkbox", silent: !1, debug: !1, verbose: !0, performance: !0, uncheckable: "auto", fireOnInit: !1, onChange: function onChange() {}, beforeChecked: function beforeChecked() {}, beforeUnchecked: function beforeUnchecked() {}, beforeDeterminate: function beforeDeterminate() {}, beforeIndeterminate: function beforeIndeterminate() {}, onChecked: function onChecked() {}, onUnchecked: function onUnchecked() {}, onDeterminate: function onDeterminate() {}, onIndeterminate: function onIndeterminate() {}, onEnable: function onEnable() {}, onDisable: function onDisable() {}, onEnabled: function onEnabled() {}, onDisabled: function onDisabled() {}, className: { checked: "checked", indeterminate: "indeterminate", disabled: "disabled", hidden: "hidden", radio: "radio", readOnly: "read-only" }, error: { method: "The method you called is not defined" }, selector: { checkbox: ".ui.checkbox", label: "label, .box", input: 'input[type="checkbox"], input[type="radio"]', link: "a[href]" } };
  10436. }(jQuery, window, document), function (e, t, n, i) {
  10437. "use strict";
  10438. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.dimmer = function (t) {
  10439. var o,
  10440. a = e(this),
  10441. r = new Date().getTime(),
  10442. s = [],
  10443. l = arguments[0],
  10444. c = "string" == typeof l,
  10445. u = [].slice.call(arguments, 1);return a.each(function () {
  10446. var d,
  10447. f,
  10448. m,
  10449. g = e.isPlainObject(t) ? e.extend(!0, {}, e.fn.dimmer.settings, t) : e.extend({}, e.fn.dimmer.settings),
  10450. p = g.selector,
  10451. h = g.namespace,
  10452. v = g.className,
  10453. b = g.error,
  10454. y = "." + h,
  10455. x = "module-" + h,
  10456. C = a.selector || "",
  10457. w = "ontouchstart" in n.documentElement ? "touchstart" : "click",
  10458. S = e(this),
  10459. k = this,
  10460. T = S.data(x);(m = { preinitialize: function preinitialize() {
  10461. 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());
  10462. }, initialize: function initialize() {
  10463. m.debug("Initializing dimmer", g), m.bind.events(), m.set.dimmable(), m.instantiate();
  10464. }, instantiate: function instantiate() {
  10465. m.verbose("Storing instance of module", m), T = m, S.data(x, T);
  10466. }, destroy: function destroy() {
  10467. m.verbose("Destroying previous module", d), m.unbind.events(), m.remove.variation(), f.off(y);
  10468. }, bind: { events: function events() {
  10469. m.is.page() && f.get(0).addEventListener("touchmove", m.event.preventScroll, { passive: !1 }), "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));
  10470. } }, unbind: { events: function events() {
  10471. m.is.page() && f.get(0).removeEventListener("touchmove", m.event.preventScroll, { passive: !1 }), S.removeData(x), f.off(y);
  10472. } }, event: { click: function click(t) {
  10473. 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());
  10474. }, preventScroll: function preventScroll(e) {
  10475. e.preventDefault();
  10476. } }, addContent: function addContent(t) {
  10477. var n = e(t);m.debug("Add content to dimmer", n), n.parent()[0] !== d[0] && n.detach().appendTo(d);
  10478. }, create: function create() {
  10479. var t = e(g.template.dimmer());return g.dimmerName && (m.debug("Creating named dimmer", g.dimmerName), t.addClass(g.dimmerName)), t.appendTo(f), t;
  10480. }, show: function show(t) {
  10481. 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));
  10482. }, hide: function hide(t) {
  10483. 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");
  10484. }, toggle: function toggle() {
  10485. m.verbose("Toggling dimmer visibility", d), m.is.dimmed() ? m.hide() : m.show();
  10486. }, animate: { show: function show(t) {
  10487. t = e.isFunction(t) ? t : function () {}, g.useCSS && e.fn.transition !== i && d.transition("is supported") ? ("auto" !== g.opacity && m.set.opacity(), d.transition({ displayType: "flex", animation: g.transition + " in", queue: !1, duration: m.get.duration(), useFailSafe: !0, onStart: function onStart() {
  10488. m.set.dimmed();
  10489. }, onComplete: function onComplete() {
  10490. m.set.active(), t();
  10491. } })) : (m.verbose("Showing dimmer animation with javascript"), m.set.dimmed(), "auto" == g.opacity && (g.opacity = .8), d.stop().css({ opacity: 0, width: "100%", height: "100%" }).fadeTo(m.get.duration(), g.opacity, function () {
  10492. d.removeAttr("style"), m.set.active(), t();
  10493. }));
  10494. }, hide: function hide(t) {
  10495. t = e.isFunction(t) ? t : function () {}, g.useCSS && e.fn.transition !== i && d.transition("is supported") ? (m.verbose("Hiding dimmer with css"), d.transition({ displayType: "flex", animation: g.transition + " out", queue: !1, duration: m.get.duration(), useFailSafe: !0, onStart: function onStart() {
  10496. m.remove.dimmed();
  10497. }, onComplete: function onComplete() {
  10498. m.remove.active(), t();
  10499. } })) : (m.verbose("Hiding dimmer with javascript"), m.remove.dimmed(), d.stop().fadeOut(m.get.duration(), function () {
  10500. m.remove.active(), d.removeAttr("style"), t();
  10501. }));
  10502. } }, get: { dimmer: function dimmer() {
  10503. return d;
  10504. }, duration: function duration() {
  10505. return "object" == _typeof(g.duration) ? m.is.active() ? g.duration.hide : g.duration.show : g.duration;
  10506. } }, has: { dimmer: function dimmer() {
  10507. return g.dimmerName ? S.find(p.dimmer).filter("." + g.dimmerName).length > 0 : S.find(p.dimmer).length > 0;
  10508. } }, is: { active: function active() {
  10509. return d.hasClass(v.active);
  10510. }, animating: function animating() {
  10511. return d.is(":animated") || d.hasClass(v.animating);
  10512. }, closable: function closable() {
  10513. return "auto" == g.closable ? "hover" != g.on : g.closable;
  10514. }, dimmer: function dimmer() {
  10515. return S.hasClass(v.dimmer);
  10516. }, dimmable: function dimmable() {
  10517. return S.hasClass(v.dimmable);
  10518. }, dimmed: function dimmed() {
  10519. return f.hasClass(v.dimmed);
  10520. }, disabled: function disabled() {
  10521. return f.hasClass(v.disabled);
  10522. }, enabled: function enabled() {
  10523. return !m.is.disabled();
  10524. }, page: function page() {
  10525. return f.is("body");
  10526. }, pageDimmer: function pageDimmer() {
  10527. return d.hasClass(v.pageDimmer);
  10528. } }, can: { show: function show() {
  10529. return !d.hasClass(v.disabled);
  10530. } }, set: { opacity: function opacity(e) {
  10531. var t = d.css("background-color"),
  10532. n = t.split(","),
  10533. i = n && 3 == n.length,
  10534. o = n && 4 == n.length;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);
  10535. }, active: function active() {
  10536. d.addClass(v.active);
  10537. }, dimmable: function dimmable() {
  10538. f.addClass(v.dimmable);
  10539. }, dimmed: function dimmed() {
  10540. f.addClass(v.dimmed);
  10541. }, pageDimmer: function pageDimmer() {
  10542. d.addClass(v.pageDimmer);
  10543. }, disabled: function disabled() {
  10544. d.addClass(v.disabled);
  10545. }, variation: function variation(e) {
  10546. (e = e || g.variation) && d.addClass(e);
  10547. } }, remove: { active: function active() {
  10548. d.removeClass(v.active);
  10549. }, dimmed: function dimmed() {
  10550. f.removeClass(v.dimmed);
  10551. }, disabled: function disabled() {
  10552. d.removeClass(v.disabled);
  10553. }, variation: function variation(e) {
  10554. (e = e || g.variation) && d.removeClass(e);
  10555. } }, setting: function setting(t, n) {
  10556. if (m.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, g, t);else {
  10557. if (n === i) return g[t];e.isPlainObject(g[t]) ? e.extend(!0, g[t], n) : g[t] = n;
  10558. }
  10559. }, internal: function internal(t, n) {
  10560. if (e.isPlainObject(t)) e.extend(!0, m, t);else {
  10561. if (n === i) return m[t];m[t] = n;
  10562. }
  10563. }, debug: function debug() {
  10564. !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)));
  10565. }, verbose: function verbose() {
  10566. !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)));
  10567. }, error: function error() {
  10568. g.silent || (m.error = Function.prototype.bind.call(console.error, console, g.name + ":"), m.error.apply(console, arguments));
  10569. }, performance: { log: function log(e) {
  10570. var t, n;g.performance && (n = (t = new Date().getTime()) - (r || t), r = t, s.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: k, "Execution Time": n })), clearTimeout(m.performance.timer), m.performance.timer = setTimeout(m.performance.display, 500);
  10571. }, display: function display() {
  10572. var t = g.name + ":",
  10573. n = 0;r = !1, clearTimeout(m.performance.timer), e.each(s, function (e, t) {
  10574. n += t["Execution Time"];
  10575. }), 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) {
  10576. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  10577. }), console.groupEnd()), s = [];
  10578. } }, invoke: function invoke(t, n, a) {
  10579. var r,
  10580. s,
  10581. l,
  10582. c = T;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) {
  10583. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  10584. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (m.error(b.method, t), !1);c = c[o];
  10585. }
  10586. })), 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;
  10587. } }).preinitialize(), c ? (T === i && m.initialize(), m.invoke(l)) : (T !== i && T.invoke("destroy"), m.initialize());
  10588. }), o !== i ? o : this;
  10589. }, e.fn.dimmer.settings = { name: "Dimmer", namespace: "dimmer", silent: !1, debug: !1, verbose: !1, performance: !0, dimmerName: !1, variation: !1, closable: "auto", useCSS: !0, transition: "fade", on: !1, opacity: "auto", duration: { show: 500, hide: 500 }, onChange: function onChange() {}, onShow: function onShow() {}, onHide: function onHide() {}, error: { method: "The method you called is not defined." }, className: { active: "active", animating: "animating", dimmable: "dimmable", dimmed: "dimmed", dimmer: "dimmer", disabled: "disabled", hide: "hide", pageDimmer: "page", show: "show" }, selector: { dimmer: "> .ui.dimmer", content: ".ui.dimmer > .content, .ui.dimmer > .content > .center" }, template: { dimmer: function dimmer() {
  10590. return e("<div />").attr("class", "ui dimmer");
  10591. } } };
  10592. }(jQuery, window, document), function (e, t, n, i) {
  10593. "use strict";
  10594. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.dropdown = function (o) {
  10595. var a,
  10596. r = e(this),
  10597. s = e(n),
  10598. l = r.selector || "",
  10599. c = "ontouchstart" in n.documentElement,
  10600. u = new Date().getTime(),
  10601. d = [],
  10602. f = arguments[0],
  10603. m = "string" == typeof f,
  10604. g = [].slice.call(arguments, 1);return r.each(function (p) {
  10605. var h,
  10606. v,
  10607. b,
  10608. y,
  10609. x,
  10610. C,
  10611. w,
  10612. S,
  10613. k = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.dropdown.settings, o) : e.extend({}, e.fn.dropdown.settings),
  10614. T = k.className,
  10615. A = k.message,
  10616. R = k.fields,
  10617. P = k.keys,
  10618. E = k.metadata,
  10619. F = k.namespace,
  10620. O = k.regExp,
  10621. D = k.selector,
  10622. q = k.error,
  10623. j = k.templates,
  10624. z = "." + F,
  10625. I = "module-" + F,
  10626. M = e(this),
  10627. L = e(k.context),
  10628. V = M.find(D.text),
  10629. N = M.find(D.search),
  10630. H = M.find(D.sizer),
  10631. U = M.find(D.input),
  10632. W = M.find(D.icon),
  10633. B = M.prev().find(D.text).length > 0 ? M.prev().find(D.text) : M.prev(),
  10634. Q = M.children(D.menu),
  10635. X = Q.find(D.item),
  10636. $ = !1,
  10637. Y = !1,
  10638. Z = !1,
  10639. K = this,
  10640. J = M.data(I);S = { initialize: function initialize() {
  10641. 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());
  10642. }, instantiate: function instantiate() {
  10643. S.verbose("Storing instance of dropdown", S), J = S, M.data(I, S);
  10644. }, destroy: function destroy() {
  10645. 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();
  10646. }, observeChanges: function observeChanges() {
  10647. "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());
  10648. }, disconnect: { menuObserver: function menuObserver() {
  10649. w && w.disconnect();
  10650. }, selectObserver: function selectObserver() {
  10651. C && C.disconnect();
  10652. } }, observe: { select: function select() {
  10653. S.has.input() && C.observe(M[0], { childList: !0, subtree: !0 });
  10654. }, menu: function menu() {
  10655. S.has.menu() && w.observe(Q[0], { childList: !0, subtree: !0 });
  10656. } }, create: { id: function id() {
  10657. x = (Math.random().toString(16) + "000000000").substr(2, 8), y = "." + x, S.verbose("Creating unique id for element", x);
  10658. }, userChoice: function userChoice(t) {
  10659. var n, o, a;return !!(t = t || S.get.userValues()) && (t = e.isArray(t) ? t : [t], e.each(t, function (t, r) {
  10660. !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));
  10661. }), n);
  10662. }, userLabels: function userLabels(t) {
  10663. var n = S.get.userValues();n && (S.debug("Adding user labels", n), e.each(n, function (e, t) {
  10664. S.verbose("Adding custom user value"), S.add.label(t, t);
  10665. }));
  10666. }, menu: function menu() {
  10667. Q = e("<div />").addClass(T.menu).appendTo(M);
  10668. }, sizer: function sizer() {
  10669. H = e("<span />").addClass(T.sizer).insertAfter(N);
  10670. } }, search: function search(e) {
  10671. e = e !== i ? e : S.get.query(), S.verbose("Searching for query", e), S.has.minCharacters(e) ? S.filter(e) : S.hide();
  10672. }, select: { firstUnfiltered: function firstUnfiltered() {
  10673. S.verbose("Selecting first non-filtered element"), S.remove.selectedItem(), X.not(D.unselectable).not(D.addition + D.hidden).eq(0).addClass(T.selected);
  10674. }, nextAvailable: function nextAvailable(e) {
  10675. var t = (e = e.eq(0)).nextAll(D.item).not(D.unselectable).eq(0),
  10676. n = e.prevAll(D.item).not(D.unselectable).eq(0);t.length > 0 ? (S.verbose("Moving selection to", t), t.addClass(T.selected)) : (S.verbose("Moving selection to", n), n.addClass(T.selected));
  10677. } }, setup: { api: function api() {
  10678. var e = { debug: k.debug, urlData: { value: S.get.value(), query: S.get.query() }, on: !1 };S.verbose("First request, initializing API"), M.api(e);
  10679. }, layout: function layout() {
  10680. 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();
  10681. }, select: function select() {
  10682. var t = S.get.selectValues();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();
  10683. }, menu: function menu(e) {
  10684. Q.html(j.menu(e, R)), X = Q.find(D.item);
  10685. }, reference: function reference() {
  10686. 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();
  10687. }, returnedObject: function returnedObject() {
  10688. var e = r.slice(0, p),
  10689. t = r.slice(p + 1);r = e.add(M).add(t);
  10690. } }, refresh: function refresh() {
  10691. S.refreshSelectors(), S.refreshData();
  10692. }, refreshItems: function refreshItems() {
  10693. X = Q.find(D.item);
  10694. }, refreshSelectors: function refreshSelectors() {
  10695. 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);
  10696. }, refreshData: function refreshData() {
  10697. S.verbose("Refreshing cached metadata"), X.removeData(E.text).removeData(E.value);
  10698. }, clearData: function clearData() {
  10699. S.verbose("Clearing metadata"), X.removeData(E.text).removeData(E.value), M.removeData(E.defaultText).removeData(E.defaultValue).removeData(E.placeholderText);
  10700. }, toggle: function toggle() {
  10701. S.verbose("Toggling menu visibility"), S.is.active() ? S.hide() : S.show();
  10702. }, show: function show(t) {
  10703. 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()) {
  10704. if (S.debug("Showing dropdown"), !S.has.message() || S.has.maxSelections() || S.has.allResultsFiltered() || S.remove.message(), S.is.allFiltered()) return !0;!1 !== k.onShow.call(K) && S.animate.show(function () {
  10705. S.can.click() && S.bind.intent(), S.has.menuSearch() && S.focusSearch(), S.set.visible(), t.call(K);
  10706. });
  10707. }
  10708. }, hide: function hide(t) {
  10709. 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 () {
  10710. S.remove.visible(), t.call(K);
  10711. }));
  10712. }, hideOthers: function hideOthers() {
  10713. S.verbose("Finding other dropdowns to hide"), r.not(M).has(D.menu + "." + T.visible).dropdown("hide");
  10714. }, hideMenu: function hideMenu() {
  10715. S.verbose("Hiding menu instantaneously"), S.remove.active(), S.remove.visible(), Q.transition("hide");
  10716. }, hideSubMenus: function hideSubMenus() {
  10717. var e = Q.children(D.item).find(D.menu);S.verbose("Hiding sub menus", e), e.transition("hide");
  10718. }, bind: { events: function events() {
  10719. c && S.bind.touchEvents(), S.bind.keyboardEvents(), S.bind.inputEvents(), S.bind.mouseEvents();
  10720. }, touchEvents: function touchEvents() {
  10721. 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);
  10722. }, keyboardEvents: function keyboardEvents() {
  10723. 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);
  10724. }, inputEvents: function inputEvents() {
  10725. S.verbose("Binding input change events"), M.on("change" + z, D.input, S.event.change);
  10726. }, mouseEvents: function mouseEvents() {
  10727. 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);
  10728. }, intent: function intent() {
  10729. 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);
  10730. } }, unbind: { intent: function intent() {
  10731. S.verbose("Removing hide intent event from document"), c && s.off("touchstart" + y).off("touchmove" + y), s.off("click" + y);
  10732. } }, filter: function filter(e) {
  10733. var t = e !== i ? e : S.get.query(),
  10734. n = function n() {
  10735. 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();
  10736. };k.useLabels && S.has.maxSelections() || (k.apiSettings ? S.can.useAPI() ? S.queryRemote(t, function () {
  10737. k.filterRemoteData && S.filterItems(t), n();
  10738. }) : S.error(q.noAPI) : (S.filterItems(t), n()));
  10739. }, queryRemote: function queryRemote(t, n) {
  10740. var i = { errorDuration: !1, cache: "local", throttle: k.throttle, urlData: { query: t }, onError: function onError() {
  10741. S.add.message(A.serverError), n();
  10742. }, onFailure: function onFailure() {
  10743. S.add.message(A.serverError), n();
  10744. }, onSuccess: function onSuccess(t) {
  10745. var i = t[R.remoteValues];e.isArray(i) && i.length > 0 ? (S.remove.message(), S.setup.menu({ values: t[R.remoteValues] })) : S.add.message(A.noResults), n();
  10746. } };M.api("get request") || S.setup.api(), i = e.extend(!0, {}, i, k.apiSettings), M.api("setting", i).api("query");
  10747. }, filterItems: function filterItems(t) {
  10748. var n = t !== i ? t : S.get.query(),
  10749. o = null,
  10750. a = S.escape.string(n),
  10751. r = new RegExp("^" + a, "igm");S.has.query() && (o = [], S.verbose("Searching for matching values", n), X.each(function () {
  10752. var t,
  10753. i,
  10754. a = e(this);if ("both" == k.match || "text" == k.match) {
  10755. if (-1 !== (t = String(S.get.choiceText(a, !1))).search(r)) return o.push(this), !0;if ("exact" === k.fullTextSearch && S.exactSearch(n, t)) return o.push(this), !0;if (!0 === k.fullTextSearch && S.fuzzySearch(n, t)) return o.push(this), !0;
  10756. }if ("both" == k.match || "value" == k.match) {
  10757. if (-1 !== (i = String(S.get.choiceValue(a, t))).search(r)) return o.push(this), !0;if ("exact" === k.fullTextSearch && S.exactSearch(n, i)) return o.push(this), !0;if (!0 === k.fullTextSearch && S.fuzzySearch(n, i)) return o.push(this), !0;
  10758. }
  10759. })), S.debug("Showing only matched items", n), S.remove.filteredItem(), o && X.not(o).addClass(T.filtered);
  10760. }, fuzzySearch: function fuzzySearch(e, t) {
  10761. var n = t.length,
  10762. i = e.length;if (e = e.toLowerCase(), t = t.toLowerCase(), i > n) return !1;if (i === n) return e === t;e: for (var o = 0, a = 0; o < i; o++) {
  10763. for (var r = e.charCodeAt(o); a < n;) {
  10764. if (t.charCodeAt(a++) === r) continue e;
  10765. }return !1;
  10766. }return !0;
  10767. }, exactSearch: function exactSearch(e, t) {
  10768. return e = e.toLowerCase(), (t = t.toLowerCase()).indexOf(e) > -1;
  10769. }, filterActive: function filterActive() {
  10770. k.useLabels && X.filter("." + T.active).addClass(T.filtered);
  10771. }, focusSearch: function focusSearch(e) {
  10772. 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());
  10773. }, forceSelection: function forceSelection() {
  10774. var e = X.not(T.filtered).filter("." + T.selected).eq(0),
  10775. t = X.not(T.filtered).filter("." + T.active).eq(0),
  10776. n = e.length > 0 ? e : t;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);k.allowAdditions ? (S.set.selected(S.get.query()), S.remove.searchTerm()) : S.remove.searchTerm();
  10777. }, change: { values: function values(t) {
  10778. k.allowAdditions || S.clear(), S.debug("Creating dropdown with specified values", t), S.setup.menu({ values: t }), e.each(t, function (e, t) {
  10779. if (1 == t.selected) return S.debug("Setting initial selection to", t.value), S.set.selected(t.value), !0;
  10780. });
  10781. } }, event: { change: function change() {
  10782. Z || (S.debug("Input changed, updating selection"), S.set.selected());
  10783. }, focus: function focus() {
  10784. k.showOnFocus && !$ && S.is.hidden() && !v && S.show();
  10785. }, blur: function blur(e) {
  10786. v = n.activeElement === this, $ || v || (S.remove.activeLabel(), S.hide());
  10787. }, mousedown: function mousedown() {
  10788. S.is.searchSelection() ? b = !0 : $ = !0;
  10789. }, mouseup: function mouseup() {
  10790. S.is.searchSelection() ? b = !1 : $ = !1;
  10791. }, click: function click(t) {
  10792. e(t.target).is(M) && (S.is.focusedOnSearch() ? S.show() : S.focusSearch());
  10793. }, search: { focus: function focus() {
  10794. $ = !0, S.is.multiple() && S.remove.activeLabel(), k.showOnFocus && S.search();
  10795. }, blur: function blur(e) {
  10796. v = n.activeElement === this, S.is.searchSelection() && !b && (Y || v || (k.forceSelection && S.forceSelection(), S.hide())), b = !1;
  10797. } }, icon: { click: function click(e) {
  10798. S.toggle();
  10799. } }, text: { focus: function focus(e) {
  10800. $ = !0, S.focusSearch();
  10801. } }, input: function input(e) {
  10802. (S.is.multiple() || S.is.searchSelection()) && S.set.filtered(), clearTimeout(S.timer), S.timer = setTimeout(S.search, k.delay.search);
  10803. }, label: { click: function click(t) {
  10804. var n = e(this),
  10805. i = M.find(D.label),
  10806. o = i.filter("." + T.active),
  10807. a = n.nextAll("." + T.active),
  10808. r = n.prevAll("." + T.active),
  10809. s = a.length > 0 ? n.nextUntil(a).add(o).add(n) : n.prevUntil(r).add(o).add(n);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));
  10810. } }, remove: { click: function click() {
  10811. var t = e(this).parent();t.hasClass(T.active) ? S.remove.activeLabels() : S.remove.activeLabels(t);
  10812. } }, test: { toggle: function toggle(e) {
  10813. var t = S.is.multiple() ? S.show : S.toggle;S.is.bubbledLabelClick(e) || S.is.bubbledIconClick(e) || S.determine.eventOnElement(e, t) && e.preventDefault();
  10814. }, touch: function touch(e) {
  10815. S.determine.eventOnElement(e, function () {
  10816. "touchstart" == e.type ? S.timer = setTimeout(function () {
  10817. S.hide();
  10818. }, k.delay.touch) : "touchmove" == e.type && clearTimeout(S.timer);
  10819. }), e.stopPropagation();
  10820. }, hide: function hide(e) {
  10821. S.determine.eventInModule(e, S.hide);
  10822. } }, select: { mutation: function mutation(t) {
  10823. S.debug("<select> modified, recreating menu");var n = !1;e.each(t, function (t, i) {
  10824. if (e(i.target).is("select") || e(i.addedNodes).is("select")) return n = !0, !0;
  10825. }), n && (S.disconnect.selectObserver(), S.refresh(), S.setup.select(), S.set.selected(), S.observe.select());
  10826. } }, menu: { mutation: function mutation(t) {
  10827. var n = t[0],
  10828. i = n.addedNodes ? e(n.addedNodes[0]) : e(!1),
  10829. o = n.removedNodes ? e(n.removedNodes[0]) : e(!1),
  10830. a = i.add(o),
  10831. r = a.is(D.addition) || a.closest(D.addition).length > 0,
  10832. s = a.is(D.message) || a.closest(D.message).length > 0;r || s ? (S.debug("Updating item selector cache"), S.refreshItems()) : (S.debug("Menu modified, updating selector cache"), S.refresh());
  10833. }, mousedown: function mousedown() {
  10834. Y = !0;
  10835. }, mouseup: function mouseup() {
  10836. Y = !1;
  10837. } }, item: { mouseenter: function mouseenter(t) {
  10838. var n = e(t.target),
  10839. i = e(this),
  10840. o = i.children(D.menu),
  10841. a = i.siblings(D.item).children(D.menu),
  10842. r = o.length > 0;!(o.find(n).length > 0) && r && (clearTimeout(S.itemTimer), S.itemTimer = setTimeout(function () {
  10843. S.verbose("Showing sub-menu", o), e.each(a, function () {
  10844. S.animate.hide(!1, e(this));
  10845. }), S.animate.show(!1, o);
  10846. }, k.delay.show), t.preventDefault());
  10847. }, mouseleave: function mouseleave(t) {
  10848. var n = e(this).children(D.menu);n.length > 0 && (clearTimeout(S.itemTimer), S.itemTimer = setTimeout(function () {
  10849. S.verbose("Hiding sub-menu", n), S.animate.hide(!1, n);
  10850. }, k.delay.hide));
  10851. }, click: function click(t, i) {
  10852. var o = e(this),
  10853. a = e(t ? t.target : ""),
  10854. r = o.find(D.menu),
  10855. s = S.get.choiceText(o),
  10856. l = S.get.choiceValue(o, s),
  10857. c = r.length > 0,
  10858. u = r.find(a).length > 0;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));
  10859. } }, document: { keydown: function keydown(e) {
  10860. var t = e.which;if (S.is.inObject(t, P)) {
  10861. var n = M.find(D.label),
  10862. i = n.filter("." + T.active),
  10863. o = (i.data(E.value), n.index(i)),
  10864. a = n.length,
  10865. r = i.length > 0,
  10866. s = i.length > 1,
  10867. l = 0 === o,
  10868. c = o + 1 == a,
  10869. u = S.is.searchSelection(),
  10870. d = S.is.focusedOnSearch(),
  10871. f = S.is.focused(),
  10872. m = d && 0 === S.get.caretPosition();if (u && !r && !d) return;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);
  10873. }
  10874. } }, keydown: function keydown(e) {
  10875. var t = e.which;if (S.is.inObject(t, P)) {
  10876. var n,
  10877. i = X.not(D.unselectable).filter("." + T.selected).eq(0),
  10878. o = Q.children("." + T.active).eq(0),
  10879. a = i.length > 0 ? i : o,
  10880. r = a.length > 0 ? a.siblings(":not(." + T.filtered + ")").addBack() : Q.children(":not(." + T.filtered + ")"),
  10881. s = a.children(D.menu),
  10882. l = a.closest(D.menu),
  10883. c = l.hasClass(T.visible) || l.hasClass(T.animating) || l.parent(D.menu).length > 0,
  10884. u = s.length > 0,
  10885. d = a.length > 0,
  10886. f = a.not(D.unselectable).length > 0,
  10887. m = t == P.delimiter && k.allowAdditions && S.is.multiple();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()) {
  10888. 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) {
  10889. 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();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();
  10890. }if (t == P.downArrow) {
  10891. 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();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();
  10892. }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());
  10893. } else m && e.preventDefault(), t != P.downArrow || S.is.visible() || (S.verbose("Down key pressed, showing dropdown"), S.show(), e.preventDefault());
  10894. } else S.has.search() || S.set.selectedLetter(String.fromCharCode(t));
  10895. } }, trigger: { change: function change() {
  10896. var e = n.createEvent("HTMLEvents"),
  10897. t = U[0];t && (S.verbose("Triggering native change event"), e.initEvent("change", !0, !1), t.dispatchEvent(e));
  10898. } }, determine: { selectAction: function selectAction(t, n) {
  10899. 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);
  10900. }, eventInModule: function eventInModule(t, i) {
  10901. var o = e(t.target),
  10902. a = o.closest(n.documentElement).length > 0,
  10903. r = o.closest(M).length > 0;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);
  10904. }, eventOnElement: function eventOnElement(t, i) {
  10905. var o = e(t.target),
  10906. a = o.closest(D.siblingLabel),
  10907. r = n.body.contains(t.target),
  10908. s = 0 === M.find(a).length,
  10909. l = 0 === o.closest(Q).length;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);
  10910. } }, action: { nothing: function nothing() {}, activate: function activate(t, n, o) {
  10911. if (n = n !== i ? n : t, S.can.activate(e(o))) {
  10912. if (S.set.selected(n, e(o)), S.is.multiple() && !S.is.allFiltered()) return;S.hideAndClear();
  10913. }
  10914. }, select: function select(t, n, o) {
  10915. if (n = n !== i ? n : t, S.can.activate(e(o))) {
  10916. if (S.set.value(n, t, e(o)), S.is.multiple() && !S.is.allFiltered()) return;S.hideAndClear();
  10917. }
  10918. }, combo: function combo(t, n, o) {
  10919. n = n !== i ? n : t, S.set.selected(n, e(o)), S.hideAndClear();
  10920. }, hide: function hide(e, t, n) {
  10921. S.set.value(t, e), S.hideAndClear();
  10922. } }, get: { id: function id() {
  10923. return x;
  10924. }, defaultText: function defaultText() {
  10925. return M.data(E.defaultText);
  10926. }, defaultValue: function defaultValue() {
  10927. return M.data(E.defaultValue);
  10928. }, placeholderText: function placeholderText() {
  10929. return "auto" != k.placeholder && "string" == typeof k.placeholder ? k.placeholder : M.data(E.placeholderText) || "";
  10930. }, text: function text() {
  10931. return V.text();
  10932. }, query: function query() {
  10933. return e.trim(N.val());
  10934. }, searchWidth: function searchWidth(e) {
  10935. return e = e !== i ? e : N.val(), H.text(e), Math.ceil(H.width() + 1);
  10936. }, selectionCount: function selectionCount() {
  10937. var t = S.get.values();return S.is.multiple() ? e.isArray(t) ? t.length : 0 : "" !== S.get.value() ? 1 : 0;
  10938. }, transition: function transition(e) {
  10939. return "auto" == k.transition ? S.is.upward(e) ? "slide up" : "slide down" : k.transition;
  10940. }, userValues: function userValues() {
  10941. var t = S.get.values();return !!t && (t = e.isArray(t) ? t : [t], e.grep(t, function (e) {
  10942. return !1 === S.get.item(e);
  10943. }));
  10944. }, uniqueArray: function uniqueArray(t) {
  10945. return e.grep(t, function (n, i) {
  10946. return e.inArray(n, t) === i;
  10947. });
  10948. }, caretPosition: function caretPosition() {
  10949. var e,
  10950. t,
  10951. i = N.get(0);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;
  10952. }, value: function value() {
  10953. var t = U.length > 0 ? U.val() : M.data(E.value),
  10954. n = e.isArray(t) && 1 === t.length && "" === t[0];return t === i || n ? "" : t;
  10955. }, values: function values() {
  10956. var e = S.get.value();return "" === e ? "" : !S.has.selectInput() && S.is.multiple() ? "string" == typeof e ? e.split(k.delimiter) : "" : e;
  10957. }, remoteValues: function remoteValues() {
  10958. var t = S.get.values(),
  10959. n = !1;return t && ("string" == typeof t && (t = [t]), e.each(t, function (e, t) {
  10960. var i = S.read.remoteData(t);S.verbose("Restoring value from session data", i, t), i && (n || (n = {}), n[t] = i);
  10961. })), n;
  10962. }, choiceText: function choiceText(t, n) {
  10963. 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());
  10964. }, choiceValue: function choiceValue(t, n) {
  10965. 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));
  10966. }, inputEvent: function inputEvent() {
  10967. var e = N[0];return !!e && (e.oninput !== i ? "input" : e.onpropertychange !== i ? "propertychange" : "keyup");
  10968. }, selectValues: function selectValues() {
  10969. var t = { values: [] };return M.find("option").each(function () {
  10970. var n = e(this),
  10971. o = n.html(),
  10972. a = n.attr("disabled"),
  10973. r = n.attr("value") !== i ? n.attr("value") : o;"auto" === k.placeholder && "" === r ? t.placeholder = o : t.values.push({ name: o, value: r, disabled: a });
  10974. }), 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) {
  10975. return e.name > t.name ? 1 : -1;
  10976. }), S.debug("Retrieved and sorted values from select", t)) : S.debug("Retrieved values from select", t), t;
  10977. }, activeItem: function activeItem() {
  10978. return X.filter("." + T.active);
  10979. }, selectedItem: function selectedItem() {
  10980. var e = X.not(D.unselectable).filter("." + T.selected);return e.length > 0 ? e : X.eq(0);
  10981. }, itemWithAdditions: function itemWithAdditions(e) {
  10982. var t = S.get.item(e),
  10983. n = S.create.userChoice(e);return n && n.length > 0 && (t = t.length > 0 ? t.add(n) : n), t;
  10984. }, item: function item(t, n) {
  10985. var o,
  10986. a,
  10987. r = !1;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 () {
  10988. var o = e(this),
  10989. s = S.get.choiceText(o),
  10990. l = S.get.choiceValue(o, s);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) {
  10991. if (S.verbose("Ambiguous dropdown value using strict type check", o, t), l === t || s === t) return r = o, !0;
  10992. } else if (String(l) == String(t) || s == t) return S.verbose("Found select item by value", l, t), r = o, !0;
  10993. }), r;
  10994. } }, check: { maxSelections: function maxSelections(e) {
  10995. 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));
  10996. } }, restore: { defaults: function defaults() {
  10997. S.clear(), S.restore.defaultText(), S.restore.defaultValue();
  10998. }, defaultText: function defaultText() {
  10999. var e = S.get.defaultText();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));
  11000. }, placeholderText: function placeholderText() {
  11001. S.set.placeholderText();
  11002. }, defaultValue: function defaultValue() {
  11003. var e = S.get.defaultValue();e !== i && (S.debug("Restoring default value", e), "" !== e ? (S.set.value(e), S.set.selected()) : (S.remove.activeItem(), S.remove.selectedItem()));
  11004. }, labels: function labels() {
  11005. k.allowAdditions && (k.useLabels || (S.error(q.labels), k.useLabels = !0), S.debug("Restoring selected values"), S.create.userLabels()), S.check.maxSelections();
  11006. }, selected: function selected() {
  11007. S.restore.values(), S.is.multiple() ? (S.debug("Restoring previously selected values and labels"), S.restore.labels()) : S.debug("Restoring previously selected values");
  11008. }, values: function values() {
  11009. S.set.initialLoad(), k.apiSettings && k.saveRemoteData && S.get.remoteValues() ? S.restore.remoteValues() : S.set.selected(), S.remove.initialLoad();
  11010. }, remoteValues: function remoteValues() {
  11011. var t = S.get.remoteValues();S.debug("Recreating selected from session data", t), t && (S.is.single() ? e.each(t, function (e, t) {
  11012. S.set.text(t);
  11013. }) : e.each(t, function (e, t) {
  11014. S.add.label(e, t);
  11015. }));
  11016. } }, read: { remoteData: function remoteData(e) {
  11017. var n;if (t.Storage !== i) return (n = sessionStorage.getItem(e)) !== i && n;S.error(q.noStorage);
  11018. } }, save: { defaults: function defaults() {
  11019. S.save.defaultText(), S.save.placeholderText(), S.save.defaultValue();
  11020. }, defaultValue: function defaultValue() {
  11021. var e = S.get.value();S.verbose("Saving default value as", e), M.data(E.defaultValue, e);
  11022. }, defaultText: function defaultText() {
  11023. var e = S.get.text();S.verbose("Saving default text as", e), M.data(E.defaultText, e);
  11024. }, placeholderText: function placeholderText() {
  11025. var e;!1 !== k.placeholder && V.hasClass(T.placeholder) && (e = S.get.text(), S.verbose("Saving placeholder text as", e), M.data(E.placeholderText, e));
  11026. }, remoteData: function remoteData(e, n) {
  11027. t.Storage !== i ? (S.verbose("Saving remote data to session storage", n, e), sessionStorage.setItem(n, e)) : S.error(q.noStorage);
  11028. } }, clear: function clear() {
  11029. S.is.multiple() && k.useLabels ? S.remove.labels() : (S.remove.activeItem(), S.remove.selectedItem()), S.set.placeholderText(), S.clearValue();
  11030. }, clearValue: function clearValue() {
  11031. S.set.value("");
  11032. }, scrollPage: function scrollPage(e, t) {
  11033. var n,
  11034. i,
  11035. o = t || S.get.selectedItem(),
  11036. a = o.closest(D.menu),
  11037. r = a.outerHeight(),
  11038. s = a.scrollTop(),
  11039. l = X.eq(0).outerHeight(),
  11040. c = Math.floor(r / l),
  11041. u = (a.prop("scrollHeight"), "up" == e ? s - l * c : s + l * c),
  11042. d = X.not(D.unselectable);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));
  11043. }, set: { filtered: function filtered() {
  11044. var e = S.is.multiple(),
  11045. t = S.is.searchSelection(),
  11046. n = e && t,
  11047. i = t ? S.get.query() : "",
  11048. o = "string" == typeof i && i.length > 0,
  11049. a = S.get.searchWidth(),
  11050. r = "" !== i;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));
  11051. }, empty: function empty() {
  11052. M.addClass(T.empty);
  11053. }, loading: function loading() {
  11054. M.addClass(T.loading);
  11055. }, placeholderText: function placeholderText(e) {
  11056. e = e || S.get.placeholderText(), S.debug("Setting placeholder text", e), S.set.text(e), V.addClass(T.placeholder);
  11057. }, tabbable: function tabbable() {
  11058. 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)));
  11059. }, initialLoad: function initialLoad() {
  11060. S.verbose("Setting initial load"), h = !0;
  11061. }, activeItem: function activeItem(e) {
  11062. k.allowAdditions && e.filter(D.addition).length > 0 ? e.addClass(T.filtered) : e.addClass(T.active);
  11063. }, partialSearch: function partialSearch(e) {
  11064. var t = S.get.query().length;N.val(e.substr(0, t));
  11065. }, scrollPosition: function scrollPosition(e, t) {
  11066. var n, o, a, r, s, l;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));
  11067. }, text: function text(e) {
  11068. "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)));
  11069. }, selectedItem: function selectedItem(e) {
  11070. var t = S.get.choiceValue(e),
  11071. n = S.get.choiceText(e, !1),
  11072. i = S.get.choiceText(e, !0);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);
  11073. }, selectedLetter: function selectedLetter(t) {
  11074. var n,
  11075. i = X.filter("." + T.selected),
  11076. o = !1;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 () {
  11077. if (S.has.firstLetter(e(this), t)) return o = e(this), !1;
  11078. }), 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));
  11079. }, direction: function direction(e) {
  11080. "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);
  11081. }, upward: function upward(e) {
  11082. (e || M).addClass(T.upward);
  11083. }, leftward: function leftward(e) {
  11084. (e || Q).addClass(T.leftward);
  11085. }, value: function value(e, t, n) {
  11086. var o = S.escape.value(e),
  11087. a = U.length > 0,
  11088. r = S.get.values(),
  11089. s = e !== i ? String(e) : e;if (a) {
  11090. if (!k.allowReselection && s == r && (S.verbose("Skipping value update already same value", e, r), !S.is.initialLoad())) return;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;
  11091. } else S.verbose("Storing value in metadata", o, U), o !== r && M.data(E.value, s);!1 === k.fireOnInit && S.is.initialLoad() ? S.verbose("No callback on initial load", k.onChange) : k.onChange.call(K, e, t, n);
  11092. }, active: function active() {
  11093. M.addClass(T.active);
  11094. }, multiple: function multiple() {
  11095. M.addClass(T.multiple);
  11096. }, visible: function visible() {
  11097. M.addClass(T.visible);
  11098. }, exactly: function exactly(e, t) {
  11099. S.debug("Setting selected to exact values"), S.clear(), S.set.selected(e, t);
  11100. }, selected: function selected(t, n) {
  11101. var i = S.is.multiple();(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 () {
  11102. var t = e(this),
  11103. o = S.get.choiceText(t),
  11104. a = S.get.choiceValue(t, o),
  11105. r = t.hasClass(T.filtered),
  11106. s = t.hasClass(T.active),
  11107. l = t.hasClass(T.addition),
  11108. c = i && 1 == n.length;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));
  11109. }));
  11110. } }, add: { label: function label(t, n, i) {
  11111. var o,
  11112. a = S.is.searchSelection() ? N : V,
  11113. r = S.escape.value(t);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)));
  11114. }, message: function message(t) {
  11115. var n = Q.children(D.message),
  11116. i = k.templates.message(S.add.variables(t));n.length > 0 ? n.html(i) : n = e("<div/>").html(i).addClass(T.message).appendTo(Q);
  11117. }, optionValue: function optionValue(t) {
  11118. var n = S.escape.value(t);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());
  11119. }, userSuggestion: function userSuggestion(e) {
  11120. var t,
  11121. n = Q.children(D.addition),
  11122. i = S.get.item(e),
  11123. o = i && i.not(D.addition).length,
  11124. a = n.length > 0;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()));
  11125. }, variables: function variables(e, t) {
  11126. var n,
  11127. i,
  11128. o = -1 !== e.search("{count}"),
  11129. a = -1 !== e.search("{maxCount}"),
  11130. r = -1 !== e.search("{term}");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;
  11131. }, value: function value(t, n, i) {
  11132. var o,
  11133. a = S.get.values();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");
  11134. } }, remove: { active: function active() {
  11135. M.removeClass(T.active);
  11136. }, activeLabel: function activeLabel() {
  11137. M.find(D.label).removeClass(T.active);
  11138. }, empty: function empty() {
  11139. M.removeClass(T.empty);
  11140. }, loading: function loading() {
  11141. M.removeClass(T.loading);
  11142. }, initialLoad: function initialLoad() {
  11143. h = !1;
  11144. }, upward: function upward(e) {
  11145. (e || M).removeClass(T.upward);
  11146. }, leftward: function leftward(e) {
  11147. (e || Q).removeClass(T.leftward);
  11148. }, visible: function visible() {
  11149. M.removeClass(T.visible);
  11150. }, activeItem: function activeItem() {
  11151. X.removeClass(T.active);
  11152. }, filteredItem: function filteredItem() {
  11153. k.useLabels && S.has.maxSelections() || (k.useLabels && S.is.multiple() ? X.not("." + T.active).removeClass(T.filtered) : X.removeClass(T.filtered), S.remove.empty());
  11154. }, optionValue: function optionValue(e) {
  11155. var t = S.escape.value(e),
  11156. n = U.find('option[value="' + S.escape.string(t) + '"]');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], { childList: !0, subtree: !0 }));
  11157. }, message: function message() {
  11158. Q.children(D.message).remove();
  11159. }, searchWidth: function searchWidth() {
  11160. N.css("width", "");
  11161. }, searchTerm: function searchTerm() {
  11162. S.verbose("Cleared search term"), N.val(""), S.set.filtered();
  11163. }, userAddition: function userAddition() {
  11164. X.filter(D.addition).remove();
  11165. }, selected: function selected(t, n) {
  11166. if (!(n = k.allowAdditions ? n || S.get.itemWithAdditions(t) : n || S.get.item(t))) return !1;n.each(function () {
  11167. var t = e(this),
  11168. n = S.get.choiceText(t),
  11169. i = S.get.choiceValue(t, n);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);
  11170. });
  11171. }, selectedItem: function selectedItem() {
  11172. X.removeClass(T.selected);
  11173. }, value: function value(e, t, n) {
  11174. var i,
  11175. o = S.get.values();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();
  11176. }, arrayValue: function arrayValue(t, n) {
  11177. return e.isArray(n) || (n = [n]), n = e.grep(n, function (e) {
  11178. return t != e;
  11179. }), S.verbose("Removed value from delimited string", t, n), n;
  11180. }, label: function label(e, t) {
  11181. var n = M.find(D.label).filter("[data-" + E.value + '="' + S.escape.string(e) + '"]');S.verbose("Removing label", n), n.remove();
  11182. }, activeLabels: function activeLabels(e) {
  11183. e = e || M.find(D.label).filter("." + T.active), S.verbose("Removing active label selections", e), S.remove.labels(e);
  11184. }, labels: function labels(t) {
  11185. t = t || M.find(D.label), S.verbose("Removing labels", t), t.each(function () {
  11186. var t = e(this),
  11187. n = t.data(E.value),
  11188. o = n !== i ? String(n) : n,
  11189. a = S.is.userValue(o);!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");
  11190. });
  11191. }, tabbable: function tabbable() {
  11192. 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"));
  11193. } }, has: { menuSearch: function menuSearch() {
  11194. return S.has.search() && N.closest(Q).length > 0;
  11195. }, search: function search() {
  11196. return N.length > 0;
  11197. }, sizer: function sizer() {
  11198. return H.length > 0;
  11199. }, selectInput: function selectInput() {
  11200. return U.is("select");
  11201. }, minCharacters: function minCharacters(e) {
  11202. return !k.minCharacters || (e = e !== i ? String(e) : String(S.get.query())).length >= k.minCharacters;
  11203. }, firstLetter: function firstLetter(e, t) {
  11204. var n;return !(!e || 0 === e.length || "string" != typeof t) && (n = S.get.choiceText(e, !1), (t = t.toLowerCase()) == String(n).charAt(0).toLowerCase());
  11205. }, input: function input() {
  11206. return U.length > 0;
  11207. }, items: function items() {
  11208. return X.length > 0;
  11209. }, menu: function menu() {
  11210. return Q.length > 0;
  11211. }, message: function message() {
  11212. return 0 !== Q.children(D.message).length;
  11213. }, label: function label(e) {
  11214. var t = S.escape.value(e),
  11215. n = M.find(D.label);return k.ignoreCase && (t = t.toLowerCase()), n.filter("[data-" + E.value + '="' + S.escape.string(t) + '"]').length > 0;
  11216. }, maxSelections: function maxSelections() {
  11217. return k.maxSelections && S.get.selectionCount() >= k.maxSelections;
  11218. }, allResultsFiltered: function allResultsFiltered() {
  11219. var e = X.not(D.addition);return e.filter(D.unselectable).length === e.length;
  11220. }, userSuggestion: function userSuggestion() {
  11221. return Q.children(D.addition).length > 0;
  11222. }, query: function query() {
  11223. return "" !== S.get.query();
  11224. }, value: function value(e) {
  11225. return k.ignoreCase ? S.has.valueIgnoringCase(e) : S.has.valueMatchingCase(e);
  11226. }, valueMatchingCase: function valueMatchingCase(t) {
  11227. var n = S.get.values();return !!(e.isArray(n) ? n && -1 !== e.inArray(t, n) : n == t);
  11228. }, valueIgnoringCase: function valueIgnoringCase(t) {
  11229. var n = S.get.values(),
  11230. i = !1;return e.isArray(n) || (n = [n]), e.each(n, function (e, n) {
  11231. if (String(t).toLowerCase() == String(n).toLowerCase()) return i = !0, !1;
  11232. }), i;
  11233. } }, is: { active: function active() {
  11234. return M.hasClass(T.active);
  11235. }, animatingInward: function animatingInward() {
  11236. return Q.transition("is inward");
  11237. }, animatingOutward: function animatingOutward() {
  11238. return Q.transition("is outward");
  11239. }, bubbledLabelClick: function bubbledLabelClick(t) {
  11240. return e(t.target).is("select, input") && M.closest("label").length > 0;
  11241. }, bubbledIconClick: function bubbledIconClick(t) {
  11242. return e(t.target).closest(W).length > 0;
  11243. }, alreadySetup: function alreadySetup() {
  11244. return M.is("select") && M.parent(D.dropdown).data(I) !== i && 0 === M.prev().length;
  11245. }, animating: function animating(e) {
  11246. return e ? e.transition && e.transition("is animating") : Q.transition && Q.transition("is animating");
  11247. }, leftward: function leftward(e) {
  11248. return (e || Q).hasClass(T.leftward);
  11249. }, disabled: function disabled() {
  11250. return M.hasClass(T.disabled);
  11251. }, focused: function focused() {
  11252. return n.activeElement === M[0];
  11253. }, focusedOnSearch: function focusedOnSearch() {
  11254. return n.activeElement === N[0];
  11255. }, allFiltered: function allFiltered() {
  11256. return (S.is.multiple() || S.has.search()) && !(0 == k.hideAdditions && S.has.userSuggestion()) && !S.has.message() && S.has.allResultsFiltered();
  11257. }, hidden: function hidden(e) {
  11258. return !S.is.visible(e);
  11259. }, initialLoad: function initialLoad() {
  11260. return h;
  11261. }, inObject: function inObject(t, n) {
  11262. var i = !1;return e.each(n, function (e, n) {
  11263. if (n == t) return i = !0, !0;
  11264. }), i;
  11265. }, multiple: function multiple() {
  11266. return M.hasClass(T.multiple);
  11267. }, remote: function remote() {
  11268. return k.apiSettings && S.can.useAPI();
  11269. }, single: function single() {
  11270. return !S.is.multiple();
  11271. }, selectMutation: function selectMutation(t) {
  11272. var n = !1;return e.each(t, function (t, i) {
  11273. if (i.target && e(i.target).is("select")) return n = !0, !0;
  11274. }), n;
  11275. }, search: function search() {
  11276. return M.hasClass(T.search);
  11277. }, searchSelection: function searchSelection() {
  11278. return S.has.search() && 1 === N.parent(D.dropdown).length;
  11279. }, selection: function selection() {
  11280. return M.hasClass(T.selection);
  11281. }, userValue: function userValue(t) {
  11282. return -1 !== e.inArray(t, S.get.userValues());
  11283. }, upward: function upward(e) {
  11284. return (e || M).hasClass(T.upward);
  11285. }, visible: function visible(e) {
  11286. return e ? e.hasClass(T.visible) : Q.hasClass(T.visible);
  11287. }, verticallyScrollableContext: function verticallyScrollableContext() {
  11288. var e = L.get(0) !== t && L.css("overflow-y");return "auto" == e || "scroll" == e;
  11289. }, horizontallyScrollableContext: function horizontallyScrollableContext() {
  11290. var e = L.get(0) !== t && L.css("overflow-X");return "auto" == e || "scroll" == e;
  11291. } }, can: { activate: function activate(e) {
  11292. return !!k.useLabels || !S.has.maxSelections() || !(!S.has.maxSelections() || !e.hasClass(T.active));
  11293. }, openDownward: function openDownward(e) {
  11294. var n,
  11295. i,
  11296. o = e || Q,
  11297. a = !0;return o.addClass(T.loading), i = { context: { offset: L.get(0) === t ? { top: 0, left: 0 } : L.offset(), scrollTop: L.scrollTop(), height: L.outerHeight() }, menu: { offset: o.offset(), height: o.outerHeight() } }, S.is.verticallyScrollableContext() && (i.menu.offset.top += i.context.scrollTop), (n = { above: i.context.scrollTop <= i.menu.offset.top - i.context.offset.top - i.menu.height, below: i.context.scrollTop + i.context.height >= i.menu.offset.top - i.context.offset.top + i.menu.height }).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;
  11298. }, openRightward: function openRightward(e) {
  11299. var n,
  11300. i,
  11301. o = e || Q,
  11302. a = !0;return o.addClass(T.loading), i = { context: { offset: L.get(0) === t ? { top: 0, left: 0 } : L.offset(), scrollLeft: L.scrollLeft(), width: L.outerWidth() }, menu: { offset: o.offset(), width: o.outerWidth() } }, 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;
  11303. }, click: function click() {
  11304. return c || "click" == k.on;
  11305. }, extendSelect: function extendSelect() {
  11306. return k.allowAdditions || k.apiSettings;
  11307. }, show: function show() {
  11308. return !S.is.disabled() && (S.has.items() || S.has.message());
  11309. }, useAPI: function useAPI() {
  11310. return e.fn.api !== i;
  11311. } }, animate: { show: function show(t, n) {
  11312. var o,
  11313. a = n || Q,
  11314. r = n ? function () {} : function () {
  11315. S.hideSubMenus(), S.hideOthers(), S.set.active();
  11316. };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({ animation: o + " in", debug: k.debug, verbose: k.verbose, duration: k.duration, queue: !0, onStart: r, onComplete: function onComplete() {
  11317. t.call(K);
  11318. } }) : S.error(q.noTransition, o));
  11319. }, hide: function hide(t, n) {
  11320. var o = n || Q,
  11321. a = (n ? k.duration : k.duration, n ? function () {} : function () {
  11322. S.can.click() && S.unbind.intent(), S.remove.active();
  11323. }),
  11324. r = S.get.transition(n);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({ animation: r + " out", duration: k.duration, debug: k.debug, verbose: k.verbose, queue: !1, onStart: a, onComplete: function onComplete() {
  11325. t.call(K);
  11326. } }) : S.error(q.transition));
  11327. } }, hideAndClear: function hideAndClear() {
  11328. S.remove.searchTerm(), S.has.maxSelections() || (S.has.search() ? S.hide(function () {
  11329. S.remove.filteredItem();
  11330. }) : S.hide());
  11331. }, delay: { show: function show() {
  11332. S.verbose("Delaying show event to ensure user intent"), clearTimeout(S.timer), S.timer = setTimeout(S.show, k.delay.show);
  11333. }, hide: function hide() {
  11334. S.verbose("Delaying hide event to ensure user intent"), clearTimeout(S.timer), S.timer = setTimeout(S.hide, k.delay.hide);
  11335. } }, escape: { value: function value(t) {
  11336. var n = e.isArray(t),
  11337. i = "string" == typeof t,
  11338. o = !i && !n,
  11339. a = i && -1 !== t.search(O.quote),
  11340. r = [];return o || !a ? t : (S.debug("Encoding quote values for use in select", t), n ? (e.each(t, function (e, t) {
  11341. r.push(t.replace(O.quote, "&quot;"));
  11342. }), r) : t.replace(O.quote, "&quot;"));
  11343. }, string: function string(e) {
  11344. return (e = String(e)).replace(O.escape, "\\$&");
  11345. } }, setting: function setting(t, n) {
  11346. if (S.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, k, t);else {
  11347. if (n === i) return k[t];e.isPlainObject(k[t]) ? e.extend(!0, k[t], n) : k[t] = n;
  11348. }
  11349. }, internal: function internal(t, n) {
  11350. if (e.isPlainObject(t)) e.extend(!0, S, t);else {
  11351. if (n === i) return S[t];S[t] = n;
  11352. }
  11353. }, debug: function debug() {
  11354. !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)));
  11355. }, verbose: function verbose() {
  11356. !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)));
  11357. }, error: function error() {
  11358. k.silent || (S.error = Function.prototype.bind.call(console.error, console, k.name + ":"), S.error.apply(console, arguments));
  11359. }, performance: { log: function log(e) {
  11360. var t, n;k.performance && (n = (t = new Date().getTime()) - (u || t), u = t, d.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: K, "Execution Time": n })), clearTimeout(S.performance.timer), S.performance.timer = setTimeout(S.performance.display, 500);
  11361. }, display: function display() {
  11362. var t = k.name + ":",
  11363. n = 0;u = !1, clearTimeout(S.performance.timer), e.each(d, function (e, t) {
  11364. n += t["Execution Time"];
  11365. }), 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) {
  11366. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  11367. }), console.groupEnd()), d = [];
  11368. } }, invoke: function invoke(t, n, o) {
  11369. var r,
  11370. s,
  11371. l,
  11372. c = J;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) {
  11373. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  11374. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (S.error(q.method, t), !1);c = c[o];
  11375. }
  11376. })), 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;
  11377. } }, m ? (J === i && S.initialize(), S.invoke(f)) : (J !== i && J.invoke("destroy"), S.initialize());
  11378. }), a !== i ? a : r;
  11379. }, e.fn.dropdown.settings = { silent: !1, debug: !1, verbose: !1, performance: !0, on: "click", action: "activate", values: !1, apiSettings: !1, selectOnKeydown: !0, minCharacters: 0, filterRemoteData: !1, saveRemoteData: !0, throttle: 200, context: t, direction: "auto", keepOnScreen: !0, match: "both", fullTextSearch: !1, placeholder: "auto", preserveHTML: !0, sortSelect: !1, forceSelection: !0, allowAdditions: !1, ignoreCase: !1, hideAdditions: !0, maxSelections: !1, useLabels: !0, delimiter: ",", showOnFocus: !0, allowReselection: !1, allowTab: !0, allowCategorySelection: !1, fireOnInit: !1, transition: "auto", duration: 200, glyphWidth: 1.037, label: { transition: "scale", duration: 200, variation: !1 }, delay: { hide: 300, show: 200, search: 20, touch: 50 }, onChange: function onChange(e, t, n) {}, onAdd: function onAdd(e, t, n) {}, onRemove: function onRemove(e, t, n) {}, onLabelSelect: function onLabelSelect(e) {}, onLabelCreate: function onLabelCreate(t, n) {
  11380. return e(this);
  11381. }, onLabelRemove: function onLabelRemove(e) {
  11382. return !0;
  11383. }, onNoResults: function onNoResults(e) {
  11384. return !0;
  11385. }, onShow: function onShow() {}, onHide: function onHide() {}, name: "Dropdown", namespace: "dropdown", message: { addResult: "Add <b>{term}</b>", count: "{count} selected", maxSelections: "Max {maxCount} selections", noResults: "No results found.", serverError: "There was an error contacting the server" }, error: { action: "You called a dropdown action that was not defined", alreadySetup: "Once a select has been initialized behaviors must be called on the created ui dropdown", labels: "Allowing user additions currently requires the use of labels.", missingMultiple: "<select> requires multiple property to be set to correctly preserve multiple values", method: "The method you called is not defined.", noAPI: "The API module is required to load resources remotely", noStorage: "Saving remote data requires session storage", noTransition: "This module requires ui transitions <https://github.com/Semantic-Org/UI-Transition>" }, regExp: { escape: /[-[\]{}()*+?.,\\^$|#\s]/g, quote: /"/g }, metadata: { defaultText: "defaultText", defaultValue: "defaultValue", placeholderText: "placeholder", text: "text", value: "value" }, fields: { remoteValues: "results", values: "values", disabled: "disabled", name: "name", value: "value", text: "text" }, keys: { backspace: 8, delimiter: 188, deleteKey: 46, enter: 13, escape: 27, pageUp: 33, pageDown: 34, leftArrow: 37, upArrow: 38, rightArrow: 39, downArrow: 40 }, selector: { addition: ".addition", dropdown: ".ui.dropdown", hidden: ".hidden", icon: "> .dropdown.icon", input: '> input[type="hidden"], > select', item: ".item", label: "> .label", remove: "> .label > .delete.icon", siblingLabel: ".label", menu: ".menu", message: ".message", menuIcon: ".dropdown.icon", search: "input.search, .menu > .search > input, .menu input.search", sizer: "> input.sizer", text: "> .text:not(.icon)", unselectable: ".disabled, .filtered" }, className: { active: "active", addition: "addition", animating: "animating", disabled: "disabled", empty: "empty", dropdown: "ui dropdown", filtered: "filtered", hidden: "hidden transition", item: "item", label: "ui label", loading: "loading", menu: "menu", message: "message", multiple: "multiple", placeholder: "default", sizer: "sizer", search: "search", selected: "selected", selection: "selection", upward: "upward", leftward: "left", visible: "visible" } }, e.fn.dropdown.settings.templates = { dropdown: function dropdown(t) {
  11386. var n = t.placeholder || !1,
  11387. i = (t.values, "");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) {
  11388. i += t.disabled ? '<div class="disabled item" data-value="' + t.value + '">' + t.name + "</div>" : '<div class="item" data-value="' + t.value + '">' + t.name + "</div>";
  11389. }), i += "</div>";
  11390. }, menu: function menu(t, n) {
  11391. var i = t[n.values] || {},
  11392. o = "";return e.each(i, function (e, t) {
  11393. var i = t[n.text] ? 'data-text="' + t[n.text] + '"' : "",
  11394. a = t[n.disabled] ? "disabled " : "";o += '<div class="' + a + 'item" data-value="' + t[n.value] + '"' + i + ">", o += t[n.name], o += "</div>";
  11395. }), o;
  11396. }, label: function label(e, t) {
  11397. return t + '<i class="delete icon"></i>';
  11398. }, message: function message(e) {
  11399. return e;
  11400. }, addition: function addition(e) {
  11401. return e;
  11402. } };
  11403. }(jQuery, window, document), function (e, t, n, i) {
  11404. "use strict";
  11405. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.embed = function (n) {
  11406. var o,
  11407. a = e(this),
  11408. r = a.selector || "",
  11409. s = new Date().getTime(),
  11410. l = [],
  11411. c = arguments[0],
  11412. u = "string" == typeof c,
  11413. d = [].slice.call(arguments, 1);return a.each(function () {
  11414. var f,
  11415. m = e.isPlainObject(n) ? e.extend(!0, {}, e.fn.embed.settings, n) : e.extend({}, e.fn.embed.settings),
  11416. g = m.selector,
  11417. p = m.className,
  11418. h = m.sources,
  11419. v = m.error,
  11420. b = m.metadata,
  11421. y = m.namespace,
  11422. x = m.templates,
  11423. C = "." + y,
  11424. w = "module-" + y,
  11425. S = (e(t), e(this)),
  11426. k = (S.find(g.placeholder), S.find(g.icon), S.find(g.embed)),
  11427. T = this,
  11428. A = S.data(w);f = { initialize: function initialize() {
  11429. f.debug("Initializing embed"), f.determine.autoplay(), f.create(), f.bind.events(), f.instantiate();
  11430. }, instantiate: function instantiate() {
  11431. f.verbose("Storing instance of module", f), A = f, S.data(w, f);
  11432. }, destroy: function destroy() {
  11433. f.verbose("Destroying previous instance of embed"), f.reset(), S.removeData(w).off(C);
  11434. }, refresh: function refresh() {
  11435. f.verbose("Refreshing selector cache"), S.find(g.placeholder), S.find(g.icon), k = S.find(g.embed);
  11436. }, bind: { events: function events() {
  11437. f.has.placeholder() && (f.debug("Adding placeholder events"), S.on("click" + C, g.placeholder, f.createAndShow).on("click" + C, g.icon, f.createAndShow));
  11438. } }, create: function create() {
  11439. f.get.placeholder() ? f.createPlaceholder() : f.createAndShow();
  11440. }, createPlaceholder: function createPlaceholder(e) {
  11441. var t = f.get.icon(),
  11442. n = f.get.url();f.generate.embed(n);e = e || f.get.placeholder(), S.html(x.placeholder(e, t)), f.debug("Creating placeholder for embed", e, t);
  11443. }, createEmbed: function createEmbed(t) {
  11444. 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);
  11445. }, changeEmbed: function changeEmbed(e) {
  11446. k.html(f.generate.embed(e));
  11447. }, createAndShow: function createAndShow() {
  11448. f.createEmbed(), f.show();
  11449. }, change: function change(e, t, n) {
  11450. 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();
  11451. }, reset: function reset() {
  11452. f.debug("Clearing embed and showing placeholder"), f.remove.active(), f.remove.embed(), f.showPlaceholder(), m.onReset.call(T);
  11453. }, show: function show() {
  11454. f.debug("Showing embed"), f.set.active(), m.onDisplay.call(T);
  11455. }, hide: function hide() {
  11456. f.debug("Hiding embed"), f.showPlaceholder();
  11457. }, showPlaceholder: function showPlaceholder() {
  11458. f.debug("Showing placeholder image"), f.remove.active(), m.onPlaceholderDisplay.call(T);
  11459. }, get: { id: function id() {
  11460. return m.id || S.data(b.id);
  11461. }, placeholder: function placeholder() {
  11462. return m.placeholder || S.data(b.placeholder);
  11463. }, icon: function icon() {
  11464. return m.icon ? m.icon : S.data(b.icon) !== i ? S.data(b.icon) : f.determine.icon();
  11465. }, source: function source(e) {
  11466. return m.source ? m.source : S.data(b.source) !== i ? S.data(b.source) : f.determine.source();
  11467. }, type: function type() {
  11468. var e = f.get.source();return h[e] !== i && h[e].type;
  11469. }, url: function url() {
  11470. return m.url ? m.url : S.data(b.url) !== i ? S.data(b.url) : f.determine.url();
  11471. } }, determine: { autoplay: function autoplay() {
  11472. f.should.autoplay() && (m.autoplay = !0);
  11473. }, source: function source(t) {
  11474. var n = !1;return (t = t || f.get.url()) && e.each(h, function (e, i) {
  11475. if (-1 !== t.search(i.domain)) return n = e, !1;
  11476. }), n;
  11477. }, icon: function icon() {
  11478. var e = f.get.source();return h[e] !== i && h[e].icon;
  11479. }, url: function url() {
  11480. var e,
  11481. t = m.id || S.data(b.id),
  11482. n = m.source || S.data(b.source);return (e = h[n] !== i && h[n].url.replace("{id}", t)) && S.data(b.url, e), e;
  11483. } }, set: { active: function active() {
  11484. S.addClass(p.active);
  11485. } }, remove: { active: function active() {
  11486. S.removeClass(p.active);
  11487. }, embed: function embed() {
  11488. k.empty();
  11489. } }, encode: { parameters: function parameters(e) {
  11490. var t,
  11491. n = [];for (t in e) {
  11492. n.push(encodeURIComponent(t) + "=" + encodeURIComponent(e[t]));
  11493. }return n.join("&amp;");
  11494. } }, generate: { embed: function embed(e) {
  11495. f.debug("Generating embed html");var t,
  11496. n,
  11497. i = f.get.source();return (e = f.get.url(e)) ? (n = f.generate.parameters(i), t = x.iframe(e, n)) : f.error(v.noURL, S), t;
  11498. }, parameters: function parameters(t, n) {
  11499. var o = h[t] && h[t].parameters !== i ? h[t].parameters(m) : {};return (n = n || m.parameters) && (o = e.extend({}, o, n)), o = m.onEmbed(o), f.encode.parameters(o);
  11500. } }, has: { embed: function embed() {
  11501. return k.length > 0;
  11502. }, placeholder: function placeholder() {
  11503. return m.placeholder || S.data(b.placeholder);
  11504. } }, should: { autoplay: function autoplay() {
  11505. return "auto" === m.autoplay ? m.placeholder || S.data(b.placeholder) !== i : m.autoplay;
  11506. } }, is: { video: function video() {
  11507. return "video" == f.get.type();
  11508. } }, setting: function setting(t, n) {
  11509. if (f.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, m, t);else {
  11510. if (n === i) return m[t];e.isPlainObject(m[t]) ? e.extend(!0, m[t], n) : m[t] = n;
  11511. }
  11512. }, internal: function internal(t, n) {
  11513. if (e.isPlainObject(t)) e.extend(!0, f, t);else {
  11514. if (n === i) return f[t];f[t] = n;
  11515. }
  11516. }, debug: function debug() {
  11517. !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)));
  11518. }, verbose: function verbose() {
  11519. !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)));
  11520. }, error: function error() {
  11521. m.silent || (f.error = Function.prototype.bind.call(console.error, console, m.name + ":"), f.error.apply(console, arguments));
  11522. }, performance: { log: function log(e) {
  11523. var t, n;m.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: T, "Execution Time": n })), clearTimeout(f.performance.timer), f.performance.timer = setTimeout(f.performance.display, 500);
  11524. }, display: function display() {
  11525. var t = m.name + ":",
  11526. n = 0;s = !1, clearTimeout(f.performance.timer), e.each(l, function (e, t) {
  11527. n += t["Execution Time"];
  11528. }), 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) {
  11529. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  11530. }), console.groupEnd()), l = [];
  11531. } }, invoke: function invoke(t, n, a) {
  11532. var r,
  11533. s,
  11534. l,
  11535. c = A;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) {
  11536. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  11537. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (f.error(v.method, t), !1);c = c[o];
  11538. }
  11539. })), 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;
  11540. } }, u ? (A === i && f.initialize(), f.invoke(c)) : (A !== i && A.invoke("destroy"), f.initialize());
  11541. }), o !== i ? o : this;
  11542. }, e.fn.embed.settings = { name: "Embed", namespace: "embed", silent: !1, debug: !1, verbose: !1, performance: !0, icon: !1, source: !1, url: !1, id: !1, autoplay: "auto", color: "#444444", hd: !0, brandedUI: !1, parameters: !1, onDisplay: function onDisplay() {}, onPlaceholderDisplay: function onPlaceholderDisplay() {}, onReset: function onReset() {}, onCreate: function onCreate(e) {}, onEmbed: function onEmbed(e) {
  11543. return e;
  11544. }, metadata: { id: "id", icon: "icon", placeholder: "placeholder", source: "source", url: "url" }, error: { noURL: "No URL specified", method: "The method you called is not defined" }, className: { active: "active", embed: "embed" }, selector: { embed: ".embed", placeholder: ".placeholder", icon: ".icon" }, sources: { youtube: { name: "youtube", type: "video", icon: "video play", domain: "youtube.com", url: "//www.youtube.com/embed/{id}", parameters: function parameters(e) {
  11545. return { autohide: !e.brandedUI, autoplay: e.autoplay, color: e.color || i, hq: e.hd, jsapi: e.api, modestbranding: !e.brandedUI };
  11546. } }, vimeo: { name: "vimeo", type: "video", icon: "video play", domain: "vimeo.com", url: "//player.vimeo.com/video/{id}", parameters: function parameters(e) {
  11547. return { api: e.api, autoplay: e.autoplay, byline: e.brandedUI, color: e.color || i, portrait: e.brandedUI, title: e.brandedUI };
  11548. } } }, templates: { iframe: function iframe(e, t) {
  11549. var n = e;return t && (n += "?" + t), '<iframe src="' + n + '" width="100%" height="100%" frameborder="0" scrolling="no" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';
  11550. }, placeholder: function placeholder(e, t) {
  11551. var n = "";return t && (n += '<i class="' + t + ' icon"></i>'), e && (n += '<img class="placeholder" src="' + e + '">'), n;
  11552. } }, api: !1, onPause: function onPause() {}, onPlay: function onPlay() {}, onStop: function onStop() {} };
  11553. }(jQuery, window, document), function (e, t, n, i) {
  11554. "use strict";
  11555. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.modal = function (o) {
  11556. var a,
  11557. r = e(this),
  11558. s = e(t),
  11559. l = e(n),
  11560. c = e("body"),
  11561. u = r.selector || "",
  11562. d = new Date().getTime(),
  11563. f = [],
  11564. m = arguments[0],
  11565. g = "string" == typeof m,
  11566. p = [].slice.call(arguments, 1),
  11567. h = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  11568. setTimeout(e, 0);
  11569. };return r.each(function () {
  11570. var r,
  11571. v,
  11572. b,
  11573. y,
  11574. x,
  11575. C,
  11576. w,
  11577. S,
  11578. k,
  11579. T = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.modal.settings, o) : e.extend({}, e.fn.modal.settings),
  11580. A = T.selector,
  11581. R = T.className,
  11582. P = T.namespace,
  11583. E = T.error,
  11584. F = "." + P,
  11585. O = "module-" + P,
  11586. D = e(this),
  11587. q = e(T.context),
  11588. j = D.find(A.close),
  11589. z = this,
  11590. I = D.data(O),
  11591. M = !1;k = { initialize: function initialize() {
  11592. k.verbose("Initializing dimmer", q), k.create.id(), k.create.dimmer(), k.refreshModals(), k.bind.events(), T.observeChanges && k.observeChanges(), k.instantiate();
  11593. }, instantiate: function instantiate() {
  11594. k.verbose("Storing instance of modal"), I = k, D.data(O, I);
  11595. }, create: { dimmer: function dimmer() {
  11596. var t = { debug: T.debug, variation: !T.centered && "top aligned", dimmerName: "modals" },
  11597. n = e.extend(!0, t, T.dimmerSettings);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);
  11598. }, id: function id() {
  11599. w = (Math.random().toString(16) + "000000000").substr(2, 8), C = "." + w, k.verbose("Creating unique id for element", w);
  11600. } }, destroy: function destroy() {
  11601. k.verbose("Destroying previous modal"), D.removeData(O).off(F), s.off(C), x.off(C), j.off(F), q.dimmer("destroy");
  11602. }, observeChanges: function observeChanges() {
  11603. "MutationObserver" in t && ((S = new MutationObserver(function (e) {
  11604. k.debug("DOM tree modified, refreshing"), k.refresh();
  11605. })).observe(z, { childList: !0, subtree: !0 }), k.debug("Setting up mutation observer", S));
  11606. }, refresh: function refresh() {
  11607. k.remove.scrolling(), k.cacheSizes(), k.set.screenHeight(), k.set.type();
  11608. }, refreshModals: function refreshModals() {
  11609. v = D.siblings(A.modal), r = v.add(D);
  11610. }, attachEvents: function attachEvents(t, n) {
  11611. var i = e(t);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);
  11612. }, bind: { events: function events() {
  11613. 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);
  11614. } }, get: { id: function id() {
  11615. return (Math.random().toString(16) + "000000000").substr(2, 8);
  11616. } }, event: { approve: function approve() {
  11617. M || !1 === T.onApprove.call(z, e(this)) ? k.verbose("Approve callback returned false cancelling hide") : (M = !0, k.hide(function () {
  11618. M = !1;
  11619. }));
  11620. }, deny: function deny() {
  11621. M || !1 === T.onDeny.call(z, e(this)) ? k.verbose("Deny callback returned false cancelling hide") : (M = !0, k.hide(function () {
  11622. M = !1;
  11623. }));
  11624. }, close: function close() {
  11625. k.hide();
  11626. }, click: function click(t) {
  11627. if (T.closable) {
  11628. var i = e(t.target).closest(A.modal).length > 0,
  11629. o = e.contains(n.documentElement, t.target);!i && o && k.is.active() && (k.debug("Dimmer clicked, hiding all modals"), k.remove.clickaway(), T.allowMultiple ? k.hide() : k.hideAll());
  11630. } else k.verbose("Dimmer clicked but closable setting is disabled");
  11631. }, debounce: function debounce(e, t) {
  11632. clearTimeout(k.timer), k.timer = setTimeout(e, t);
  11633. }, keyboard: function keyboard(e) {
  11634. 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());
  11635. }, resize: function resize() {
  11636. y.dimmer("is active") && (k.is.animating() || k.is.active()) && h(k.refresh);
  11637. } }, toggle: function toggle() {
  11638. k.is.active() || k.is.animating() ? k.hide() : k.show();
  11639. }, show: function show(t) {
  11640. t = e.isFunction(t) ? t : function () {}, k.refreshModals(), k.set.dimmerSettings(), k.showModal(t);
  11641. }, hide: function hide(t) {
  11642. t = e.isFunction(t) ? t : function () {}, k.refreshModals(), k.hideModal(t);
  11643. }, showModal: function showModal(t) {
  11644. 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({ debug: T.debug, animation: T.transition + " in", queue: T.queue, duration: T.duration, useFailSafe: !0, onComplete: function onComplete() {
  11645. T.onVisible.apply(z), T.keyboardShortcuts && k.add.keyboardShortcuts(), k.save.focus(), k.set.active(), T.autofocus && k.set.autofocus(), t();
  11646. } })) : k.error(E.noTransition))) : k.debug("Modal is already visible");
  11647. }, hideModal: function hideModal(t, n) {
  11648. 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({ debug: T.debug, animation: T.transition + " out", queue: T.queue, duration: T.duration, useFailSafe: !0, onStart: function onStart() {
  11649. k.others.active() || n || k.hideDimmer(), T.keyboardShortcuts && k.remove.keyboardShortcuts();
  11650. }, onComplete: function onComplete() {
  11651. T.onHidden.call(z), k.restore.focus(), t();
  11652. } })) : k.error(E.noTransition)) : k.verbose("Hide callback returned false cancelling hide");
  11653. }, showDimmer: function showDimmer() {
  11654. y.dimmer("is animating") || !y.dimmer("is active") ? (k.debug("Showing dimmer"), y.dimmer("show")) : k.debug("Dimmer already visible");
  11655. }, hideDimmer: function hideDimmer() {
  11656. y.dimmer("is animating") || y.dimmer("is active") ? y.dimmer("hide", function () {
  11657. k.remove.clickaway(), k.remove.screenHeight();
  11658. }) : k.debug("Dimmer is not visible cannot hide");
  11659. }, hideAll: function hideAll(t) {
  11660. var n = r.filter("." + R.active + ", ." + R.animating);t = e.isFunction(t) ? t : function () {}, n.length > 0 && (k.debug("Hiding all visible modals"), k.hideDimmer(), n.modal("hide modal", t));
  11661. }, hideOthers: function hideOthers(t) {
  11662. var n = v.filter("." + R.active + ", ." + R.animating);t = e.isFunction(t) ? t : function () {}, n.length > 0 && (k.debug("Hiding other modals", v), n.modal("hide modal", t, !0));
  11663. }, others: { active: function active() {
  11664. return v.filter("." + R.active).length > 0;
  11665. }, animating: function animating() {
  11666. return v.filter("." + R.animating).length > 0;
  11667. } }, add: { keyboardShortcuts: function keyboardShortcuts() {
  11668. k.verbose("Adding keyboard shortcuts"), l.on("keyup" + F, k.event.keyboard);
  11669. } }, save: { focus: function focus() {
  11670. e(n.activeElement).closest(D).length > 0 || (b = e(n.activeElement).blur());
  11671. } }, restore: { focus: function focus() {
  11672. b && b.length > 0 && b.focus();
  11673. } }, remove: { active: function active() {
  11674. D.removeClass(R.active);
  11675. }, clickaway: function clickaway() {
  11676. x.off("click" + C);
  11677. }, bodyStyle: function bodyStyle() {
  11678. "" === c.attr("style") && (k.verbose("Removing style attribute"), c.removeAttr("style"));
  11679. }, screenHeight: function screenHeight() {
  11680. k.debug("Removing page height"), c.css("height", "");
  11681. }, keyboardShortcuts: function keyboardShortcuts() {
  11682. k.verbose("Removing keyboard shortcuts"), l.off("keyup" + F);
  11683. }, scrolling: function scrolling() {
  11684. y.removeClass(R.scrolling), D.removeClass(R.scrolling);
  11685. } }, cacheSizes: function cacheSizes() {
  11686. D.addClass(R.loading);var o = D.prop("scrollHeight"),
  11687. a = D.outerHeight();k.cache !== i && 0 === a || (k.cache = { pageHeight: e(n).outerHeight(), height: a + T.offset, scrollHeight: o + T.offset, contextHeight: "body" == T.context ? e(t).height() : y.height() }, k.cache.topOffset = -k.cache.height / 2), D.removeClass(R.loading), k.debug("Caching modal and container sizes", k.cache);
  11688. }, can: { fit: function fit() {
  11689. var e = k.cache.contextHeight,
  11690. t = k.cache.contextHeight / 2,
  11691. n = k.cache.topOffset,
  11692. i = k.cache.scrollHeight,
  11693. o = k.cache.height,
  11694. a = T.padding;return i > o ? t + n + i + a < e : o + 2 * a < e;
  11695. } }, is: { active: function active() {
  11696. return D.hasClass(R.active);
  11697. }, animating: function animating() {
  11698. return D.transition("is supported") ? D.transition("is animating") : D.is(":visible");
  11699. }, scrolling: function scrolling() {
  11700. return y.hasClass(R.scrolling);
  11701. }, modernBrowser: function modernBrowser() {
  11702. return !(t.ActiveXObject || "ActiveXObject" in t);
  11703. } }, set: { autofocus: function autofocus() {
  11704. var e = D.find("[tabindex], :input").filter(":visible"),
  11705. t = e.filter("[autofocus]"),
  11706. n = t.length > 0 ? t.first() : e.first();n.length > 0 && n.focus();
  11707. }, clickaway: function clickaway() {
  11708. x.on("click" + C, k.event.click);
  11709. }, dimmerSettings: function dimmerSettings() {
  11710. if (e.fn.dimmer !== i) {
  11711. var t = { debug: T.debug, dimmerName: "modals", closable: "auto", variation: !T.centered && "top aligned", duration: { show: T.duration, hide: T.duration } },
  11712. n = e.extend(!0, t, T.dimmerSettings);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);
  11713. } else k.error(E.dimmer);
  11714. }, screenHeight: function screenHeight() {
  11715. 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));
  11716. }, active: function active() {
  11717. D.addClass(R.active);
  11718. }, scrolling: function scrolling() {
  11719. y.addClass(R.scrolling), D.addClass(R.scrolling);
  11720. }, type: function type() {
  11721. 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());
  11722. }, undetached: function undetached() {
  11723. y.addClass(R.undetached);
  11724. } }, setting: function setting(t, n) {
  11725. if (k.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, T, t);else {
  11726. if (n === i) return T[t];e.isPlainObject(T[t]) ? e.extend(!0, T[t], n) : T[t] = n;
  11727. }
  11728. }, internal: function internal(t, n) {
  11729. if (e.isPlainObject(t)) e.extend(!0, k, t);else {
  11730. if (n === i) return k[t];k[t] = n;
  11731. }
  11732. }, debug: function debug() {
  11733. !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)));
  11734. }, verbose: function verbose() {
  11735. !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)));
  11736. }, error: function error() {
  11737. T.silent || (k.error = Function.prototype.bind.call(console.error, console, T.name + ":"), k.error.apply(console, arguments));
  11738. }, performance: { log: function log(e) {
  11739. var t, n;T.performance && (n = (t = new Date().getTime()) - (d || t), d = t, f.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: z, "Execution Time": n })), clearTimeout(k.performance.timer), k.performance.timer = setTimeout(k.performance.display, 500);
  11740. }, display: function display() {
  11741. var t = T.name + ":",
  11742. n = 0;d = !1, clearTimeout(k.performance.timer), e.each(f, function (e, t) {
  11743. n += t["Execution Time"];
  11744. }), 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) {
  11745. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  11746. }), console.groupEnd()), f = [];
  11747. } }, invoke: function invoke(t, n, o) {
  11748. var r,
  11749. s,
  11750. l,
  11751. c = I;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) {
  11752. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  11753. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);c = c[o];
  11754. }
  11755. })), 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;
  11756. } }, g ? (I === i && k.initialize(), k.invoke(m)) : (I !== i && I.invoke("destroy"), k.initialize());
  11757. }), a !== i ? a : this;
  11758. }, e.fn.modal.settings = { name: "Modal", namespace: "modal", silent: !1, debug: !1, verbose: !1, performance: !0, observeChanges: !1, allowMultiple: !1, detachable: !0, closable: !0, autofocus: !0, inverted: !1, blurring: !1, centered: !0, dimmerSettings: { closable: !1, useCSS: !0 }, keyboardShortcuts: !0, context: "body", queue: !1, duration: 500, offset: 0, transition: "scale", padding: 50, onShow: function onShow() {}, onVisible: function onVisible() {}, onHide: function onHide() {
  11759. return !0;
  11760. }, onHidden: function onHidden() {}, onApprove: function onApprove() {
  11761. return !0;
  11762. }, onDeny: function onDeny() {
  11763. return !0;
  11764. }, selector: { close: "> .close", approve: ".actions .positive, .actions .approve, .actions .ok", deny: ".actions .negative, .actions .deny, .actions .cancel", modal: ".ui.modal" }, error: { dimmer: "UI Dimmer, a required component is not included in this page", method: "The method you called is not defined.", notFound: "The element you specified could not be found" }, className: { active: "active", animating: "animating", blurring: "blurring", inverted: "inverted", loading: "loading", scrolling: "scrolling", undetached: "undetached" } };
  11765. }(jQuery, window, document), function (e, t, n, i) {
  11766. "use strict";
  11767. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.nag = function (n) {
  11768. var o,
  11769. a = e(this),
  11770. r = a.selector || "",
  11771. s = new Date().getTime(),
  11772. l = [],
  11773. c = arguments[0],
  11774. u = "string" == typeof c,
  11775. d = [].slice.call(arguments, 1);return a.each(function () {
  11776. var a,
  11777. f = e.isPlainObject(n) ? e.extend(!0, {}, e.fn.nag.settings, n) : e.extend({}, e.fn.nag.settings),
  11778. m = (f.className, f.selector),
  11779. g = f.error,
  11780. p = f.namespace,
  11781. h = "." + p,
  11782. v = p + "-module",
  11783. b = e(this),
  11784. y = (b.find(m.close), f.context ? e(f.context) : e("body")),
  11785. x = this,
  11786. C = b.data(v);t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame;a = { initialize: function initialize() {
  11787. 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();
  11788. }, destroy: function destroy() {
  11789. a.verbose("Destroying instance"), b.removeData(v).off(h);
  11790. }, show: function show() {
  11791. 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));
  11792. }, hide: function hide() {
  11793. a.debug("Showing nag", f.animation.hide), "fade" == f.animation.show ? b.fadeIn(f.duration, f.easing) : b.slideUp(f.duration, f.easing);
  11794. }, onHide: function onHide() {
  11795. a.debug("Removing nag", f.animation.hide), b.remove(), f.onHide && f.onHide();
  11796. }, dismiss: function dismiss(e) {
  11797. f.storageMethod && a.storage.set(f.key, f.value), a.hide(), e.stopImmediatePropagation(), e.preventDefault();
  11798. }, should: { show: function show() {
  11799. 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);
  11800. } }, get: { storageOptions: function storageOptions() {
  11801. var e = {};return f.expires && (e.expires = f.expires), f.domain && (e.domain = f.domain), f.path && (e.path = f.path), e;
  11802. } }, clear: function clear() {
  11803. a.storage.remove(f.key);
  11804. }, storage: { set: function set(n, o) {
  11805. var r = a.get.storageOptions();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 {
  11806. if (e.cookie === i) return void a.error(g.noCookieStorage);e.cookie(n, o, r), a.debug("Value stored using cookie", n, o, r);
  11807. }
  11808. }, get: function get(n, o) {
  11809. var r;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;
  11810. }, remove: function remove(n) {
  11811. var o = a.get.storageOptions();"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);
  11812. } }, setting: function setting(t, n) {
  11813. if (a.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, f, t);else {
  11814. if (n === i) return f[t];e.isPlainObject(f[t]) ? e.extend(!0, f[t], n) : f[t] = n;
  11815. }
  11816. }, internal: function internal(t, n) {
  11817. if (e.isPlainObject(t)) e.extend(!0, a, t);else {
  11818. if (n === i) return a[t];a[t] = n;
  11819. }
  11820. }, debug: function debug() {
  11821. !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)));
  11822. }, verbose: function verbose() {
  11823. !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)));
  11824. }, error: function error() {
  11825. f.silent || (a.error = Function.prototype.bind.call(console.error, console, f.name + ":"), a.error.apply(console, arguments));
  11826. }, performance: { log: function log(e) {
  11827. var t, n;f.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: x, "Execution Time": n })), clearTimeout(a.performance.timer), a.performance.timer = setTimeout(a.performance.display, 500);
  11828. }, display: function display() {
  11829. var t = f.name + ":",
  11830. n = 0;s = !1, clearTimeout(a.performance.timer), e.each(l, function (e, t) {
  11831. n += t["Execution Time"];
  11832. }), 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) {
  11833. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  11834. }), console.groupEnd()), l = [];
  11835. } }, invoke: function invoke(t, n, r) {
  11836. var s,
  11837. l,
  11838. c,
  11839. u = C;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) {
  11840. var r = n != s ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(u[r]) && n != s) u = u[r];else {
  11841. if (u[r] !== i) return l = u[r], !1;if (!e.isPlainObject(u[o]) || n == s) return u[o] !== i ? (l = u[o], !1) : (a.error(g.method, t), !1);u = u[o];
  11842. }
  11843. })), 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;
  11844. } }, u ? (C === i && a.initialize(), a.invoke(c)) : (C !== i && C.invoke("destroy"), a.initialize());
  11845. }), o !== i ? o : this;
  11846. }, e.fn.nag.settings = { name: "Nag", silent: !1, debug: !1, verbose: !1, performance: !0, namespace: "Nag", persist: !1, displayTime: 0, animation: { show: "slide", hide: "slide" }, context: !1, detachable: !1, expires: 30, domain: !1, path: "/", storageMethod: "cookie", key: "nag", value: "dismiss", error: { noCookieStorage: "$.cookie is not included. A storage solution is required.", noStorage: "Neither $.cookie or store is defined. A storage solution is required for storing state", method: "The method you called is not defined." }, className: { bottom: "bottom", fixed: "fixed" }, selector: { close: ".close.icon" }, speed: 500, easing: "easeOutQuad", onHide: function onHide() {} }, e.extend(e.easing, { easeOutQuad: function easeOutQuad(e, t, n, i, o) {
  11847. return -i * (t /= o) * (t - 2) + n;
  11848. } });
  11849. }(jQuery, window, document), function (e, t, n, i) {
  11850. "use strict";
  11851. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.popup = function (o) {
  11852. var a,
  11853. r = e(this),
  11854. s = e(n),
  11855. l = e(t),
  11856. c = e("body"),
  11857. u = r.selector || "",
  11858. d = new Date().getTime(),
  11859. f = [],
  11860. m = arguments[0],
  11861. g = "string" == typeof m,
  11862. p = [].slice.call(arguments, 1);return r.each(function () {
  11863. var r,
  11864. h,
  11865. v,
  11866. b,
  11867. y,
  11868. x,
  11869. C = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.popup.settings, o) : e.extend({}, e.fn.popup.settings),
  11870. w = C.selector,
  11871. S = C.className,
  11872. k = C.error,
  11873. T = C.metadata,
  11874. A = C.namespace,
  11875. R = "." + C.namespace,
  11876. P = "module-" + A,
  11877. E = e(this),
  11878. F = e(C.context),
  11879. O = e(C.scrollContext),
  11880. D = e(C.boundary),
  11881. q = C.target ? e(C.target) : E,
  11882. j = 0,
  11883. z = !1,
  11884. I = !1,
  11885. M = this,
  11886. L = E.data(P);x = { initialize: function initialize() {
  11887. x.debug("Initializing", E), x.createID(), x.bind.events(), !x.exists() && C.preserve && x.create(), C.observeChanges && x.observeChanges(), x.instantiate();
  11888. }, instantiate: function instantiate() {
  11889. x.verbose("Storing instance", x), L = x, E.data(P, L);
  11890. }, observeChanges: function observeChanges() {
  11891. "MutationObserver" in t && ((v = new MutationObserver(x.event.documentChanged)).observe(n, { childList: !0, subtree: !0 }), x.debug("Setting up mutation observer", v));
  11892. }, refresh: function refresh() {
  11893. 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();
  11894. }, reposition: function reposition() {
  11895. x.refresh(), x.set.position();
  11896. }, destroy: function destroy() {
  11897. 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);
  11898. }, event: { start: function start(t) {
  11899. var n = e.isPlainObject(C.delay) ? C.delay.show : C.delay;clearTimeout(x.hideTimer), I || (x.showTimer = setTimeout(x.show, n));
  11900. }, end: function end() {
  11901. var t = e.isPlainObject(C.delay) ? C.delay.hide : C.delay;clearTimeout(x.showTimer), x.hideTimer = setTimeout(x.hide, t);
  11902. }, touchstart: function touchstart(e) {
  11903. I = !0, x.show();
  11904. }, resize: function resize() {
  11905. x.is.visible() && x.set.position();
  11906. }, documentChanged: function documentChanged(t) {
  11907. [].forEach.call(t, function (t) {
  11908. t.removedNodes && [].forEach.call(t.removedNodes, function (t) {
  11909. (t == M || e(t).find(M).length > 0) && (x.debug("Element removed from DOM, tearing down events"), x.destroy());
  11910. });
  11911. });
  11912. }, hideGracefully: function hideGracefully(t) {
  11913. var i = e(t.target),
  11914. o = e.contains(n.documentElement, t.target),
  11915. a = i.closest(w.popup).length > 0;t && !a && o ? (x.debug("Click occurred outside popup hiding popup"), x.hide()) : x.debug("Click was inside popup, keeping popup open");
  11916. } }, create: function create() {
  11917. var t = x.get.html(),
  11918. n = x.get.title(),
  11919. i = x.get.content();t || i || n ? (x.debug("Creating pop-up html"), t || (t = C.templates.popup({ title: n, content: i })), 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);
  11920. }, createID: function createID() {
  11921. y = (Math.random().toString(16) + "000000000").substr(2, 8), b = "." + y, x.verbose("Creating unique id for element", y);
  11922. }, toggle: function toggle() {
  11923. 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());
  11924. }, show: function show(e) {
  11925. if (e = e || function () {}, x.debug("Showing pop-up", C.transition), x.is.hidden() && (!x.is.active() || !x.is.dropdown())) {
  11926. if (x.exists() || x.create(), !1 === C.onShow.call(r, M)) return void x.debug("onShow callback returned false, cancelling popup animation");C.preserve || C.popup || x.refresh(), r && x.set.position() && (x.save.conditions(), C.exclusive && x.hideAll(), x.animate.show(e));
  11927. }
  11928. }, hide: function hide(e) {
  11929. if (e = e || function () {}, x.is.visible() || x.is.animating()) {
  11930. if (!1 === C.onHide.call(r, M)) return void x.debug("onHide callback returned false, cancelling popup animation");x.remove.visible(), x.unbind.close(), x.restore.conditions(), x.animate.hide(e);
  11931. }
  11932. }, hideAll: function hideAll() {
  11933. e(w.popup).filter("." + S.popupVisible).each(function () {
  11934. e(this).data(T.activator).popup("hide");
  11935. });
  11936. }, exists: function exists() {
  11937. return !!r && (C.inline || C.popup ? x.has.popup() : r.closest(F).length >= 1);
  11938. }, removePopup: function removePopup() {
  11939. x.has.popup() && !C.popup && (x.debug("Removing popup", r), r.remove(), r = i, C.onRemove.call(r, M));
  11940. }, save: { conditions: function conditions() {
  11941. x.cache = { title: E.attr("title") }, x.cache.title && E.removeAttr("title"), x.verbose("Saving original attributes", x.cache.title);
  11942. } }, restore: { conditions: function conditions() {
  11943. return x.cache && x.cache.title && (E.attr("title", x.cache.title), x.verbose("Restoring original attributes", x.cache.title)), !0;
  11944. } }, supports: { svg: function svg() {
  11945. return "undefined" == typeof SVGGraphicsElement;
  11946. } }, animate: { show: function show(t) {
  11947. t = e.isFunction(t) ? t : function () {}, C.transition && e.fn.transition !== i && E.transition("is supported") ? (x.set.visible(), r.transition({ animation: C.transition + " in", queue: !1, debug: C.debug, verbose: C.verbose, duration: C.duration, onComplete: function onComplete() {
  11948. x.bind.close(), t.call(r, M), C.onVisible.call(r, M);
  11949. } })) : x.error(k.noTransition);
  11950. }, hide: function hide(t) {
  11951. 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({ animation: C.transition + " out", queue: !1, duration: C.duration, debug: C.debug, verbose: C.verbose, onComplete: function onComplete() {
  11952. x.reset(), t.call(r, M), C.onHidden.call(r, M);
  11953. } }) : x.error(k.noTransition) : x.debug("onHide callback returned false, cancelling popup animation");
  11954. } }, change: { content: function content(e) {
  11955. r.html(e);
  11956. } }, get: { html: function html() {
  11957. return E.removeData(T.html), E.data(T.html) || C.html;
  11958. }, title: function title() {
  11959. return E.removeData(T.title), E.data(T.title) || C.title;
  11960. }, content: function content() {
  11961. return E.removeData(T.content), E.data(T.content) || C.content || E.attr("title");
  11962. }, variation: function variation() {
  11963. return E.removeData(T.variation), E.data(T.variation) || C.variation;
  11964. }, popup: function popup() {
  11965. return r;
  11966. }, popupOffset: function popupOffset() {
  11967. return r.offset();
  11968. }, calculations: function calculations() {
  11969. var e,
  11970. n = x.get.offsetParent(r),
  11971. i = q[0],
  11972. o = D[0] == t,
  11973. a = C.inline || C.popup && C.movePopup ? q.position() : q.offset(),
  11974. s = o ? { top: 0, left: 0 } : D.offset(),
  11975. c = {},
  11976. u = o ? { top: l.scrollTop(), left: l.scrollLeft() } : { top: 0, left: 0 };if (c = { target: { element: q[0], width: q.outerWidth(), height: q.outerHeight(), top: a.top, left: a.left, margin: {} }, popup: { width: r.outerWidth(), height: r.outerHeight() }, parent: { width: h.outerWidth(), height: h.outerHeight() }, screen: { top: s.top, left: s.left, scroll: { top: u.top, left: u.left }, width: D.width(), height: D.height() } }, n.get(0) !== h.get(0)) {
  11977. var d = n.offset();c.target.top -= d.top, c.target.left -= d.left, c.parent.width = n.outerWidth(), c.parent.height = n.outerHeight();
  11978. }return C.setFluidWidth && x.is.fluid() && (c.container = { width: r.parent().outerWidth() }, 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 = { top: e.top + e.scroll.top, bottom: e.top + e.scroll.top + e.height, left: e.left + e.scroll.left, right: e.left + e.scroll.left + e.width }, c;
  11979. }, id: function id() {
  11980. return y;
  11981. }, startEvent: function startEvent() {
  11982. return "hover" == C.on ? "mouseenter" : "focus" == C.on && "focus";
  11983. }, scrollEvent: function scrollEvent() {
  11984. return "scroll";
  11985. }, endEvent: function endEvent() {
  11986. return "hover" == C.on ? "mouseleave" : "focus" == C.on && "blur";
  11987. }, distanceFromBoundary: function distanceFromBoundary(e, t) {
  11988. var n,
  11989. i,
  11990. o = {};return n = (t = t || x.get.calculations()).popup, i = t.boundary, e && (o = { top: e.top - i.top, left: e.left - i.left, right: i.right - (e.left + n.width), bottom: i.bottom - (e.top + n.height) }, x.verbose("Distance from boundaries determined", e, o)), o;
  11991. }, offsetParent: function offsetParent(t) {
  11992. var n = (t !== i ? t[0] : q[0]).parentNode,
  11993. o = e(n);if (n) for (var a = "none" === o.css("transform"), r = "static" === o.css("position"), s = o.is("body"); n && !s && r && a;) {
  11994. n = n.parentNode, a = "none" === (o = e(n)).css("transform"), r = "static" === o.css("position"), s = o.is("body");
  11995. }return o && o.length > 0 ? o : e();
  11996. }, positions: function positions() {
  11997. return { "top left": !1, "top center": !1, "top right": !1, "bottom left": !1, "bottom center": !1, "bottom right": !1, "left center": !1, "right center": !1 };
  11998. }, nextPosition: function nextPosition(e) {
  11999. var t = e.split(" "),
  12000. n = t[0],
  12001. i = t[1],
  12002. o = "top" == n || "bottom" == n,
  12003. a = !1,
  12004. r = !1,
  12005. s = !1;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 = [{ top: "bottom", bottom: "top", left: "right", right: "left" }[n], i]).join(" "), a = !0 === z[s], x.debug("Trying opposite strategy", s)), "adjacent" === C.prefer && o && (s = (s = [n, { left: "center", center: "right", right: "left" }[i]]).join(" "), r = !0 === z[s], x.debug("Trying adjacent strategy", s)), (r || a) && (x.debug("Using backup position", s), s = { "top left": "top center", "top center": "top right", "top right": "right center", "right center": "bottom right", "bottom right": "bottom center", "bottom center": "bottom left", "bottom left": "left center", "left center": "top left" }[e]), s;
  12006. } }, set: { position: function position(e, t) {
  12007. if (0 !== q.length && 0 !== r.length) {
  12008. var n, o, a, s, l, c, u, d;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;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) {
  12009. return "left" == e ? "right" : "left";
  12010. }), x.debug("RTL: Popup position updated", e)), j == C.maxSearchDepth && "string" == typeof C.lastResort && (e = C.lastResort), e) {case "top left":
  12011. c = { top: "auto", bottom: l.height - a.top + o, left: a.left + n, right: "auto" };break;case "top center":
  12012. c = { bottom: l.height - a.top + o, left: a.left + a.width / 2 - s.width / 2 + n, top: "auto", right: "auto" };break;case "top right":
  12013. c = { bottom: l.height - a.top + o, right: l.width - a.left - a.width - n, top: "auto", left: "auto" };break;case "left center":
  12014. c = { top: a.top + a.height / 2 - s.height / 2 + n, right: l.width - a.left + o, left: "auto", bottom: "auto" };break;case "right center":
  12015. c = { top: a.top + a.height / 2 - s.height / 2 + n, left: a.left + a.width + o, bottom: "auto", right: "auto" };break;case "bottom left":
  12016. c = { top: a.top + a.height + o, left: a.left + n, bottom: "auto", right: "auto" };break;case "bottom center":
  12017. c = { top: a.top + a.height + o, left: a.left + a.width / 2 - s.width / 2 + n, bottom: "auto", right: "auto" };break;case "bottom right":
  12018. c = { top: a.top + a.height + o, right: l.width - a.left - a.width - n, left: "auto", bottom: "auto" };}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)) {
  12019. 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);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;x.debug("No position found, showing with last position");
  12020. }return x.debug("Position is on stage", e), x.remove.attempts(), x.remove.loading(), C.setFluidWidth && x.is.fluid() && x.set.fluidWidth(t), !0;
  12021. }x.error(k.notFound);
  12022. }, fluidWidth: function fluidWidth(e) {
  12023. e = e || x.get.calculations(), x.debug("Automatically setting element width to parent width", e.parent.width), r.css("width", e.container.width);
  12024. }, variation: function variation(e) {
  12025. (e = e || x.get.variation()) && x.has.popup() && (x.verbose("Adding variation to popup", e), r.addClass(e));
  12026. }, visible: function visible() {
  12027. E.addClass(S.visible);
  12028. } }, remove: { loading: function loading() {
  12029. r.removeClass(S.loading);
  12030. }, variation: function variation(e) {
  12031. (e = e || x.get.variation()) && (x.verbose("Removing variation", e), r.removeClass(e));
  12032. }, visible: function visible() {
  12033. E.removeClass(S.visible);
  12034. }, attempts: function attempts() {
  12035. x.verbose("Resetting all searched positions"), j = 0, z = !1;
  12036. } }, bind: { events: function events() {
  12037. 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);
  12038. }, popup: function popup() {
  12039. 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);
  12040. }, close: function close() {
  12041. (!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();
  12042. }, closeOnScroll: function closeOnScroll() {
  12043. x.verbose("Binding scroll close event to document"), O.one(x.get.scrollEvent() + b, x.event.hideGracefully);
  12044. }, touchClose: function touchClose() {
  12045. x.verbose("Binding popup touchclose event to document"), s.on("touchstart" + b, function (e) {
  12046. x.verbose("Touched away from popup"), x.event.hideGracefully.call(M, e);
  12047. });
  12048. }, clickaway: function clickaway() {
  12049. x.verbose("Binding popup close event to document"), s.on("click" + b, function (e) {
  12050. x.verbose("Clicked away from popup"), x.event.hideGracefully.call(M, e);
  12051. });
  12052. } }, unbind: { events: function events() {
  12053. l.off(b), E.off(R);
  12054. }, close: function close() {
  12055. s.off(b), O.off(b);
  12056. } }, has: { popup: function popup() {
  12057. return r && r.length > 0;
  12058. } }, should: { centerArrow: function centerArrow(e) {
  12059. return !x.is.basic() && e.target.width <= 2 * C.arrowPixelsFromEdge;
  12060. } }, is: { offstage: function offstage(t, n) {
  12061. var i = [];return e.each(t, function (e, t) {
  12062. t < -C.jitter && (x.debug("Position exceeds allowable distance from edge", e, t, n), i.push(e));
  12063. }), i.length > 0;
  12064. }, svg: function svg(e) {
  12065. return x.supports.svg() && e instanceof SVGGraphicsElement;
  12066. }, basic: function basic() {
  12067. return E.hasClass(S.basic);
  12068. }, active: function active() {
  12069. return E.hasClass(S.active);
  12070. }, animating: function animating() {
  12071. return r !== i && r.hasClass(S.animating);
  12072. }, fluid: function fluid() {
  12073. return r !== i && r.hasClass(S.fluid);
  12074. }, visible: function visible() {
  12075. return r !== i && r.hasClass(S.popupVisible);
  12076. }, dropdown: function dropdown() {
  12077. return E.hasClass(S.dropdown);
  12078. }, hidden: function hidden() {
  12079. return !x.is.visible();
  12080. }, rtl: function rtl() {
  12081. return "rtl" == E.css("direction");
  12082. } }, reset: function reset() {
  12083. x.remove.visible(), C.preserve ? e.fn.transition !== i && r.transition("remove transition") : x.removePopup();
  12084. }, setting: function setting(t, n) {
  12085. if (e.isPlainObject(t)) e.extend(!0, C, t);else {
  12086. if (n === i) return C[t];C[t] = n;
  12087. }
  12088. }, internal: function internal(t, n) {
  12089. if (e.isPlainObject(t)) e.extend(!0, x, t);else {
  12090. if (n === i) return x[t];x[t] = n;
  12091. }
  12092. }, debug: function debug() {
  12093. !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)));
  12094. }, verbose: function verbose() {
  12095. !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)));
  12096. }, error: function error() {
  12097. C.silent || (x.error = Function.prototype.bind.call(console.error, console, C.name + ":"), x.error.apply(console, arguments));
  12098. }, performance: { log: function log(e) {
  12099. var t, n;C.performance && (n = (t = new Date().getTime()) - (d || t), d = t, f.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: M, "Execution Time": n })), clearTimeout(x.performance.timer), x.performance.timer = setTimeout(x.performance.display, 500);
  12100. }, display: function display() {
  12101. var t = C.name + ":",
  12102. n = 0;d = !1, clearTimeout(x.performance.timer), e.each(f, function (e, t) {
  12103. n += t["Execution Time"];
  12104. }), 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) {
  12105. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  12106. }), console.groupEnd()), f = [];
  12107. } }, invoke: function invoke(t, n, o) {
  12108. var r,
  12109. s,
  12110. l,
  12111. c = L;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) {
  12112. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  12113. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);c = c[o];
  12114. }
  12115. })), 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;
  12116. } }, g ? (L === i && x.initialize(), x.invoke(m)) : (L !== i && L.invoke("destroy"), x.initialize());
  12117. }), a !== i ? a : this;
  12118. }, e.fn.popup.settings = { name: "Popup", silent: !1, debug: !1, verbose: !1, performance: !0, namespace: "popup", observeChanges: !0, onCreate: function onCreate() {}, onRemove: function onRemove() {}, onShow: function onShow() {}, onVisible: function onVisible() {}, onHide: function onHide() {}, onUnplaceable: function onUnplaceable() {}, onHidden: function onHidden() {}, on: "hover", boundary: t, addTouchEvents: !0, position: "top left", variation: "", movePopup: !0, target: !1, popup: !1, inline: !1, preserve: !1, hoverable: !1, content: !1, html: !1, title: !1, closable: !0, hideOnScroll: "auto", exclusive: !1, context: "body", scrollContext: t, prefer: "opposite", lastResort: !1, arrowPixelsFromEdge: 20, delay: { show: 50, hide: 70 }, setFluidWidth: !0, duration: 200, transition: "scale", distanceAway: 0, jitter: 2, offset: 0, maxSearchDepth: 15, error: { invalidPosition: "The position you specified is not a valid position", cannotPlace: "Popup does not fit within the boundaries of the viewport", method: "The method you called is not defined.", noTransition: "This module requires ui transitions <https://github.com/Semantic-Org/UI-Transition>", notFound: "The target or popup you specified does not exist on the page" }, metadata: { activator: "activator", content: "content", html: "html", offset: "offset", position: "position", title: "title", variation: "variation" }, className: { active: "active", basic: "basic", animating: "animating", dropdown: "dropdown", fluid: "fluid", loading: "loading", popup: "ui popup", position: "top left center bottom right", visible: "visible", popupVisible: "visible" }, selector: { popup: ".ui.popup" }, templates: { escape: function escape(e) {
  12119. var t = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#x27;", "`": "&#x60;" };return (/[&<>"'`]/.test(e) ? e.replace(/[&<>"'`]/g, function (e) {
  12120. return t[e];
  12121. }) : e
  12122. );
  12123. }, popup: function popup(t) {
  12124. var n = "",
  12125. o = e.fn.popup.settings.templates.escape;return (typeof t === "undefined" ? "undefined" : _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;
  12126. } } };
  12127. }(jQuery, window, document), function (e, t, n, i) {
  12128. "use strict";
  12129. 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")());e.fn.progress = function (t) {
  12130. var o,
  12131. a = e(this),
  12132. r = a.selector || "",
  12133. s = new Date().getTime(),
  12134. l = [],
  12135. c = arguments[0],
  12136. u = "string" == typeof c,
  12137. d = [].slice.call(arguments, 1);return a.each(function () {
  12138. var a,
  12139. f = e.isPlainObject(t) ? e.extend(!0, {}, e.fn.progress.settings, t) : e.extend({}, e.fn.progress.settings),
  12140. m = f.className,
  12141. g = f.metadata,
  12142. p = f.namespace,
  12143. h = f.selector,
  12144. v = f.error,
  12145. b = "." + p,
  12146. y = "module-" + p,
  12147. x = e(this),
  12148. C = e(this).find(h.bar),
  12149. w = e(this).find(h.progress),
  12150. S = e(this).find(h.label),
  12151. k = this,
  12152. T = x.data(y),
  12153. A = !1;a = { initialize: function initialize() {
  12154. a.debug("Initializing progress bar", f), a.set.duration(), a.set.transitionEvent(), a.read.metadata(), a.read.settings(), a.instantiate();
  12155. }, instantiate: function instantiate() {
  12156. a.verbose("Storing instance of progress", a), T = a, x.data(y, a);
  12157. }, destroy: function destroy() {
  12158. a.verbose("Destroying previous progress for", x), clearInterval(T.interval), a.remove.state(), x.removeData(y), T = i;
  12159. }, reset: function reset() {
  12160. a.remove.nextValue(), a.update.progress(0);
  12161. }, complete: function complete() {
  12162. (a.percent === i || a.percent < 100) && (a.remove.progressPoll(), a.set.percent(100));
  12163. }, read: { metadata: function metadata() {
  12164. var e = { percent: x.data(g.percent), total: x.data(g.total), value: x.data(g.value) };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));
  12165. }, settings: function settings() {
  12166. !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));
  12167. } }, bind: { transitionEnd: function transitionEnd(e) {
  12168. var t = a.get.transitionEnd();C.one(t + b, function (t) {
  12169. clearTimeout(a.failSafeTimer), e.call(this, t);
  12170. }), a.failSafeTimer = setTimeout(function () {
  12171. C.triggerHandler(t);
  12172. }, f.duration + f.failSafeDelay), a.verbose("Adding fail safe timer", a.timer);
  12173. } }, increment: function increment(e) {
  12174. var t, n;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);
  12175. }, decrement: function decrement(e) {
  12176. var t, n;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);
  12177. }, has: { progressPoll: function progressPoll() {
  12178. return a.progressPoll;
  12179. }, total: function total() {
  12180. return !1 !== a.get.total();
  12181. } }, get: { text: function text(e) {
  12182. var t = a.value || 0,
  12183. n = a.total || 0,
  12184. i = A ? a.get.displayPercent() : a.percent || 0,
  12185. o = a.total > 0 ? n - t : 100 - i;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;
  12186. }, normalizedValue: function normalizedValue(e) {
  12187. if (e < 0) return a.debug("Value cannot decrement below 0"), 0;if (a.has.total()) {
  12188. if (e > a.total) return a.debug("Value cannot increment above total", a.total), a.total;
  12189. } else if (e > 100) return a.debug("Value cannot increment above 100 percent"), 100;return e;
  12190. }, updateInterval: function updateInterval() {
  12191. return "auto" == f.updateInterval ? f.duration : f.updateInterval;
  12192. }, randomValue: function randomValue() {
  12193. return a.debug("Generating random increment percentage"), Math.floor(Math.random() * f.random.max + f.random.min);
  12194. }, numericValue: function numericValue(e) {
  12195. return "string" == typeof e ? "" !== e.replace(/[^\d.]/g, "") && +e.replace(/[^\d.]/g, "") : e;
  12196. }, transitionEnd: function transitionEnd() {
  12197. var e,
  12198. t = n.createElement("element"),
  12199. o = { transition: "transitionend", OTransition: "oTransitionEnd", MozTransition: "transitionend", WebkitTransition: "webkitTransitionEnd" };for (e in o) {
  12200. if (t.style[e] !== i) return o[e];
  12201. }
  12202. }, displayPercent: function displayPercent() {
  12203. var e = C.width(),
  12204. t = x.width(),
  12205. n = e > parseInt(C.css("min-width"), 10) ? e / t * 100 : a.percent;return f.precision > 0 ? Math.round(n * (10 * f.precision)) / (10 * f.precision) : Math.round(n);
  12206. }, percent: function percent() {
  12207. return a.percent || 0;
  12208. }, value: function value() {
  12209. return a.nextValue || a.value || 0;
  12210. }, total: function total() {
  12211. return a.total || !1;
  12212. } }, create: { progressPoll: function progressPoll() {
  12213. a.progressPoll = setTimeout(function () {
  12214. a.update.toNextValue(), a.remove.progressPoll();
  12215. }, a.get.updateInterval());
  12216. } }, is: { complete: function complete() {
  12217. return a.is.success() || a.is.warning() || a.is.error();
  12218. }, success: function success() {
  12219. return x.hasClass(m.success);
  12220. }, warning: function warning() {
  12221. return x.hasClass(m.warning);
  12222. }, error: function error() {
  12223. return x.hasClass(m.error);
  12224. }, active: function active() {
  12225. return x.hasClass(m.active);
  12226. }, visible: function visible() {
  12227. return x.is(":visible");
  12228. } }, remove: { progressPoll: function progressPoll() {
  12229. a.verbose("Removing progress poll timer"), a.progressPoll && (clearTimeout(a.progressPoll), delete a.progressPoll);
  12230. }, nextValue: function nextValue() {
  12231. a.verbose("Removing progress value stored for next update"), delete a.nextValue;
  12232. }, state: function state() {
  12233. a.verbose("Removing stored state"), delete a.total, delete a.percent, delete a.value;
  12234. }, active: function active() {
  12235. a.verbose("Removing active state"), x.removeClass(m.active);
  12236. }, success: function success() {
  12237. a.verbose("Removing success state"), x.removeClass(m.success);
  12238. }, warning: function warning() {
  12239. a.verbose("Removing warning state"), x.removeClass(m.warning);
  12240. }, error: function error() {
  12241. a.verbose("Removing error state"), x.removeClass(m.error);
  12242. } }, set: { barWidth: function barWidth(e) {
  12243. 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)));
  12244. }, duration: function duration(e) {
  12245. e = "number" == typeof (e = e || f.duration) ? e + "ms" : e, a.verbose("Setting progress bar transition duration", e), C.css({ "transition-duration": e });
  12246. }, percent: function percent(e) {
  12247. 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);
  12248. }, labelInterval: function labelInterval() {
  12249. clearInterval(a.interval), a.bind.transitionEnd(function () {
  12250. a.verbose("Bar finished animating, removing continuous label updates"), clearInterval(a.interval), A = !1, a.set.labels();
  12251. }), A = !0, a.interval = setInterval(function () {
  12252. e.contains(n.documentElement, k) || (clearInterval(a.interval), A = !1), a.set.labels();
  12253. }, f.framerate);
  12254. }, labels: function labels() {
  12255. a.verbose("Setting both bar progress and outer label text"), a.set.barLabel(), a.set.state();
  12256. }, label: function label(e) {
  12257. (e = e || "") && (e = a.get.text(e), a.verbose("Setting label to text", e), S.text(e));
  12258. }, state: function state(e) {
  12259. 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));
  12260. }, barLabel: function barLabel(e) {
  12261. 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)));
  12262. }, active: function active(e) {
  12263. 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 () {
  12264. f.onActive.call(k, a.value, a.total);
  12265. });
  12266. }, success: function success(e) {
  12267. 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 () {
  12268. f.onSuccess.call(k, a.total);
  12269. });
  12270. }, warning: function warning(e) {
  12271. 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 () {
  12272. f.onWarning.call(k, a.value, a.total);
  12273. });
  12274. }, error: function error(e) {
  12275. 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 () {
  12276. f.onError.call(k, a.value, a.total);
  12277. });
  12278. }, transitionEvent: function transitionEvent() {
  12279. a.get.transitionEnd();
  12280. }, total: function total(e) {
  12281. a.total = e;
  12282. }, value: function value(e) {
  12283. a.value = e;
  12284. }, progress: function progress(e) {
  12285. 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());
  12286. }, nextValue: function nextValue(e) {
  12287. a.nextValue = e;
  12288. } }, update: { toNextValue: function toNextValue() {
  12289. var e = a.nextValue;e && (a.debug("Update interval complete using last updated value", e), a.update.progress(e), a.remove.nextValue());
  12290. }, progress: function progress(e) {
  12291. var t;!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));
  12292. } }, setting: function setting(t, n) {
  12293. if (a.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, f, t);else {
  12294. if (n === i) return f[t];e.isPlainObject(f[t]) ? e.extend(!0, f[t], n) : f[t] = n;
  12295. }
  12296. }, internal: function internal(t, n) {
  12297. if (e.isPlainObject(t)) e.extend(!0, a, t);else {
  12298. if (n === i) return a[t];a[t] = n;
  12299. }
  12300. }, debug: function debug() {
  12301. !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)));
  12302. }, verbose: function verbose() {
  12303. !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)));
  12304. }, error: function error() {
  12305. f.silent || (a.error = Function.prototype.bind.call(console.error, console, f.name + ":"), a.error.apply(console, arguments));
  12306. }, performance: { log: function log(e) {
  12307. var t, n;f.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: k, "Execution Time": n })), clearTimeout(a.performance.timer), a.performance.timer = setTimeout(a.performance.display, 500);
  12308. }, display: function display() {
  12309. var t = f.name + ":",
  12310. n = 0;s = !1, clearTimeout(a.performance.timer), e.each(l, function (e, t) {
  12311. n += t["Execution Time"];
  12312. }), 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) {
  12313. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  12314. }), console.groupEnd()), l = [];
  12315. } }, invoke: function invoke(t, n, r) {
  12316. var s,
  12317. l,
  12318. c,
  12319. u = T;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) {
  12320. var r = n != s ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(u[r]) && n != s) u = u[r];else {
  12321. if (u[r] !== i) return l = u[r], !1;if (!e.isPlainObject(u[o]) || n == s) return u[o] !== i ? (l = u[o], !1) : (a.error(v.method, t), !1);u = u[o];
  12322. }
  12323. })), 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;
  12324. } }, u ? (T === i && a.initialize(), a.invoke(c)) : (T !== i && T.invoke("destroy"), a.initialize());
  12325. }), o !== i ? o : this;
  12326. }, e.fn.progress.settings = { name: "Progress", namespace: "progress", silent: !1, debug: !1, verbose: !1, performance: !0, random: { min: 2, max: 5 }, duration: 300, updateInterval: "auto", autoSuccess: !0, showActivity: !0, limitValues: !0, label: "percent", precision: 0, framerate: 1e3 / 30, percent: !1, total: !1, value: !1, failSafeDelay: 100, onLabelUpdate: function onLabelUpdate(e, t, n, i) {
  12327. return t;
  12328. }, onChange: function onChange(e, t, n) {}, onSuccess: function onSuccess(e) {}, onActive: function onActive(e, t) {}, onError: function onError(e, t) {}, onWarning: function onWarning(e, t) {}, error: { method: "The method you called is not defined.", nonNumeric: "Progress value is non numeric", tooHigh: "Value specified is above 100%", tooLow: "Value specified is below 0%" }, regExp: { variable: /\{\$*[A-z0-9]+\}/g }, metadata: { percent: "percent", total: "total", value: "value" }, selector: { bar: "> .bar", label: "> .label", progress: ".bar > .progress" }, text: { active: !1, error: !1, success: !1, warning: !1, percent: "{percent}%", ratio: "{value} of {total}" }, className: { active: "active", error: "error", success: "success", warning: "warning" } };
  12329. }(jQuery, window, document), function (e, t, n, i) {
  12330. "use strict";
  12331. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.rating = function (t) {
  12332. var n,
  12333. o = e(this),
  12334. a = o.selector || "",
  12335. r = new Date().getTime(),
  12336. s = [],
  12337. l = arguments[0],
  12338. c = "string" == typeof l,
  12339. u = [].slice.call(arguments, 1);return o.each(function () {
  12340. var d,
  12341. f,
  12342. m = e.isPlainObject(t) ? e.extend(!0, {}, e.fn.rating.settings, t) : e.extend({}, e.fn.rating.settings),
  12343. g = m.namespace,
  12344. p = m.className,
  12345. h = m.metadata,
  12346. v = m.selector,
  12347. b = (m.error, "." + g),
  12348. y = "module-" + g,
  12349. x = this,
  12350. C = e(this).data(y),
  12351. w = e(this),
  12352. S = w.find(v.icon);f = { initialize: function initialize() {
  12353. 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();
  12354. }, instantiate: function instantiate() {
  12355. f.verbose("Instantiating module", m), C = f, w.data(y, f);
  12356. }, destroy: function destroy() {
  12357. f.verbose("Destroying previous instance", C), f.remove.events(), w.removeData(y);
  12358. }, refresh: function refresh() {
  12359. S = w.find(v.icon);
  12360. }, setup: { layout: function layout() {
  12361. var t = f.get.maxRating(),
  12362. n = e.fn.rating.settings.templates.icon(t);f.debug("Generating icon html dynamically"), w.html(n), f.refresh();
  12363. } }, event: { mouseenter: function mouseenter() {
  12364. var t = e(this);t.nextAll().removeClass(p.selected), w.addClass(p.selected), t.addClass(p.selected).prevAll().addClass(p.selected);
  12365. }, mouseleave: function mouseleave() {
  12366. w.removeClass(p.selected), S.removeClass(p.selected);
  12367. }, click: function click() {
  12368. var t = e(this),
  12369. n = f.get.rating(),
  12370. i = S.index(t) + 1;("auto" == m.clearable ? 1 === S.length : m.clearable) && n == i ? f.clearRating() : f.set.rating(i);
  12371. } }, clearRating: function clearRating() {
  12372. f.debug("Clearing current rating"), f.set.rating(0);
  12373. }, bind: { events: function events() {
  12374. 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);
  12375. } }, remove: { events: function events() {
  12376. f.verbose("Removing events"), w.off(b);
  12377. }, initialLoad: function initialLoad() {
  12378. d = !1;
  12379. } }, enable: function enable() {
  12380. f.debug("Setting rating to interactive mode"), f.bind.events(), w.removeClass(p.disabled);
  12381. }, disable: function disable() {
  12382. f.debug("Setting rating to read-only mode"), f.remove.events(), w.addClass(p.disabled);
  12383. }, is: { initialLoad: function initialLoad() {
  12384. return d;
  12385. } }, get: { initialRating: function initialRating() {
  12386. return w.data(h.rating) !== i ? (w.removeData(h.rating), w.data(h.rating)) : m.initialRating;
  12387. }, maxRating: function maxRating() {
  12388. return w.data(h.maxRating) !== i ? (w.removeData(h.maxRating), w.data(h.maxRating)) : m.maxRating;
  12389. }, rating: function rating() {
  12390. var e = S.filter("." + p.active).length;return f.verbose("Current rating retrieved", e), e;
  12391. } }, set: { rating: function rating(e) {
  12392. var t = e - 1 >= 0 ? e - 1 : 0,
  12393. n = S.eq(t);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);
  12394. }, initialLoad: function initialLoad() {
  12395. d = !0;
  12396. } }, setting: function setting(t, n) {
  12397. if (f.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, m, t);else {
  12398. if (n === i) return m[t];e.isPlainObject(m[t]) ? e.extend(!0, m[t], n) : m[t] = n;
  12399. }
  12400. }, internal: function internal(t, n) {
  12401. if (e.isPlainObject(t)) e.extend(!0, f, t);else {
  12402. if (n === i) return f[t];f[t] = n;
  12403. }
  12404. }, debug: function debug() {
  12405. !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)));
  12406. }, verbose: function verbose() {
  12407. !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)));
  12408. }, error: function error() {
  12409. m.silent || (f.error = Function.prototype.bind.call(console.error, console, m.name + ":"), f.error.apply(console, arguments));
  12410. }, performance: { log: function log(e) {
  12411. var t, n;m.performance && (n = (t = new Date().getTime()) - (r || t), r = t, s.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: x, "Execution Time": n })), clearTimeout(f.performance.timer), f.performance.timer = setTimeout(f.performance.display, 500);
  12412. }, display: function display() {
  12413. var t = m.name + ":",
  12414. n = 0;r = !1, clearTimeout(f.performance.timer), e.each(s, function (e, t) {
  12415. n += t["Execution Time"];
  12416. }), 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) {
  12417. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  12418. }), console.groupEnd()), s = [];
  12419. } }, invoke: function invoke(t, o, a) {
  12420. var r,
  12421. s,
  12422. l,
  12423. c = C;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) {
  12424. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  12425. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);c = c[o];
  12426. }
  12427. })), 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;
  12428. } }, c ? (C === i && f.initialize(), f.invoke(l)) : (C !== i && C.invoke("destroy"), f.initialize());
  12429. }), n !== i ? n : this;
  12430. }, e.fn.rating.settings = { name: "Rating", namespace: "rating", slent: !1, debug: !1, verbose: !1, performance: !0, initialRating: 0, interactive: !0, maxRating: 4, clearable: "auto", fireOnInit: !1, onRate: function onRate(e) {}, error: { method: "The method you called is not defined", noMaximum: "No maximum rating specified. Cannot generate HTML automatically" }, metadata: { rating: "rating", maxRating: "maxRating" }, className: { active: "active", disabled: "disabled", selected: "selected", loading: "loading" }, selector: { icon: ".icon" }, templates: { icon: function icon(e) {
  12431. for (var t = 1, n = ""; t <= e;) {
  12432. n += '<i class="icon"></i>', t++;
  12433. }return n;
  12434. } } };
  12435. }(jQuery, window, document), function (e, t, n, i) {
  12436. "use strict";
  12437. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.search = function (o) {
  12438. var a,
  12439. r = e(this),
  12440. s = r.selector || "",
  12441. l = new Date().getTime(),
  12442. c = [],
  12443. u = arguments[0],
  12444. d = "string" == typeof u,
  12445. f = [].slice.call(arguments, 1);return e(this).each(function () {
  12446. var m,
  12447. g = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.search.settings, o) : e.extend({}, e.fn.search.settings),
  12448. p = g.className,
  12449. h = g.metadata,
  12450. v = g.regExp,
  12451. b = g.fields,
  12452. y = g.selector,
  12453. x = g.error,
  12454. C = g.namespace,
  12455. w = "." + C,
  12456. S = C + "-module",
  12457. k = e(this),
  12458. T = k.find(y.prompt),
  12459. A = k.find(y.searchButton),
  12460. R = k.find(y.results),
  12461. P = k.find(y.result),
  12462. E = (k.find(y.category), this),
  12463. F = k.data(S),
  12464. O = !1,
  12465. D = !1;m = { initialize: function initialize() {
  12466. m.verbose("Initializing module"), m.get.settings(), m.determine.searchFields(), m.bind.events(), m.set.type(), m.create.results(), m.instantiate();
  12467. }, instantiate: function instantiate() {
  12468. m.verbose("Storing instance of module", m), F = m, k.data(S, m);
  12469. }, destroy: function destroy() {
  12470. m.verbose("Destroying instance"), k.off(w).removeData(S);
  12471. }, refresh: function refresh() {
  12472. 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);
  12473. }, refreshResults: function refreshResults() {
  12474. R = k.find(y.results), P = k.find(y.result);
  12475. }, bind: { events: function events() {
  12476. 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);
  12477. } }, determine: { searchFields: function searchFields() {
  12478. o && o.searchFields !== i && (g.searchFields = o.searchFields);
  12479. } }, event: { input: function input() {
  12480. g.searchDelay ? (clearTimeout(m.timer), m.timer = setTimeout(function () {
  12481. m.is.focused() && m.query();
  12482. }, g.searchDelay)) : m.query();
  12483. }, focus: function focus() {
  12484. m.set.focus(), g.searchOnFocus && m.has.minimumCharacters() && m.query(function () {
  12485. m.can.show() && m.showResults();
  12486. });
  12487. }, blur: function blur(e) {
  12488. var t = function t() {
  12489. m.cancel.query(), m.remove.focus(), m.timer = setTimeout(m.hideResults, g.hideDelay);
  12490. };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) {
  12491. m.is.inMessage(e) || O ? T.focus() : (O = !1, m.is.animating() || m.is.hidden() || t());
  12492. })) : (m.debug("Input blurred without user action, closing results"), t()));
  12493. }, result: { mousedown: function mousedown() {
  12494. m.resultsClicked = !0;
  12495. }, mouseup: function mouseup() {
  12496. m.resultsClicked = !1;
  12497. }, click: function click(n) {
  12498. m.debug("Search result selected");var i = e(this),
  12499. o = i.find(y.title).eq(0),
  12500. a = i.is("a[href]") ? i : i.find("a[href]").eq(0),
  12501. r = a.attr("href") || !1,
  12502. s = a.attr("target") || !1,
  12503. l = (o.html(), o.length > 0 && o.text()),
  12504. c = m.get.results(),
  12505. u = i.data(h.result) || m.get.result(l, c);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);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);
  12506. } } }, handleKeyboard: function handleKeyboard(e) {
  12507. var t,
  12508. n = k.find(y.result),
  12509. i = k.find(y.category),
  12510. o = n.filter("." + p.active),
  12511. a = n.index(o),
  12512. r = n.length,
  12513. s = o.length > 0,
  12514. l = e.which,
  12515. c = 13,
  12516. u = 38,
  12517. d = 40;if (l == 27 && (m.verbose("Escape key pressed, blurring search field"), m.hideResults(), D = !0), m.is.visible()) {
  12518. if (l == c) {
  12519. 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;
  12520. } 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());
  12521. } else l == c && (m.verbose("Enter key pressed, executing query"), m.query(), m.set.buttonPressed(), T.one("keyup", m.remove.buttonFocus));
  12522. }, setup: { api: function api(t, n) {
  12523. var i = { debug: g.debug, on: !1, cache: g.cache, action: "search", urlData: { query: t }, onSuccess: function onSuccess(e) {
  12524. m.parse.response.call(E, e, t), n();
  12525. }, onFailure: function onFailure() {
  12526. m.displayMessage(x.serverError), n();
  12527. }, onAbort: function onAbort(e) {}, onError: m.error };e.extend(!0, i, g.apiSettings), m.verbose("Setting up API request", i), k.api(i);
  12528. } }, can: { useAPI: function useAPI() {
  12529. return e.fn.api !== i;
  12530. }, show: function show() {
  12531. return m.is.focused() && !m.is.visible() && !m.is.empty();
  12532. }, transition: function transition() {
  12533. return g.transition && e.fn.transition !== i && k.transition("is supported");
  12534. } }, is: { animating: function animating() {
  12535. return R.hasClass(p.animating);
  12536. }, hidden: function hidden() {
  12537. return R.hasClass(p.hidden);
  12538. }, inMessage: function inMessage(t) {
  12539. if (t.target) {
  12540. var i = e(t.target);return e.contains(n.documentElement, t.target) && i.closest(y.message).length > 0;
  12541. }
  12542. }, empty: function empty() {
  12543. return "" === R.html();
  12544. }, visible: function visible() {
  12545. return R.filter(":visible").length > 0;
  12546. }, focused: function focused() {
  12547. return T.filter(":focus").length > 0;
  12548. } }, get: { settings: function settings() {
  12549. e.isPlainObject(o) && o.searchFullText && (g.fullTextSearch = o.searchFullText, m.error(g.error.oldSearchSyntax, E));
  12550. }, inputEvent: function inputEvent() {
  12551. var e = T[0];return e !== i && e.oninput !== i ? "input" : e !== i && e.onpropertychange !== i ? "propertychange" : "keyup";
  12552. }, value: function value() {
  12553. return T.val();
  12554. }, results: function results() {
  12555. return k.data(h.results);
  12556. }, result: function result(t, n) {
  12557. var o = ["title", "id"],
  12558. a = !1;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) {
  12559. if (e.isArray(i.results) && (a = m.search.object(t, i.results, o)[0])) return !1;
  12560. })) : (m.debug("Finding result in results object", t), a = m.search.object(t, n, o)[0]), a || !1;
  12561. } }, select: { firstResult: function firstResult() {
  12562. m.verbose("Selecting first result"), P.first().addClass(p.active);
  12563. } }, set: { focus: function focus() {
  12564. k.addClass(p.focus);
  12565. }, loading: function loading() {
  12566. k.addClass(p.loading);
  12567. }, value: function value(e) {
  12568. m.verbose("Setting search input value", e), T.val(e);
  12569. }, type: function type(e) {
  12570. e = e || g.type, "category" == g.type && k.addClass(g.type);
  12571. }, buttonPressed: function buttonPressed() {
  12572. A.addClass(p.pressed);
  12573. } }, remove: { loading: function loading() {
  12574. k.removeClass(p.loading);
  12575. }, focus: function focus() {
  12576. k.removeClass(p.focus);
  12577. }, buttonPressed: function buttonPressed() {
  12578. A.removeClass(p.pressed);
  12579. } }, query: function query(t) {
  12580. t = e.isFunction(t) ? t : function () {};var n = m.get.value(),
  12581. i = m.read.cache(n);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();
  12582. }, search: { local: function local(e) {
  12583. var t,
  12584. n = m.search.object(e, g.content);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({ results: n }), m.remove.loading(), m.addResults(t), m.inject.id(n), m.write.cache(e, { html: t, results: n });
  12585. }, remote: function remote(t, n) {
  12586. n = e.isFunction(n) ? n : function () {}, k.api("is loading") && k.api("abort"), m.setup.api(t, n), k.api("query");
  12587. }, object: function object(t, n, o) {
  12588. var a = [],
  12589. r = [],
  12590. s = [],
  12591. l = t.toString().replace(v.escape, "\\$&"),
  12592. c = new RegExp(v.beginsWith + l, "i"),
  12593. u = function u(t, n) {
  12594. var i = -1 == e.inArray(n, a),
  12595. o = -1 == e.inArray(n, s),
  12596. l = -1 == e.inArray(n, r);i && o && l && t.push(n);
  12597. };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) {
  12598. e.each(n, function (e, n) {
  12599. "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));
  12600. });
  12601. }), e.merge(r, s), e.merge(a, r), a);
  12602. } }, exactSearch: function exactSearch(e, t) {
  12603. return e = e.toLowerCase(), (t = t.toLowerCase()).indexOf(e) > -1;
  12604. }, fuzzySearch: function fuzzySearch(e, t) {
  12605. var n = t.length,
  12606. i = e.length;if ("string" != typeof e) return !1;if (e = e.toLowerCase(), t = t.toLowerCase(), i > n) return !1;if (i === n) return e === t;e: for (var o = 0, a = 0; o < i; o++) {
  12607. for (var r = e.charCodeAt(o); a < n;) {
  12608. if (t.charCodeAt(a++) === r) continue e;
  12609. }return !1;
  12610. }return !0;
  12611. }, parse: { response: function response(e, t) {
  12612. var n = m.generateResults(e);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, { html: n, results: e[b.results] }), m.save.results(e[b.results]));
  12613. } }, cancel: { query: function query() {
  12614. m.can.useAPI() && k.api("abort");
  12615. } }, has: { minimumCharacters: function minimumCharacters() {
  12616. return m.get.value().length >= g.minCharacters;
  12617. }, results: function results() {
  12618. return 0 !== R.length && "" != R.html();
  12619. } }, clear: { cache: function cache(e) {
  12620. var t = k.data(h.cache);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));
  12621. } }, read: { cache: function cache(e) {
  12622. var t = k.data(h.cache);return !!g.cache && (m.verbose("Checking cache for generated html for query", e), "object" == (typeof t === "undefined" ? "undefined" : _typeof(t)) && t[e] !== i && t[e]);
  12623. } }, create: { categoryResults: function categoryResults(t) {
  12624. var n = {};return e.each(t, function (e, t) {
  12625. t.category && (n[t.category] === i ? (m.verbose("Creating new category of results", t.category), n[t.category] = { name: t.category, results: [t] }) : n[t.category].results.push(t));
  12626. }), n;
  12627. }, id: function id(e, t) {
  12628. var n,
  12629. o = e + 1;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;
  12630. }, results: function results() {
  12631. 0 === R.length && (R = e("<div />").addClass(p.results).appendTo(k));
  12632. } }, inject: { result: function result(e, t, n) {
  12633. m.verbose("Injecting result into results");var o = n !== i ? R.children().eq(n).children(y.results).first().children(y.result).eq(t) : R.children(y.result).eq(t);m.verbose("Injecting results metadata", o), o.data(h.result, e);
  12634. }, id: function id(t) {
  12635. m.debug("Injecting unique ids into results");var n = 0,
  12636. o = 0;return "category" === g.type ? e.each(t, function (t, a) {
  12637. o = 0, e.each(a.results, function (e, t) {
  12638. var r = a.results[e];r.id === i && (r.id = m.create.id(o, n)), m.inject.result(r, o, n), o++;
  12639. }), n++;
  12640. }) : e.each(t, function (e, n) {
  12641. var a = t[e];a.id === i && (a.id = m.create.id(o)), m.inject.result(a, o), o++;
  12642. }), t;
  12643. } }, save: { results: function results(e) {
  12644. m.verbose("Saving current search results to metadata", e), k.data(h.results, e);
  12645. } }, write: { cache: function cache(e, t) {
  12646. var n = k.data(h.cache) !== i ? k.data(h.cache) : {};g.cache && (m.verbose("Writing generated html to cache", e, t), n[e] = t, k.data(h.cache, n));
  12647. } }, addResults: function addResults(t) {
  12648. if (e.isFunction(g.onResultsAdd) && !1 === g.onResultsAdd.call(R, t)) return m.debug("onResultsAdd callback cancelled default action"), !1;t ? (R.html(t), m.refreshResults(), g.selectFirstResult && m.select.firstResult(), m.showResults()) : m.hideResults(function () {
  12649. R.empty();
  12650. });
  12651. }, showResults: function showResults(t) {
  12652. 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({ animation: g.transition + " in", debug: g.debug, verbose: g.verbose, duration: g.duration, onComplete: function onComplete() {
  12653. t();
  12654. }, queue: !0 })) : (m.debug("Showing results with javascript"), R.stop().fadeIn(g.duration, g.easing)), g.onResultsOpen.call(R));
  12655. }, hideResults: function hideResults(t) {
  12656. t = e.isFunction(t) ? t : function () {}, m.is.visible() && (m.can.transition() ? (m.debug("Hiding results with css animations"), R.transition({ animation: g.transition + " out", debug: g.debug, verbose: g.verbose, duration: g.duration, onComplete: function onComplete() {
  12657. t();
  12658. }, queue: !0 })) : (m.debug("Hiding results with javascript"), R.stop().fadeOut(g.duration, g.easing)), g.onResultsClose.call(R));
  12659. }, generateResults: function generateResults(t) {
  12660. m.debug("Generating html from response", t);var n = g.templates[g.type],
  12661. i = e.isPlainObject(t[b.results]) && !e.isEmptyObject(t[b.results]),
  12662. o = e.isArray(t[b.results]) && t[b.results].length > 0,
  12663. a = "";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;
  12664. }, displayMessage: function displayMessage(e, t) {
  12665. return t = t || "standard", m.debug("Displaying message", e, t), m.addResults(g.templates.message(e, t)), g.templates.message(e, t);
  12666. }, setting: function setting(t, n) {
  12667. if (e.isPlainObject(t)) e.extend(!0, g, t);else {
  12668. if (n === i) return g[t];g[t] = n;
  12669. }
  12670. }, internal: function internal(t, n) {
  12671. if (e.isPlainObject(t)) e.extend(!0, m, t);else {
  12672. if (n === i) return m[t];m[t] = n;
  12673. }
  12674. }, debug: function debug() {
  12675. !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)));
  12676. }, verbose: function verbose() {
  12677. !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)));
  12678. }, error: function error() {
  12679. g.silent || (m.error = Function.prototype.bind.call(console.error, console, g.name + ":"), m.error.apply(console, arguments));
  12680. }, performance: { log: function log(e) {
  12681. var t, n;g.performance && (n = (t = new Date().getTime()) - (l || t), l = t, c.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: E, "Execution Time": n })), clearTimeout(m.performance.timer), m.performance.timer = setTimeout(m.performance.display, 500);
  12682. }, display: function display() {
  12683. var t = g.name + ":",
  12684. n = 0;l = !1, clearTimeout(m.performance.timer), e.each(c, function (e, t) {
  12685. n += t["Execution Time"];
  12686. }), 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) {
  12687. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  12688. }), console.groupEnd()), c = [];
  12689. } }, invoke: function invoke(t, n, o) {
  12690. var r,
  12691. s,
  12692. l,
  12693. c = F;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) {
  12694. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  12695. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);c = c[o];
  12696. }
  12697. })), 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;
  12698. } }, d ? (F === i && m.initialize(), m.invoke(u)) : (F !== i && F.invoke("destroy"), m.initialize());
  12699. }), a !== i ? a : this;
  12700. }, e.fn.search.settings = { name: "Search", namespace: "search", silent: !1, debug: !1, verbose: !1, performance: !0, type: "standard", minCharacters: 1, selectFirstResult: !1, apiSettings: !1, source: !1, searchOnFocus: !0, searchFields: ["title", "description"], displayField: "", fullTextSearch: "exact", automatic: !0, hideDelay: 0, searchDelay: 200, maxResults: 7, cache: !0, showNoResults: !0, transition: "scale", duration: 200, easing: "easeOutExpo", onSelect: !1, onResultsAdd: !1, onSearchQuery: function onSearchQuery(e) {}, onResults: function onResults(e) {}, onResultsOpen: function onResultsOpen() {}, onResultsClose: function onResultsClose() {}, className: { animating: "animating", active: "active", empty: "empty", focus: "focus", hidden: "hidden", loading: "loading", results: "results", pressed: "down" }, error: { source: "Cannot search. No source used, and Semantic API module was not included", noResults: "Your search returned no results", logging: "Error in debug logging, exiting.", noEndpoint: "No search endpoint was specified", noTemplate: "A valid template name was not specified.", oldSearchSyntax: "searchFullText setting has been renamed fullTextSearch for consistency, please adjust your settings.", serverError: "There was an issue querying the server.", maxResults: "Results must be an array to use maxResults setting", method: "The method you called is not defined." }, metadata: { cache: "cache", results: "results", result: "result" }, regExp: { escape: /[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, beginsWith: "(?:s|^)" }, fields: { categories: "results", categoryName: "name", categoryResults: "results", description: "description", image: "image", price: "price", results: "results", title: "title", url: "url", action: "action", actionText: "text", actionURL: "url" }, selector: { prompt: ".prompt", searchButton: ".search.button", results: ".results", message: ".results > .message", category: ".category", result: ".result", title: ".title, .name" }, templates: { escape: function escape(e) {
  12701. var t = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#x27;", "`": "&#x60;" };return (/[&<>"'`]/.test(e) ? e.replace(/[&<>"'`]/g, function (e) {
  12702. return t[e];
  12703. }) : e
  12704. );
  12705. }, message: function message(e, t) {
  12706. var n = "";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;
  12707. }, category: function category(t, n) {
  12708. var o = "";e.fn.search.settings.templates.escape;return t[n.categoryResults] !== i && (e.each(t[n.categoryResults], function (t, a) {
  12709. 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) {
  12710. 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>";
  12711. }), o += "</div>", o += "</div>");
  12712. }), t[n.action] && (o += '<a href="' + t[n.action][n.actionURL] + '" class="action">' + t[n.action][n.actionText] + "</a>"), o);
  12713. }, standard: function standard(t, n) {
  12714. var o = "";return t[n.results] !== i && (e.each(t[n.results], function (e, t) {
  12715. 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>";
  12716. }), t[n.action] && (o += '<a href="' + t[n.action][n.actionURL] + '" class="action">' + t[n.action][n.actionText] + "</a>"), o);
  12717. } } };
  12718. }(jQuery, window, document), function (e, t, n, i) {
  12719. "use strict";
  12720. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.shape = function (o) {
  12721. var a,
  12722. r = e(this),
  12723. s = (e("body"), new Date().getTime()),
  12724. l = [],
  12725. c = arguments[0],
  12726. u = "string" == typeof c,
  12727. d = [].slice.call(arguments, 1),
  12728. f = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  12729. setTimeout(e, 0);
  12730. };return r.each(function () {
  12731. var t,
  12732. m,
  12733. g,
  12734. p = r.selector || "",
  12735. h = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.shape.settings, o) : e.extend({}, e.fn.shape.settings),
  12736. v = h.namespace,
  12737. b = h.selector,
  12738. y = h.error,
  12739. x = h.className,
  12740. C = "." + v,
  12741. w = "module-" + v,
  12742. S = e(this),
  12743. k = S.find(b.sides),
  12744. T = S.find(b.side),
  12745. A = !1,
  12746. R = this,
  12747. P = S.data(w);g = { initialize: function initialize() {
  12748. g.verbose("Initializing module for", R), g.set.defaultSide(), g.instantiate();
  12749. }, instantiate: function instantiate() {
  12750. g.verbose("Storing instance of module", g), P = g, S.data(w, P);
  12751. }, destroy: function destroy() {
  12752. g.verbose("Destroying previous module for", R), S.removeData(w).off(C);
  12753. }, refresh: function refresh() {
  12754. g.verbose("Refreshing selector cache for", R), S = e(R), k = e(this).find(b.shape), T = e(this).find(b.side);
  12755. }, repaint: function repaint() {
  12756. g.verbose("Forcing repaint event");(k[0] || n.createElement("div")).offsetWidth;
  12757. }, animate: function animate(e, n) {
  12758. g.verbose("Animating box with properties", e), n = n || function (e) {
  12759. g.verbose("Executing animation callback"), e !== i && e.stopPropagation(), g.reset(), g.set.active();
  12760. }, 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 () {
  12761. S.addClass(x.animating), t.addClass(x.hidden);
  12762. })) : n();
  12763. }, queue: function queue(e) {
  12764. g.debug("Queueing animation of", e), k.one(g.get.transitionEvent(), function () {
  12765. g.debug("Executing queued animation"), setTimeout(function () {
  12766. S.shape(e);
  12767. }, 0);
  12768. });
  12769. }, reset: function reset() {
  12770. 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");
  12771. }, is: { complete: function complete() {
  12772. return T.filter("." + x.active)[0] == m[0];
  12773. }, animating: function animating() {
  12774. return S.hasClass(x.animating);
  12775. } }, set: { defaultSide: function defaultSide() {
  12776. 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);
  12777. }, duration: function duration(e) {
  12778. 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({ "-webkit-transition-duration": e, "-moz-transition-duration": e, "-ms-transition-duration": e, "-o-transition-duration": e, "transition-duration": e });
  12779. }, currentStageSize: function currentStageSize() {
  12780. var e = S.find("." + h.className.active),
  12781. t = e.outerWidth(!0),
  12782. n = e.outerHeight(!0);S.css({ width: t, height: n });
  12783. }, stageSize: function stageSize() {
  12784. var e = S.clone().addClass(x.loading),
  12785. t = e.find("." + h.className.active),
  12786. n = A ? e.find(b.side).eq(A) : t.next(b.side).length > 0 ? t.next(b.side) : e.find(b.side).first(),
  12787. i = "next" == h.width ? n.outerWidth(!0) : "initial" == h.width ? S.width() : h.width,
  12788. o = "next" == h.height ? n.outerHeight(!0) : "initial" == h.height ? S.height() : h.height;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));
  12789. }, nextSide: function nextSide(e) {
  12790. 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);
  12791. }, active: function active() {
  12792. g.verbose("Setting new side to active", m), T.removeClass(x.active), m.addClass(x.active), h.onChange.call(m[0]), g.set.defaultSide();
  12793. } }, flip: { up: function up() {
  12794. if (!g.is.complete() || g.is.animating() || h.allowRepeats) {
  12795. if (g.is.animating()) g.queue("flip up");else {
  12796. g.debug("Flipping up", m);var e = g.get.transform.up();g.set.stageSize(), g.stage.above(), g.animate(e);
  12797. }
  12798. } else g.debug("Side already visible", m);
  12799. }, down: function down() {
  12800. if (!g.is.complete() || g.is.animating() || h.allowRepeats) {
  12801. if (g.is.animating()) g.queue("flip down");else {
  12802. g.debug("Flipping down", m);var e = g.get.transform.down();g.set.stageSize(), g.stage.below(), g.animate(e);
  12803. }
  12804. } else g.debug("Side already visible", m);
  12805. }, left: function left() {
  12806. if (!g.is.complete() || g.is.animating() || h.allowRepeats) {
  12807. if (g.is.animating()) g.queue("flip left");else {
  12808. g.debug("Flipping left", m);var e = g.get.transform.left();g.set.stageSize(), g.stage.left(), g.animate(e);
  12809. }
  12810. } else g.debug("Side already visible", m);
  12811. }, right: function right() {
  12812. if (!g.is.complete() || g.is.animating() || h.allowRepeats) {
  12813. if (g.is.animating()) g.queue("flip right");else {
  12814. g.debug("Flipping right", m);var e = g.get.transform.right();g.set.stageSize(), g.stage.right(), g.animate(e);
  12815. }
  12816. } else g.debug("Side already visible", m);
  12817. }, over: function over() {
  12818. !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);
  12819. }, back: function back() {
  12820. !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);
  12821. } }, get: { transform: { up: function up() {
  12822. return { transform: "translateY(" + -(t.outerHeight(!0) - m.outerHeight(!0)) / 2 + "px) translateZ(" + -t.outerHeight(!0) / 2 + "px) rotateX(-90deg)" };
  12823. }, down: function down() {
  12824. return { transform: "translateY(" + -(t.outerHeight(!0) - m.outerHeight(!0)) / 2 + "px) translateZ(" + -t.outerHeight(!0) / 2 + "px) rotateX(90deg)" };
  12825. }, left: function left() {
  12826. return { transform: "translateX(" + -(t.outerWidth(!0) - m.outerWidth(!0)) / 2 + "px) translateZ(" + -t.outerWidth(!0) / 2 + "px) rotateY(90deg)" };
  12827. }, right: function right() {
  12828. return { transform: "translateX(" + -(t.outerWidth(!0) - m.outerWidth(!0)) / 2 + "px) translateZ(" + -t.outerWidth(!0) / 2 + "px) rotateY(-90deg)" };
  12829. }, over: function over() {
  12830. return { transform: "translateX(" + -(t.outerWidth(!0) - m.outerWidth(!0)) / 2 + "px) rotateY(180deg)" };
  12831. }, back: function back() {
  12832. return { transform: "translateX(" + -(t.outerWidth(!0) - m.outerWidth(!0)) / 2 + "px) rotateY(-180deg)" };
  12833. } }, transitionEvent: function transitionEvent() {
  12834. var e,
  12835. t = n.createElement("element"),
  12836. o = { transition: "transitionend", OTransition: "oTransitionEnd", MozTransition: "transitionend", WebkitTransition: "webkitTransitionEnd" };for (e in o) {
  12837. if (t.style[e] !== i) return o[e];
  12838. }
  12839. }, nextSide: function nextSide() {
  12840. return t.next(b.side).length > 0 ? t.next(b.side) : S.find(b.side).first();
  12841. } }, stage: { above: function above() {
  12842. var e = { origin: (t.outerHeight(!0) - m.outerHeight(!0)) / 2, depth: { active: m.outerHeight(!0) / 2, next: t.outerHeight(!0) / 2 } };g.verbose("Setting the initial animation position as above", m, e), k.css({ transform: "translateZ(-" + e.depth.active + "px)" }), t.css({ transform: "rotateY(0deg) translateZ(" + e.depth.active + "px)" }), m.addClass(x.animating).css({ top: e.origin + "px", transform: "rotateX(90deg) translateZ(" + e.depth.next + "px)" });
  12843. }, below: function below() {
  12844. var e = { origin: (t.outerHeight(!0) - m.outerHeight(!0)) / 2, depth: { active: m.outerHeight(!0) / 2, next: t.outerHeight(!0) / 2 } };g.verbose("Setting the initial animation position as below", m, e), k.css({ transform: "translateZ(-" + e.depth.active + "px)" }), t.css({ transform: "rotateY(0deg) translateZ(" + e.depth.active + "px)" }), m.addClass(x.animating).css({ top: e.origin + "px", transform: "rotateX(-90deg) translateZ(" + e.depth.next + "px)" });
  12845. }, left: function left() {
  12846. var e = t.outerWidth(!0),
  12847. n = m.outerWidth(!0),
  12848. i = { origin: (e - n) / 2, depth: { active: n / 2, next: e / 2 } };g.verbose("Setting the initial animation position as left", m, i), k.css({ transform: "translateZ(-" + i.depth.active + "px)" }), t.css({ transform: "rotateY(0deg) translateZ(" + i.depth.active + "px)" }), m.addClass(x.animating).css({ left: i.origin + "px", transform: "rotateY(-90deg) translateZ(" + i.depth.next + "px)" });
  12849. }, right: function right() {
  12850. var e = t.outerWidth(!0),
  12851. n = m.outerWidth(!0),
  12852. i = { origin: (e - n) / 2, depth: { active: n / 2, next: e / 2 } };g.verbose("Setting the initial animation position as left", m, i), k.css({ transform: "translateZ(-" + i.depth.active + "px)" }), t.css({ transform: "rotateY(0deg) translateZ(" + i.depth.active + "px)" }), m.addClass(x.animating).css({ left: i.origin + "px", transform: "rotateY(90deg) translateZ(" + i.depth.next + "px)" });
  12853. }, behind: function behind() {
  12854. var e = t.outerWidth(!0),
  12855. n = m.outerWidth(!0),
  12856. i = { origin: (e - n) / 2, depth: { active: n / 2, next: e / 2 } };g.verbose("Setting the initial animation position as behind", m, i), t.css({ transform: "rotateY(0deg)" }), m.addClass(x.animating).css({ left: i.origin + "px", transform: "rotateY(-180deg)" });
  12857. } }, setting: function setting(t, n) {
  12858. if (g.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, h, t);else {
  12859. if (n === i) return h[t];e.isPlainObject(h[t]) ? e.extend(!0, h[t], n) : h[t] = n;
  12860. }
  12861. }, internal: function internal(t, n) {
  12862. if (e.isPlainObject(t)) e.extend(!0, g, t);else {
  12863. if (n === i) return g[t];g[t] = n;
  12864. }
  12865. }, debug: function debug() {
  12866. !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)));
  12867. }, verbose: function verbose() {
  12868. !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)));
  12869. }, error: function error() {
  12870. h.silent || (g.error = Function.prototype.bind.call(console.error, console, h.name + ":"), g.error.apply(console, arguments));
  12871. }, performance: { log: function log(e) {
  12872. var t, n;h.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: R, "Execution Time": n })), clearTimeout(g.performance.timer), g.performance.timer = setTimeout(g.performance.display, 500);
  12873. }, display: function display() {
  12874. var t = h.name + ":",
  12875. n = 0;s = !1, clearTimeout(g.performance.timer), e.each(l, function (e, t) {
  12876. n += t["Execution Time"];
  12877. }), 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) {
  12878. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  12879. }), console.groupEnd()), l = [];
  12880. } }, invoke: function invoke(t, n, o) {
  12881. var r,
  12882. s,
  12883. l,
  12884. c = P;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) {
  12885. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  12886. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);c = c[o];
  12887. }
  12888. })), 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;
  12889. } }, u ? (P === i && g.initialize(), g.invoke(c)) : (P !== i && P.invoke("destroy"), g.initialize());
  12890. }), a !== i ? a : this;
  12891. }, e.fn.shape.settings = { name: "Shape", silent: !1, debug: !1, verbose: !1, jitter: 0, performance: !0, namespace: "shape", width: "initial", height: "initial", beforeChange: function beforeChange() {}, onChange: function onChange() {}, allowRepeats: !1, duration: !1, error: { side: "You tried to switch to a side that does not exist.", method: "The method you called is not defined" }, className: { animating: "animating", hidden: "hidden", loading: "loading", active: "active" }, selector: { sides: ".sides", side: ".side" } };
  12892. }(jQuery, window, document), function (e, t, n, i) {
  12893. "use strict";
  12894. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.sidebar = function (o) {
  12895. var a,
  12896. r = e(this),
  12897. s = e(t),
  12898. l = e(n),
  12899. c = e("html"),
  12900. u = e("head"),
  12901. d = r.selector || "",
  12902. f = new Date().getTime(),
  12903. m = [],
  12904. g = arguments[0],
  12905. p = "string" == typeof g,
  12906. h = [].slice.call(arguments, 1),
  12907. v = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  12908. setTimeout(e, 0);
  12909. };return r.each(function () {
  12910. var r,
  12911. b,
  12912. y,
  12913. x,
  12914. C,
  12915. w,
  12916. S = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.sidebar.settings, o) : e.extend({}, e.fn.sidebar.settings),
  12917. k = S.selector,
  12918. T = S.className,
  12919. A = S.namespace,
  12920. R = S.regExp,
  12921. P = S.error,
  12922. E = "." + A,
  12923. F = "module-" + A,
  12924. O = e(this),
  12925. D = e(S.context),
  12926. q = O.children(k.sidebar),
  12927. j = (D.children(k.fixed), D.children(k.pusher)),
  12928. z = this,
  12929. I = O.data(F);w = { initialize: function initialize() {
  12930. w.debug("Initializing sidebar", o), w.create.id(), C = w.get.transitionEvent(), S.delaySetup ? v(w.setup.layout) : w.setup.layout(), v(function () {
  12931. w.setup.cache();
  12932. }), w.instantiate();
  12933. }, instantiate: function instantiate() {
  12934. w.verbose("Storing instance of module", w), I = w, O.data(F, w);
  12935. }, create: { id: function id() {
  12936. y = (Math.random().toString(16) + "000000000").substr(2, 8), b = "." + y, w.verbose("Creating unique id for element", y);
  12937. } }, destroy: function destroy() {
  12938. 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);
  12939. }, event: { clickaway: function clickaway(e) {
  12940. var t = j.find(e.target).length > 0 || j.is(e.target),
  12941. n = D.is(e.target);t && (w.verbose("User clicked on dimmed page"), w.hide()), n && (w.verbose("User clicked on dimmable context (scaled out page)"), w.hide());
  12942. }, touch: function touch(e) {}, containScroll: function containScroll(e) {
  12943. z.scrollTop <= 0 && (z.scrollTop = 1), z.scrollTop + z.offsetHeight >= z.scrollHeight && (z.scrollTop = z.scrollHeight - z.offsetHeight - 1);
  12944. }, scroll: function scroll(t) {
  12945. 0 === e(t.target).closest(k.sidebar).length && t.preventDefault();
  12946. } }, bind: { clickaway: function clickaway() {
  12947. w.verbose("Adding clickaway events to context", D), S.closable && D.on("click" + b, w.event.clickaway).on("touchend" + b, w.event.clickaway);
  12948. }, scrollLock: function scrollLock() {
  12949. 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);
  12950. } }, unbind: { clickaway: function clickaway() {
  12951. w.verbose("Removing clickaway events from context", D), D.off(b);
  12952. }, scrollLock: function scrollLock() {
  12953. w.verbose("Removing scroll lock from page"), l.off(b), s.off(b), O.off("scroll" + E);
  12954. } }, add: { inlineCSS: function inlineCSS() {
  12955. var t,
  12956. n = w.cache.width || O.outerWidth(),
  12957. i = w.cache.height || O.outerHeight(),
  12958. o = w.is.rtl(),
  12959. a = w.get.direction(),
  12960. s = { left: n, right: -n, top: i, bottom: -i };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);
  12961. } }, refresh: function refresh() {
  12962. 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();
  12963. }, refreshSidebars: function refreshSidebars() {
  12964. w.verbose("Refreshing other sidebars"), q = D.children(k.sidebar);
  12965. }, repaint: function repaint() {
  12966. w.verbose("Forcing repaint event"), z.style.display = "none";z.offsetHeight;z.scrollTop = z.scrollTop, z.style.display = "";
  12967. }, setup: { cache: function cache() {
  12968. w.cache = { width: O.outerWidth(), height: O.outerHeight(), rtl: "rtl" == O.css("direction") };
  12969. }, layout: function layout() {
  12970. 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();
  12971. } }, attachEvents: function attachEvents(t, n) {
  12972. var i = e(t);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);
  12973. }, show: function show(t) {
  12974. if (t = e.isFunction(t) ? t : function () {}, w.is.hidden()) {
  12975. 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) {
  12976. if ("overlay" != S.transition) return void w.hideOthers(w.show);w.hideOthers();
  12977. } else S.transition = "overlay";w.pushPage(function () {
  12978. t.call(z), S.onShow.call(z);
  12979. }), S.onChange.call(z), S.onVisible.call(z);
  12980. } else w.debug("Sidebar is already visible");
  12981. }, hide: function hide(t) {
  12982. t = e.isFunction(t) ? t : function () {}, (w.is.visible() || w.is.animating()) && (w.debug("Hiding sidebar", t), w.refreshSidebars(), w.pullPage(function () {
  12983. t.call(z), S.onHidden.call(z);
  12984. }), S.onChange.call(z), S.onHide.call(z));
  12985. }, othersAnimating: function othersAnimating() {
  12986. return q.not(O).filter("." + T.animating).length > 0;
  12987. }, othersVisible: function othersVisible() {
  12988. return q.not(O).filter("." + T.visible).length > 0;
  12989. }, othersActive: function othersActive() {
  12990. return w.othersVisible() || w.othersAnimating();
  12991. }, hideOthers: function hideOthers(e) {
  12992. var t = q.not(O).filter("." + T.visible),
  12993. n = t.length,
  12994. i = 0;e = e || function () {}, t.sidebar("hide", function () {
  12995. ++i == n && e();
  12996. });
  12997. }, toggle: function toggle() {
  12998. w.verbose("Determining toggled direction"), w.is.hidden() ? w.show() : w.hide();
  12999. }, pushPage: function pushPage(t) {
  13000. var n,
  13001. i,
  13002. _o,
  13003. a = w.get.transition(),
  13004. r = "overlay" === a || w.othersActive() ? O : j;t = e.isFunction(t) ? t : function () {}, "scale down" == S.transition && w.scrollToTop(), w.set.transition(a), w.repaint(), n = function n() {
  13005. w.bind.clickaway(), w.add.inlineCSS(), w.set.animating(), w.set.visible();
  13006. }, i = function i() {
  13007. w.set.dimmed();
  13008. }, _o = function o(e) {
  13009. e.target == r[0] && (r.off(C + b, _o), w.remove.animating(), w.bind.scrollLock(), t.call(z));
  13010. }, r.off(C + b), r.on(C + b, _o), v(n), S.dimPage && !w.othersVisible() && v(i);
  13011. }, pullPage: function pullPage(t) {
  13012. var n,
  13013. _i,
  13014. o = w.get.transition(),
  13015. a = "overlay" == o || w.othersActive() ? O : j;t = e.isFunction(t) ? t : function () {}, w.verbose("Removing context push state", w.get.direction()), w.unbind.clickaway(), w.unbind.scrollLock(), n = function n() {
  13016. w.set.transition(o), w.set.animating(), w.remove.visible(), S.dimPage && !w.othersVisible() && j.removeClass(T.dimmed);
  13017. }, _i = function i(e) {
  13018. 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));
  13019. }, a.off(C + b), a.on(C + b, _i), v(n);
  13020. }, scrollToTop: function scrollToTop() {
  13021. w.verbose("Scrolling to top of page to avoid animation issues"), x = e(t).scrollTop(), O.scrollTop(0), t.scrollTo(0, 0);
  13022. }, scrollBack: function scrollBack() {
  13023. w.verbose("Scrolling back to original page position"), t.scrollTo(0, x);
  13024. }, clear: { cache: function cache() {
  13025. w.verbose("Clearing cached dimensions"), w.cache = {};
  13026. } }, set: { ios: function ios() {
  13027. c.addClass(T.ios);
  13028. }, pushed: function pushed() {
  13029. D.addClass(T.pushed);
  13030. }, pushable: function pushable() {
  13031. D.addClass(T.pushable);
  13032. }, dimmed: function dimmed() {
  13033. j.addClass(T.dimmed);
  13034. }, active: function active() {
  13035. O.addClass(T.active);
  13036. }, animating: function animating() {
  13037. O.addClass(T.animating);
  13038. }, transition: function transition(e) {
  13039. e = e || w.get.transition(), O.addClass(e);
  13040. }, direction: function direction(e) {
  13041. e = e || w.get.direction(), O.addClass(T[e]);
  13042. }, visible: function visible() {
  13043. O.addClass(T.visible);
  13044. }, overlay: function overlay() {
  13045. O.addClass(T.overlay);
  13046. } }, remove: { inlineCSS: function inlineCSS() {
  13047. w.debug("Removing inline css styles", r), r && r.length > 0 && r.remove();
  13048. }, ios: function ios() {
  13049. c.removeClass(T.ios);
  13050. }, pushed: function pushed() {
  13051. D.removeClass(T.pushed);
  13052. }, pushable: function pushable() {
  13053. D.removeClass(T.pushable);
  13054. }, active: function active() {
  13055. O.removeClass(T.active);
  13056. }, animating: function animating() {
  13057. O.removeClass(T.animating);
  13058. }, transition: function transition(e) {
  13059. e = e || w.get.transition(), O.removeClass(e);
  13060. }, direction: function direction(e) {
  13061. e = e || w.get.direction(), O.removeClass(T[e]);
  13062. }, visible: function visible() {
  13063. O.removeClass(T.visible);
  13064. }, overlay: function overlay() {
  13065. O.removeClass(T.overlay);
  13066. } }, get: { direction: function direction() {
  13067. return O.hasClass(T.top) ? T.top : O.hasClass(T.right) ? T.right : O.hasClass(T.bottom) ? T.bottom : T.left;
  13068. }, transition: function transition() {
  13069. var e,
  13070. t = w.get.direction();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;
  13071. }, transitionEvent: function transitionEvent() {
  13072. var e,
  13073. t = n.createElement("element"),
  13074. o = { transition: "transitionend", OTransition: "oTransitionEnd", MozTransition: "transitionend", WebkitTransition: "webkitTransitionEnd" };for (e in o) {
  13075. if (t.style[e] !== i) return o[e];
  13076. }
  13077. } }, is: { ie: function ie() {
  13078. return !t.ActiveXObject && "ActiveXObject" in t || "ActiveXObject" in t;
  13079. }, ios: function ios() {
  13080. var e = navigator.userAgent,
  13081. t = e.match(R.ios),
  13082. n = e.match(R.mobileChrome);return !(!t || n) && (w.verbose("Browser was found to be iOS", e), !0);
  13083. }, mobile: function mobile() {
  13084. var e = navigator.userAgent;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);
  13085. }, hidden: function hidden() {
  13086. return !w.is.visible();
  13087. }, visible: function visible() {
  13088. return O.hasClass(T.visible);
  13089. }, open: function open() {
  13090. return w.is.visible();
  13091. }, closed: function closed() {
  13092. return w.is.hidden();
  13093. }, vertical: function vertical() {
  13094. return O.hasClass(T.top);
  13095. }, animating: function animating() {
  13096. return D.hasClass(T.animating);
  13097. }, rtl: function rtl() {
  13098. return w.cache.rtl === i && (w.cache.rtl = "rtl" == O.css("direction")), w.cache.rtl;
  13099. } }, setting: function setting(t, n) {
  13100. if (w.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, S, t);else {
  13101. if (n === i) return S[t];e.isPlainObject(S[t]) ? e.extend(!0, S[t], n) : S[t] = n;
  13102. }
  13103. }, internal: function internal(t, n) {
  13104. if (e.isPlainObject(t)) e.extend(!0, w, t);else {
  13105. if (n === i) return w[t];w[t] = n;
  13106. }
  13107. }, debug: function debug() {
  13108. !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)));
  13109. }, verbose: function verbose() {
  13110. !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)));
  13111. }, error: function error() {
  13112. S.silent || (w.error = Function.prototype.bind.call(console.error, console, S.name + ":"), w.error.apply(console, arguments));
  13113. }, performance: { log: function log(e) {
  13114. var t, n;S.performance && (n = (t = new Date().getTime()) - (f || t), f = t, m.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: z, "Execution Time": n })), clearTimeout(w.performance.timer), w.performance.timer = setTimeout(w.performance.display, 500);
  13115. }, display: function display() {
  13116. var t = S.name + ":",
  13117. n = 0;f = !1, clearTimeout(w.performance.timer), e.each(m, function (e, t) {
  13118. n += t["Execution Time"];
  13119. }), 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) {
  13120. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  13121. }), console.groupEnd()), m = [];
  13122. } }, invoke: function invoke(t, n, o) {
  13123. var r,
  13124. s,
  13125. l,
  13126. c = I;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) {
  13127. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  13128. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (w.error(P.method, t), !1);c = c[o];
  13129. }
  13130. })), 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;
  13131. } }, p ? (I === i && w.initialize(), w.invoke(g)) : (I !== i && w.invoke("destroy"), w.initialize());
  13132. }), a !== i ? a : this;
  13133. }, e.fn.sidebar.settings = { name: "Sidebar", namespace: "sidebar", silent: !1, debug: !1, verbose: !1, performance: !0, transition: "auto", mobileTransition: "auto", defaultTransition: { computer: { left: "uncover", right: "uncover", top: "overlay", bottom: "overlay" }, mobile: { left: "uncover", right: "uncover", top: "overlay", bottom: "overlay" } }, context: "body", exclusive: !1, closable: !0, dimPage: !0, scrollLock: !1, returnScroll: !1, delaySetup: !1, duration: 500, onChange: function onChange() {}, onShow: function onShow() {}, onHide: function onHide() {}, onHidden: function onHidden() {}, onVisible: function onVisible() {}, className: { active: "active", animating: "animating", dimmed: "dimmed", ios: "ios", pushable: "pushable", pushed: "pushed", right: "right", top: "top", left: "left", bottom: "bottom", visible: "visible" }, selector: { fixed: ".fixed", omitted: "script, link, style, .ui.modal, .ui.dimmer, .ui.nag, .ui.fixed", pusher: ".pusher", sidebar: ".ui.sidebar" }, regExp: { ios: /(iPad|iPhone|iPod)/g, mobileChrome: /(CriOS)/g, 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 }, error: { method: "The method you called is not defined.", pusher: "Had to add pusher element. For optimal performance make sure body content is inside a pusher element", movedSidebar: "Had to move sidebar. For optimal performance make sure sidebar and pusher are direct children of your body tag", overlay: "The overlay setting is no longer supported, use animation: overlay", notFound: "There were no elements that matched the specified selector" } };
  13134. }(jQuery, window, document), function (e, t, n, i) {
  13135. "use strict";
  13136. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.sticky = function (o) {
  13137. var a,
  13138. r = e(this),
  13139. s = r.selector || "",
  13140. l = new Date().getTime(),
  13141. c = [],
  13142. u = arguments[0],
  13143. d = "string" == typeof u,
  13144. f = [].slice.call(arguments, 1);return r.each(function () {
  13145. var r,
  13146. m,
  13147. g,
  13148. p,
  13149. h,
  13150. v = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.sticky.settings, o) : e.extend({}, e.fn.sticky.settings),
  13151. b = v.className,
  13152. y = v.namespace,
  13153. x = v.error,
  13154. C = "." + y,
  13155. w = "module-" + y,
  13156. S = e(this),
  13157. k = e(t),
  13158. T = e(v.scrollContext),
  13159. A = (S.selector, S.data(w)),
  13160. R = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  13161. setTimeout(e, 0);
  13162. },
  13163. P = this;h = { initialize: function initialize() {
  13164. h.determineContainer(), h.determineContext(), h.verbose("Initializing sticky", v, r), h.save.positions(), h.checkErrors(), h.bind.events(), v.observeChanges && h.observeChanges(), h.instantiate();
  13165. }, instantiate: function instantiate() {
  13166. h.verbose("Storing instance of module", h), A = h, S.data(w, h);
  13167. }, destroy: function destroy() {
  13168. 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);
  13169. }, observeChanges: function observeChanges() {
  13170. "MutationObserver" in t && (g = new MutationObserver(h.event.documentChanged), p = new MutationObserver(h.event.changed), g.observe(n, { childList: !0, subtree: !0 }), p.observe(P, { childList: !0, subtree: !0 }), p.observe(m[0], { childList: !0, subtree: !0 }), h.debug("Setting up mutation observer", p));
  13171. }, determineContainer: function determineContainer() {
  13172. r = v.container ? e(v.container) : S.offsetParent();
  13173. }, determineContext: function determineContext() {
  13174. 0 !== (m = v.context ? e(v.context) : r).length || h.error(x.invalidContext, v.context, S);
  13175. }, checkErrors: function checkErrors() {
  13176. 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);
  13177. }, bind: { events: function events() {
  13178. 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);
  13179. } }, event: { changed: function changed(e) {
  13180. clearTimeout(h.timer), h.timer = setTimeout(function () {
  13181. h.verbose("DOM tree modified, updating sticky menu", e), h.refresh();
  13182. }, 100);
  13183. }, documentChanged: function documentChanged(t) {
  13184. [].forEach.call(t, function (t) {
  13185. t.removedNodes && [].forEach.call(t.removedNodes, function (t) {
  13186. (t == P || e(t).find(P).length > 0) && (h.debug("Element removed from DOM, tearing down events"), h.destroy());
  13187. });
  13188. });
  13189. }, load: function load() {
  13190. h.verbose("Page contents finished loading"), R(h.refresh);
  13191. }, resize: function resize() {
  13192. h.verbose("Window resized"), R(h.refresh);
  13193. }, scroll: function scroll() {
  13194. R(function () {
  13195. T.triggerHandler("scrollchange" + C, T.scrollTop());
  13196. });
  13197. }, scrollchange: function scrollchange(e, t) {
  13198. h.stick(t), v.onScroll.call(P);
  13199. } }, refresh: function refresh(e) {
  13200. h.reset(), v.context || h.determineContext(), e && h.determineContainer(), h.save.positions(), h.stick(), v.onReposition.call(P);
  13201. }, supports: { sticky: function sticky() {
  13202. var t = e("<div/>");t[0];return t.addClass(b.supported), t.css("position").match("sticky");
  13203. } }, save: { lastScroll: function lastScroll(e) {
  13204. h.lastScroll = e;
  13205. }, elementScroll: function elementScroll(e) {
  13206. h.elementScroll = e;
  13207. }, positions: function positions() {
  13208. var e = { height: T.height() },
  13209. t = { margin: { top: parseInt(S.css("margin-top"), 10), bottom: parseInt(S.css("margin-bottom"), 10) }, offset: S.offset(), width: S.outerWidth(), height: S.outerHeight() },
  13210. n = { offset: m.offset(), height: m.outerHeight() };r.outerHeight();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 = { fits: t.height + v.offset <= e.height, sameHeight: t.height == n.height, scrollContext: { height: e.height }, element: { margin: t.margin, top: t.offset.top - t.margin.top, left: t.offset.left, width: t.width, height: t.height, bottom: t.offset.top + t.height }, context: { top: n.offset.top, height: n.height, bottom: n.offset.top + n.height } }, h.set.containerSize(), h.stick(), h.debug("Caching element positions", h.cache);
  13211. } }, get: { direction: function direction(e) {
  13212. var t = "down";return e = e || T.scrollTop(), h.lastScroll !== i && (h.lastScroll < e ? t = "down" : h.lastScroll > e && (t = "up")), t;
  13213. }, scrollChange: function scrollChange(e) {
  13214. return e = e || T.scrollTop(), h.lastScroll ? e - h.lastScroll : 0;
  13215. }, currentElementScroll: function currentElementScroll() {
  13216. return h.elementScroll ? h.elementScroll : h.is.top() ? Math.abs(parseInt(S.css("top"), 10)) || 0 : Math.abs(parseInt(S.css("bottom"), 10)) || 0;
  13217. }, elementScroll: function elementScroll(e) {
  13218. e = e || T.scrollTop();var t = h.cache.element,
  13219. n = h.cache.scrollContext,
  13220. i = h.get.scrollChange(e),
  13221. o = t.height - n.height + v.offset,
  13222. a = h.get.currentElementScroll(),
  13223. r = a + i;return a = h.cache.fits || r < 0 ? 0 : r > o ? o : r;
  13224. } }, remove: { lastScroll: function lastScroll() {
  13225. delete h.lastScroll;
  13226. }, elementScroll: function elementScroll(e) {
  13227. delete h.elementScroll;
  13228. }, minimumSize: function minimumSize() {
  13229. r.css("min-height", "");
  13230. }, offset: function offset() {
  13231. S.css("margin-top", "");
  13232. } }, set: { offset: function offset() {
  13233. h.verbose("Setting offset on element", v.offset), S.css("margin-top", v.offset);
  13234. }, containerSize: function containerSize() {
  13235. var e = r.get(0).tagName;"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({ height: h.cache.context.height }));
  13236. }, minimumSize: function minimumSize() {
  13237. var e = h.cache.element;r.css("min-height", e.height);
  13238. }, scroll: function scroll(e) {
  13239. 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));
  13240. }, size: function size() {
  13241. 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"));
  13242. } }, is: { standardScroll: function standardScroll() {
  13243. return T[0] == t;
  13244. }, top: function top() {
  13245. return S.hasClass(b.top);
  13246. }, bottom: function bottom() {
  13247. return S.hasClass(b.bottom);
  13248. }, initialPosition: function initialPosition() {
  13249. return !h.is.fixed() && !h.is.bound();
  13250. }, hidden: function hidden() {
  13251. return !S.is(":visible");
  13252. }, bound: function bound() {
  13253. return S.hasClass(b.bound);
  13254. }, fixed: function fixed() {
  13255. return S.hasClass(b.fixed);
  13256. } }, stick: function stick(e) {
  13257. var t = e || T.scrollTop(),
  13258. n = h.cache,
  13259. i = n.fits,
  13260. o = n.sameHeight,
  13261. a = n.element,
  13262. r = n.scrollContext,
  13263. s = n.context,
  13264. l = h.is.bottom() && v.pushing ? v.bottomOffset : v.offset,
  13265. c = (e = { top: t + l, bottom: t + l + r.height }, h.get.direction(e.top), i ? 0 : h.get.elementScroll(e.top)),
  13266. u = !i;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())));
  13267. }, bindTop: function bindTop() {
  13268. h.debug("Binding element to top of parent container"), h.remove.offset(), S.css({ left: "", top: "", marginBottom: "" }).removeClass(b.fixed).removeClass(b.bottom).addClass(b.bound).addClass(b.top), v.onTop.call(P), v.onUnstick.call(P);
  13269. }, bindBottom: function bindBottom() {
  13270. h.debug("Binding element to bottom of parent container"), h.remove.offset(), S.css({ left: "", top: "" }).removeClass(b.fixed).removeClass(b.top).addClass(b.bound).addClass(b.bottom), v.onBottom.call(P), v.onUnstick.call(P);
  13271. }, setInitialPosition: function setInitialPosition() {
  13272. h.debug("Returning to initial position"), h.unfix(), h.unbind();
  13273. }, fixTop: function fixTop() {
  13274. h.debug("Fixing element to top of page"), v.setSize && h.set.size(), h.set.minimumSize(), h.set.offset(), S.css({ left: h.cache.element.left, bottom: "", marginBottom: "" }).removeClass(b.bound).removeClass(b.bottom).addClass(b.fixed).addClass(b.top), v.onStick.call(P);
  13275. }, fixBottom: function fixBottom() {
  13276. h.debug("Sticking element to bottom of page"), v.setSize && h.set.size(), h.set.minimumSize(), h.set.offset(), S.css({ left: h.cache.element.left, bottom: "", marginBottom: "" }).removeClass(b.bound).removeClass(b.top).addClass(b.fixed).addClass(b.bottom), v.onStick.call(P);
  13277. }, unbind: function unbind() {
  13278. h.is.bound() && (h.debug("Removing container bound position on element"), h.remove.offset(), S.removeClass(b.bound).removeClass(b.top).removeClass(b.bottom));
  13279. }, unfix: function unfix() {
  13280. 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));
  13281. }, reset: function reset() {
  13282. h.debug("Resetting elements position"), h.unbind(), h.unfix(), h.resetCSS(), h.remove.offset(), h.remove.lastScroll();
  13283. }, resetCSS: function resetCSS() {
  13284. S.css({ width: "", height: "" }), r.css({ height: "" });
  13285. }, setting: function setting(t, n) {
  13286. if (e.isPlainObject(t)) e.extend(!0, v, t);else {
  13287. if (n === i) return v[t];v[t] = n;
  13288. }
  13289. }, internal: function internal(t, n) {
  13290. if (e.isPlainObject(t)) e.extend(!0, h, t);else {
  13291. if (n === i) return h[t];h[t] = n;
  13292. }
  13293. }, debug: function debug() {
  13294. !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)));
  13295. }, verbose: function verbose() {
  13296. !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)));
  13297. }, error: function error() {
  13298. v.silent || (h.error = Function.prototype.bind.call(console.error, console, v.name + ":"), h.error.apply(console, arguments));
  13299. }, performance: { log: function log(e) {
  13300. var t, n;v.performance && (n = (t = new Date().getTime()) - (l || t), l = t, c.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: P, "Execution Time": n })), clearTimeout(h.performance.timer), h.performance.timer = setTimeout(h.performance.display, 0);
  13301. }, display: function display() {
  13302. var t = v.name + ":",
  13303. n = 0;l = !1, clearTimeout(h.performance.timer), e.each(c, function (e, t) {
  13304. n += t["Execution Time"];
  13305. }), 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) {
  13306. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  13307. }), console.groupEnd()), c = [];
  13308. } }, invoke: function invoke(t, n, o) {
  13309. var r,
  13310. s,
  13311. l,
  13312. c = A;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) {
  13313. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  13314. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);c = c[o];
  13315. }
  13316. })), 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;
  13317. } }, d ? (A === i && h.initialize(), h.invoke(u)) : (A !== i && A.invoke("destroy"), h.initialize());
  13318. }), a !== i ? a : this;
  13319. }, e.fn.sticky.settings = { name: "Sticky", namespace: "sticky", silent: !1, debug: !1, verbose: !0, performance: !0, pushing: !1, context: !1, container: !1, scrollContext: t, offset: 0, bottomOffset: 0, jitter: 5, setSize: !0, observeChanges: !1, onReposition: function onReposition() {}, onScroll: function onScroll() {}, onStick: function onStick() {}, onUnstick: function onUnstick() {}, onTop: function onTop() {}, onBottom: function onBottom() {}, error: { container: "Sticky element must be inside a relative container", visible: "Element is hidden, you must call refresh after element becomes visible. Use silent setting to surpress this warning in production.", method: "The method you called is not defined.", invalidContext: "Context specified does not exist", elementSize: "Sticky element is larger than its container, cannot create sticky." }, className: { bound: "bound", fixed: "fixed", supported: "native", top: "top", bottom: "bottom" } };
  13320. }(jQuery, window, document), function (e, t, n, i) {
  13321. "use strict";
  13322. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.tab = function (o) {
  13323. var a,
  13324. r = e.isFunction(this) ? e(t) : e(this),
  13325. s = r.selector || "",
  13326. l = new Date().getTime(),
  13327. c = [],
  13328. u = arguments[0],
  13329. d = "string" == typeof u,
  13330. f = [].slice.call(arguments, 1),
  13331. m = !1;return r.each(function () {
  13332. var g,
  13333. p,
  13334. h,
  13335. v,
  13336. b,
  13337. y,
  13338. x = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.tab.settings, o) : e.extend({}, e.fn.tab.settings),
  13339. C = x.className,
  13340. w = x.metadata,
  13341. S = x.selector,
  13342. k = x.error,
  13343. T = "." + x.namespace,
  13344. A = "module-" + x.namespace,
  13345. R = e(this),
  13346. P = {},
  13347. E = !0,
  13348. F = 0,
  13349. O = this,
  13350. D = R.data(A);b = { initialize: function initialize() {
  13351. 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();
  13352. }, instantiate: function instantiate() {
  13353. b.verbose("Storing instance of module", b), D = b, R.data(A, b);
  13354. }, destroy: function destroy() {
  13355. b.debug("Destroying tabs", R), R.removeData(A).off(T);
  13356. }, bind: { events: function events() {
  13357. e.isWindow(O) || (b.debug("Attaching tab activation events to element", R), R.on("click" + T, b.event.click));
  13358. } }, determineTabs: function determineTabs() {
  13359. var t;"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));
  13360. }, fix: { callbacks: function callbacks() {
  13361. 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));
  13362. } }, initializeHistory: function initializeHistory() {
  13363. if (b.debug("Initializing page state"), e.address === i) return b.error(k.state), !1;if ("state" == x.historyType) {
  13364. if (b.debug("Using HTML5 to manage state"), !1 === x.path) return b.error(k.path), !1;e.address.history(!0).state(x.path);
  13365. }e.address.bind("change", b.event.history.change);
  13366. }, event: { click: function click(t) {
  13367. var n = e(this).data(w.tab);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");
  13368. }, history: { change: function change(t) {
  13369. var n = t.pathNames.join("/") || b.get.initialPath(),
  13370. o = x.templates.determineTitle(n) || !1;b.performance.display(), b.debug("History change event", n, t), y = t, n !== i && b.changeTab(n), o && e.address.title(o);
  13371. } } }, refresh: function refresh() {
  13372. h && (b.debug("Refreshing tab", h), b.changeTab(h));
  13373. }, cache: { read: function read(e) {
  13374. return e !== i && P[e];
  13375. }, add: function add(e, t) {
  13376. e = e || h, b.debug("Adding cached content for", e), P[e] = t;
  13377. }, remove: function remove(e) {
  13378. e = e || h, b.debug("Removing cached content for", e), delete P[e];
  13379. } }, set: { auto: function auto() {
  13380. var t = "string" == typeof x.path ? x.path.replace(/\/$/, "") + "/{$tab}" : "/{$tab}";b.verbose("Setting up automatic tab retrieval from server", t), e.isPlainObject(x.apiSettings) ? x.apiSettings.url = t : x.apiSettings = { url: t };
  13381. }, loading: function loading(e) {
  13382. var t = b.get.tabElement(e);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));
  13383. }, state: function state(t) {
  13384. e.address.value(t);
  13385. } }, changeTab: function changeTab(n) {
  13386. var i = t.history && t.history.pushState && x.ignoreFirstLoad && E,
  13387. o = x.auto || e.isPlainObject(x.apiSettings),
  13388. a = o && !i ? b.utilities.pathToArray(n) : b.get.defaultPathArray(n);n = b.utilities.arrayToPath(a), e.each(a, function (t, r) {
  13389. var s,
  13390. l,
  13391. c,
  13392. u,
  13393. d = a.slice(0, t + 1),
  13394. f = b.utilities.arrayToPath(d),
  13395. m = b.is.tab(f),
  13396. p = t + 1 == a.length,
  13397. S = b.get.tabElement(f);if (b.verbose("Looking for tab", r), m) {
  13398. 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;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);
  13399. } else {
  13400. if (-1 != n.search("/") || "" === n) return b.error(k.missingTab, R, g, f), !1;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 () {
  13401. b.scrollTo(s);
  13402. }, 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;
  13403. }
  13404. });
  13405. }, scrollTo: function scrollTo(t) {
  13406. var i = !!(t && t.length > 0) && t.offset().top;!1 !== i && (b.debug("Forcing scroll to an in-page link in a hidden tab", i, t), e(n).scrollTop(i));
  13407. }, update: { content: function content(t, n, o) {
  13408. var a = b.get.tabElement(t),
  13409. r = a[0];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);
  13410. } }, fetch: { content: function content(t, n) {
  13411. var o,
  13412. a,
  13413. r = b.get.tabElement(t),
  13414. s = { dataType: "html", encodeParameters: !1, on: "now", cache: x.alwaysRefresh, headers: { "X-Remote": !0 }, onSuccess: function onSuccess(e) {
  13415. "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 () {
  13416. var e = r.children().clone(!0);e = e.not("script"), b.cache.add(n, e);
  13417. }, 0) : b.cache.add(n, r.html());
  13418. }, urlData: { tab: n } },
  13419. l = r.api("get request") || !1,
  13420. c = l && "pending" === l.state();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);
  13421. } }, activate: { all: function all(e) {
  13422. b.activate.tab(e), b.activate.navigation(e);
  13423. }, tab: function tab(e) {
  13424. var t = b.get.tabElement(e),
  13425. n = "siblings" == x.deactivate ? t.siblings(p) : p.not(t),
  13426. i = t.hasClass(C.active);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));
  13427. }, navigation: function navigation(e) {
  13428. var t = b.get.navElement(e),
  13429. n = "siblings" == x.deactivate ? t.siblings(r) : r.not(t),
  13430. i = t.hasClass(C.active);b.verbose("Activating tab navigation for", t, e), i || (t.addClass(C.active), n.removeClass(C.active + " " + C.loading));
  13431. } }, deactivate: { all: function all() {
  13432. b.deactivate.navigation(), b.deactivate.tabs();
  13433. }, navigation: function navigation() {
  13434. r.removeClass(C.active);
  13435. }, tabs: function tabs() {
  13436. p.removeClass(C.active + " " + C.loading);
  13437. } }, is: { tab: function tab(e) {
  13438. return e !== i && b.get.tabElement(e).length > 0;
  13439. } }, get: { initialPath: function initialPath() {
  13440. return r.eq(0).data(w.tab) || p.eq(0).data(w.tab);
  13441. }, path: function path() {
  13442. return e.address.value();
  13443. }, defaultPathArray: function defaultPathArray(e) {
  13444. return b.utilities.pathToArray(b.get.defaultPath(e));
  13445. }, defaultPath: function defaultPath(e) {
  13446. var t = r.filter("[data-" + w.tab + '^="' + e + '/"]').eq(0).data(w.tab) || !1;if (t) {
  13447. if (b.debug("Found default tab", t), F < x.maxDepth) return F++, b.get.defaultPath(t);b.error(k.recursion);
  13448. } else b.debug("No default tabs found for", e, p);return F = 0, e;
  13449. }, navElement: function navElement(e) {
  13450. return e = e || h, r.filter("[data-" + w.tab + '="' + e + '"]');
  13451. }, tabElement: function tabElement(e) {
  13452. var t, n, i, o;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;
  13453. }, tab: function tab() {
  13454. return h;
  13455. } }, utilities: { filterArray: function filterArray(t, n) {
  13456. return e.grep(t, function (t) {
  13457. return -1 == e.inArray(t, n);
  13458. });
  13459. }, last: function last(t) {
  13460. return !!e.isArray(t) && t[t.length - 1];
  13461. }, pathToArray: function pathToArray(e) {
  13462. return e === i && (e = h), "string" == typeof e ? e.split("/") : [e];
  13463. }, arrayToPath: function arrayToPath(t) {
  13464. return !!e.isArray(t) && t.join("/");
  13465. } }, setting: function setting(t, n) {
  13466. if (b.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, x, t);else {
  13467. if (n === i) return x[t];e.isPlainObject(x[t]) ? e.extend(!0, x[t], n) : x[t] = n;
  13468. }
  13469. }, internal: function internal(t, n) {
  13470. if (e.isPlainObject(t)) e.extend(!0, b, t);else {
  13471. if (n === i) return b[t];b[t] = n;
  13472. }
  13473. }, debug: function debug() {
  13474. !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)));
  13475. }, verbose: function verbose() {
  13476. !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)));
  13477. }, error: function error() {
  13478. x.silent || (b.error = Function.prototype.bind.call(console.error, console, x.name + ":"), b.error.apply(console, arguments));
  13479. }, performance: { log: function log(e) {
  13480. var t, n;x.performance && (n = (t = new Date().getTime()) - (l || t), l = t, c.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: O, "Execution Time": n })), clearTimeout(b.performance.timer), b.performance.timer = setTimeout(b.performance.display, 500);
  13481. }, display: function display() {
  13482. var t = x.name + ":",
  13483. n = 0;l = !1, clearTimeout(b.performance.timer), e.each(c, function (e, t) {
  13484. n += t["Execution Time"];
  13485. }), 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) {
  13486. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  13487. }), console.groupEnd()), c = [];
  13488. } }, invoke: function invoke(t, n, o) {
  13489. var r,
  13490. s,
  13491. l,
  13492. c = D;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) {
  13493. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  13494. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (b.error(k.method, t), !1);c = c[o];
  13495. }
  13496. })), 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;
  13497. } }, d ? (D === i && b.initialize(), b.invoke(u)) : (D !== i && D.invoke("destroy"), b.initialize());
  13498. }), a !== i ? a : this;
  13499. }, e.tab = function () {
  13500. e(t).tab.apply(this, arguments);
  13501. }, e.fn.tab.settings = { name: "Tab", namespace: "tab", silent: !1, debug: !1, verbose: !1, performance: !0, auto: !1, history: !1, historyType: "hash", path: !1, context: !1, childrenOnly: !1, maxDepth: 25, deactivate: "siblings", alwaysRefresh: !1, cache: !0, loadOnce: !1, cacheType: "response", ignoreFirstLoad: !1, apiSettings: !1, evaluateScripts: "once", onFirstLoad: function onFirstLoad(e, t, n) {}, onLoad: function onLoad(e, t, n) {}, onVisible: function onVisible(e, t, n) {}, onRequest: function onRequest(e, t, n) {}, templates: { determineTitle: function determineTitle(e) {} }, error: { api: "You attempted to load content without API module", method: "The method you called is not defined", missingTab: "Activated tab cannot be found. Tabs are case-sensitive.", noContent: "The tab you specified is missing a content url.", path: "History enabled, but no path was specified", recursion: "Max recursive depth reached", legacyInit: "onTabInit has been renamed to onFirstLoad in 2.0, please adjust your code.", legacyLoad: "onTabLoad has been renamed to onLoad in 2.0. Please adjust your code", state: "History requires Asual's Address library <https://github.com/asual/jquery-address>" }, metadata: { tab: "tab", loaded: "loaded", promise: "promise" }, className: { loading: "loading", active: "active" }, selector: { tabs: ".ui.tab", ui: ".ui" } };
  13502. }(jQuery, window, document), function (e, t, n, i) {
  13503. "use strict";
  13504. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.transition = function () {
  13505. var o,
  13506. a = e(this),
  13507. r = a.selector || "",
  13508. s = new Date().getTime(),
  13509. l = [],
  13510. c = arguments,
  13511. u = c[0],
  13512. d = [].slice.call(arguments, 1),
  13513. f = "string" == typeof u;t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame;return a.each(function (t) {
  13514. var m,
  13515. g,
  13516. p,
  13517. h,
  13518. v,
  13519. b,
  13520. y,
  13521. x,
  13522. C,
  13523. w = e(this),
  13524. S = this;(C = { initialize: function initialize() {
  13525. 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());
  13526. }, instantiate: function instantiate() {
  13527. C.verbose("Storing instance of module", C), g = C, w.data(y, g);
  13528. }, destroy: function destroy() {
  13529. C.verbose("Destroying previous module for", S), w.removeData(y);
  13530. }, refresh: function refresh() {
  13531. C.verbose("Refreshing display type on next animation"), delete C.displayType;
  13532. }, forceRepaint: function forceRepaint() {
  13533. C.verbose("Forcing element repaint");var e = w.parent(),
  13534. t = w.next();0 === t.length ? w.detach().appendTo(e) : w.detach().insertBefore(t);
  13535. }, repaint: function repaint() {
  13536. C.verbose("Repainting element");S.offsetWidth;
  13537. }, delay: function delay(e) {
  13538. var n,
  13539. o = C.get.animationDirection();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);
  13540. }, animate: function animate(e) {
  13541. if (m = e || m, !C.is.supported()) return C.error(p.support), !1;if (C.debug("Preparing animation", m.animation), C.is.animating()) {
  13542. 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;if (!m.allowRepeats && C.is.occurring()) return C.debug("Animation is already occurring, will not execute repeated animation", m.animation), !1;C.debug("New animation started, completing previous early", m.animation), g.complete();
  13543. }C.can.animate() ? C.set.animating(m.animation) : C.error(p.noAnimation, m.animation, S);
  13544. }, reset: function reset() {
  13545. C.debug("Resetting animation to beginning conditions"), C.remove.animationCallbacks(), C.restore.conditions(), C.remove.animating();
  13546. }, queue: function queue(e) {
  13547. C.debug("Queueing animation of", e), C.queuing = !0, w.one(b + ".queue" + x, function () {
  13548. C.queuing = !1, C.repaint(), C.animate.apply(this, m);
  13549. });
  13550. }, complete: function complete(e) {
  13551. 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)));
  13552. }, force: { visible: function visible() {
  13553. var e = w.attr("style"),
  13554. t = C.get.userStyle(),
  13555. n = C.get.displayType(),
  13556. o = t + "display: " + n + " !important;",
  13557. a = w.css("display"),
  13558. r = e === i || "" === e;a !== n ? (C.verbose("Overriding default display to show element", n), w.attr("style", o)) : r && w.removeAttr("style");
  13559. }, hidden: function hidden() {
  13560. var e = w.attr("style"),
  13561. t = w.css("display"),
  13562. n = e === i || "" === e;"none" === t || C.is.hidden() ? n && w.removeAttr("style") : (C.verbose("Overriding default display to hide element"), w.css("display", "none"));
  13563. } }, has: { direction: function direction(t) {
  13564. var n = !1;return "string" == typeof (t = t || m.animation) && (t = t.split(" "), e.each(t, function (e, t) {
  13565. t !== h.inward && t !== h.outward || (n = !0);
  13566. })), n;
  13567. }, inlineDisplay: function inlineDisplay() {
  13568. var t = w.attr("style") || "";return e.isArray(t.match(/display.*?;/, ""));
  13569. } }, set: { animating: function animating(e) {
  13570. var t;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);
  13571. }, duration: function duration(e, t) {
  13572. ((t = "number" == typeof (t = t || m.duration) ? t + "ms" : t) || 0 === t) && (C.verbose("Setting animation duration", t), w.css({ "animation-duration": t }));
  13573. }, direction: function direction(e) {
  13574. (e = e || C.get.direction()) == h.inward ? C.set.inward() : C.set.outward();
  13575. }, looping: function looping() {
  13576. C.debug("Transition set to loop"), w.addClass(h.looping);
  13577. }, hidden: function hidden() {
  13578. w.addClass(h.transition).addClass(h.hidden);
  13579. }, inward: function inward() {
  13580. C.debug("Setting direction to inward"), w.removeClass(h.outward).addClass(h.inward);
  13581. }, outward: function outward() {
  13582. C.debug("Setting direction to outward"), w.removeClass(h.inward).addClass(h.outward);
  13583. }, visible: function visible() {
  13584. w.addClass(h.transition).addClass(h.visible);
  13585. } }, start: { animation: function animation(e) {
  13586. 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);
  13587. } }, save: { animation: function animation(e) {
  13588. C.cache || (C.cache = {}), C.cache.animation = e;
  13589. }, displayType: function displayType(e) {
  13590. "none" !== e && w.data(v.displayType, e);
  13591. }, transitionExists: function transitionExists(t, n) {
  13592. e.fn.transition.exists[t] = n, C.verbose("Saving existence of transition", t, n);
  13593. } }, restore: { conditions: function conditions() {
  13594. var e = C.get.currentAnimation();e && (w.removeClass(e), C.verbose("Removing animation class", C.cache)), C.remove.duration();
  13595. } }, add: { failSafe: function failSafe() {
  13596. var e = C.get.duration();C.timer = setTimeout(function () {
  13597. w.triggerHandler(b);
  13598. }, e + m.failSafeDelay), C.verbose("Adding fail safe timer", C.timer);
  13599. } }, remove: { animating: function animating() {
  13600. w.removeClass(h.animating);
  13601. }, animationCallbacks: function animationCallbacks() {
  13602. C.remove.queueCallback(), C.remove.completeCallback();
  13603. }, queueCallback: function queueCallback() {
  13604. w.off(".queue" + x);
  13605. }, completeCallback: function completeCallback() {
  13606. w.off(".complete" + x);
  13607. }, display: function display() {
  13608. w.css("display", "");
  13609. }, direction: function direction() {
  13610. w.removeClass(h.inward).removeClass(h.outward);
  13611. }, duration: function duration() {
  13612. w.css("animation-duration", "");
  13613. }, failSafe: function failSafe() {
  13614. C.verbose("Removing fail safe timer", C.timer), C.timer && clearTimeout(C.timer);
  13615. }, hidden: function hidden() {
  13616. w.removeClass(h.hidden);
  13617. }, visible: function visible() {
  13618. w.removeClass(h.visible);
  13619. }, looping: function looping() {
  13620. C.debug("Transitions are no longer looping"), C.is.looping() && (C.reset(), w.removeClass(h.looping));
  13621. }, transition: function transition() {
  13622. w.removeClass(h.visible).removeClass(h.hidden);
  13623. } }, get: { settings: function settings(t, n, i) {
  13624. return "object" == (typeof t === "undefined" ? "undefined" : _typeof(t)) ? e.extend(!0, {}, e.fn.transition.settings, t) : "function" == typeof i ? e.extend({}, e.fn.transition.settings, { animation: t, onComplete: i, duration: n }) : "string" == typeof n || "number" == typeof n ? e.extend({}, e.fn.transition.settings, { animation: t, duration: n }) : "object" == (typeof n === "undefined" ? "undefined" : _typeof(n)) ? e.extend({}, e.fn.transition.settings, n, { animation: t }) : "function" == typeof n ? e.extend({}, e.fn.transition.settings, { animation: t, onComplete: n }) : e.extend({}, e.fn.transition.settings, { animation: t });
  13625. }, animationClass: function animationClass(e) {
  13626. var t = e || m.animation,
  13627. n = C.can.transition() && !C.has.direction() ? C.get.direction() + " " : "";return h.animating + " " + h.transition + " " + n + t;
  13628. }, currentAnimation: function currentAnimation() {
  13629. return !(!C.cache || C.cache.animation === i) && C.cache.animation;
  13630. }, currentDirection: function currentDirection() {
  13631. return C.is.inward() ? h.inward : h.outward;
  13632. }, direction: function direction() {
  13633. return C.is.hidden() || !C.is.visible() ? h.inward : h.outward;
  13634. }, animationDirection: function animationDirection(t) {
  13635. var n;return "string" == typeof (t = t || m.animation) && (t = t.split(" "), e.each(t, function (e, t) {
  13636. t === h.inward ? n = h.inward : t === h.outward && (n = h.outward);
  13637. })), n || !1;
  13638. }, duration: function duration(e) {
  13639. 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;
  13640. }, displayType: function displayType(e) {
  13641. return e = e === i || e, m.displayType ? m.displayType : (e && w.data(v.displayType) === i && C.can.transition(!0), w.data(v.displayType));
  13642. }, userStyle: function userStyle(e) {
  13643. return (e = e || w.attr("style") || "").replace(/display.*?;/, "");
  13644. }, transitionExists: function transitionExists(t) {
  13645. return e.fn.transition.exists[t];
  13646. }, animationStartEvent: function animationStartEvent() {
  13647. var e,
  13648. t = n.createElement("div"),
  13649. o = { animation: "animationstart", OAnimation: "oAnimationStart", MozAnimation: "mozAnimationStart", WebkitAnimation: "webkitAnimationStart" };for (e in o) {
  13650. if (t.style[e] !== i) return o[e];
  13651. }return !1;
  13652. }, animationEndEvent: function animationEndEvent() {
  13653. var e,
  13654. t = n.createElement("div"),
  13655. o = { animation: "animationend", OAnimation: "oAnimationEnd", MozAnimation: "mozAnimationEnd", WebkitAnimation: "webkitAnimationEnd" };for (e in o) {
  13656. if (t.style[e] !== i) return o[e];
  13657. }return !1;
  13658. } }, can: { transition: function transition(t) {
  13659. var n,
  13660. o,
  13661. a,
  13662. r,
  13663. s,
  13664. l,
  13665. c = m.animation,
  13666. u = C.get.transitionExists(c),
  13667. d = C.get.displayType(!1);if (u === i || t) {
  13668. 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 {
  13669. if ("none" == r || !r) return void C.debug("No animation defined in css", c);C.debug("Static animation found", c, d), l = !1;
  13670. }C.save.transitionExists(c, l);
  13671. }return u !== i ? u : l;
  13672. }, animate: function animate() {
  13673. return C.can.transition() !== i;
  13674. } }, is: { animating: function animating() {
  13675. return w.hasClass(h.animating);
  13676. }, inward: function inward() {
  13677. return w.hasClass(h.inward);
  13678. }, outward: function outward() {
  13679. return w.hasClass(h.outward);
  13680. }, looping: function looping() {
  13681. return w.hasClass(h.looping);
  13682. }, occurring: function occurring(e) {
  13683. return e = "." + (e = e || m.animation).replace(" ", "."), w.filter(e).length > 0;
  13684. }, visible: function visible() {
  13685. return w.is(":visible");
  13686. }, hidden: function hidden() {
  13687. return "hidden" === w.css("visibility");
  13688. }, supported: function supported() {
  13689. return !1 !== b;
  13690. } }, hide: function hide() {
  13691. 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);
  13692. }, show: function show(e) {
  13693. C.verbose("Showing element", e), C.remove.hidden(), C.set.visible(), C.force.visible(), m.onShow.call(S), m.onComplete.call(S);
  13694. }, toggle: function toggle() {
  13695. C.is.visible() ? C.hide() : C.show();
  13696. }, stop: function stop() {
  13697. C.debug("Stopping current animation"), w.triggerHandler(b);
  13698. }, stopAll: function stopAll() {
  13699. C.debug("Stopping all animation"), C.remove.queueCallback(), w.triggerHandler(b);
  13700. }, clear: { queue: function queue() {
  13701. C.debug("Clearing animation queue"), C.remove.queueCallback();
  13702. } }, enable: function enable() {
  13703. C.verbose("Starting animation"), w.removeClass(h.disabled);
  13704. }, disable: function disable() {
  13705. C.debug("Stopping animation"), w.addClass(h.disabled);
  13706. }, setting: function setting(t, n) {
  13707. if (C.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, m, t);else {
  13708. if (n === i) return m[t];e.isPlainObject(m[t]) ? e.extend(!0, m[t], n) : m[t] = n;
  13709. }
  13710. }, internal: function internal(t, n) {
  13711. if (e.isPlainObject(t)) e.extend(!0, C, t);else {
  13712. if (n === i) return C[t];C[t] = n;
  13713. }
  13714. }, debug: function debug() {
  13715. !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)));
  13716. }, verbose: function verbose() {
  13717. !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)));
  13718. }, error: function error() {
  13719. m.silent || (C.error = Function.prototype.bind.call(console.error, console, m.name + ":"), C.error.apply(console, arguments));
  13720. }, performance: { log: function log(e) {
  13721. var t, n;m.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: S, "Execution Time": n })), clearTimeout(C.performance.timer), C.performance.timer = setTimeout(C.performance.display, 500);
  13722. }, display: function display() {
  13723. var t = m.name + ":",
  13724. n = 0;s = !1, clearTimeout(C.performance.timer), e.each(l, function (e, t) {
  13725. n += t["Execution Time"];
  13726. }), 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) {
  13727. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  13728. }), console.groupEnd()), l = [];
  13729. } }, invoke: function invoke(t, n, a) {
  13730. var r,
  13731. s,
  13732. l,
  13733. c = g;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) {
  13734. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  13735. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);c = c[o];
  13736. }
  13737. })), 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;
  13738. } }).initialize();
  13739. }), o !== i ? o : this;
  13740. }, e.fn.transition.exists = {}, e.fn.transition.settings = { name: "Transition", silent: !1, debug: !1, verbose: !1, performance: !0, namespace: "transition", interval: 0, reverse: "auto", onStart: function onStart() {}, onComplete: function onComplete() {}, onShow: function onShow() {}, onHide: function onHide() {}, useFailSafe: !0, failSafeDelay: 100, allowRepeats: !1, displayType: !1, animation: "fade", duration: !1, queue: !0, metadata: { displayType: "display" }, className: { animating: "animating", disabled: "disabled", hidden: "hidden", inward: "in", loading: "loading", looping: "looping", outward: "out", transition: "transition", visible: "visible" }, error: { noAnimation: "Element is no longer attached to DOM. Unable to animate. Use silent setting to surpress this warning in production.", repeated: "That animation is already occurring, cancelling repeated animation", method: "The method you called is not defined", support: "This browser does not support CSS animations" } };
  13741. }(jQuery, window, document), function (e, t, n, i) {
  13742. "use strict";
  13743. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")();e.api = e.fn.api = function (n) {
  13744. var o,
  13745. a = e.isFunction(this) ? e(t) : e(this),
  13746. r = a.selector || "",
  13747. s = new Date().getTime(),
  13748. l = [],
  13749. c = arguments[0],
  13750. u = "string" == typeof c,
  13751. d = [].slice.call(arguments, 1);return a.each(function () {
  13752. var a,
  13753. f,
  13754. m,
  13755. g,
  13756. p,
  13757. h,
  13758. v = e.isPlainObject(n) ? e.extend(!0, {}, e.fn.api.settings, n) : e.extend({}, e.fn.api.settings),
  13759. b = v.namespace,
  13760. y = v.metadata,
  13761. x = v.selector,
  13762. C = v.error,
  13763. w = v.className,
  13764. S = "." + b,
  13765. k = "module-" + b,
  13766. T = e(this),
  13767. A = T.closest(x.form),
  13768. R = v.stateContext ? e(v.stateContext) : T,
  13769. P = this,
  13770. E = R[0],
  13771. F = T.data(k);h = { initialize: function initialize() {
  13772. u || h.bind.events(), h.instantiate();
  13773. }, instantiate: function instantiate() {
  13774. h.verbose("Storing instance of module", h), F = h, T.data(k, F);
  13775. }, destroy: function destroy() {
  13776. h.verbose("Destroying previous module for", P), T.removeData(k).off(S);
  13777. }, bind: { events: function events() {
  13778. var e = h.get.event();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());
  13779. } }, decode: { json: function json(e) {
  13780. if (e !== i && "string" == typeof e) try {
  13781. e = JSON.parse(e);
  13782. } catch (e) {}return e;
  13783. } }, read: { cachedResponse: function cachedResponse(e) {
  13784. var n;if (t.Storage !== i) return n = sessionStorage.getItem(e), h.debug("Using cached response", e, n), n = h.decode.json(n);h.error(C.noStorage);
  13785. } }, write: { cachedResponse: function cachedResponse(n, o) {
  13786. 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);
  13787. } }, query: function query() {
  13788. if (h.is.disabled()) h.debug("Element is disabled API request aborted");else {
  13789. if (h.is.loading()) {
  13790. if (!v.interruptRequests) return void h.debug("Cancelling request, previous request is still pending");h.debug("Interrupting previous request"), h.abort();
  13791. }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);if (h.cancelled = !1, (m = h.get.templatedURL()) || h.is.mocked()) {
  13792. if ((m = h.add.urlData(m)) || h.is.mocked()) {
  13793. if (f.url = v.base + m, a = e.extend(!0, {}, v, { type: v.method || v.type, data: g, url: v.base + m, beforeSend: v.beforeXHR, success: function success() {}, failure: function failure() {}, complete: function complete() {} }), 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)]);v.throttle ? v.throttleFirstRequest || h.timer ? (h.debug("Throttling request", v.throttle), clearTimeout(h.timer), h.timer = setTimeout(function () {
  13794. h.timer && delete h.timer, h.debug("Sending throttled request", g, a.method), h.send.request();
  13795. }, 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());
  13796. }
  13797. } else h.error(C.missingURL);
  13798. }
  13799. }, should: { removeError: function removeError() {
  13800. return !0 === v.hideError || "auto" === v.hideError && !h.is.form();
  13801. } }, is: { disabled: function disabled() {
  13802. return T.filter(x.disabled).length > 0;
  13803. }, expectingJSON: function expectingJSON() {
  13804. return "json" === v.dataType || "jsonp" === v.dataType;
  13805. }, form: function form() {
  13806. return T.is("form") || R.is("form");
  13807. }, mocked: function mocked() {
  13808. return v.mockResponse || v.mockResponseAsync || v.response || v.responseAsync;
  13809. }, input: function input() {
  13810. return T.is("input");
  13811. }, loading: function loading() {
  13812. return !!h.request && "pending" == h.request.state();
  13813. }, abortedRequest: function abortedRequest(e) {
  13814. 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);
  13815. }, validResponse: function validResponse(t) {
  13816. 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);
  13817. } }, was: { cancelled: function cancelled() {
  13818. return h.cancelled || !1;
  13819. }, succesful: function succesful() {
  13820. return h.request && "resolved" == h.request.state();
  13821. }, failure: function failure() {
  13822. return h.request && "rejected" == h.request.state();
  13823. }, complete: function complete() {
  13824. return h.request && ("resolved" == h.request.state() || "rejected" == h.request.state());
  13825. } }, add: { urlData: function urlData(t, n) {
  13826. var o, a;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) {
  13827. var r = -1 !== a.indexOf("$") ? a.substr(2, a.length - 3) : a.substr(1, a.length - 2),
  13828. 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];if (s === i) return h.error(C.requiredParameter, r, t), t = !1, !1;h.verbose("Found required variable", r, s), s = v.encodeParameters ? h.get.urlEncodedValue(s) : s, t = t.replace(a, s);
  13829. })), a && (h.debug("Looking for optional URL variables", o), e.each(a, function (o, a) {
  13830. var r = -1 !== a.indexOf("$") ? a.substr(3, a.length - 4) : a.substr(2, a.length - 3),
  13831. 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];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, ""));
  13832. }))), t;
  13833. }, formData: function formData(t) {
  13834. var n = e.fn.serializeObject !== i,
  13835. o = n ? A.serializeObject() : A.serialize();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;
  13836. } }, send: { request: function request() {
  13837. 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);
  13838. } }, event: { trigger: function trigger(e) {
  13839. h.query(), "submit" != e.type && "click" != e.type || e.preventDefault();
  13840. }, xhr: { always: function always() {}, done: function done(t, n, i) {
  13841. var o = this,
  13842. a = new Date().getTime() - p,
  13843. r = v.loadingDuration - a,
  13844. s = !!e.isFunction(v.onResponse) && (h.is.expectingJSON() ? v.onResponse.call(o, e.extend(!0, {}, t)) : v.onResponse.call(o, t));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 () {
  13845. h.is.validResponse(t) ? h.request.resolveWith(o, [t, i]) : h.request.rejectWith(o, [i, "invalid"]);
  13846. }, r);
  13847. }, fail: function fail(e, t, n) {
  13848. var i = this,
  13849. o = new Date().getTime() - p,
  13850. a = v.loadingDuration - o;(a = a > 0 ? a : 0) > 0 && h.debug("Response completed early delaying state change by", a), setTimeout(function () {
  13851. h.is.abortedRequest(e) ? h.request.rejectWith(i, [e, "aborted", n]) : h.request.rejectWith(i, [e, "error", t, n]);
  13852. }, a);
  13853. } }, request: { done: function done(e, t) {
  13854. 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);
  13855. }, complete: function complete(e, t) {
  13856. var n, i;h.was.succesful() ? (i = e, n = t) : (n = e, i = h.get.responseFromXHR(n)), h.remove.loading(), v.onComplete.call(E, i, T, n);
  13857. }, fail: function fail(e, t, n) {
  13858. var o = h.get.responseFromXHR(e),
  13859. r = h.get.errorFromRequest(o, t, n);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;"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);
  13860. } } }, create: { request: function request() {
  13861. return e.Deferred().always(h.event.request.complete).done(h.event.request.done).fail(h.event.request.fail);
  13862. }, mockedXHR: function mockedXHR() {
  13863. var t,
  13864. n,
  13865. i,
  13866. o = v.mockResponse || v.response,
  13867. a = v.mockResponseAsync || v.responseAsync;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, { responseText: n }])) : e.isFunction(a) && (t = function t(e) {
  13868. h.debug("Async callback returned response", e), e ? i.resolveWith(E, [e, !1, { responseText: e }]) : i.rejectWith(E, [{ responseText: e }, !1, !1]);
  13869. }, h.debug("Using specified async response callback", a), a.call(E, f, t)), i;
  13870. }, xhr: function xhr() {
  13871. var t;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;
  13872. } }, set: { error: function error() {
  13873. h.verbose("Adding error state to element", R), R.addClass(w.error);
  13874. }, loading: function loading() {
  13875. h.verbose("Adding loading state to element", R), R.addClass(w.loading), p = new Date().getTime();
  13876. } }, remove: { error: function error() {
  13877. h.verbose("Removing error state from element", R), R.removeClass(w.error);
  13878. }, loading: function loading() {
  13879. h.verbose("Removing loading state from element", R), R.removeClass(w.loading);
  13880. } }, get: { responseFromXHR: function responseFromXHR(t) {
  13881. return !!e.isPlainObject(t) && (h.is.expectingJSON() ? h.decode.json(t.responseText) : t.responseText);
  13882. }, errorFromRequest: function errorFromRequest(t, n, o) {
  13883. return e.isPlainObject(t) && t.error !== i ? t.error : v.error[n] !== i ? v.error[n] : o;
  13884. }, request: function request() {
  13885. return h.request || !1;
  13886. }, xhr: function xhr() {
  13887. return h.xhr || !1;
  13888. }, settings: function settings() {
  13889. var t;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);
  13890. }, urlEncodedValue: function urlEncodedValue(e) {
  13891. var n = t.decodeURIComponent(e),
  13892. i = t.encodeURIComponent(e);return n !== e ? (h.debug("URL value is already encoded, avoiding double encoding", e), e) : (h.verbose("Encoding value using encodeURIComponent", e, i), i);
  13893. }, defaultData: function defaultData() {
  13894. var t = {};return e.isWindow(P) || (h.is.input() ? t.value = T.val() : h.is.form() || (t.text = T.text())), t;
  13895. }, event: function event() {
  13896. 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;
  13897. }, templatedURL: function templatedURL(e) {
  13898. 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;if (e) {
  13899. 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);m = v.api[e];
  13900. } else h.is.form() && (m = T.attr("action") || R.attr("action") || !1, h.debug("No url or action specified, defaulting to form action", m));return m;
  13901. } }, abort: function abort() {
  13902. var e = h.get.xhr();e && "resolved" !== e.state() && (h.debug("Cancelling API request"), e.abort());
  13903. }, reset: function reset() {
  13904. h.remove.error(), h.remove.loading();
  13905. }, setting: function setting(t, n) {
  13906. if (h.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, v, t);else {
  13907. if (n === i) return v[t];e.isPlainObject(v[t]) ? e.extend(!0, v[t], n) : v[t] = n;
  13908. }
  13909. }, internal: function internal(t, n) {
  13910. if (e.isPlainObject(t)) e.extend(!0, h, t);else {
  13911. if (n === i) return h[t];h[t] = n;
  13912. }
  13913. }, debug: function debug() {
  13914. !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)));
  13915. }, verbose: function verbose() {
  13916. !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)));
  13917. }, error: function error() {
  13918. v.silent || (h.error = Function.prototype.bind.call(console.error, console, v.name + ":"), h.error.apply(console, arguments));
  13919. }, performance: { log: function log(e) {
  13920. var t, n;v.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", "Execution Time": n })), clearTimeout(h.performance.timer), h.performance.timer = setTimeout(h.performance.display, 500);
  13921. }, display: function display() {
  13922. var t = v.name + ":",
  13923. n = 0;s = !1, clearTimeout(h.performance.timer), e.each(l, function (e, t) {
  13924. n += t["Execution Time"];
  13925. }), 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) {
  13926. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  13927. }), console.groupEnd()), l = [];
  13928. } }, invoke: function invoke(t, n, a) {
  13929. var r,
  13930. s,
  13931. l,
  13932. c = F;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) {
  13933. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  13934. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (h.error(C.method, t), !1);c = c[o];
  13935. }
  13936. })), 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;
  13937. } }, u ? (F === i && h.initialize(), h.invoke(c)) : (F !== i && F.invoke("destroy"), h.initialize());
  13938. }), o !== i ? o : this;
  13939. }, e.api.settings = { name: "API", namespace: "api", debug: !1, verbose: !1, performance: !0, api: {}, cache: !0, interruptRequests: !0, on: "auto", stateContext: !1, loadingDuration: 0, hideError: "auto", errorDuration: 2e3, encodeParameters: !0, action: !1, url: !1, base: "", urlData: {}, defaultData: !0, serializeForm: !1, throttle: 0, throttleFirstRequest: !0, method: "get", data: {}, dataType: "json", mockResponse: !1, mockResponseAsync: !1, response: !1, responseAsync: !1, beforeSend: function beforeSend(e) {
  13940. return e;
  13941. }, beforeXHR: function beforeXHR(e) {}, onRequest: function onRequest(e, t) {}, onResponse: !1, onSuccess: function onSuccess(e, t) {}, onComplete: function onComplete(e, t) {}, onFailure: function onFailure(e, t) {}, onError: function onError(e, t) {}, onAbort: function onAbort(e, t) {}, successTest: !1, error: { beforeSend: "The before send function has aborted the request", error: "There was an error with your request", exitConditions: "API Request Aborted. Exit conditions met", JSONParse: "JSON could not be parsed during error handling", legacyParameters: "You are using legacy API success callback names", method: "The method you called is not defined", missingAction: "API action used but no url was defined", missingSerialize: "jquery-serialize-object is required to add form data to an existing data object", missingURL: "No URL specified for api event", noReturnedValue: "The beforeSend callback must return a settings object, beforeSend ignored.", noStorage: "Caching responses locally requires session storage", parseError: "There was an error parsing your request", requiredParameter: "Missing a required URL parameter: ", statusMessage: "Server gave an error: ", timeout: "Your request timed out" }, regExp: { required: /\{\$*[A-z0-9]+\}/g, optional: /\{\/\$*[A-z0-9]+\}/g }, className: { loading: "loading", error: "error" }, selector: { disabled: ".disabled", form: "form" }, metadata: { action: "action", url: "url" } };
  13942. }(jQuery, window, document), function (e, t, n, i) {
  13943. "use strict";
  13944. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.visibility = function (o) {
  13945. var a,
  13946. r = e(this),
  13947. s = r.selector || "",
  13948. l = new Date().getTime(),
  13949. c = [],
  13950. u = arguments[0],
  13951. d = "string" == typeof u,
  13952. f = [].slice.call(arguments, 1),
  13953. m = r.length,
  13954. g = 0;return r.each(function () {
  13955. var r,
  13956. p,
  13957. h,
  13958. v,
  13959. b = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.visibility.settings, o) : e.extend({}, e.fn.visibility.settings),
  13960. y = b.className,
  13961. x = b.namespace,
  13962. C = b.error,
  13963. w = b.metadata,
  13964. S = "." + x,
  13965. k = "module-" + x,
  13966. T = e(t),
  13967. A = e(this),
  13968. R = e(b.context),
  13969. P = (A.selector, A.data(k)),
  13970. E = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  13971. setTimeout(e, 0);
  13972. },
  13973. F = this,
  13974. O = !1;v = { initialize: function initialize() {
  13975. 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();
  13976. }, instantiate: function instantiate() {
  13977. v.debug("Storing instance", v), A.data(k, v), P = v;
  13978. }, destroy: function destroy() {
  13979. 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);
  13980. }, observeChanges: function observeChanges() {
  13981. "MutationObserver" in t && (p = new MutationObserver(v.event.contextChanged), h = new MutationObserver(v.event.changed), p.observe(n, { childList: !0, subtree: !0 }), h.observe(F, { childList: !0, subtree: !0 }), v.debug("Setting up mutation observer", h));
  13982. }, bind: { events: function events() {
  13983. 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);
  13984. } }, event: { changed: function changed(e) {
  13985. v.verbose("DOM tree modified, updating visibility calculations"), v.timer = setTimeout(function () {
  13986. v.verbose("DOM tree modified, updating sticky menu"), v.refresh();
  13987. }, 100);
  13988. }, contextChanged: function contextChanged(t) {
  13989. [].forEach.call(t, function (t) {
  13990. t.removedNodes && [].forEach.call(t.removedNodes, function (t) {
  13991. (t == F || e(t).find(F).length > 0) && (v.debug("Element removed from DOM, tearing down events"), v.destroy());
  13992. });
  13993. });
  13994. }, resize: function resize() {
  13995. v.debug("Window resized"), b.refreshOnResize && E(v.refresh);
  13996. }, load: function load() {
  13997. v.debug("Page finished loading"), E(v.refresh);
  13998. }, scroll: function scroll() {
  13999. b.throttle ? (clearTimeout(v.timer), v.timer = setTimeout(function () {
  14000. R.triggerHandler("scrollchange" + S, [R.scrollTop()]);
  14001. }, b.throttle)) : E(function () {
  14002. R.triggerHandler("scrollchange" + S, [R.scrollTop()]);
  14003. });
  14004. }, scrollchange: function scrollchange(e, t) {
  14005. v.checkVisibility(t);
  14006. } }, precache: function precache(t, i) {
  14007. t instanceof Array || (t = [t]);for (var o = t.length, a = 0, r = [], s = n.createElement("img"), l = function l() {
  14008. ++a >= t.length && e.isFunction(i) && i();
  14009. }; o--;) {
  14010. (s = n.createElement("img")).onload = l, s.onerror = l, s.src = t[o], r.push(s);
  14011. }
  14012. }, enableCallbacks: function enableCallbacks() {
  14013. v.debug("Allowing callbacks to occur"), O = !1;
  14014. }, disableCallbacks: function disableCallbacks() {
  14015. v.debug("Disabling all callbacks temporarily"), O = !0;
  14016. }, should: { trackChanges: function trackChanges() {
  14017. return d ? (v.debug("One time query, no need to bind events"), !1) : (v.debug("Callbacks being attached"), !0);
  14018. } }, setup: { cache: function cache() {
  14019. v.cache = { occurred: {}, screen: {}, element: {} };
  14020. }, image: function image() {
  14021. var e = A.data(w.src);e && (v.verbose("Lazy loading image", e), b.once = !0, b.observeChanges = !1, b.onOnScreen = function () {
  14022. v.debug("Image on screen", F), v.precache(e, function () {
  14023. v.set.image(e, function () {
  14024. ++g == m && b.onAllLoaded.call(this), b.onLoad.call(this);
  14025. });
  14026. });
  14027. });
  14028. }, fixed: function fixed() {
  14029. 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 () {
  14030. 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);
  14031. }, b.onTopPassedReverse = function () {
  14032. v.debug("Element returned to position, removing fixed", A), v.hide.placeholder(), v.remove.fixed();
  14033. };
  14034. } }, create: { placeholder: function placeholder() {
  14035. v.verbose("Creating fixed position placeholder"), r = A.clone(!1).css("display", "none").addClass(y.placeholder).insertAfter(A);
  14036. } }, show: { placeholder: function placeholder() {
  14037. v.verbose("Showing placeholder"), r.css("display", "block").css("visibility", "hidden");
  14038. } }, hide: { placeholder: function placeholder() {
  14039. v.verbose("Hiding placeholder"), r.css("display", "none").css("visibility", "");
  14040. } }, set: { fixed: function fixed() {
  14041. v.verbose("Setting element to fixed position"), A.addClass(y.fixed).css({ position: "fixed", top: b.offset + "px", left: "auto", zIndex: b.zIndex }), b.onFixed.call(F);
  14042. }, image: function image(t, n) {
  14043. if (A.attr("src", t), b.transition) {
  14044. if (e.fn.transition !== i) {
  14045. if (A.hasClass(y.visible)) return void v.debug("Transition already occurred on this image, skipping animation");A.transition(b.transition, b.duration, n);
  14046. } else A.fadeIn(b.duration, n);
  14047. } else A.show();
  14048. } }, is: { onScreen: function onScreen() {
  14049. return v.get.elementCalculations().onScreen;
  14050. }, offScreen: function offScreen() {
  14051. return v.get.elementCalculations().offScreen;
  14052. }, visible: function visible() {
  14053. return !(!v.cache || !v.cache.element) && !(0 === v.cache.element.width && 0 === v.cache.element.offset.top);
  14054. }, verticallyScrollableContext: function verticallyScrollableContext() {
  14055. var e = R.get(0) !== t && R.css("overflow-y");return "auto" == e || "scroll" == e;
  14056. }, horizontallyScrollableContext: function horizontallyScrollableContext() {
  14057. var e = R.get(0) !== t && R.css("overflow-x");return "auto" == e || "scroll" == e;
  14058. } }, refresh: function refresh() {
  14059. v.debug("Refreshing constants (width/height)"), "fixed" == b.type && v.resetFixed(), v.reset(), v.save.position(), b.checkOnRefresh && v.checkVisibility(), b.onRefresh.call(F);
  14060. }, resetFixed: function resetFixed() {
  14061. v.remove.fixed(), v.remove.occurred();
  14062. }, reset: function reset() {
  14063. v.verbose("Resetting all cached values"), e.isPlainObject(v.cache) && (v.cache.screen = {}, v.cache.element = {});
  14064. }, checkVisibility: function checkVisibility(e) {
  14065. 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()));
  14066. }, passed: function passed(t, n) {
  14067. var o = v.get.elementCalculations();if (t && n) b.onPassed[t] = n;else {
  14068. if (t !== i) return v.get.pixelsPassed(t) > o.pixelsPassed;o.passing && e.each(b.onPassed, function (e, t) {
  14069. o.bottomVisible || o.pixelsPassed > v.get.pixelsPassed(e) ? v.execute(t, e) : b.once || v.remove.occurred(t);
  14070. });
  14071. }
  14072. }, onScreen: function onScreen(e) {
  14073. var t = v.get.elementCalculations(),
  14074. n = e || b.onOnScreen,
  14075. o = "onScreen";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;
  14076. }, offScreen: function offScreen(e) {
  14077. var t = v.get.elementCalculations(),
  14078. n = e || b.onOffScreen,
  14079. o = "offScreen";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;
  14080. }, passing: function passing(e) {
  14081. var t = v.get.elementCalculations(),
  14082. n = e || b.onPassing,
  14083. o = "passing";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;
  14084. }, topVisible: function topVisible(e) {
  14085. var t = v.get.elementCalculations(),
  14086. n = e || b.onTopVisible,
  14087. o = "topVisible";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;
  14088. }, bottomVisible: function bottomVisible(e) {
  14089. var t = v.get.elementCalculations(),
  14090. n = e || b.onBottomVisible,
  14091. o = "bottomVisible";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;
  14092. }, topPassed: function topPassed(e) {
  14093. var t = v.get.elementCalculations(),
  14094. n = e || b.onTopPassed,
  14095. o = "topPassed";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;
  14096. }, bottomPassed: function bottomPassed(e) {
  14097. var t = v.get.elementCalculations(),
  14098. n = e || b.onBottomPassed,
  14099. o = "bottomPassed";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;
  14100. }, passingReverse: function passingReverse(e) {
  14101. var t = v.get.elementCalculations(),
  14102. n = e || b.onPassingReverse,
  14103. o = "passingReverse";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;
  14104. }, topVisibleReverse: function topVisibleReverse(e) {
  14105. var t = v.get.elementCalculations(),
  14106. n = e || b.onTopVisibleReverse,
  14107. o = "topVisibleReverse";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;
  14108. }, bottomVisibleReverse: function bottomVisibleReverse(e) {
  14109. var t = v.get.elementCalculations(),
  14110. n = e || b.onBottomVisibleReverse,
  14111. o = "bottomVisibleReverse";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;
  14112. }, topPassedReverse: function topPassedReverse(e) {
  14113. var t = v.get.elementCalculations(),
  14114. n = e || b.onTopPassedReverse,
  14115. o = "topPassedReverse";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;
  14116. }, bottomPassedReverse: function bottomPassedReverse(e) {
  14117. var t = v.get.elementCalculations(),
  14118. n = e || b.onBottomPassedReverse,
  14119. o = "bottomPassedReverse";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;
  14120. }, execute: function execute(e, t) {
  14121. var n = v.get.elementCalculations(),
  14122. i = v.get.screenCalculations();(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);
  14123. }, remove: { fixed: function fixed() {
  14124. v.debug("Removing fixed position"), A.removeClass(y.fixed).css({ position: "", top: "", left: "", zIndex: "" }), b.onUnfixed.call(F);
  14125. }, placeholder: function placeholder() {
  14126. v.debug("Removing placeholder content"), r && r.remove();
  14127. }, occurred: function occurred(e) {
  14128. if (e) {
  14129. var t = v.cache.occurred;t[e] !== i && !0 === t[e] && (v.debug("Callback can now be called again", e), v.cache.occurred[e] = !1);
  14130. } else v.cache.occurred = {};
  14131. } }, save: { calculations: function calculations() {
  14132. v.verbose("Saving all calculations necessary to determine positioning"), v.save.direction(), v.save.screenCalculations(), v.save.elementCalculations();
  14133. }, occurred: function occurred(e) {
  14134. e && (v.cache.occurred[e] !== i && !0 === v.cache.occurred[e] || (v.verbose("Saving callback occurred", e), v.cache.occurred[e] = !0));
  14135. }, scroll: function scroll(e) {
  14136. e = e + b.offset || R.scrollTop() + b.offset, v.cache.scroll = e;
  14137. }, direction: function direction() {
  14138. var e,
  14139. t = v.get.scroll(),
  14140. n = v.get.lastScroll();return e = t > n && n ? "down" : t < n && n ? "up" : "static", v.cache.direction = e, v.cache.direction;
  14141. }, elementPosition: function elementPosition() {
  14142. var e = v.cache.element,
  14143. t = v.get.screenSize();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;
  14144. }, elementCalculations: function elementCalculations() {
  14145. var e = v.get.screenCalculations(),
  14146. t = v.get.elementPosition();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;
  14147. }, screenCalculations: function screenCalculations() {
  14148. var e = v.get.scroll();return v.save.direction(), v.cache.screen.top = e, v.cache.screen.bottom = e + v.cache.screen.height, v.cache.screen;
  14149. }, screenSize: function screenSize() {
  14150. v.verbose("Saving window position"), v.cache.screen = { height: R.height() };
  14151. }, position: function position() {
  14152. v.save.screenSize(), v.save.elementPosition();
  14153. } }, get: { pixelsPassed: function pixelsPassed(e) {
  14154. var t = v.get.elementCalculations();return e.search("%") > -1 ? t.height * (parseInt(e, 10) / 100) : parseInt(e, 10);
  14155. }, occurred: function occurred(e) {
  14156. return v.cache.occurred !== i && v.cache.occurred[e] || !1;
  14157. }, direction: function direction() {
  14158. return v.cache.direction === i && v.save.direction(), v.cache.direction;
  14159. }, elementPosition: function elementPosition() {
  14160. return v.cache.element === i && v.save.elementPosition(), v.cache.element;
  14161. }, elementCalculations: function elementCalculations() {
  14162. return v.cache.element === i && v.save.elementCalculations(), v.cache.element;
  14163. }, screenCalculations: function screenCalculations() {
  14164. return v.cache.screen === i && v.save.screenCalculations(), v.cache.screen;
  14165. }, screenSize: function screenSize() {
  14166. return v.cache.screen === i && v.save.screenSize(), v.cache.screen;
  14167. }, scroll: function scroll() {
  14168. return v.cache.scroll === i && v.save.scroll(), v.cache.scroll;
  14169. }, lastScroll: function lastScroll() {
  14170. return v.cache.screen === i ? (v.debug("First scroll event, no last scroll could be found"), !1) : v.cache.screen.top;
  14171. } }, setting: function setting(t, n) {
  14172. if (e.isPlainObject(t)) e.extend(!0, b, t);else {
  14173. if (n === i) return b[t];b[t] = n;
  14174. }
  14175. }, internal: function internal(t, n) {
  14176. if (e.isPlainObject(t)) e.extend(!0, v, t);else {
  14177. if (n === i) return v[t];v[t] = n;
  14178. }
  14179. }, debug: function debug() {
  14180. !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)));
  14181. }, verbose: function verbose() {
  14182. !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)));
  14183. }, error: function error() {
  14184. b.silent || (v.error = Function.prototype.bind.call(console.error, console, b.name + ":"), v.error.apply(console, arguments));
  14185. }, performance: { log: function log(e) {
  14186. var t, n;b.performance && (n = (t = new Date().getTime()) - (l || t), l = t, c.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: F, "Execution Time": n })), clearTimeout(v.performance.timer), v.performance.timer = setTimeout(v.performance.display, 500);
  14187. }, display: function display() {
  14188. var t = b.name + ":",
  14189. n = 0;l = !1, clearTimeout(v.performance.timer), e.each(c, function (e, t) {
  14190. n += t["Execution Time"];
  14191. }), 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) {
  14192. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  14193. }), console.groupEnd()), c = [];
  14194. } }, invoke: function invoke(t, n, o) {
  14195. var r,
  14196. s,
  14197. l,
  14198. c = P;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) {
  14199. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  14200. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (v.error(C.method, t), !1);c = c[o];
  14201. }
  14202. })), 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;
  14203. } }, d ? (P === i && v.initialize(), P.save.scroll(), P.save.calculations(), v.invoke(u)) : (P !== i && P.invoke("destroy"), v.initialize());
  14204. }), a !== i ? a : this;
  14205. }, e.fn.visibility.settings = { name: "Visibility", namespace: "visibility", debug: !1, verbose: !1, performance: !0, observeChanges: !0, initialCheck: !0, refreshOnLoad: !0, refreshOnResize: !0, checkOnRefresh: !0, once: !0, continuous: !1, offset: 0, includeMargin: !1, context: t, throttle: !1, type: !1, zIndex: "10", transition: "fade in", duration: 1e3, onPassed: {}, onOnScreen: !1, onOffScreen: !1, onPassing: !1, onTopVisible: !1, onBottomVisible: !1, onTopPassed: !1, onBottomPassed: !1, onPassingReverse: !1, onTopVisibleReverse: !1, onBottomVisibleReverse: !1, onTopPassedReverse: !1, onBottomPassedReverse: !1, onLoad: function onLoad() {}, onAllLoaded: function onAllLoaded() {}, onFixed: function onFixed() {}, onUnfixed: function onUnfixed() {}, onUpdate: !1, onRefresh: function onRefresh() {}, metadata: { src: "src" }, className: { fixed: "fixed", placeholder: "placeholder", visible: "visible" }, error: { method: "The method you called is not defined.", visible: "Element is hidden, you must call refresh after element becomes visible" } };
  14206. }(jQuery, window, document);
  14207. /***/ }),
  14208. /***/ "./js/services/i18nHelper.js":
  14209. /*!***********************************!*\
  14210. !*** ./js/services/i18nHelper.js ***!
  14211. \***********************************/
  14212. /*! no static exports found */
  14213. /***/ (function(module, exports, __webpack_require__) {
  14214. "use strict";
  14215. Object.defineProperty(exports, "__esModule", {
  14216. value: true
  14217. });
  14218. exports.i18nHelper = undefined;
  14219. var _lineI18n = __webpack_require__(/*! line-i18n */ "./node_modules/line-i18n/dist/index.js");
  14220. var _lineI18n2 = _interopRequireDefault(_lineI18n);
  14221. var _localizedStringsService = __webpack_require__(/*! ./localizedStringsService */ "./js/services/localizedStringsService.js");
  14222. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14223. var StringTypes = _lineI18n2.default.StringTypes;
  14224. var i18nHelper = exports.i18nHelper = Object.freeze({
  14225. i18n: function i18n(identifier) {
  14226. var opts = identifier.split(':');
  14227. var type = opts[0].toLowerCase();
  14228. var id = opts[1];
  14229. if (StringTypes.ERROR === type) {
  14230. return _localizedStringsService.LocalizedStrings.getError(id);
  14231. } else if (StringTypes.MESSAGE === type) {
  14232. return _localizedStringsService.LocalizedStrings.getMessage(id);
  14233. } else if (StringTypes.UI === type) {
  14234. return _localizedStringsService.LocalizedStrings.getUI(id);
  14235. } else {
  14236. console.warn("A string has been passed to the i18n helper function that was not in the form type:id -> " + identifier);
  14237. return _localizedStringsService.LocalizedStrings.getString(identifier, type);
  14238. }
  14239. }
  14240. });
  14241. /***/ }),
  14242. /***/ "./js/services/languageService.js":
  14243. /*!****************************************!*\
  14244. !*** ./js/services/languageService.js ***!
  14245. \****************************************/
  14246. /*! no static exports found */
  14247. /***/ (function(module, exports, __webpack_require__) {
  14248. "use strict";
  14249. Object.defineProperty(exports, "__esModule", {
  14250. value: true
  14251. });
  14252. exports.LanguageService = undefined;
  14253. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  14254. var _grammar = __webpack_require__(/*! ./../../grammar/ */ "./grammar/index.js");
  14255. var _grammar2 = _interopRequireDefault(_grammar);
  14256. var _lineI18n = __webpack_require__(/*! line-i18n */ "./node_modules/line-i18n/dist/index.js");
  14257. var _lineI18n2 = _interopRequireDefault(_lineI18n);
  14258. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14259. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14260. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  14261. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  14262. // This is for LanguageService with localStorage
  14263. // const DEFAULT_LANG = "pt";
  14264. var LanguageServiceExtended = function (_line_i18n$LanguageSe) {
  14265. _inherits(LanguageServiceExtended, _line_i18n$LanguageSe);
  14266. function LanguageServiceExtended() {
  14267. _classCallCheck(this, LanguageServiceExtended);
  14268. return _possibleConstructorReturn(this, (LanguageServiceExtended.__proto__ || Object.getPrototypeOf(LanguageServiceExtended)).call(this, iLMparameters.lang));
  14269. }
  14270. _createClass(LanguageServiceExtended, [{
  14271. key: 'getCurrentLexer',
  14272. value: function getCurrentLexer() {
  14273. var langInfo = _grammar2.default[this.getLang()];
  14274. if (langInfo === null || langInfo === undefined) {
  14275. return _grammar2.default[this.getDefaultLang()].lexer;
  14276. } else {
  14277. return langInfo.lexer;
  14278. }
  14279. }
  14280. }, {
  14281. key: 'getCurrentLangFuncs',
  14282. value: function getCurrentLangFuncs() {
  14283. var langInfo = _grammar2.default[this.getLang()];
  14284. if (langInfo === null || langInfo === undefined) {
  14285. return _grammar2.default[this.getDefaultLang()].langFuncs;
  14286. } else {
  14287. return langInfo.langFuncs;
  14288. }
  14289. }
  14290. }, {
  14291. key: 'getCurrentLangLibs',
  14292. value: function getCurrentLangLibs() {
  14293. var langInfo = _grammar2.default[this.getLang()];
  14294. if (langInfo === null || langInfo === undefined) {
  14295. return _grammar2.default[this.getDefaultLang()].langLibs;
  14296. }
  14297. return langInfo.langLibs;
  14298. }
  14299. }]);
  14300. return LanguageServiceExtended;
  14301. }(_lineI18n2.default.LanguageServiceNoLS);
  14302. var LanguageService = exports.LanguageService = new LanguageServiceExtended();
  14303. /***/ }),
  14304. /***/ "./js/services/localizedStringsService.js":
  14305. /*!************************************************!*\
  14306. !*** ./js/services/localizedStringsService.js ***!
  14307. \************************************************/
  14308. /*! no static exports found */
  14309. /***/ (function(module, exports, __webpack_require__) {
  14310. "use strict";
  14311. Object.defineProperty(exports, "__esModule", {
  14312. value: true
  14313. });
  14314. exports.LocalizedStrings = undefined;
  14315. var _languageService = __webpack_require__(/*! ./languageService */ "./js/services/languageService.js");
  14316. var _lineI18n = __webpack_require__(/*! line-i18n */ "./node_modules/line-i18n/dist/index.js");
  14317. var _lineI18n2 = _interopRequireDefault(_lineI18n);
  14318. var _i18n = __webpack_require__(/*! ./../../i18n */ "./i18n/index.js");
  14319. var _i18n2 = _interopRequireDefault(_i18n);
  14320. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14321. var LocalizedStrings = exports.LocalizedStrings = Object.freeze(new _lineI18n2.default.LocalizedStrings(_languageService.LanguageService, _i18n2.default, true));
  14322. /***/ }),
  14323. /***/ "./js/typeSystem/baseTypes.js":
  14324. /*!************************************!*\
  14325. !*** ./js/typeSystem/baseTypes.js ***!
  14326. \************************************/
  14327. /*! no static exports found */
  14328. /***/ (function(module, exports, __webpack_require__) {
  14329. "use strict";
  14330. Object.defineProperty(exports, "__esModule", {
  14331. value: true
  14332. });
  14333. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  14334. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14335. var BaseType = function () {
  14336. function BaseType(name, ord) {
  14337. _classCallCheck(this, BaseType);
  14338. this.name = name;
  14339. this.ord = ord;
  14340. }
  14341. _createClass(BaseType, [{
  14342. key: "isCompatible",
  14343. value: function isCompatible(another) {
  14344. if (another instanceof BaseType) {
  14345. return this.name === another.name && this.ord === another.ord;
  14346. }
  14347. return false;
  14348. }
  14349. }, {
  14350. key: "value",
  14351. get: function get() {
  14352. return this.name;
  14353. }
  14354. }]);
  14355. return BaseType;
  14356. }();
  14357. // Base types names are the same as i18n ui type keys
  14358. var BaseTypes = exports.BaseTypes = Object.freeze({
  14359. INTEGER: new BaseType("integer", 0),
  14360. REAL: new BaseType("real", 1),
  14361. STRING: new BaseType("text", 2),
  14362. BOOLEAN: new BaseType("boolean", 3),
  14363. VOID: new BaseType("void", 4),
  14364. UNDEFINED: new BaseType("undefined", 5)
  14365. });
  14366. /***/ }),
  14367. /***/ "./js/typeSystem/compoundType.js":
  14368. /*!***************************************!*\
  14369. !*** ./js/typeSystem/compoundType.js ***!
  14370. \***************************************/
  14371. /*! no static exports found */
  14372. /***/ (function(module, exports, __webpack_require__) {
  14373. "use strict";
  14374. Object.defineProperty(exports, "__esModule", {
  14375. value: true
  14376. });
  14377. exports.CompoundType = undefined;
  14378. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  14379. var _type = __webpack_require__(/*! ./type */ "./js/typeSystem/type.js");
  14380. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14381. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  14382. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  14383. var CompoundType = exports.CompoundType = function (_Type) {
  14384. _inherits(CompoundType, _Type);
  14385. function CompoundType(type, dimensions) {
  14386. _classCallCheck(this, CompoundType);
  14387. var _this = _possibleConstructorReturn(this, (CompoundType.__proto__ || Object.getPrototypeOf(CompoundType)).call(this, null));
  14388. _this.innerType = type;
  14389. _this.dimensions = dimensions;
  14390. return _this;
  14391. }
  14392. _createClass(CompoundType, [{
  14393. key: "isCompatible",
  14394. value: function isCompatible(another) {
  14395. if (another instanceof CompoundType) {
  14396. if (this.dimensions !== another.dimensions) {
  14397. return false;
  14398. }
  14399. return this.innerType.isCompatible(another.innerType);
  14400. }
  14401. return false;
  14402. }
  14403. }, {
  14404. key: "stringInfo",
  14405. value: function stringInfo() {
  14406. var _this2 = this;
  14407. var list = this.innerType.stringInfo();
  14408. list.forEach(function (v) {
  14409. v.dim = _this2.dimensions;
  14410. });
  14411. return list;
  14412. }
  14413. }, {
  14414. key: "canAccept",
  14415. value: function canAccept(another) {
  14416. if (another instanceof CompoundType) {
  14417. return this.dimensions > another.dimensions && this.innerType.isCompatible(another.innerType);
  14418. } else {
  14419. return this.innerType.isCompatible(another);
  14420. }
  14421. }
  14422. }]);
  14423. return CompoundType;
  14424. }(_type.Type);
  14425. /***/ }),
  14426. /***/ "./js/typeSystem/multiType.js":
  14427. /*!************************************!*\
  14428. !*** ./js/typeSystem/multiType.js ***!
  14429. \************************************/
  14430. /*! no static exports found */
  14431. /***/ (function(module, exports, __webpack_require__) {
  14432. "use strict";
  14433. Object.defineProperty(exports, "__esModule", {
  14434. value: true
  14435. });
  14436. exports.MultiType = undefined;
  14437. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  14438. var _type = __webpack_require__(/*! ./type */ "./js/typeSystem/type.js");
  14439. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14440. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  14441. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  14442. var MultiType = exports.MultiType = function (_Type) {
  14443. _inherits(MultiType, _Type);
  14444. function MultiType(types) {
  14445. _classCallCheck(this, MultiType);
  14446. var _this = _possibleConstructorReturn(this, (MultiType.__proto__ || Object.getPrototypeOf(MultiType)).call(this, null));
  14447. _this.types = types;
  14448. return _this;
  14449. }
  14450. _createClass(MultiType, [{
  14451. key: "stringInfo",
  14452. value: function stringInfo() {
  14453. var list = [];
  14454. for (var i = 0; i < this.types.length; i++) {
  14455. var t = this.types[i];
  14456. list = list.concat(t.stringInfo());
  14457. }
  14458. return list;
  14459. }
  14460. }, {
  14461. key: "isCompatible",
  14462. value: function isCompatible(another) {
  14463. if (another instanceof _type.Type) {
  14464. for (var i = 0; i < this.types.length; i++) {
  14465. var t = this.types[i];
  14466. if (t.isCompatible(another)) {
  14467. return true;
  14468. }
  14469. }
  14470. }
  14471. return false;
  14472. }
  14473. }, {
  14474. key: "value",
  14475. get: function get() {
  14476. return null;
  14477. }
  14478. }, {
  14479. key: "ord",
  14480. get: function get() {
  14481. return null;
  14482. }
  14483. }]);
  14484. return MultiType;
  14485. }(_type.Type);
  14486. /***/ }),
  14487. /***/ "./js/typeSystem/parsers.js":
  14488. /*!**********************************!*\
  14489. !*** ./js/typeSystem/parsers.js ***!
  14490. \**********************************/
  14491. /*! no static exports found */
  14492. /***/ (function(module, exports, __webpack_require__) {
  14493. "use strict";
  14494. Object.defineProperty(exports, "__esModule", {
  14495. value: true
  14496. });
  14497. exports.toInt = toInt;
  14498. exports.toString = toString;
  14499. exports.toReal = toReal;
  14500. exports.toBool = toBool;
  14501. exports.convertToString = convertToString;
  14502. var _languageService = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js");
  14503. var _types = __webpack_require__(/*! ./types */ "./js/typeSystem/types.js");
  14504. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  14505. var _decimal2 = _interopRequireDefault(_decimal);
  14506. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14507. function toInt(str) {
  14508. return new _decimal2.default(str);
  14509. }
  14510. function toString(str) {
  14511. var value = str.replace(/^"/, '');
  14512. value = value.replace(/"$/, '');
  14513. value = value.replace(/\\b/g, "\b");
  14514. value = value.replace(/\\t/g, "\t");
  14515. value = value.replace(/\\n/g, "\n");
  14516. value = value.replace(/\\r/g, "\r");
  14517. value = value.replace(/\\\"/g, "\"");
  14518. value = value.replace(/\\\'/g, "\'");
  14519. value = value.replace(/\\\\/g, "\\");
  14520. return value;
  14521. }
  14522. function toReal(value) {
  14523. return new _decimal2.default(value);
  14524. }
  14525. function toBool(str) {
  14526. var val = "'" + str + "'";
  14527. var lexer = _languageService.LanguageService.getCurrentLexer();
  14528. var instance = new lexer(null);
  14529. if (instance.literalNames[lexer.RK_TRUE] === val) {
  14530. return true;
  14531. } else if (instance.literalNames[lexer.RK_FALSE] === val) {
  14532. return false;
  14533. } else {
  14534. // TODO: better error message
  14535. throw new Error(str + "not a valid boolean");
  14536. }
  14537. }
  14538. function convertBoolToString(bool) {
  14539. var lexer = _languageService.LanguageService.getCurrentLexer();
  14540. var instance = new lexer(null);
  14541. if (bool) {
  14542. return instance.literalNames[lexer.RK_TRUE];
  14543. } else {
  14544. return instance.literalNames[lexer.RK_FALSE];
  14545. }
  14546. }
  14547. function convertToString(stoObj, type) {
  14548. switch (type.ord) {
  14549. case _types.Types.INTEGER.ord:
  14550. return stoObj.toString();
  14551. case _types.Types.REAL.ord:
  14552. {
  14553. if (stoObj.dp() <= 0) {
  14554. return stoObj.toFixed(1);
  14555. } else {
  14556. return stoObj.toNumber();
  14557. }
  14558. }
  14559. case _types.Types.BOOLEAN.ord:
  14560. return convertBoolToString(stoObj);
  14561. default:
  14562. return stoObj;
  14563. }
  14564. }
  14565. /***/ }),
  14566. /***/ "./js/typeSystem/type.js":
  14567. /*!*******************************!*\
  14568. !*** ./js/typeSystem/type.js ***!
  14569. \*******************************/
  14570. /*! no static exports found */
  14571. /***/ (function(module, exports, __webpack_require__) {
  14572. "use strict";
  14573. Object.defineProperty(exports, "__esModule", {
  14574. value: true
  14575. });
  14576. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  14577. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14578. var Type = exports.Type = function () {
  14579. function Type(baseType) {
  14580. _classCallCheck(this, Type);
  14581. this.baseType = baseType;
  14582. }
  14583. _createClass(Type, [{
  14584. key: "stringInfo",
  14585. value: function stringInfo() {
  14586. return [{ type: this.baseType.name, dim: 0 }];
  14587. }
  14588. }, {
  14589. key: "isCompatible",
  14590. value: function isCompatible(another) {
  14591. if (another instanceof Type) {
  14592. return this.baseType.isCompatible(another.baseType);
  14593. }
  14594. return false;
  14595. }
  14596. }, {
  14597. key: "value",
  14598. get: function get() {
  14599. return this.baseType.value;
  14600. }
  14601. }, {
  14602. key: "ord",
  14603. get: function get() {
  14604. return this.baseType.ord;
  14605. }
  14606. }]);
  14607. return Type;
  14608. }();
  14609. /***/ }),
  14610. /***/ "./js/typeSystem/types.js":
  14611. /*!********************************!*\
  14612. !*** ./js/typeSystem/types.js ***!
  14613. \********************************/
  14614. /*! no static exports found */
  14615. /***/ (function(module, exports, __webpack_require__) {
  14616. "use strict";
  14617. Object.defineProperty(exports, "__esModule", {
  14618. value: true
  14619. });
  14620. exports.Types = undefined;
  14621. var _baseTypes = __webpack_require__(/*! ./baseTypes */ "./js/typeSystem/baseTypes.js");
  14622. var _type = __webpack_require__(/*! ./type */ "./js/typeSystem/type.js");
  14623. var _multiType = __webpack_require__(/*! ./multiType */ "./js/typeSystem/multiType.js");
  14624. var INTEGER = new _type.Type(_baseTypes.BaseTypes.INTEGER);
  14625. var REAL = new _type.Type(_baseTypes.BaseTypes.REAL);
  14626. var STRING = new _type.Type(_baseTypes.BaseTypes.STRING);
  14627. var BOOLEAN = new _type.Type(_baseTypes.BaseTypes.BOOLEAN);
  14628. var VOID = new _type.Type(_baseTypes.BaseTypes.VOID);
  14629. var UNDEFINED = new _type.Type(_baseTypes.BaseTypes.UNDEFINED);
  14630. var ALL = new _multiType.MultiType([INTEGER, REAL, STRING, BOOLEAN]);
  14631. var Types = exports.Types = Object.freeze({
  14632. INTEGER: INTEGER,
  14633. REAL: REAL,
  14634. STRING: STRING,
  14635. BOOLEAN: BOOLEAN,
  14636. VOID: VOID,
  14637. UNDEFINED: UNDEFINED,
  14638. ALL: ALL
  14639. });
  14640. /***/ }),
  14641. /***/ "./js/util/config.js":
  14642. /*!***************************!*\
  14643. !*** ./js/util/config.js ***!
  14644. \***************************/
  14645. /*! no static exports found */
  14646. /***/ (function(module, exports, __webpack_require__) {
  14647. "use strict";
  14648. Object.defineProperty(exports, "__esModule", {
  14649. value: true
  14650. });
  14651. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  14652. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14653. var ConfigObject = function () {
  14654. function ConfigObject() {
  14655. _classCallCheck(this, ConfigObject);
  14656. this.loopTimeout = 5000;
  14657. this.decimalPlaces = 5;
  14658. this.intConvertRoundMode = 2;
  14659. }
  14660. _createClass(ConfigObject, [{
  14661. key: "setConfig",
  14662. value: function setConfig(opts) {
  14663. for (var key in opts) {
  14664. if (this.hasOwnProperty(key)) {
  14665. this[key] = opts[key];
  14666. }
  14667. }
  14668. }
  14669. }]);
  14670. return ConfigObject;
  14671. }();
  14672. var config = new ConfigObject();
  14673. var Config = exports.Config = config;
  14674. /***/ }),
  14675. /***/ "./js/util/inputTest.js":
  14676. /*!******************************!*\
  14677. !*** ./js/util/inputTest.js ***!
  14678. \******************************/
  14679. /*! no static exports found */
  14680. /***/ (function(module, exports, __webpack_require__) {
  14681. "use strict";
  14682. Object.defineProperty(exports, "__esModule", {
  14683. value: true
  14684. });
  14685. exports.InputTest = undefined;
  14686. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  14687. var _input = __webpack_require__(/*! ./../io/input */ "./js/io/input.js");
  14688. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14689. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  14690. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  14691. var InputTest = exports.InputTest = function (_Input) {
  14692. _inherits(InputTest, _Input);
  14693. function InputTest(inputList) {
  14694. _classCallCheck(this, InputTest);
  14695. var _this = _possibleConstructorReturn(this, (InputTest.__proto__ || Object.getPrototypeOf(InputTest)).call(this));
  14696. _this.index = 0;
  14697. _this.inputList = inputList;
  14698. return _this;
  14699. }
  14700. _createClass(InputTest, [{
  14701. key: 'requestInput',
  14702. value: function requestInput(callback) {
  14703. if (this.index < this.inputList.length) {
  14704. callback(this.inputList[this.index]);
  14705. this.index++;
  14706. } else {
  14707. throw new Error('The amount of requests exceeded the amount of available inputs');
  14708. }
  14709. }
  14710. }]);
  14711. return InputTest;
  14712. }(_input.Input);
  14713. /***/ }),
  14714. /***/ "./js/util/outputTest.js":
  14715. /*!*******************************!*\
  14716. !*** ./js/util/outputTest.js ***!
  14717. \*******************************/
  14718. /*! no static exports found */
  14719. /***/ (function(module, exports, __webpack_require__) {
  14720. "use strict";
  14721. Object.defineProperty(exports, "__esModule", {
  14722. value: true
  14723. });
  14724. exports.OutputTest = undefined;
  14725. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  14726. var _output = __webpack_require__(/*! ./../io/output */ "./js/io/output.js");
  14727. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14728. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  14729. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  14730. var OutputTest = exports.OutputTest = function (_Output) {
  14731. _inherits(OutputTest, _Output);
  14732. function OutputTest() {
  14733. _classCallCheck(this, OutputTest);
  14734. var _this = _possibleConstructorReturn(this, (OutputTest.__proto__ || Object.getPrototypeOf(OutputTest)).call(this));
  14735. _this.list = [];
  14736. return _this;
  14737. }
  14738. _createClass(OutputTest, [{
  14739. key: 'sendOutput',
  14740. value: function sendOutput(text) {
  14741. this.list.push(text);
  14742. }
  14743. }]);
  14744. return OutputTest;
  14745. }(_output.Output);
  14746. /***/ }),
  14747. /***/ "./js/visualUI/algorithm.js":
  14748. /*!**********************************!*\
  14749. !*** ./js/visualUI/algorithm.js ***!
  14750. \**********************************/
  14751. /*! no static exports found */
  14752. /***/ (function(module, exports, __webpack_require__) {
  14753. "use strict";
  14754. Object.defineProperty(exports, "__esModule", {
  14755. value: true
  14756. });
  14757. exports.renderAlgorithm = renderAlgorithm;
  14758. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  14759. var _jquery2 = _interopRequireDefault(_jquery);
  14760. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  14761. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  14762. var Models = _interopRequireWildcard(_ivprog_elements);
  14763. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  14764. var _globals = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  14765. var GlobalsManagement = _interopRequireWildcard(_globals);
  14766. var _variables = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  14767. var VariablesManagement = _interopRequireWildcard(_variables);
  14768. var _commands = __webpack_require__(/*! ./commands */ "./js/visualUI/commands.js");
  14769. var CommandsManagement = _interopRequireWildcard(_commands);
  14770. var _code_generator = __webpack_require__(/*! ./code_generator */ "./js/visualUI/code_generator.js");
  14771. var CodeManagement = _interopRequireWildcard(_code_generator);
  14772. var _variable_value_menu = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  14773. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  14774. var _functions = __webpack_require__(/*! ./functions */ "./js/visualUI/functions.js");
  14775. var FunctionsManagement = _interopRequireWildcard(_functions);
  14776. var _domConsole = __webpack_require__(/*! ./../io/domConsole */ "./js/io/domConsole.js");
  14777. var _ivprogParser = __webpack_require__(/*! ./../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  14778. var _ivprogProcessor = __webpack_require__(/*! ./../processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  14779. var _languageService = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js");
  14780. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  14781. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14782. var block_render = false;
  14783. function renderAlgorithm() {
  14784. if (block_render) {
  14785. return;
  14786. }
  14787. block_render = true;
  14788. (0, _jquery2.default)('.all_functions').children().off();
  14789. (0, _jquery2.default)('.all_functions').empty();
  14790. (0, _jquery2.default)('.list_globals').children().off();
  14791. (0, _jquery2.default)('.list_globals').empty();
  14792. for (var i = 0; i < window.program_obj.functions.length; i++) {
  14793. FunctionsManagement.renderFunction(window.program_obj.functions[i]);
  14794. }
  14795. for (var i = 0; i < window.program_obj.globals.length; i++) {
  14796. GlobalsManagement.renderGlobal(window.program_obj.globals[i]);
  14797. }
  14798. setTimeout(function () {
  14799. block_render = false;
  14800. }, 500);
  14801. }
  14802. /***/ }),
  14803. /***/ "./js/visualUI/code_generator.js":
  14804. /*!***************************************!*\
  14805. !*** ./js/visualUI/code_generator.js ***!
  14806. \***************************************/
  14807. /*! no static exports found */
  14808. /***/ (function(module, exports, __webpack_require__) {
  14809. "use strict";
  14810. Object.defineProperty(exports, "__esModule", {
  14811. value: true
  14812. });
  14813. exports.generate = generate;
  14814. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  14815. var _jquery2 = _interopRequireDefault(_jquery);
  14816. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  14817. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  14818. var Models = _interopRequireWildcard(_ivprog_elements);
  14819. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  14820. var _globals = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  14821. var GlobalsManagement = _interopRequireWildcard(_globals);
  14822. var _variables = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  14823. var VariablesManagement = _interopRequireWildcard(_variables);
  14824. var _commands = __webpack_require__(/*! ./commands */ "./js/visualUI/commands.js");
  14825. var CommandsManagement = _interopRequireWildcard(_commands);
  14826. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  14827. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14828. function generate() {
  14829. (0, _jquery2.default)('.ivprog_visual_panel').find('.error_icon').remove();
  14830. var code = _localizedStringsService.LocalizedStrings.getUI('program') + ' { ';
  14831. code += globalsCode();
  14832. code += '\n';
  14833. var has_error = false;
  14834. for (var i = 0; i < window.program_obj.functions.length; i++) {
  14835. var n_code = functionsCode(window.program_obj.functions[i]);
  14836. if (n_code == null) {
  14837. has_error = true;
  14838. }
  14839. code += n_code;
  14840. code += '\n';
  14841. }
  14842. code += '\n}';
  14843. if (has_error) {
  14844. return null;
  14845. } else {
  14846. return code;
  14847. }
  14848. }
  14849. function functionsCode(function_obj) {
  14850. var ret = '\n\t' + _localizedStringsService.LocalizedStrings.getUI('function') + ' ';
  14851. var has_error = false;
  14852. switch (function_obj.return_type) {
  14853. case _types.Types.INTEGER:
  14854. ret += _localizedStringsService.LocalizedStrings.getUI('integer');
  14855. break;
  14856. case _types.Types.REAL:
  14857. ret += _localizedStringsService.LocalizedStrings.getUI('real');
  14858. break;
  14859. case _types.Types.TEXT:
  14860. ret += _localizedStringsService.LocalizedStrings.getUI('text');
  14861. break;
  14862. case _types.Types.BOOLEAN:
  14863. ret += _localizedStringsService.LocalizedStrings.getUI('boolean');
  14864. break;
  14865. case _types.Types.VOID:
  14866. ret += _localizedStringsService.LocalizedStrings.getUI('void');
  14867. break;
  14868. }
  14869. ret += ' ';
  14870. if (function_obj.return_dimensions == 1) {
  14871. ret += '[] ';
  14872. } else if (function_obj.return_dimensions == 2) {
  14873. ret += '[][] ';
  14874. }
  14875. ret += function_obj.name + ' ( ';
  14876. for (var j = 0; j < function_obj.parameters_list.length; j++) {
  14877. ret += parametersCode(function_obj.parameters_list[j]);
  14878. if (j + 1 < function_obj.parameters_list.length) {
  14879. ret += ',';
  14880. }
  14881. }
  14882. ret += ' ) {';
  14883. for (var j = 0; j < function_obj.variables_list.length; j++) {
  14884. ret += variablesCode(function_obj.variables_list[j]);
  14885. }
  14886. for (var j = 0; j < function_obj.commands.length; j++) {
  14887. //try {
  14888. ret += commandsCode(function_obj.commands[j]);
  14889. /*} catch (err) {
  14890. has_error = true;
  14891. console.error(err.message);
  14892. var todos = $('body').find('.command_container');
  14893. for (var i = 0; i < todos.length; i++) {
  14894. if ($(todos[i]).data('command') == function_obj.commands[j]) {
  14895. $( todos[i] ).prepend( ' <i class="ui icon red exclamation triangle error_icon"></i> ' );
  14896. break;
  14897. }
  14898. }
  14899. }*/
  14900. }
  14901. ret += '\n\t}';
  14902. if (has_error) {
  14903. return null;
  14904. } else {
  14905. return ret;
  14906. }
  14907. }
  14908. function commandsCode(command_obj) {
  14909. var indentation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
  14910. switch (command_obj.type) {
  14911. case Models.COMMAND_TYPES.break:
  14912. return breaksCode(command_obj, indentation);
  14913. case Models.COMMAND_TYPES.comment:
  14914. return commentsCode(command_obj, indentation);
  14915. case Models.COMMAND_TYPES.reader:
  14916. return readersCode(command_obj, indentation);
  14917. case Models.COMMAND_TYPES.writer:
  14918. return writersCode(command_obj, indentation);
  14919. case Models.COMMAND_TYPES.functioncall:
  14920. return functioncallsCode(command_obj, indentation);
  14921. case Models.COMMAND_TYPES.attribution:
  14922. return attributionsCode(command_obj, indentation);
  14923. case Models.COMMAND_TYPES.whiletrue:
  14924. return whiletruesCode(command_obj, indentation);
  14925. case Models.COMMAND_TYPES.dowhiletrue:
  14926. return doWhilesCode(command_obj, indentation);
  14927. case Models.COMMAND_TYPES.iftrue:
  14928. return iftruesCode(command_obj, indentation);
  14929. case Models.COMMAND_TYPES.repeatNtimes:
  14930. return repeatNtimesCode(command_obj, indentation);
  14931. case Models.COMMAND_TYPES.switch:
  14932. return switchsCode(command_obj, indentation);
  14933. case Models.COMMAND_TYPES.return:
  14934. return returnsCode(command_obj, indentation);
  14935. }
  14936. }
  14937. function returnsCode(command_obj, indentation) {
  14938. var ret = '\n';
  14939. for (var i = 0; i < indentation; i++) {
  14940. ret += '\t';
  14941. }
  14942. ret += _localizedStringsService.LocalizedStrings.getUI('text_return');
  14943. if (command_obj.variable_value_menu) {
  14944. try {
  14945. ret += ' ' + variableValueMenuCode(command_obj.variable_value_menu);
  14946. } catch (err) {}
  14947. }
  14948. return ret;
  14949. }
  14950. function breaksCode(command_obj, indentation) {
  14951. var ret = '\n';
  14952. for (var i = 0; i < indentation; i++) {
  14953. ret += '\t';
  14954. }
  14955. ret += _localizedStringsService.LocalizedStrings.getUI('text_break');
  14956. return ret;
  14957. }
  14958. function switchsCode(command_obj, indentation) {
  14959. var ret = '\n';
  14960. for (var i = 0; i < indentation; i++) {
  14961. ret += '\t';
  14962. }
  14963. ret += _localizedStringsService.LocalizedStrings.getUI('text_code_switch') + ' ( ';
  14964. ret += variableValueMenuCode(command_obj.variable);
  14965. ret += ' ) { ';
  14966. if (command_obj.cases) {
  14967. for (var i = 0; i < command_obj.cases.length; i++) {
  14968. ret += switchcasesCode(command_obj.cases[i], indentation + 1);
  14969. }
  14970. }
  14971. ret += '\n';
  14972. for (var i = 0; i < indentation; i++) {
  14973. ret += '\t';
  14974. }
  14975. ret += '} ';
  14976. return ret;
  14977. }
  14978. function switchcasesCode(switchcase, indentation) {
  14979. var ret = '\n';
  14980. for (var i = 0; i < indentation; i++) {
  14981. ret += '\t';
  14982. }
  14983. ret += _localizedStringsService.LocalizedStrings.getUI('text_code_case') + ' ';
  14984. ret += variableValueMenuCode(switchcase.variable_value_menu);
  14985. ret += ' :';
  14986. if (switchcase.commands_block) {
  14987. for (var i = 0; i < switchcase.commands_block.length; i++) {
  14988. ret += commandsCode(switchcase.commands_block[i], indentation + 1);
  14989. }
  14990. }
  14991. return ret;
  14992. }
  14993. function repeatNtimesCode(command_obj, indentation) {
  14994. var ret = '\n';
  14995. for (var i = 0; i < indentation; i++) {
  14996. ret += '\t';
  14997. }
  14998. ret += _localizedStringsService.LocalizedStrings.getUI('text_for') + ' ( ';
  14999. if (command_obj.var_attribution) {
  15000. ret += variableValueMenuCode(command_obj.var_attribution);
  15001. ret += ' = ';
  15002. ret += variableValueMenuCode(command_obj.expression1);
  15003. }
  15004. ret += ' ; ';
  15005. if (command_obj.expression2) {
  15006. switch (command_obj.expression2.expression.type) {
  15007. case Models.EXPRESSION_TYPES.exp_logic:
  15008. ret += logicExpressionCode(command_obj.expression2.expression);
  15009. break;
  15010. case Models.EXPRESSION_TYPES.exp_arithmetic:
  15011. ret += arithmeticExpressionCode(command_obj.expression2.expression);
  15012. break;
  15013. }
  15014. }
  15015. ret += ' ; ';
  15016. if (command_obj.var_incrementation) {
  15017. ret += variableValueMenuCode(command_obj.var_incrementation);
  15018. ret += ' = ';
  15019. ret += variableValueMenuCode(command_obj.expression3.itens[0]);
  15020. switch (command_obj.expression3.itens[1]) {
  15021. case Models.ARITHMETIC_TYPES.plus:
  15022. ret += ' + ';
  15023. break;
  15024. case Models.ARITHMETIC_TYPES.minus:
  15025. ret += ' - ';
  15026. break;
  15027. case Models.ARITHMETIC_TYPES.multiplication:
  15028. ret += ' * ';
  15029. break;
  15030. case Models.ARITHMETIC_TYPES.division:
  15031. ret += ' / ';
  15032. break;
  15033. case Models.ARITHMETIC_TYPES.module:
  15034. ret += ' % ';
  15035. break;
  15036. }
  15037. ret += variableValueMenuCode(command_obj.expression3.itens[2]);
  15038. }
  15039. ret += ' ) { ';
  15040. if (command_obj.commands_block) {
  15041. for (var i = 0; i < command_obj.commands_block.length; i++) {
  15042. ret += commandsCode(command_obj.commands_block[i], indentation + 1);
  15043. }
  15044. }
  15045. ret += '\n';
  15046. for (var i = 0; i < indentation; i++) {
  15047. ret += '\t';
  15048. }
  15049. ret += '}';
  15050. return ret;
  15051. }
  15052. function iftruesCode(command_obj, indentation) {
  15053. var ret = '\n';
  15054. for (var i = 0; i < indentation; i++) {
  15055. ret += '\t';
  15056. }
  15057. ret += _localizedStringsService.LocalizedStrings.getUI('text_if');
  15058. switch (command_obj.expression.expression.type) {
  15059. case Models.EXPRESSION_TYPES.exp_logic:
  15060. ret += logicExpressionCode(command_obj.expression.expression);
  15061. break;
  15062. case Models.EXPRESSION_TYPES.exp_arithmetic:
  15063. ret += arithmeticExpressionCode(command_obj.expression.expression);
  15064. break;
  15065. }
  15066. ret += ' { ';
  15067. if (command_obj.commands_block) {
  15068. for (var i = 0; i < command_obj.commands_block.length; i++) {
  15069. ret += commandsCode(command_obj.commands_block[i], indentation + 1);
  15070. }
  15071. }
  15072. ret += '\n';
  15073. for (var i = 0; i < indentation; i++) {
  15074. ret += '\t';
  15075. }
  15076. ret += '} ' + _localizedStringsService.LocalizedStrings.getUI('text_else') + ' {';
  15077. if (command_obj.commands_else) {
  15078. for (var i = 0; i < command_obj.commands_else.length; i++) {
  15079. ret += commandsCode(command_obj.commands_else[i], indentation + 1);
  15080. }
  15081. }
  15082. ret += '\n';
  15083. for (var i = 0; i < indentation; i++) {
  15084. ret += '\t';
  15085. }
  15086. ret += '}';
  15087. return ret;
  15088. }
  15089. function doWhilesCode(command_obj, indentation) {
  15090. var ret = '\n';
  15091. for (var i = 0; i < indentation; i++) {
  15092. ret += '\t';
  15093. }
  15094. ret += _localizedStringsService.LocalizedStrings.getUI('text_code_do') + ' { ';
  15095. if (command_obj.commands_block) {
  15096. for (var i = 0; i < command_obj.commands_block.length; i++) {
  15097. ret += commandsCode(command_obj.commands_block[i], indentation + 1);
  15098. }
  15099. }
  15100. ret += '\n';
  15101. for (var i = 0; i < indentation; i++) {
  15102. ret += '\t';
  15103. }
  15104. ret += '} ' + _localizedStringsService.LocalizedStrings.getUI('text_code_while');
  15105. switch (command_obj.expression.expression.type) {
  15106. case Models.EXPRESSION_TYPES.exp_logic:
  15107. ret += logicExpressionCode(command_obj.expression.expression);
  15108. break;
  15109. case Models.EXPRESSION_TYPES.exp_arithmetic:
  15110. ret += arithmeticExpressionCode(command_obj.expression.expression);
  15111. break;
  15112. }
  15113. return ret;
  15114. }
  15115. function whiletruesCode(command_obj, indentation) {
  15116. var ret = '\n';
  15117. for (var i = 0; i < indentation; i++) {
  15118. ret += '\t';
  15119. }
  15120. ret += _localizedStringsService.LocalizedStrings.getUI('text_code_while');
  15121. switch (command_obj.expression.expression.type) {
  15122. case Models.EXPRESSION_TYPES.exp_logic:
  15123. ret += logicExpressionCode(command_obj.expression.expression);
  15124. break;
  15125. case Models.EXPRESSION_TYPES.exp_arithmetic:
  15126. ret += arithmeticExpressionCode(command_obj.expression.expression);
  15127. break;
  15128. }
  15129. ret += ' { ';
  15130. if (command_obj.commands_block) {
  15131. for (var i = 0; i < command_obj.commands_block.length; i++) {
  15132. ret += commandsCode(command_obj.commands_block[i], indentation + 1);
  15133. }
  15134. }
  15135. ret += '\n';
  15136. for (var i = 0; i < indentation; i++) {
  15137. ret += '\t';
  15138. }
  15139. ret += '}';
  15140. return ret;
  15141. }
  15142. function logicExpressionCode(expression) {
  15143. var ret = ' ( ';
  15144. if (expression.first_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  15145. ret += logicExpressionCode(expression.first_operand);
  15146. } else if (expression.first_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  15147. ret += arithmeticExpressionCode(expression.first_operand);
  15148. } else {
  15149. ret += variableValueMenuCode(expression.first_operand);
  15150. }
  15151. if (expression.operator) {
  15152. switch (expression.operator) {
  15153. case Models.LOGIC_COMPARISON.equals_to:
  15154. ret += ' == ';
  15155. break;
  15156. case Models.LOGIC_COMPARISON.not_equals_to:
  15157. ret += ' != ';
  15158. break;
  15159. case Models.LOGIC_COMPARISON.and:
  15160. ret += ' && ';
  15161. break;
  15162. case Models.LOGIC_COMPARISON.or:
  15163. ret += ' || ';
  15164. break;
  15165. }
  15166. if (expression.second_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  15167. ret += logicExpressionCode(expression.second_operand);
  15168. } else if (expression.second_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  15169. ret += arithmeticExpressionCode(expression.second_operand);
  15170. } else {
  15171. ret += variableValueMenuCode(expression.second_operand);
  15172. }
  15173. }
  15174. ret += ' ) ';
  15175. return ret;
  15176. }
  15177. function arithmeticExpressionCode(expression) {
  15178. var ret = ' ( ';
  15179. if (expression.first_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  15180. ret += logicExpressionCode(expression.first_operand);
  15181. } else if (expression.first_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  15182. ret += arithmeticExpressionCode(expression.first_operand);
  15183. } else {
  15184. ret += variableValueMenuCode(expression.first_operand);
  15185. }
  15186. switch (expression.operator) {
  15187. case Models.ARITHMETIC_COMPARISON.greater_than:
  15188. ret += ' > ';
  15189. break;
  15190. case Models.ARITHMETIC_COMPARISON.less_than:
  15191. ret += ' < ';
  15192. break;
  15193. case Models.ARITHMETIC_COMPARISON.equals_to:
  15194. ret += ' == ';
  15195. break;
  15196. case Models.ARITHMETIC_COMPARISON.not_equals_to:
  15197. ret += ' != ';
  15198. break;
  15199. case Models.ARITHMETIC_COMPARISON.greater_than_or_equals_to:
  15200. ret += ' >= ';
  15201. break;
  15202. case Models.ARITHMETIC_COMPARISON.less_than_or_equals_to:
  15203. ret += ' <= ';
  15204. break;
  15205. }
  15206. if (expression.second_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  15207. ret += logicExpressionCode(expression.second_operand);
  15208. } else if (expression.second_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  15209. ret += arithmeticExpressionCode(expression.second_operand);
  15210. } else {
  15211. ret += variableValueMenuCode(expression.second_operand);
  15212. }
  15213. ret += ' ) ';
  15214. return ret;
  15215. }
  15216. function attributionsCode(command_obj, indentation) {
  15217. var ret = '\n';
  15218. for (var i = 0; i < indentation; i++) {
  15219. ret += '\t';
  15220. }
  15221. ret += variableValueMenuCode(command_obj.variable) + ' = ';
  15222. for (var i = 0; i < command_obj.expression.length; i++) {
  15223. ret += elementExpressionCode(command_obj.expression[i]);
  15224. }
  15225. return ret;
  15226. }
  15227. function elementExpressionCode(expression_obj) {
  15228. var ret = '';
  15229. for (var i = 0; i < expression_obj.itens.length; i++) {
  15230. if (expression_obj.itens[i].type) {
  15231. ret += variableValueMenuCode(expression_obj.itens[i]);
  15232. } else if (expression_obj.itens[i].type_exp) {
  15233. if (expression_obj.itens[i].type_exp == Models.EXPRESSION_ELEMENTS.par_exp_par) {
  15234. ret += ' ( ';
  15235. }
  15236. ret += elementExpressionCode(expression_obj.itens[i]);
  15237. if (expression_obj.itens[i].type_exp == Models.EXPRESSION_ELEMENTS.par_exp_par) {
  15238. ret += ' ) ';
  15239. }
  15240. } else {
  15241. switch (expression_obj.itens[i]) {
  15242. case Models.ARITHMETIC_TYPES.plus:
  15243. ret += ' + ';
  15244. break;
  15245. case Models.ARITHMETIC_TYPES.minus:
  15246. ret += ' - ';
  15247. break;
  15248. case Models.ARITHMETIC_TYPES.multiplication:
  15249. ret += ' * ';
  15250. break;
  15251. case Models.ARITHMETIC_TYPES.division:
  15252. ret += ' / ';
  15253. break;
  15254. case Models.ARITHMETIC_TYPES.module:
  15255. ret += ' % ';
  15256. break;
  15257. }
  15258. }
  15259. }
  15260. return ret;
  15261. }
  15262. function functioncallsCode(command_obj, indentation) {
  15263. var ret = '\n';
  15264. for (var i = 0; i < indentation; i++) {
  15265. ret += '\t';
  15266. }
  15267. ret += variableValueMenuCode(command_obj.function_called);
  15268. return ret;
  15269. }
  15270. function readersCode(command_obj, indentation) {
  15271. var ret = '\n';
  15272. for (var i = 0; i < indentation; i++) {
  15273. ret += '\t';
  15274. }
  15275. ret += _localizedStringsService.LocalizedStrings.getUI('text_command_read') + ' ( ';
  15276. ret += variableValueMenuCode(command_obj.variable_value_menu);
  15277. ret += ' ) ';
  15278. return ret;
  15279. }
  15280. function variableValueMenuCode(variable_obj) {
  15281. var ret = '';
  15282. if (variable_obj.function_called) {
  15283. if (variable_obj.function_called.name) {
  15284. ret += variable_obj.function_called.name + ' ( ';
  15285. } else {
  15286. ret += _localizedStringsService.LocalizedStrings.getUI(variable_obj.function_called.category) + '.' + _localizedStringsService.LocalizedStrings.getUI(variable_obj.function_called.identifier) + ' ( ';
  15287. }
  15288. if (variable_obj.parameters_list) {
  15289. for (var i = 0; i < variable_obj.parameters_list.length; i++) {
  15290. ret += variableValueMenuCode(variable_obj.parameters_list[i]);
  15291. if (i + 1 < variable_obj.parameters_list.length) {
  15292. ret += ', ';
  15293. }
  15294. }
  15295. }
  15296. ret += ' )';
  15297. } else if (variable_obj.content.type) {
  15298. ret += variable_obj.content.name;
  15299. if (variable_obj.content.dimensions == 1) {
  15300. ret += ' [ ' + variableValueMenuCode(variable_obj.column) + ' ] ';
  15301. }
  15302. if (variable_obj.content.dimensions == 2) {
  15303. ret += ' [ ' + variableValueMenuCode(variable_obj.row) + ' ] ';
  15304. ret += ' [ ' + variableValueMenuCode(variable_obj.column) + ' ] ';
  15305. }
  15306. } else {
  15307. if (isNaN(variable_obj.content)) {
  15308. ret += '"' + variable_obj.content + '"';
  15309. } else {
  15310. ret += variable_obj.content;
  15311. }
  15312. }
  15313. return ret;
  15314. }
  15315. function writersCode(command_obj, indentation) {
  15316. var ret = '\n';
  15317. for (var i = 0; i < indentation; i++) {
  15318. ret += '\t';
  15319. }
  15320. ret += _localizedStringsService.LocalizedStrings.getUI('text_command_write') + ' ( ';
  15321. for (var i = 0; i < command_obj.content.length; i++) {
  15322. ret += variableValueMenuCode(command_obj.content[i]);
  15323. if (i + 1 < command_obj.content.length) {
  15324. ret += ' + ';
  15325. }
  15326. }
  15327. ret += ' ) ';
  15328. return ret;
  15329. }
  15330. function commentsCode(command_obj, indentation) {
  15331. var ret = '\n';
  15332. for (var i = 0; i < indentation; i++) {
  15333. ret += '\t';
  15334. }
  15335. ret += '// ';
  15336. ret += command_obj.comment_text.content;
  15337. return ret;
  15338. }
  15339. function parametersCode(parameter_obj) {
  15340. var ret = '';
  15341. switch (parameter_obj.type) {
  15342. case _types.Types.INTEGER:
  15343. ret += ' ' + _localizedStringsService.LocalizedStrings.getUI('integer') + ' ';
  15344. break;
  15345. case _types.Types.REAL:
  15346. ret += ' ' + _localizedStringsService.LocalizedStrings.getUI('real') + ' ';
  15347. break;
  15348. case _types.Types.TEXT:
  15349. ret += ' ' + _localizedStringsService.LocalizedStrings.getUI('text') + ' ';
  15350. break;
  15351. case _types.Types.BOOLEAN:
  15352. ret += ' ' + _localizedStringsService.LocalizedStrings.getUI('boolean') + ' ';
  15353. break;
  15354. }
  15355. ret += parameter_obj.name + '';
  15356. if (parameter_obj.dimensions == 1) {
  15357. ret += ' []';
  15358. } else if (parameter_obj.dimensions == 2) {
  15359. ret += ' [][]';
  15360. }
  15361. return ret;
  15362. }
  15363. function variablesCode(variable_obj) {
  15364. var ret = '';
  15365. var temp = variable_obj;
  15366. ret += '\n\t\t';
  15367. if (temp.is_constant) {
  15368. ret += 'const ';
  15369. }
  15370. switch (temp.type) {
  15371. case _types.Types.INTEGER:
  15372. ret += _localizedStringsService.LocalizedStrings.getUI('integer') + ' ';
  15373. break;
  15374. case _types.Types.REAL:
  15375. ret += _localizedStringsService.LocalizedStrings.getUI('real') + ' ';
  15376. break;
  15377. case _types.Types.TEXT:
  15378. ret += _localizedStringsService.LocalizedStrings.getUI('text') + ' ';
  15379. break;
  15380. case _types.Types.BOOLEAN:
  15381. ret += _localizedStringsService.LocalizedStrings.getUI('boolean') + ' ';
  15382. break;
  15383. }
  15384. ret += temp.name + ' ';
  15385. if (temp.dimensions == 1) {
  15386. ret += '[' + temp.columns + '] ';
  15387. switch (temp.type) {
  15388. case _types.Types.INTEGER:
  15389. ret += '= {' + temp.value + '}';
  15390. break;
  15391. case _types.Types.REAL:
  15392. ret += '= {' + temp.value.toFixed(2) + '}';
  15393. break;
  15394. case _types.Types.TEXT:
  15395. ret += '= {';
  15396. for (var j = 0; j < temp.value.length; j++) {
  15397. ret += '"' + temp.value[j] + '"';
  15398. if (j + 1 < temp.value.length) {
  15399. ret += ',';
  15400. }
  15401. }
  15402. ret += '}';
  15403. break;
  15404. case _types.Types.BOOLEAN:
  15405. ret += '= {';
  15406. for (var j = 0; j < temp.value.length; j++) {
  15407. if (temp.value[j]) {
  15408. ret += _localizedStringsService.LocalizedStrings.getUI("true");
  15409. } else {
  15410. ret += _localizedStringsService.LocalizedStrings.getUI("false");
  15411. }
  15412. if (j + 1 < temp.value.length) {
  15413. ret += ',';
  15414. }
  15415. }
  15416. ret += '}';
  15417. break;
  15418. }
  15419. } else if (temp.dimensions == 2) {
  15420. ret += '[' + temp.rows + '][' + temp.columns + '] ';
  15421. switch (temp.type) {
  15422. case _types.Types.INTEGER:
  15423. ret += '= {';
  15424. for (var j = 0; j < temp.rows; j++) {
  15425. ret += '{' + temp.value[j] + '}';
  15426. if (j + 1 < temp.rows) {
  15427. ret += ',';
  15428. }
  15429. }
  15430. ret += '}';
  15431. break;
  15432. case _types.Types.REAL:
  15433. ret += '= {';
  15434. for (var j = 0; j < temp.rows; j++) {
  15435. ret += '{' + temp.value[j].toFixed(2) + '}';
  15436. if (j + 1 < temp.rows) {
  15437. ret += ',';
  15438. }
  15439. }
  15440. ret += '}';
  15441. break;
  15442. case _types.Types.TEXT:
  15443. ret += '= {';
  15444. for (var j = 0; j < temp.rows; j++) {
  15445. ret += '{';
  15446. for (var k = 0; k < temp.columns; k++) {
  15447. ret += '"' + temp.value[j][k] + '"';
  15448. if (k + 1 < temp.columns) {
  15449. ret += ',';
  15450. }
  15451. }
  15452. ret += '}';
  15453. if (j + 1 < temp.rows) {
  15454. ret += ',';
  15455. }
  15456. }
  15457. ret += '}';
  15458. break;
  15459. case _types.Types.BOOLEAN:
  15460. ret += '= {';
  15461. for (var j = 0; j < temp.rows; j++) {
  15462. ret += '{';
  15463. for (var k = 0; k < temp.columns; k++) {
  15464. if (temp.value[j][k]) {
  15465. ret += _localizedStringsService.LocalizedStrings.getUI("true");
  15466. } else {
  15467. ret += _localizedStringsService.LocalizedStrings.getUI("false");
  15468. }
  15469. if (k + 1 < temp.columns) {
  15470. ret += ',';
  15471. }
  15472. }
  15473. ret += '}';
  15474. if (j + 1 < temp.rows) {
  15475. ret += ',';
  15476. }
  15477. }
  15478. ret += '}';
  15479. break;
  15480. }
  15481. } else {
  15482. switch (temp.type) {
  15483. case _types.Types.INTEGER:
  15484. ret += '= ' + temp.value;
  15485. break;
  15486. case _types.Types.REAL:
  15487. ret += '= ' + temp.value.toFixed(2);
  15488. break;
  15489. case _types.Types.TEXT:
  15490. ret += '= "' + temp.value + '"';
  15491. break;
  15492. case _types.Types.BOOLEAN:
  15493. ret += '= ';
  15494. if (temp.value) {
  15495. ret += _localizedStringsService.LocalizedStrings.getUI("true");
  15496. } else {
  15497. ret += _localizedStringsService.LocalizedStrings.getUI("false");
  15498. }
  15499. break;
  15500. }
  15501. }
  15502. return ret;
  15503. }
  15504. function globalsCode() {
  15505. var ret = '';
  15506. if (window.program_obj.globals) {
  15507. for (var i = 0; i < window.program_obj.globals.length; i++) {
  15508. var temp = window.program_obj.globals[i];
  15509. ret += '\n\t';
  15510. if (temp.is_constant) {
  15511. ret += 'const ';
  15512. }
  15513. switch (temp.type) {
  15514. case _types.Types.INTEGER:
  15515. ret += _localizedStringsService.LocalizedStrings.getUI('integer');
  15516. break;
  15517. case _types.Types.REAL:
  15518. ret += _localizedStringsService.LocalizedStrings.getUI('real');
  15519. break;
  15520. case _types.Types.TEXT:
  15521. ret += _localizedStringsService.LocalizedStrings.getUI('text');
  15522. break;
  15523. case _types.Types.BOOLEAN:
  15524. ret += _localizedStringsService.LocalizedStrings.getUI('boolean');
  15525. break;
  15526. }
  15527. ret += ' ' + temp.name + ' ';
  15528. if (temp.dimensions == 1) {
  15529. ret += '[' + temp.columns + '] ';
  15530. switch (temp.type) {
  15531. case _types.Types.INTEGER:
  15532. ret += '= {' + temp.value + '}';
  15533. break;
  15534. case _types.Types.REAL:
  15535. ret += '= {';
  15536. for (var j = 0; j < temp.value.length; j++) {
  15537. ret += temp.value[j].toFixed(2);
  15538. if (j + 1 < temp.value.length) {
  15539. ret += ',';
  15540. }
  15541. }
  15542. ret += '}';
  15543. break;
  15544. case _types.Types.TEXT:
  15545. ret += '= {';
  15546. for (var j = 0; j < temp.value.length; j++) {
  15547. ret += '"' + temp.value[j] + '"';
  15548. if (j + 1 < temp.value.length) {
  15549. ret += ',';
  15550. }
  15551. }
  15552. ret += '}';
  15553. break;
  15554. case _types.Types.BOOLEAN:
  15555. ret += '= {';
  15556. for (var j = 0; j < temp.value.length; j++) {
  15557. if (temp.value[j]) {
  15558. ret += _localizedStringsService.LocalizedStrings.getUI("true");
  15559. } else {
  15560. ret += _localizedStringsService.LocalizedStrings.getUI("false");
  15561. }
  15562. if (j + 1 < temp.value.length) {
  15563. ret += ',';
  15564. }
  15565. }
  15566. ret += '}';
  15567. break;
  15568. }
  15569. } else if (temp.dimensions == 2) {
  15570. ret += '[' + temp.rows + '][' + temp.columns + '] ';
  15571. switch (temp.type) {
  15572. case _types.Types.INTEGER:
  15573. ret += '= {';
  15574. for (var j = 0; j < temp.rows; j++) {
  15575. ret += '{' + temp.value[j] + '}';
  15576. if (j + 1 < temp.rows) {
  15577. ret += ',';
  15578. }
  15579. }
  15580. ret += '}';
  15581. break;
  15582. case _types.Types.REAL:
  15583. ret += '= {';
  15584. for (var j = 0; j < temp.rows; j++) {
  15585. ret += '{';
  15586. for (var k = 0; k < temp.columns; k++) {
  15587. ret += temp.value[j][k].toFixed(2);
  15588. if (k + 1 < temp.columns) {
  15589. ret += ',';
  15590. }
  15591. }
  15592. ret += '}';
  15593. if (j + 1 < temp.rows) {
  15594. ret += ',';
  15595. }
  15596. }
  15597. ret += '}';
  15598. break;
  15599. case _types.Types.TEXT:
  15600. ret += '= {';
  15601. for (var j = 0; j < temp.rows; j++) {
  15602. ret += '{';
  15603. for (var k = 0; k < temp.columns; k++) {
  15604. ret += '"' + temp.value[j][k] + '"';
  15605. if (k + 1 < temp.columns) {
  15606. ret += ',';
  15607. }
  15608. }
  15609. ret += '}';
  15610. if (j + 1 < temp.rows) {
  15611. ret += ',';
  15612. }
  15613. }
  15614. ret += '}';
  15615. break;
  15616. case _types.Types.BOOLEAN:
  15617. ret += '= {';
  15618. for (var j = 0; j < temp.rows; j++) {
  15619. ret += '{';
  15620. for (var k = 0; k < temp.columns; k++) {
  15621. if (temp.value[j][k]) {
  15622. ret += _localizedStringsService.LocalizedStrings.getUI("true");
  15623. } else {
  15624. ret += _localizedStringsService.LocalizedStrings.getUI("false");
  15625. }
  15626. if (k + 1 < temp.columns) {
  15627. ret += ',';
  15628. }
  15629. }
  15630. ret += '}';
  15631. if (j + 1 < temp.rows) {
  15632. ret += ',';
  15633. }
  15634. }
  15635. ret += '}';
  15636. break;
  15637. }
  15638. } else {
  15639. switch (temp.type) {
  15640. case _types.Types.INTEGER:
  15641. ret += '= ' + temp.value;
  15642. break;
  15643. case _types.Types.REAL:
  15644. ret += '= ' + temp.value.toFixed(2);
  15645. break;
  15646. case _types.Types.TEXT:
  15647. ret += '= "' + temp.value + '"';
  15648. break;
  15649. case _types.Types.BOOLEAN:
  15650. ret += '= ';
  15651. if (temp.value) {
  15652. ret += _localizedStringsService.LocalizedStrings.getUI("true");;
  15653. } else {
  15654. ret += _localizedStringsService.LocalizedStrings.getUI("false");;
  15655. }
  15656. break;
  15657. }
  15658. }
  15659. }
  15660. }
  15661. return ret;
  15662. }
  15663. /***/ }),
  15664. /***/ "./js/visualUI/commands.js":
  15665. /*!*********************************!*\
  15666. !*** ./js/visualUI/commands.js ***!
  15667. \*********************************/
  15668. /*! no static exports found */
  15669. /***/ (function(module, exports, __webpack_require__) {
  15670. "use strict";
  15671. Object.defineProperty(exports, "__esModule", {
  15672. value: true
  15673. });
  15674. exports.removeCommand = removeCommand;
  15675. exports.createFloatingCommand = createFloatingCommand;
  15676. exports.renderCommand = renderCommand;
  15677. exports.genericCreateCommand = genericCreateCommand;
  15678. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  15679. var _jquery2 = _interopRequireDefault(_jquery);
  15680. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  15681. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  15682. var Models = _interopRequireWildcard(_ivprog_elements);
  15683. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  15684. var _globals = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  15685. var GlobalsManagement = _interopRequireWildcard(_globals);
  15686. var _variables = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  15687. var VariablesManagement = _interopRequireWildcard(_variables);
  15688. var _comment = __webpack_require__(/*! ./commands/comment */ "./js/visualUI/commands/comment.js");
  15689. var CommentsManagement = _interopRequireWildcard(_comment);
  15690. var _reader = __webpack_require__(/*! ./commands/reader */ "./js/visualUI/commands/reader.js");
  15691. var ReadersManagement = _interopRequireWildcard(_reader);
  15692. var _writer = __webpack_require__(/*! ./commands/writer */ "./js/visualUI/commands/writer.js");
  15693. var WritersManagement = _interopRequireWildcard(_writer);
  15694. var _attribution = __webpack_require__(/*! ./commands/attribution */ "./js/visualUI/commands/attribution.js");
  15695. var AttributionsManagement = _interopRequireWildcard(_attribution);
  15696. var _iftrue = __webpack_require__(/*! ./commands/iftrue */ "./js/visualUI/commands/iftrue.js");
  15697. var IftruesManagement = _interopRequireWildcard(_iftrue);
  15698. var _repeatNtimes = __webpack_require__(/*! ./commands/repeatNtimes */ "./js/visualUI/commands/repeatNtimes.js");
  15699. var RepeatNtimesManagement = _interopRequireWildcard(_repeatNtimes);
  15700. var _whiletrue = __webpack_require__(/*! ./commands/whiletrue */ "./js/visualUI/commands/whiletrue.js");
  15701. var WhiletruesManagement = _interopRequireWildcard(_whiletrue);
  15702. var _dowhiletrue = __webpack_require__(/*! ./commands/dowhiletrue */ "./js/visualUI/commands/dowhiletrue.js");
  15703. var DowhiletruesManagement = _interopRequireWildcard(_dowhiletrue);
  15704. var _switch = __webpack_require__(/*! ./commands/switch */ "./js/visualUI/commands/switch.js");
  15705. var SwitchesManagement = _interopRequireWildcard(_switch);
  15706. var _functioncall = __webpack_require__(/*! ./commands/functioncall */ "./js/visualUI/commands/functioncall.js");
  15707. var FunctioncallsManagement = _interopRequireWildcard(_functioncall);
  15708. var _variable_value_menu = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  15709. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  15710. var _break = __webpack_require__(/*! ./commands/break */ "./js/visualUI/commands/break.js");
  15711. var BreaksManagement = _interopRequireWildcard(_break);
  15712. var _return = __webpack_require__(/*! ./commands/return */ "./js/visualUI/commands/return.js");
  15713. var ReturnsManagement = _interopRequireWildcard(_return);
  15714. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  15715. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  15716. var has_element_created_draged = false;
  15717. var which_element_is_draged = null;
  15718. function removeCommand(command, function_obj, dom_obj) {
  15719. if (function_obj.commands.indexOf(command) > -1) {
  15720. function_obj.commands.splice(function_obj.commands.indexOf(command), 1);
  15721. return true;
  15722. }
  15723. // Utilize dois parantNode, pois o primeiro é o div de comandos
  15724. try {
  15725. if (dom_obj.parent().parent().data('command').commands_block.indexOf(command) > -1) {
  15726. dom_obj.parent().parent().data('command').commands_block.splice(dom_obj.parent().parent().data('command').commands_block.indexOf(command), 1);
  15727. return true;
  15728. }
  15729. } catch (err) {}
  15730. try {
  15731. if (dom_obj.parent().parent().data('command').type == Models.COMMAND_TYPES.iftrue) {
  15732. if (dom_obj.parent().parent().data('command').commands_else.indexOf(command) > -1) {
  15733. dom_obj.parent().parent().data('command').commands_else.splice(dom_obj.parent().parent().data('command').commands_else.indexOf(command), 1);
  15734. return true;
  15735. }
  15736. }
  15737. } catch (err) {}
  15738. if (dom_obj.parent().data('switchcase')) {
  15739. console.log("o que encontrei: ");
  15740. console.log(dom_obj.parent().data('switchcase'));
  15741. dom_obj.parent().data('switchcase').commands_block.splice(dom_obj.parent().data('switchcase').commands_block.indexOf(command), 1);
  15742. return true;
  15743. }
  15744. return false;
  15745. }
  15746. function createFloatingCommand(function_obj, function_container, command_type, mouse_event) {
  15747. var floatingObject;
  15748. switch (command_type) {
  15749. case Models.COMMAND_TYPES.break:
  15750. floatingObject = BreaksManagement.createFloatingCommand();
  15751. break;
  15752. case Models.COMMAND_TYPES.comment:
  15753. floatingObject = CommentsManagement.createFloatingCommand();
  15754. break;
  15755. case Models.COMMAND_TYPES.reader:
  15756. floatingObject = ReadersManagement.createFloatingCommand();
  15757. break;
  15758. case Models.COMMAND_TYPES.writer:
  15759. floatingObject = WritersManagement.createFloatingCommand();
  15760. break;
  15761. case Models.COMMAND_TYPES.attribution:
  15762. floatingObject = AttributionsManagement.createFloatingCommand();
  15763. break;
  15764. case Models.COMMAND_TYPES.iftrue:
  15765. floatingObject = IftruesManagement.createFloatingCommand();
  15766. break;
  15767. case Models.COMMAND_TYPES.repeatNtimes:
  15768. floatingObject = RepeatNtimesManagement.createFloatingCommand();
  15769. break;
  15770. case Models.COMMAND_TYPES.whiletrue:
  15771. floatingObject = WhiletruesManagement.createFloatingCommand();
  15772. break;
  15773. case Models.COMMAND_TYPES.dowhiletrue:
  15774. floatingObject = DowhiletruesManagement.createFloatingCommand();
  15775. break;
  15776. case Models.COMMAND_TYPES.switch:
  15777. floatingObject = SwitchesManagement.createFloatingCommand();
  15778. break;
  15779. case Models.COMMAND_TYPES.functioncall:
  15780. floatingObject = FunctioncallsManagement.createFloatingCommand();
  15781. break;
  15782. case Models.COMMAND_TYPES.return:
  15783. floatingObject = ReturnsManagement.createFloatingCommand();
  15784. break;
  15785. }
  15786. floatingObject.draggable().appendTo("body");
  15787. floatingObject.mouseup(function (evt) {
  15788. manageCommand(function_obj, function_container, evt, command_type);
  15789. });
  15790. floatingObject.css("position", "absolute");
  15791. mouse_event.type = "mousedown.draggable";
  15792. mouse_event.target = floatingObject[0];
  15793. floatingObject.css("left", mouse_event.pageX - 15);
  15794. floatingObject.css("top", mouse_event.pageY - 15);
  15795. floatingObject.trigger(mouse_event);
  15796. }
  15797. // before_after_inside: 1 -> before, 2 -> after, 3 -> inside
  15798. function renderCommand(command, element_reference, before_after_inside, function_obj) {
  15799. var createdElement;
  15800. switch (command.type) {
  15801. case Models.COMMAND_TYPES.comment:
  15802. createdElement = CommentsManagement.renderCommand(command, function_obj);
  15803. break;
  15804. case Models.COMMAND_TYPES.break:
  15805. createdElement = BreaksManagement.renderCommand(command, function_obj);
  15806. break;
  15807. case Models.COMMAND_TYPES.reader:
  15808. createdElement = ReadersManagement.renderCommand(command, function_obj);
  15809. break;
  15810. case Models.COMMAND_TYPES.writer:
  15811. createdElement = WritersManagement.renderCommand(command, function_obj);
  15812. break;
  15813. case Models.COMMAND_TYPES.attribution:
  15814. createdElement = AttributionsManagement.renderCommand(command, function_obj);
  15815. break;
  15816. case Models.COMMAND_TYPES.functioncall:
  15817. createdElement = FunctioncallsManagement.renderCommand(command, function_obj);
  15818. break;
  15819. case Models.COMMAND_TYPES.iftrue:
  15820. createdElement = IftruesManagement.renderCommand(command, function_obj);
  15821. break;
  15822. case Models.COMMAND_TYPES.repeatNtimes:
  15823. createdElement = RepeatNtimesManagement.renderCommand(command, function_obj);
  15824. break;
  15825. case Models.COMMAND_TYPES.whiletrue:
  15826. createdElement = WhiletruesManagement.renderCommand(command, function_obj);
  15827. break;
  15828. case Models.COMMAND_TYPES.dowhiletrue:
  15829. createdElement = DowhiletruesManagement.renderCommand(command, function_obj);
  15830. break;
  15831. case Models.COMMAND_TYPES.switch:
  15832. createdElement = SwitchesManagement.renderCommand(command, function_obj);
  15833. break;
  15834. case Models.COMMAND_TYPES.return:
  15835. createdElement = ReturnsManagement.renderCommand(command, function_obj);
  15836. break;
  15837. }
  15838. switch (before_after_inside) {
  15839. case 1:
  15840. createdElement.insertBefore(element_reference);
  15841. break;
  15842. case 2:
  15843. createdElement.insertAfter(element_reference);
  15844. break;
  15845. case 3:
  15846. element_reference.append(createdElement);
  15847. break;
  15848. }
  15849. }
  15850. function genericCreateCommand(command_type) {
  15851. switch (command_type) {
  15852. case Models.COMMAND_TYPES.break:
  15853. return new Models.Break();
  15854. case Models.COMMAND_TYPES.comment:
  15855. return new Models.Comment(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_value, _localizedStringsService.LocalizedStrings.getUI('text_comment'), null, null, false));
  15856. case Models.COMMAND_TYPES.reader:
  15857. return new Models.Reader(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_variable, null, null, null, false));
  15858. case Models.COMMAND_TYPES.writer:
  15859. return new Models.Writer([new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
  15860. case Models.COMMAND_TYPES.attribution:
  15861. return new Models.Attribution(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_variable, null, null, null, false), []);
  15862. case Models.COMMAND_TYPES.functioncall:
  15863. return new Models.FunctionCall(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_function, null, null, null, false), null);
  15864. case Models.COMMAND_TYPES.iftrue:
  15865. return new Models.IfTrue(new Models.ConditionalExpression(null), null, null);
  15866. case Models.COMMAND_TYPES.repeatNtimes:
  15867. return new Models.RepeatNTimes(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_variable, null, null, null, false), new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_variable, null, null, null, false), null, new Models.ConditionalExpression(null), null, null);
  15868. case Models.COMMAND_TYPES.whiletrue:
  15869. return new Models.WhileTrue(new Models.ConditionalExpression(null), null);
  15870. case Models.COMMAND_TYPES.dowhiletrue:
  15871. return new Models.DoWhileTrue(new Models.ConditionalExpression(null), null);
  15872. case Models.COMMAND_TYPES.switch:
  15873. var sc = [new Models.SwitchCase(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true))];
  15874. return new Models.Switch(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.variable_and_function, null, null, null, true), sc);
  15875. case Models.COMMAND_TYPES.return:
  15876. return new Models.Return(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  15877. }
  15878. }
  15879. function manageCommand(function_obj, function_container, event, command_type) {
  15880. (0, _jquery2.default)(".created_element").each(function (index) {
  15881. (0, _jquery2.default)(this).remove();
  15882. });
  15883. var el = (0, _jquery2.default)(document.elementFromPoint(event.clientX, event.clientY));
  15884. console.log('soltou no: ');
  15885. console.log(el);
  15886. console.log(el.data('fun'));
  15887. // Primeiro verificar se ele soltou no espaço da função correta:
  15888. var hier = el.parentsUntil(".all_functions");
  15889. var esta_correto = false;
  15890. var esta_na_div_correta = false;
  15891. if (el.hasClass("commands_list_div")) {
  15892. esta_na_div_correta = true;
  15893. }
  15894. for (var i = 0; i < hier.length; i++) {
  15895. var temp = (0, _jquery2.default)(hier[i]);
  15896. if (temp.hasClass("commands_list_div")) {
  15897. esta_na_div_correta = true;
  15898. }
  15899. if (temp.data('fun') == function_obj) {
  15900. esta_correto = true;
  15901. break;
  15902. }
  15903. }
  15904. if (!esta_correto) {
  15905. has_element_created_draged = false;
  15906. which_element_is_draged = null;
  15907. return;
  15908. } else {
  15909. if (!esta_na_div_correta) {
  15910. has_element_created_draged = false;
  15911. which_element_is_draged = null;
  15912. return;
  15913. }
  15914. }
  15915. // Agora é descobrir qual o escopo para adicionar o comando:
  15916. // Se o elemento clicado possuir o atributo "fun", então, é direto na div dos comandos:
  15917. if (typeof el.data('fun') !== 'undefined') {
  15918. // Se a lista de comandos estiver vazia, então é o primeiro.
  15919. // Portanto, ele deve soltar o elemento obrigatoriamente no objeto vazio
  15920. if (el.data('fun').commands == null || el.data('fun').commands.length == 0) {
  15921. // pode adicionar
  15922. el.data('fun').commands = [];
  15923. var new_cmd = genericCreateCommand(command_type);
  15924. el.data('fun').commands.push(new_cmd);
  15925. renderCommand(new_cmd, (0, _jquery2.default)(function_container).find('.commands_list_div'), 3, function_obj);
  15926. } else {
  15927. // Entra nesse else, caso já existam outros comandos no bloco:
  15928. findNearbyCommandToAddInFunctionScope(el, event, (0, _jquery2.default)(function_container).find('.commands_list_div'), function_obj, command_type);
  15929. }
  15930. } else {
  15931. console.log("soltou em um comando");
  15932. // descobrir em qual comando ele soltou:
  15933. var hier_find = el.parentsUntil(".commands_list_div");
  15934. var hierarquia_bottom_up = [];
  15935. if (typeof el.data('command') !== 'undefined') {
  15936. hierarquia_bottom_up.push(el.data('command'));
  15937. }
  15938. for (var i = 0; i < hier_find.length; i++) {
  15939. if (typeof (0, _jquery2.default)(hier_find[i]).data('command') !== 'undefined') {
  15940. hierarquia_bottom_up.push((0, _jquery2.default)(hier_find[i]).data('command'));
  15941. }
  15942. }
  15943. console.log("comando em que soltou: ");
  15944. console.log(hierarquia_bottom_up[0]);
  15945. console.log("hierarquia de baixo para cima na árvore, de onde ele soltou: ");
  15946. for (var i = 0; i < hierarquia_bottom_up.length; i++) {
  15947. console.log(hierarquia_bottom_up[i]);
  15948. }
  15949. // Se for do tipo break, verificar se está no contexto correto:
  15950. // Caso não esteja no contexto, apenas retorna sem dar continuidade:
  15951. var is_correct_context = false;
  15952. if (command_type == Models.COMMAND_TYPES.break) {
  15953. for (var i = 0; i < hierarquia_bottom_up.length; i++) {
  15954. if (hierarquia_bottom_up[i].type == Models.COMMAND_TYPES.repeatNtimes || hierarquia_bottom_up[i].type == Models.COMMAND_TYPES.whiletrue || hierarquia_bottom_up[i].type == Models.COMMAND_TYPES.dowhiletrue || hierarquia_bottom_up[i].type == Models.COMMAND_TYPES.switch) {
  15955. is_correct_context = true;
  15956. break;
  15957. }
  15958. }
  15959. if (!is_correct_context) {
  15960. console.error("Context not allowed to insert BREAK COMMAND!");
  15961. return;
  15962. }
  15963. }
  15964. // se a hierarquia possuir apenas um elemento, então está na raiz dos comandos:
  15965. if (hierarquia_bottom_up.length == 1) {
  15966. console.log('QQ1');
  15967. var sub_elemento = false;
  15968. for (var i = 0; i < hier_find.length; i++) {
  15969. if (typeof (0, _jquery2.default)(hier_find[i]).data('command') !== 'undefined') {
  15970. console.log('QQ2');
  15971. findBeforeOrAfterCommandToAdd(hier_find[i], event, function_obj, command_type);
  15972. sub_elemento = true;
  15973. break;
  15974. }
  15975. }
  15976. if (!sub_elemento) {
  15977. console.log('QQ3');
  15978. findBeforeOrAfterCommandToAdd(el[0], event, function_obj, command_type);
  15979. }
  15980. } else {
  15981. console.log('QQ4');
  15982. // caso exista mais de um elemento na hierarquia:
  15983. if (typeof (0, _jquery2.default)(el).data('command') !== 'undefined') {
  15984. console.log('QQ5');
  15985. console.log("PPP1");
  15986. insertCommandInBlockHierar(el[0], event, function_obj, command_type, hier_find, hierarquia_bottom_up);
  15987. } else {
  15988. console.log('QQ6');
  15989. var sub_elemento = false;
  15990. for (var i = 0; i < hier_find.length; i++) {
  15991. if (typeof (0, _jquery2.default)(hier_find[i]).data('command') !== 'undefined') {
  15992. console.log('QQ7');
  15993. insertCommandInBlockHierar(hier_find[i], event, function_obj, command_type, hier_find, hierarquia_bottom_up);
  15994. sub_elemento = true;
  15995. break;
  15996. }
  15997. }
  15998. }
  15999. }
  16000. }
  16001. has_element_created_draged = false;
  16002. which_element_is_draged = null;
  16003. }
  16004. function insertCommandInBlockHierar(el, event, function_obj, command_type, hier_dom, hier_obj) {
  16005. var el_jq = (0, _jquery2.default)(el);
  16006. var command_parent = el_jq.data('command');
  16007. if (el_jq.data('command').type == Models.COMMAND_TYPES.repeatNtimes || el_jq.data('command').type == Models.COMMAND_TYPES.whiletrue || el_jq.data('command').type == Models.COMMAND_TYPES.dowhiletrue || el_jq.data('command').type == Models.COMMAND_TYPES.switch) {
  16008. console.log('QQ17');
  16009. if (el_jq.data('command').type == Models.COMMAND_TYPES.repeatNtimes || el_jq.data('command').type == Models.COMMAND_TYPES.whiletrue || el_jq.data('command').type == Models.COMMAND_TYPES.dowhiletrue) {
  16010. console.log('QQ18');
  16011. // Se não tiver outro comando ainda no bloco, só adiciona:
  16012. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  16013. command_parent.commands_block = [];
  16014. var recentComand = genericCreateCommand(command_type);
  16015. command_parent.commands_block.push(recentComand);
  16016. renderCommand(recentComand, el_jq.find('.block_commands'), 3, function_obj);
  16017. } else {
  16018. // Se já tem algum comando no bloco:
  16019. findNearbyCommandToAddInBlockScope(el, event, el, function_obj, command_type, command_parent);
  16020. }
  16021. } else {
  16022. // QUANDO FOR BLOCO DO TIPO IF OU SWITCH/CASE:
  16023. addCommandToSwitchCase(event, function_obj, command_type);
  16024. }
  16025. } else {
  16026. console.log('QQ19');
  16027. // entra neste bloco, se soltou o comando sobre outro comando dentro de um subbloco:
  16028. findBeforeOrAfterCommandToAddInsertBlock(el, event, function_obj, command_type);
  16029. }
  16030. }
  16031. function findNearbyCommandToAddInBlockScope(el, event, node_list_commands, function_obj, command_type, command_parent) {
  16032. var all_sub = (0, _jquery2.default)(node_list_commands).find('div.command_container');
  16033. var menor_distancia = 999999999;
  16034. var elemento_menor_distancia = null;
  16035. var antes = true;
  16036. var t_bot;
  16037. var t_top;
  16038. // Descobrindo o elemento mais próximo:
  16039. for (var i = 0; i < all_sub.length; i++) {
  16040. t_top = all_sub[i].getBoundingClientRect().top;
  16041. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  16042. if (t_top - event.clientY < menor_distancia) {
  16043. menor_distancia = event.clientY - t_top;
  16044. elemento_menor_distancia = all_sub[i];
  16045. }
  16046. }
  16047. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height;
  16048. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  16049. if (borda_inferior - event.clientY < menor_distancia) {
  16050. var recentComand = genericCreateCommand(command_type);
  16051. command_parent.commands_block.push(recentComand);
  16052. //
  16053. renderCommand(recentComand, node_list_commands, 3, function_obj);
  16054. } else {
  16055. var recentComand = genericCreateCommand(command_type);
  16056. var index = command_parent.commands_block.indexOf((0, _jquery2.default)(elemento_menor_distancia).data('command'));
  16057. if (index > -1) {
  16058. command_parent.commands_block.splice(index, 0, recentComand);
  16059. }
  16060. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  16061. }
  16062. }
  16063. function findBeforeOrAfterCommandToAddInsertBlock(el, event, function_obj, command_type) {
  16064. var el_jq = (0, _jquery2.default)(el);
  16065. var command_parent = (0, _jquery2.default)(el.parentNode.parentNode).data('command');
  16066. var command_target = el_jq.data('command');
  16067. var temp_parent = (0, _jquery2.default)(el.parentNode.parentNode);
  16068. var is_in_else = false;
  16069. if (!command_parent) {
  16070. command_parent = el_jq.data('command');
  16071. temp_parent = el_jq;
  16072. var hier = el_jq.parentsUntil(".command_container");
  16073. for (var i = 0; i < hier.length; i++) {
  16074. var temp = (0, _jquery2.default)(hier[i]);
  16075. if (typeof temp.data('else') != 'undefined') {
  16076. is_in_else = true;
  16077. }
  16078. if (typeof temp.data('command') != 'undefined') {
  16079. command_parent = temp.data('command');
  16080. temp_parent = temp;
  16081. }
  16082. }
  16083. }
  16084. var hier = el_jq.parentsUntil(".command_container");
  16085. for (var i = 0; i < hier.length; i++) {
  16086. var temp = (0, _jquery2.default)(hier[i]);
  16087. if (typeof temp.data('else') != 'undefined') {
  16088. is_in_else = true;
  16089. }
  16090. }
  16091. if (command_parent == command_target) {
  16092. var hier = el_jq.parentsUntil(".command_container");
  16093. for (var i = 0; i < hier.length; i++) {
  16094. var temp = (0, _jquery2.default)(hier[i]);
  16095. if (typeof temp.data('else') !== 'undefined') {
  16096. is_in_else = true;
  16097. break;
  16098. }
  16099. }
  16100. }
  16101. if (command_parent.type != Models.COMMAND_TYPES.iftrue && command_parent.type != Models.COMMAND_TYPES.switch) {
  16102. var hier = temp_parent.parentsUntil(".all_cases_div");
  16103. console.log("vou procurar!!");
  16104. for (var i = 0; i < hier.length; i++) {
  16105. console.log("estou vasculhando...");
  16106. var temp = (0, _jquery2.default)(hier[i]);
  16107. if (typeof temp.data('switchcase') !== 'undefined') {
  16108. console.log("encontrei");
  16109. command_parent = temp.data('switchcase');
  16110. is_in_else = false;
  16111. break;
  16112. }
  16113. }
  16114. }
  16115. console.log('debugging:');
  16116. console.log('el_jq');
  16117. console.log(el_jq);
  16118. console.log('command_parent');
  16119. console.log(command_parent);
  16120. console.log('command_target');
  16121. console.log(command_target);
  16122. var menor_distancia = 999999999;
  16123. var antes = true;
  16124. var t_bot;
  16125. var t_top;
  16126. t_top = el.getBoundingClientRect().top;
  16127. t_bot = el.getBoundingClientRect().top + el.getBoundingClientRect().height;
  16128. var d_top = event.clientY - t_top; // distancia topo
  16129. var d_bot = t_bot - event.clientY; // distancia baixo
  16130. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  16131. if (d_top < d_bot) {
  16132. var recentComand = genericCreateCommand(command_type);
  16133. console.log('MMM1');
  16134. if (is_in_else) {
  16135. console.log('MMM2');
  16136. if (command_parent == command_target) {
  16137. console.log('MMM3');
  16138. if (command_parent.commands_else == null || command_parent.commands_else.length == 0) {
  16139. command_parent.commands_else = [];
  16140. var recentComand = genericCreateCommand(command_type);
  16141. command_parent.commands_else.push(recentComand);
  16142. renderCommand(recentComand, el_jq, 3, function_obj);
  16143. } else {
  16144. // Se já tem algum comando no bloco:
  16145. findInBlockCorrectPlace(el_jq, event, function_obj, command_type, true);
  16146. }
  16147. return;
  16148. }
  16149. console.log('MMM7');
  16150. var index = command_parent.commands_else.indexOf(command_target);
  16151. if (index > -1) {
  16152. command_parent.commands_else.splice(index, 0, recentComand);
  16153. }
  16154. renderCommand(recentComand, el, 1, function_obj);
  16155. } else {
  16156. console.log('MMM4');
  16157. if (command_parent == command_target) {
  16158. console.log('Nxxxx5');
  16159. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  16160. command_parent.commands_block = [];
  16161. console.log('SSS4');
  16162. var recentComand = genericCreateCommand(command_type);
  16163. command_parent.commands_block.push(recentComand);
  16164. renderCommand(recentComand, el_jq, 3, function_obj);
  16165. } else {
  16166. console.log('SSS5');
  16167. findInBlockCorrectPlace(el_jq, event, function_obj, command_type);
  16168. }
  16169. return;
  16170. }
  16171. console.log('MMM6');
  16172. var index = command_parent.commands_block.indexOf(command_target);
  16173. if (index > -1) {
  16174. command_parent.commands_block.splice(index, 0, recentComand);
  16175. }
  16176. renderCommand(recentComand, el, 1, function_obj);
  16177. }
  16178. } else {
  16179. console.log('XXX1');
  16180. var recentComand = genericCreateCommand(command_type);
  16181. if (is_in_else) {
  16182. if (command_parent == command_target) {
  16183. console.log('MMM3');
  16184. if (command_parent.commands_else == null || command_parent.commands_else.length == 0) {
  16185. command_parent.commands_else = [];
  16186. console.log('SSS1');
  16187. var recentComand = genericCreateCommand(command_type);
  16188. command_parent.commands_else.push(recentComand);
  16189. renderCommand(recentComand, el_jq, 3, function_obj);
  16190. } else {
  16191. // Se já tem algum comando no bloco:
  16192. console.log('SSS2');
  16193. findInBlockCorrectPlace(el_jq, event, function_obj, command_type, true);
  16194. }
  16195. return;
  16196. }
  16197. console.log('XXX2');
  16198. var index = command_parent.commands_else.indexOf(command_target);
  16199. if (index > -1) {
  16200. command_parent.commands_else.splice(index + 1, 0, recentComand);
  16201. }
  16202. renderCommand(recentComand, el, 2, function_obj);
  16203. } else {
  16204. if (command_parent == command_target) {
  16205. console.log('Nxxxx78');
  16206. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  16207. command_parent.commands_block = [];
  16208. var recentComand = genericCreateCommand(command_type);
  16209. command_parent.commands_block.push(recentComand);
  16210. console.log('SSS6');
  16211. renderCommand(recentComand, el_jq, 3, function_obj);
  16212. } else {
  16213. console.log('SSS7');
  16214. findInBlockCorrectPlace(el_jq, event, function_obj, command_type);
  16215. }
  16216. return;
  16217. }
  16218. console.log('XXX3');
  16219. var index = command_parent.commands_block.indexOf(command_target);
  16220. if (index > -1) {
  16221. command_parent.commands_block.splice(index + 1, 0, recentComand);
  16222. }
  16223. renderCommand(recentComand, el, 2, function_obj);
  16224. }
  16225. }
  16226. }
  16227. function insertCommandInBlock(el, event, function_obj, command_type) {
  16228. var el_jq = (0, _jquery2.default)(el);
  16229. var command_parent = el_jq.data('command');
  16230. if (el_jq.data('command').type == Models.COMMAND_TYPES.repeatNtimes || el_jq.data('command').type == Models.COMMAND_TYPES.whiletrue || el_jq.data('command').type == Models.COMMAND_TYPES.dowhiletrue) {
  16231. // Se não tiver outro comando ainda no bloco, só adiciona:
  16232. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  16233. command_parent.commands_block = [];
  16234. var recentComand = genericCreateCommand(command_type);
  16235. command_parent.commands_block.push(recentComand);
  16236. renderCommand(recentComand, el_jq.find('.block_commands'), 3, function_obj);
  16237. } else {
  16238. // Se já tem algum comando no bloco:
  16239. findInBlockCorrectPlace(el, event, function_obj, command_type);
  16240. }
  16241. } else if (el_jq.data('command').type == Models.COMMAND_TYPES.iftrue) {
  16242. console.log('QQ9');
  16243. // no if ou no else?
  16244. var correct_div = (0, _jquery2.default)(document.elementFromPoint(event.pageX, event.pageY));
  16245. var is_in_if = true;
  16246. if (correct_div.data('if')) {
  16247. is_in_if = true;
  16248. } else if (correct_div.data('else')) {
  16249. is_in_if = false;
  16250. } else {
  16251. var hier = correct_div.parentsUntil(".command_container");
  16252. for (var i = 0; i < hier.length; i++) {
  16253. var temp = (0, _jquery2.default)(hier[i]);
  16254. if (typeof temp.data('if') !== 'undefined') {
  16255. is_in_if = true;
  16256. break;
  16257. }
  16258. if (typeof temp.data('else') !== 'undefined') {
  16259. is_in_if = false;
  16260. break;
  16261. }
  16262. }
  16263. }
  16264. if (is_in_if) {
  16265. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  16266. command_parent.commands_block = [];
  16267. var recentComand = genericCreateCommand(command_type);
  16268. command_parent.commands_block.push(recentComand);
  16269. renderCommand(recentComand, el_jq.find('.commands_if'), 3, function_obj);
  16270. } else {
  16271. // Se já tem algum comando no bloco:
  16272. findInBlockCorrectPlace(el_jq.find('.commands_if'), event, function_obj, command_type);
  16273. }
  16274. } else {
  16275. if (command_parent.commands_else == null || command_parent.commands_else.length == 0) {
  16276. command_parent.commands_else = [];
  16277. var recentComand = genericCreateCommand(command_type);
  16278. command_parent.commands_else.push(recentComand);
  16279. renderCommand(recentComand, el_jq.find('.commands_else'), 3, function_obj);
  16280. } else {
  16281. // Se já tem algum comando no bloco:
  16282. findInBlockCorrectPlace(el_jq.find('.commands_else'), event, function_obj, command_type, true);
  16283. }
  16284. }
  16285. } else {
  16286. // é do tipo switch
  16287. console.log("está tentando inserir em um switch que está na raiz!");
  16288. addCommandToSwitchCase(event, function_obj, command_type);
  16289. }
  16290. }
  16291. function addCommandToSwitchCase(event, function_obj, command_type) {
  16292. var el = (0, _jquery2.default)(document.elementFromPoint(event.clientX, event.clientY));
  16293. var which_case = el.data('switchcase');
  16294. var case_div = el;
  16295. if (!which_case) {
  16296. var hier_find = el.parentsUntil(".all_cases_div");
  16297. for (var i = 0; i < hier_find.length; i++) {
  16298. if (typeof (0, _jquery2.default)(hier_find[i]).data('switchcase') !== 'undefined') {
  16299. which_case = (0, _jquery2.default)(hier_find[i]).data('switchcase');
  16300. case_div = (0, _jquery2.default)(hier_find[i]);
  16301. break;
  16302. }
  16303. }
  16304. }
  16305. if (which_case.commands_block == null || which_case.commands_block.length < 1) {
  16306. which_case.commands_block = [];
  16307. var recentComand = genericCreateCommand(command_type);
  16308. which_case.commands_block.push(recentComand);
  16309. renderCommand(recentComand, case_div.find('.case_commands_block'), 3, function_obj);
  16310. } else {
  16311. findInBlockCorrectPlaceInSwitchCase(which_case, case_div, event, function_obj, command_type);
  16312. }
  16313. }
  16314. function findInBlockCorrectPlaceInSwitchCase(which_case, case_div, event, function_obj, command_type) {
  16315. var all_sub = case_div.find('div.command_container');
  16316. var menor_distancia = 999999999;
  16317. var elemento_menor_distancia = null;
  16318. var antes = true;
  16319. var t_bot;
  16320. var t_top;
  16321. // Descobrindo o elemento mais próximo:
  16322. for (var i = 0; i < all_sub.length; i++) {
  16323. t_top = all_sub[i].getBoundingClientRect().top;
  16324. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  16325. if (t_top - event.clientY < menor_distancia) {
  16326. menor_distancia = event.clientY - t_top;
  16327. elemento_menor_distancia = all_sub[i];
  16328. }
  16329. }
  16330. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height;
  16331. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  16332. if (borda_inferior - event.clientY < menor_distancia) {
  16333. var recentComand = genericCreateCommand(command_type);
  16334. which_case.commands_block.push(recentComand);
  16335. renderCommand(recentComand, (0, _jquery2.default)(case_div.find('.case_commands_block')[0]), 3, function_obj);
  16336. } else {
  16337. var recentComand = genericCreateCommand(command_type);
  16338. var index = which_case.commands_block.indexOf((0, _jquery2.default)(elemento_menor_distancia).data('command'));
  16339. if (index > -1) {
  16340. which_case.commands_block.splice(index, 0, recentComand);
  16341. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  16342. }
  16343. }
  16344. }
  16345. function findInBlockCorrectPlace(el, event, function_obj, command_type) {
  16346. var is_in_else = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  16347. var el_jq = (0, _jquery2.default)(el);
  16348. var all_sub = el_jq.find('div.command_container');
  16349. var menor_distancia = 999999999;
  16350. var elemento_menor_distancia = null;
  16351. var antes = true;
  16352. var t_bot;
  16353. var t_top;
  16354. // Descobrindo o elemento mais próximo:
  16355. for (var i = 0; i < all_sub.length; i++) {
  16356. t_top = all_sub[i].getBoundingClientRect().top;
  16357. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  16358. if (t_top - event.clientY < menor_distancia) {
  16359. menor_distancia = event.clientY - t_top;
  16360. elemento_menor_distancia = all_sub[i];
  16361. }
  16362. }
  16363. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height;
  16364. console.log("menor_distancia: ");
  16365. console.log(elemento_menor_distancia);
  16366. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  16367. if (borda_inferior - event.clientY < menor_distancia) {
  16368. console.log('QQ11');
  16369. var recentComand = genericCreateCommand(command_type);
  16370. var command_parent = el_jq.data('command');
  16371. if (is_in_else) {
  16372. console.log('QQ15');
  16373. command_parent.commands_else.push(recentComand);
  16374. console.log('el_jq');
  16375. console.log(el_jq);
  16376. console.log("$(el_jq.find('.commands_else')[0]):: ");
  16377. console.log((0, _jquery2.default)(el_jq.find('.commands_else')[0]));
  16378. renderCommand(recentComand, el_jq, 3, function_obj);
  16379. } else {
  16380. console.log('QQ16');
  16381. command_parent.commands_block.push(recentComand);
  16382. renderCommand(recentComand, (0, _jquery2.default)(el_jq.find('.block_commands')[0]), 3, function_obj);
  16383. }
  16384. } else {
  16385. console.log('QQ12');
  16386. var recentComand = genericCreateCommand(command_type);
  16387. var command_parent = el_jq.data('command');
  16388. if (is_in_else) {
  16389. var index = command_parent.commands_else.indexOf((0, _jquery2.default)(elemento_menor_distancia).data('command'));
  16390. if (index > -1) {
  16391. command_parent.commands_else.splice(index, 0, recentComand);
  16392. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  16393. }
  16394. } else {
  16395. var index = command_parent.commands_block.indexOf((0, _jquery2.default)(elemento_menor_distancia).data('command'));
  16396. if (index > -1) {
  16397. command_parent.commands_block.splice(index, 0, recentComand);
  16398. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  16399. }
  16400. }
  16401. }
  16402. }
  16403. function findBeforeOrAfterCommandToAdd(el, event, function_obj, command_type) {
  16404. switch ((0, _jquery2.default)(el).data('command').type) {
  16405. case Models.COMMAND_TYPES.iftrue:
  16406. case Models.COMMAND_TYPES.switch:
  16407. case Models.COMMAND_TYPES.repeatNtimes:
  16408. case Models.COMMAND_TYPES.whiletrue:
  16409. case Models.COMMAND_TYPES.dowhiletrue:
  16410. insertCommandInBlock(el, event, function_obj, command_type);
  16411. return;
  16412. }
  16413. var menor_distancia = 999999999;
  16414. var antes = true;
  16415. var t_bot;
  16416. var t_top;
  16417. t_top = el.getBoundingClientRect().top;
  16418. t_bot = el.getBoundingClientRect().top + el.getBoundingClientRect().height;
  16419. var d_top = event.clientY - t_top; // distancia topo
  16420. var d_bot = t_bot - event.clientY; // distancia baixo
  16421. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  16422. if (d_top < d_bot) {
  16423. var recentComand = genericCreateCommand(command_type);
  16424. var index = function_obj.commands.indexOf((0, _jquery2.default)(el).data('command'));
  16425. if (index > -1) {
  16426. function_obj.commands.splice(index, 0, recentComand);
  16427. }
  16428. renderCommand(recentComand, el, 1, function_obj);
  16429. } else {
  16430. var recentComand = genericCreateCommand(command_type);
  16431. var index = function_obj.commands.indexOf((0, _jquery2.default)(el).data('command'));
  16432. if (index > -1) {
  16433. function_obj.commands.splice(index + 1, 0, recentComand);
  16434. }
  16435. renderCommand(recentComand, el, 2, function_obj);
  16436. }
  16437. }
  16438. function findNearbyCommandToAddInFunctionScope(el, event, node_list_commands, function_obj, command_type) {
  16439. var all_sub = (0, _jquery2.default)(node_list_commands).find('div.command_container');
  16440. var menor_distancia = 999999999;
  16441. var elemento_menor_distancia = null;
  16442. var antes = true;
  16443. var t_bot;
  16444. var t_top;
  16445. // Descobrindo o elemento mais próximo:
  16446. for (var i = 0; i < all_sub.length; i++) {
  16447. t_top = all_sub[i].getBoundingClientRect().top;
  16448. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  16449. if (t_top - event.clientY < menor_distancia) {
  16450. menor_distancia = event.clientY - t_top;
  16451. elemento_menor_distancia = all_sub[i];
  16452. }
  16453. }
  16454. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height;
  16455. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  16456. if (borda_inferior - event.clientY < menor_distancia) {
  16457. var recentComand = genericCreateCommand(command_type);
  16458. function_obj.commands.push(recentComand);
  16459. //
  16460. renderCommand(recentComand, node_list_commands, 3, function_obj);
  16461. } else {
  16462. var recentComand = genericCreateCommand(command_type);
  16463. var index = function_obj.commands.indexOf((0, _jquery2.default)(elemento_menor_distancia).data('command'));
  16464. if (index > -1) {
  16465. function_obj.commands.splice(index, 0, recentComand);
  16466. }
  16467. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  16468. }
  16469. }
  16470. /***/ }),
  16471. /***/ "./js/visualUI/commands/attribution.js":
  16472. /*!*********************************************!*\
  16473. !*** ./js/visualUI/commands/attribution.js ***!
  16474. \*********************************************/
  16475. /*! no static exports found */
  16476. /***/ (function(module, exports, __webpack_require__) {
  16477. "use strict";
  16478. Object.defineProperty(exports, "__esModule", {
  16479. value: true
  16480. });
  16481. exports.createFloatingCommand = createFloatingCommand;
  16482. exports.renderCommand = renderCommand;
  16483. exports.manageExpressionElements = manageExpressionElements;
  16484. exports.renderMenuOperations = renderMenuOperations;
  16485. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  16486. var _jquery2 = _interopRequireDefault(_jquery);
  16487. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  16488. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  16489. var Models = _interopRequireWildcard(_ivprog_elements);
  16490. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  16491. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  16492. var GlobalsManagement = _interopRequireWildcard(_globals);
  16493. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  16494. var VariablesManagement = _interopRequireWildcard(_variables);
  16495. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  16496. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  16497. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  16498. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  16499. var CommandsManagement = _interopRequireWildcard(_commands);
  16500. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  16501. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  16502. function createFloatingCommand() {
  16503. return (0, _jquery2.default)('<div class="ui attribution created_element"> <i class="ui icon small arrow left"></i> <span> x = 1 + 1 </span></div>');
  16504. }
  16505. function renderCommand(command, function_obj) {
  16506. var el = (0, _jquery2.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">' + _localizedStringsService.LocalizedStrings.getUI('text_receives') + '</span> ' + '<div class="expression_elements"></div> </div>');
  16507. el.data('command', command);
  16508. VariableValueMenu.renderMenu(command, command.variable, el.find('.var_attributed'), function_obj);
  16509. if (!command.expression || command.expression.length < 1) {
  16510. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.op_exp, [Models.ARITHMETIC_TYPES.none, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
  16511. command.expression.push(exp);
  16512. }
  16513. addHandlers(command, function_obj, el);
  16514. renderExpressionElements(command, function_obj, el);
  16515. return el;
  16516. }
  16517. function manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, selectedItem, expression_element) {
  16518. var index_to_move = expression_element.itens.indexOf(ref_object);
  16519. switch (selectedItem.data('exp')) {
  16520. case Models.EXPRESSION_ELEMENTS.exp_op_exp:
  16521. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.exp_op_exp, [expression_element.itens[index_to_move], Models.ARITHMETIC_TYPES.plus, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
  16522. expression_element.itens[index_to_move] = exp;
  16523. break;
  16524. case Models.EXPRESSION_ELEMENTS.op_exp:
  16525. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.op_exp, [Models.ARITHMETIC_TYPES.plus, expression_element.itens[index_to_move]]);
  16526. expression_element.itens[index_to_move] = exp;
  16527. break;
  16528. case Models.EXPRESSION_ELEMENTS.par_exp_par:
  16529. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.par_exp_par, [expression_element.itens[index_to_move]]);
  16530. expression_element.itens[index_to_move] = exp;
  16531. break;
  16532. }
  16533. renderExpressionElements(command, function_obj, dom_object);
  16534. }
  16535. function renderExpressionElements(command, function_obj, el) {
  16536. var expression_div = el.find('.expression_elements');
  16537. var command_container;
  16538. if (el.hasClass("command_container") == false) {
  16539. var hier = el.parentsUntil(".command_container");
  16540. for (var i = 0; i < hier.length; i++) {
  16541. if ((0, _jquery2.default)(hier[i]).hasClass("command_container")) {
  16542. command_container = (0, _jquery2.default)(hier[i]);
  16543. break;
  16544. }
  16545. if ((0, _jquery2.default)(hier[i]).hasClass("expression_elements")) {
  16546. expression_div = (0, _jquery2.default)(hier[i]);
  16547. break;
  16548. }
  16549. }
  16550. }
  16551. if (command_container) {
  16552. expression_div = command_container.find('.expression_elements');
  16553. }
  16554. expression_div.text('');
  16555. for (var i = 0; i < command.expression.length; i++) {
  16556. var temp = (0, _jquery2.default)('<div class="expression_element"></div>');
  16557. temp.data('ref_element', command.expression[i]);
  16558. temp.data('ref_index', i);
  16559. expression_div.append(temp);
  16560. renderElement(command, function_obj, temp, command.expression[i]);
  16561. }
  16562. }
  16563. function renderOperator(command, function_obj, temp_op, expression_element, index_op) {
  16564. var context_menu = '<div class="ui dropdown"><div class="text">';
  16565. switch (expression_element.itens[index_op]) {
  16566. case Models.ARITHMETIC_TYPES.plus:
  16567. context_menu += '+';
  16568. break;
  16569. case Models.ARITHMETIC_TYPES.minus:
  16570. context_menu += '-';
  16571. break;
  16572. case Models.ARITHMETIC_TYPES.multiplication:
  16573. context_menu += '*';
  16574. break;
  16575. case Models.ARITHMETIC_TYPES.division:
  16576. context_menu += '/';
  16577. break;
  16578. case Models.ARITHMETIC_TYPES.module:
  16579. context_menu += '%';
  16580. break;
  16581. case Models.ARITHMETIC_TYPES.none:
  16582. context_menu += '...';
  16583. break;
  16584. }
  16585. context_menu += '</div><div class="menu">';
  16586. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.plus + '">+</div>';
  16587. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.minus + '">-</div>';
  16588. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.multiplication + '">*</div>';
  16589. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.division + '">/</div>';
  16590. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.module + '">%</div>';
  16591. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.none + '" data-text="...">Nenhum</div>';
  16592. context_menu += '</div></div>';
  16593. context_menu = (0, _jquery2.default)(context_menu);
  16594. temp_op.append(context_menu);
  16595. context_menu.dropdown({
  16596. onChange: function onChange(value, text, $selectedItem) {
  16597. expression_element.itens[index_op] = value;
  16598. }
  16599. });
  16600. }
  16601. function renderMenuAddExpression(command, function_obj, el, dom_append_menu, expression_append_new_expression) {
  16602. if (el.hasClass("command_container") == false) {
  16603. var hier = el.parentsUntil(".commands_list_div");
  16604. for (var i = 0; i < hier.length; i++) {
  16605. if ((0, _jquery2.default)(hier[i]).hasClass("command_container")) {
  16606. el = (0, _jquery2.default)(hier[i]);
  16607. break;
  16608. }
  16609. }
  16610. }
  16611. if (dom_append_menu.hasClass("expression_elements") == false) {
  16612. var hier = el.parentsUntil(".commands_list_div");
  16613. for (var i = 0; i < hier.length; i++) {
  16614. if ((0, _jquery2.default)(hier[i]).hasClass("expression_elements")) {
  16615. dom_append_menu = (0, _jquery2.default)(hier[i]);
  16616. break;
  16617. }
  16618. }
  16619. }
  16620. var context_menu = '<div class="ui dropdown"><div class="text"></div><i class="ui icon arrow alternate circle right outline"></i><div class="menu">';
  16621. context_menu += '<div class="item" data-value="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  16622. context_menu += '<div class="item" data-value="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  16623. context_menu += '<div class="item" data-value="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  16624. context_menu += '</div></div>';
  16625. context_menu = (0, _jquery2.default)(context_menu);
  16626. dom_append_menu.append(context_menu);
  16627. context_menu.dropdown({
  16628. onChange: function onChange(value, text, $selectedItem) {
  16629. switch (value) {
  16630. case Models.EXPRESSION_ELEMENTS.exp_op_exp:
  16631. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.exp_op_exp, [new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true), Models.ARITHMETIC_TYPES.plus, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
  16632. expression_append_new_expression.push(exp);
  16633. break;
  16634. case Models.EXPRESSION_ELEMENTS.op_exp:
  16635. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.op_exp, [Models.ARITHMETIC_TYPES.plus, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
  16636. expression_append_new_expression.push(exp);
  16637. break;
  16638. case Models.EXPRESSION_ELEMENTS.par_exp_par:
  16639. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.par_exp_par, [new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
  16640. expression_append_new_expression.push(exp);
  16641. break;
  16642. }
  16643. renderExpressionElements(command, function_obj, el);
  16644. }
  16645. });
  16646. }
  16647. function renderElement(command, function_obj, el, expression_element) {
  16648. switch (expression_element.type_exp) {
  16649. case Models.EXPRESSION_ELEMENTS.exp_op_exp:
  16650. var temp_op = (0, _jquery2.default)('<div class="component_element"></div>');
  16651. var temp_exp_1 = (0, _jquery2.default)('<div class="component_element"></div>');
  16652. var temp_exp_2 = (0, _jquery2.default)('<div class="component_element"></div>');
  16653. el.append(temp_exp_1);
  16654. el.append(temp_op);
  16655. el.append(temp_exp_2);
  16656. if (expression_element.itens[0].type) {
  16657. VariableValueMenu.renderMenu(command, expression_element.itens[0], temp_exp_1, function_obj, 2, expression_element);
  16658. } else {
  16659. renderElement(command, function_obj, temp_exp_1, expression_element.itens[0]);
  16660. }
  16661. renderOperator(command, function_obj, temp_op, expression_element, 1);
  16662. if (expression_element.itens[2].type) {
  16663. VariableValueMenu.renderMenu(command, expression_element.itens[2], temp_exp_2, function_obj, 2, expression_element);
  16664. } else {
  16665. renderElement(command, function_obj, temp_exp_2, expression_element.itens[2]);
  16666. }
  16667. break;
  16668. case Models.EXPRESSION_ELEMENTS.op_exp:
  16669. var temp_op = (0, _jquery2.default)('<div class="component_element"></div>');
  16670. var temp_exp = (0, _jquery2.default)('<div class="component_element"></div>');
  16671. el.append(temp_op);
  16672. el.append(temp_exp);
  16673. renderOperator(command, function_obj, temp_op, expression_element, 0);
  16674. if (expression_element.itens[1].type) {
  16675. VariableValueMenu.renderMenu(command, expression_element.itens[1], temp_exp, function_obj, 2, expression_element);
  16676. } else {
  16677. renderElement(command, function_obj, temp_exp, expression_element.itens[1]);
  16678. }
  16679. break;
  16680. case Models.EXPRESSION_ELEMENTS.par_exp_par:
  16681. var temp_par_1 = (0, _jquery2.default)('<div class="component_element"> ( </div>');
  16682. var temp_exp = (0, _jquery2.default)('<div class="component_element"></div>');
  16683. var temp_par_2 = (0, _jquery2.default)('<div class="component_element"> ) </div>');
  16684. el.append(temp_par_1);
  16685. el.append(temp_exp);
  16686. for (var j = 0; j < expression_element.itens.length; j++) {
  16687. if (expression_element.itens[j].type) {
  16688. VariableValueMenu.renderMenu(command, expression_element.itens[j], temp_exp, function_obj, 2, expression_element);
  16689. } else {
  16690. renderElement(command, function_obj, temp_exp, expression_element.itens[j]);
  16691. }
  16692. }
  16693. //renderMenuAddExpression(command, function_obj, el, el, expression_element.itens);
  16694. el.append(temp_par_2);
  16695. break;
  16696. }
  16697. }
  16698. function renderExpression(command, function_obj, el) {
  16699. var expression_div = el.find('.expression_elements');
  16700. expression_div.text('');
  16701. var menu_add_item = (0, _jquery2.default)('<div class="menu_add_item"></div>');
  16702. menu_add_item.data('index_add', 0);
  16703. expression_div.append(menu_add_item);
  16704. for (var i = 0; i < command.expression.length; i++) {
  16705. if (command.expression[i].type) {
  16706. var temp = (0, _jquery2.default)('<div class="expression_element"></div>');
  16707. temp.data('ref_element', command.expression[i]);
  16708. temp.data('ref_index', i);
  16709. expression_div.append(temp);
  16710. VariableValueMenu.renderMenu(command, command.expression[i], temp, function_obj);
  16711. } else if (command.expression[i] == "(" || command.expression[i] == ")") {
  16712. var temp = (0, _jquery2.default)('<div class="expression_element">' + command.expression[i] + '</div>');
  16713. temp.data('ref_element', command.expression[i]);
  16714. temp.data('ref_index', i);
  16715. expression_div.append(temp);
  16716. } else {
  16717. var temp = '<div class="expression_element">';
  16718. switch (command.expression[i]) {
  16719. case Models.ARITHMETIC_TYPES.plus:
  16720. temp += '+';
  16721. break;
  16722. case Models.ARITHMETIC_TYPES.minus:
  16723. temp += '-';
  16724. break;
  16725. case Models.ARITHMETIC_TYPES.multiplication:
  16726. temp += '*';
  16727. break;
  16728. case Models.ARITHMETIC_TYPES.division:
  16729. temp += '/';
  16730. break;
  16731. case Models.ARITHMETIC_TYPES.module:
  16732. temp += '%';
  16733. break;
  16734. }
  16735. temp += '</div>';
  16736. temp = (0, _jquery2.default)(temp);
  16737. temp.data('ref_element', command.expression[i]);
  16738. temp.data('ref_index', i);
  16739. expression_div.append(temp);
  16740. }
  16741. var menu_add_item_seq = (0, _jquery2.default)('<div class="menu_add_item"></div>');
  16742. var index_temp = i + 1;
  16743. menu_add_item_seq.data('index_add', index_temp);
  16744. expression_div.append(menu_add_item_seq);
  16745. }
  16746. addMenuItens(command, function_obj, el);
  16747. }
  16748. function addMenuItens(command, function_obj, expression_div) {
  16749. var divs_expression = expression_div.find('.menu_add_item');
  16750. for (var i = 0; i < divs_expression.length; i++) {
  16751. var temp = (0, _jquery2.default)(divs_expression[i]).data('index_add');
  16752. var context_menu = '<div class="ui dropdown context_menu_clear"><i class="ui icon plus square outline"></i><div class="menu">';
  16753. context_menu += '<div class="item" data-option="value" data-index="' + temp + '">' + _localizedStringsService.LocalizedStrings.getUI('text_value') + '</div>';
  16754. context_menu += '<div class="item" data-option="operator" data-index="' + temp + '">' + _localizedStringsService.LocalizedStrings.getUI('text_operator') + '</div>';
  16755. context_menu += '<div class="item" data-option="parentheses" data-index="' + temp + '">' + _localizedStringsService.LocalizedStrings.getUI('text_parentheses') + '</div>';
  16756. context_menu += '</div></div>';
  16757. context_menu = (0, _jquery2.default)(context_menu);
  16758. (0, _jquery2.default)(divs_expression[i]).append(context_menu);
  16759. context_menu.dropdown({
  16760. on: 'hover',
  16761. onChange: function onChange(value, text, $selectedItem) {
  16762. switch ($selectedItem.data('option')) {
  16763. case "value":
  16764. command.expression.splice($selectedItem.data('index'), 0, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  16765. renderExpression(command, function_obj, expression_div);
  16766. break;
  16767. case "operator":
  16768. command.expression.splice($selectedItem.data('index'), 0, Models.ARITHMETIC_TYPES.plus);
  16769. renderExpression(command, function_obj, expression_div);
  16770. break;
  16771. case "parentheses":
  16772. command.expression.splice($selectedItem.data('index'), 0, "(");
  16773. command.expression.splice($selectedItem.data('index') + 1, 0, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  16774. command.expression.splice($selectedItem.data('index') + 2, 0, ")");
  16775. renderExpression(command, function_obj, expression_div);
  16776. break;
  16777. }
  16778. }
  16779. });
  16780. }
  16781. }
  16782. function addHandlers(command, function_obj, attribution_dom) {
  16783. attribution_dom.find('.button_remove_command').on('click', function () {
  16784. if (CommandsManagement.removeCommand(command, function_obj, attribution_dom)) {
  16785. attribution_dom.fadeOut();
  16786. }
  16787. });
  16788. attribution_dom.find('.button_refresh_attribution').on('click', function () {
  16789. renderExpressionElements(command, function_obj, attribution_dom);
  16790. });
  16791. }
  16792. function renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected) {
  16793. /*console.log("recebido o seguinte DOM: ");
  16794. console.log(dom_object);
  16795. if (dom_object.hasClass('var_attributed')) {
  16796. return;
  16797. } else {
  16798. var hier = dom_object.parentsUntil(".command_container");
  16799. for (var i = 0; i < hier.length; i++) {
  16800. if ($(hier[i]).hasClass('var_attributed') || $(hier[i]).hasClass('parameters_function_called')) {
  16801. return;
  16802. }
  16803. }
  16804. }
  16805. dom_object.find('.context_menu_clear').remove();
  16806. var menu_operations = '<div class="ui dropdown menu_operations"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  16807. for (var tm in Models.ARITHMETIC_TYPES) {
  16808. menu_operations += '<div class="item" data-option="'+tm+'">'+LocalizedStrings.getUI('btn_arithmetic_' + tm)+'</div>';
  16809. }
  16810. menu_operations += '<div class="item" data-option="clear">'+LocalizedStrings.getUI('btn_clear')+'</div>';
  16811. menu_operations += '</div></div>';
  16812. menu_operations = $(menu_operations);
  16813. dom_object.append(menu_operations);
  16814. menu_operations.dropdown({
  16815. onChange: function(value, text, $selectedItem) {
  16816. switch ($($selectedItem).data('option')) {
  16817. case "clear":
  16818. $(dom_object).text('');
  16819. VariableValueMenu.renderMenu(command, ref_object, dom_object, function_obj);
  16820. break;
  16821. default:
  16822. createExpressionAround(command, ref_object, dom_object, function_obj);
  16823. menu_operations.find('.text').text('');
  16824. }
  16825. }
  16826. });*/
  16827. }
  16828. function createExpressionAround(command, ref_object, dom_object, function_obj) {
  16829. (0, _jquery2.default)('<span> ( </span>').insertBefore(dom_object);
  16830. (0, _jquery2.default)('<span> ) </span>').insertAfter(dom_object);
  16831. VariableValueMenu.renderMenu(command, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true), dom_object, function_obj);
  16832. }
  16833. /***/ }),
  16834. /***/ "./js/visualUI/commands/break.js":
  16835. /*!***************************************!*\
  16836. !*** ./js/visualUI/commands/break.js ***!
  16837. \***************************************/
  16838. /*! no static exports found */
  16839. /***/ (function(module, exports, __webpack_require__) {
  16840. "use strict";
  16841. Object.defineProperty(exports, "__esModule", {
  16842. value: true
  16843. });
  16844. exports.createFloatingCommand = createFloatingCommand;
  16845. exports.renderCommand = renderCommand;
  16846. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  16847. var _jquery2 = _interopRequireDefault(_jquery);
  16848. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  16849. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  16850. var Models = _interopRequireWildcard(_ivprog_elements);
  16851. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  16852. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  16853. var CommandsManagement = _interopRequireWildcard(_commands);
  16854. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  16855. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  16856. function createFloatingCommand() {
  16857. return (0, _jquery2.default)('<div class="ui comment created_element"> <i class="ui icon small quote left"></i> <span> ' + _localizedStringsService.LocalizedStrings.getUI('text_break') + ' </span></div>');
  16858. }
  16859. function renderCommand(command, function_obj) {
  16860. var el = (0, _jquery2.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>' + _localizedStringsService.LocalizedStrings.getUI('text_break') + '</span> </div>');
  16861. el.data('command', command);
  16862. addHandlers(command, function_obj, el);
  16863. return el;
  16864. }
  16865. function addHandlers(command, function_obj, break_dom) {
  16866. break_dom.find('.button_remove_command').on('click', function () {
  16867. if (CommandsManagement.removeCommand(command, function_obj, break_dom)) {
  16868. break_dom.fadeOut();
  16869. }
  16870. });
  16871. }
  16872. /***/ }),
  16873. /***/ "./js/visualUI/commands/comment.js":
  16874. /*!*****************************************!*\
  16875. !*** ./js/visualUI/commands/comment.js ***!
  16876. \*****************************************/
  16877. /*! no static exports found */
  16878. /***/ (function(module, exports, __webpack_require__) {
  16879. "use strict";
  16880. Object.defineProperty(exports, "__esModule", {
  16881. value: true
  16882. });
  16883. exports.createFloatingCommand = createFloatingCommand;
  16884. exports.renderCommand = renderCommand;
  16885. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  16886. var _jquery2 = _interopRequireDefault(_jquery);
  16887. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  16888. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  16889. var Models = _interopRequireWildcard(_ivprog_elements);
  16890. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  16891. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  16892. var GlobalsManagement = _interopRequireWildcard(_globals);
  16893. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  16894. var VariablesManagement = _interopRequireWildcard(_variables);
  16895. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  16896. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  16897. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  16898. var CommandsManagement = _interopRequireWildcard(_commands);
  16899. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  16900. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  16901. function createFloatingCommand() {
  16902. return (0, _jquery2.default)('<div class="ui comment created_element"> <i class="ui icon small quote left"></i> <span class="span_comment_text" "> ' + _localizedStringsService.LocalizedStrings.getUI('text_comment') + ' </span></div>');
  16903. }
  16904. function renderCommand(command, function_obj) {
  16905. var el = (0, _jquery2.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>');
  16906. el.data('command', command);
  16907. addHandlers(command, function_obj, el);
  16908. renderTextComment(command, function_obj, el);
  16909. return el;
  16910. }
  16911. function renderTextComment(command, function_obj, el) {
  16912. VariableValueMenu.renderMenu(command, command.comment_text, el.find('.var_value_menu_div'), function_obj, 20);
  16913. }
  16914. function addHandlers(command, function_obj, comment_dom) {
  16915. comment_dom.find('.button_remove_command').on('click', function () {
  16916. if (CommandsManagement.removeCommand(command, function_obj, comment_dom)) {
  16917. comment_dom.fadeOut();
  16918. }
  16919. });
  16920. }
  16921. /***/ }),
  16922. /***/ "./js/visualUI/commands/conditional_expression.js":
  16923. /*!********************************************************!*\
  16924. !*** ./js/visualUI/commands/conditional_expression.js ***!
  16925. \********************************************************/
  16926. /*! no static exports found */
  16927. /***/ (function(module, exports, __webpack_require__) {
  16928. "use strict";
  16929. Object.defineProperty(exports, "__esModule", {
  16930. value: true
  16931. });
  16932. exports.renderExpression = renderExpression;
  16933. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  16934. var _jquery2 = _interopRequireDefault(_jquery);
  16935. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  16936. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  16937. var Models = _interopRequireWildcard(_ivprog_elements);
  16938. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  16939. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  16940. var GlobalsManagement = _interopRequireWildcard(_globals);
  16941. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  16942. var VariablesManagement = _interopRequireWildcard(_variables);
  16943. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  16944. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  16945. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  16946. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  16947. function renderExpression(command, expression, function_obj, initial_el_to_render) {
  16948. if (expression.expression == null || expression.expression.length < 1) {
  16949. renderStartMenu(command, expression, function_obj, initial_el_to_render);
  16950. } else {
  16951. var main_div = (0, _jquery2.default)('<div class="expression_elements"></div>');
  16952. switch (expression.expression.type) {
  16953. case Models.EXPRESSION_TYPES.exp_logic:
  16954. renderLogicExpression(command, expression, expression.expression, function_obj, main_div, initial_el_to_render);
  16955. break;
  16956. case Models.EXPRESSION_TYPES.exp_arithmetic:
  16957. renderArithmeticExpression(command, expression, expression.expression, function_obj, main_div);
  16958. break;
  16959. }
  16960. initial_el_to_render.append(main_div);
  16961. }
  16962. }
  16963. function renderArithmeticOperator(command, all_expression, expression_arithmetic, arithmetic_operator, function_obj, element_to_append) {
  16964. var menu_operator = (0, _jquery2.default)('<div class="ui dropdown"><div class="text"></div><i class="dropdown icon"></i></div>');
  16965. menu_operator.dropdown({
  16966. values: [{
  16967. name: '>',
  16968. value: Models.ARITHMETIC_COMPARISON.greater_than,
  16969. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.greater_than
  16970. }, {
  16971. name: '<',
  16972. value: Models.ARITHMETIC_COMPARISON.less_than,
  16973. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.less_than
  16974. }, {
  16975. name: '==',
  16976. value: Models.ARITHMETIC_COMPARISON.equals_to,
  16977. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.equals_to
  16978. }, {
  16979. name: '!=',
  16980. value: Models.ARITHMETIC_COMPARISON.not_equals_to,
  16981. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.not_equals_to
  16982. }, {
  16983. name: '>=',
  16984. value: Models.ARITHMETIC_COMPARISON.greater_than_or_equals_to,
  16985. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.greater_than_or_equals_to
  16986. }, {
  16987. name: '<=',
  16988. value: Models.ARITHMETIC_COMPARISON.less_than_or_equals_to,
  16989. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.less_than_or_equals_to
  16990. }],
  16991. onChange: function onChange(value, text, $selectedItem) {
  16992. expression_arithmetic.operator = value;
  16993. }
  16994. });
  16995. element_to_append.append(menu_operator);
  16996. }
  16997. function renderLogicOperator(command, all_expression, expression_logic, logic_operator, function_obj, element_to_append, initial_el_to_render) {
  16998. var menu_operator = (0, _jquery2.default)('<div class="ui dropdown"><div class="text"></div><i class="dropdown icon"></i></div>');
  16999. menu_operator.dropdown({
  17000. values: [{
  17001. name: '==',
  17002. value: Models.LOGIC_COMPARISON.equals_to,
  17003. selected: logic_operator == Models.LOGIC_COMPARISON.equals_to
  17004. }, {
  17005. name: '!=',
  17006. value: Models.LOGIC_COMPARISON.not_equals_to,
  17007. selected: logic_operator == Models.LOGIC_COMPARISON.not_equals_to
  17008. }, {
  17009. name: '&&',
  17010. value: Models.LOGIC_COMPARISON.and,
  17011. selected: logic_operator == Models.LOGIC_COMPARISON.and
  17012. }, {
  17013. name: '||',
  17014. value: Models.LOGIC_COMPARISON.or,
  17015. selected: logic_operator == Models.LOGIC_COMPARISON.or
  17016. }],
  17017. onChange: function onChange(value, text, $selectedItem) {
  17018. if ($selectedItem) {
  17019. expression_logic.operator = value;
  17020. if (expression_logic.second_operand == null) {
  17021. expression_logic.second_operand = new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true);
  17022. initial_el_to_render.empty();
  17023. renderExpression(command, all_expression, function_obj, initial_el_to_render);
  17024. }
  17025. }
  17026. }
  17027. });
  17028. element_to_append.append(menu_operator);
  17029. }
  17030. function renderLogicExpression(command, all_expression, expression_logic, function_obj, element_to_append, initial_el_to_render) {
  17031. var exp_el_par_1 = (0, _jquery2.default)(' <span class="span_command_spec"> </span> ');
  17032. var exp_el_expr_el_1 = (0, _jquery2.default)('<div class="expression_element"></div>');
  17033. var exp_el_expr_operand = (0, _jquery2.default)('<div class="expression_element"></div>');
  17034. var exp_el_expr_el_2 = (0, _jquery2.default)('<div class="expression_element"></div>');
  17035. var exp_el_par_2 = (0, _jquery2.default)(' <span class="span_command_spec"> </span> ');
  17036. if (expression_logic.first_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  17037. renderLogicExpression(command, all_expression, expression_logic.first_operand, function_obj, exp_el_expr_el_1);
  17038. } else if (expression_logic.first_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  17039. renderArithmeticExpression(command, all_expression, expression_logic.first_operand, function_obj, exp_el_expr_el_1);
  17040. } else {
  17041. VariableValueMenuManagement.renderMenu(command, expression_logic.first_operand, exp_el_expr_el_1, function_obj);
  17042. }
  17043. element_to_append.append(exp_el_par_1);
  17044. element_to_append.append(exp_el_expr_el_1);
  17045. renderLogicOperator(command, all_expression, expression_logic, expression_logic.operator, function_obj, exp_el_expr_operand, initial_el_to_render);
  17046. element_to_append.append(exp_el_expr_operand);
  17047. if (expression_logic.second_operand) {
  17048. if (expression_logic.second_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  17049. renderLogicExpression(command, all_expression, expression_logic.second_operand, function_obj, exp_el_expr_el_2);
  17050. } else if (expression_logic.second_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  17051. renderArithmeticExpression(command, all_expression, expression_logic.second_operand, function_obj, exp_el_expr_el_2);
  17052. } else {
  17053. VariableValueMenuManagement.renderMenu(command, expression_logic.second_operand, exp_el_expr_el_2, function_obj);
  17054. }
  17055. element_to_append.append(exp_el_expr_el_2);
  17056. }
  17057. element_to_append.append(exp_el_par_2);
  17058. }
  17059. function renderArithmeticExpression(command, all_expression, expression_arithmetic, function_obj, element_to_append) {
  17060. var exp_el_par_1 = (0, _jquery2.default)(' <span class="span_command_spec"> </span> ');
  17061. var exp_el_expr_el_1 = (0, _jquery2.default)('<div class="expression_element"></div>');
  17062. var exp_el_expr_operand = (0, _jquery2.default)('<div class="expression_element"></div>');
  17063. var exp_el_expr_el_2 = (0, _jquery2.default)('<div class="expression_element"></div>');
  17064. var exp_el_par_2 = (0, _jquery2.default)(' <span class="span_command_spec"> </span> ');
  17065. if (expression_arithmetic.first_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  17066. renderLogicExpression(command, all_expression, expression_arithmetic.first_operand, function_obj, exp_el_expr_el_1);
  17067. } else if (expression_arithmetic.first_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  17068. renderArithmeticExpression(command, all_expression, expression_arithmetic.first_operand, function_obj, exp_el_expr_el_1);
  17069. } else {
  17070. VariableValueMenuManagement.renderMenu(command, expression_arithmetic.first_operand, exp_el_expr_el_1, function_obj);
  17071. }
  17072. if (expression_arithmetic.second_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  17073. renderLogicExpression(command, all_expression, expression_arithmetic.second_operand, function_obj, exp_el_expr_el_2);
  17074. } else if (expression_arithmetic.second_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  17075. renderArithmeticExpression(command, all_expression, expression_arithmetic.second_operand, function_obj, exp_el_expr_el_2);
  17076. } else {
  17077. VariableValueMenuManagement.renderMenu(command, expression_arithmetic.second_operand, exp_el_expr_el_2, function_obj);
  17078. }
  17079. renderArithmeticOperator(command, all_expression, expression_arithmetic, expression_arithmetic.operator, function_obj, exp_el_expr_operand);
  17080. element_to_append.append(exp_el_par_1);
  17081. element_to_append.append(exp_el_expr_el_1);
  17082. element_to_append.append(exp_el_expr_operand);
  17083. element_to_append.append(exp_el_expr_el_2);
  17084. element_to_append.append(exp_el_par_2);
  17085. }
  17086. function renderStartMenu(command, expression, function_obj, initial_el_to_render) {
  17087. var start_menu = '';
  17088. start_menu += '<div class="ui dropdown menu_start_rendered"><div class="text"><i>' + _localizedStringsService.LocalizedStrings.getUI('expression_menu_select') + '</i></div><i class="dropdown icon"></i><div class="menu">';
  17089. start_menu += '<div class="item" data-exp="' + Models.EXPRESSION_TYPES.exp_logic + '">' + _localizedStringsService.LocalizedStrings.getUI('text_logic_expression') + '</div>';
  17090. start_menu += '<div class="item" data-exp="' + Models.EXPRESSION_TYPES.exp_arithmetic + '">' + _localizedStringsService.LocalizedStrings.getUI('text_arithmetic_expression') + '</div>';
  17091. start_menu += '</div></div>';
  17092. start_menu = (0, _jquery2.default)(start_menu);
  17093. start_menu.dropdown({
  17094. onChange: function onChange(value, text, $selectedItem) {
  17095. switch ($selectedItem.data('exp')) {
  17096. case Models.EXPRESSION_TYPES.exp_logic:
  17097. expression.expression = new Models.LogicExpression(false, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  17098. break;
  17099. case Models.EXPRESSION_TYPES.exp_arithmetic:
  17100. expression.expression = new Models.ArithmeticExpression(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true), new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true), Models.ARITHMETIC_COMPARISON.less_than);
  17101. break;
  17102. }
  17103. initial_el_to_render.html('');
  17104. renderExpression(command, expression, function_obj, initial_el_to_render);
  17105. }
  17106. });
  17107. initial_el_to_render.append(' <span class="span_command_spec"> </span> ');
  17108. initial_el_to_render.append(start_menu);
  17109. initial_el_to_render.append(' <span class="span_command_spec"> </span> ');
  17110. }
  17111. /***/ }),
  17112. /***/ "./js/visualUI/commands/contextualized_menu.js":
  17113. /*!*****************************************************!*\
  17114. !*** ./js/visualUI/commands/contextualized_menu.js ***!
  17115. \*****************************************************/
  17116. /*! no static exports found */
  17117. /***/ (function(module, exports, __webpack_require__) {
  17118. "use strict";
  17119. Object.defineProperty(exports, "__esModule", {
  17120. value: true
  17121. });
  17122. exports.renderMenu = renderMenu;
  17123. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17124. var _jquery2 = _interopRequireDefault(_jquery);
  17125. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17126. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17127. var Models = _interopRequireWildcard(_ivprog_elements);
  17128. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17129. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17130. var CommandsManagement = _interopRequireWildcard(_commands);
  17131. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17132. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  17133. var _switch = __webpack_require__(/*! ./switch */ "./js/visualUI/commands/switch.js");
  17134. var SwitchManagement = _interopRequireWildcard(_switch);
  17135. var _repeatNtimes = __webpack_require__(/*! ./repeatNtimes */ "./js/visualUI/commands/repeatNtimes.js");
  17136. var RepeatNTimesManagement = _interopRequireWildcard(_repeatNtimes);
  17137. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  17138. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17139. function renderMenu(command, dom_where_render, function_obj, dom_command) {
  17140. var menu_div = '<div class="ui dropdown menu_commands" ><i class="icon code"></i> <div class="menu"> ';
  17141. if (command.type == Models.COMMAND_TYPES.repeatNtimes || command.type == Models.COMMAND_TYPES.whiletrue || command.type == Models.COMMAND_TYPES.dowhiletrue) {
  17142. menu_div += '<a class="item" data-command="' + Models.COMMAND_TYPES.break + '"><i class="download icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('btn_break') + ' </a>';
  17143. } else {
  17144. menu_div += '<a class="item" data-command="' + Models.COMMAND_TYPES.break + '"><i class="download icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('btn_break') + ' </a>';
  17145. menu_div += '<a class="item" data-command="' + Models.COMMAND_TYPES.switchcase + '"><i class="download icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('btn_case') + ' </a>';
  17146. }
  17147. menu_div += '</div></div>';
  17148. menu_div = (0, _jquery2.default)(menu_div);
  17149. dom_where_render.append(menu_div);
  17150. addHandlers(command, dom_where_render, function_obj, dom_command);
  17151. }
  17152. function addHandlers(command, dom_where_render, function_obj, dom_command) {
  17153. dom_where_render.find('.menu_commands').dropdown({
  17154. on: 'hover'
  17155. });
  17156. dom_where_render.find('.menu_commands a').on('click', function (evt) {
  17157. if (command.type == Models.COMMAND_TYPES.repeatNtimes || command.type == Models.COMMAND_TYPES.whiletrue || command.type == Models.COMMAND_TYPES.dowhiletrue) {
  17158. if (command.commands_block == null || command.commands_block.length == 0) {
  17159. command.commands_block = [];
  17160. var new_cmd = CommandsManagement.genericCreateCommand((0, _jquery2.default)(this).data('command'));
  17161. command.commands_block.push(new_cmd);
  17162. CommandsManagement.renderCommand(new_cmd, dom_command.find('.block_commands'), 3, function_obj);
  17163. } else {
  17164. CommandsManagement.createFloatingCommand(function_obj, dom_command.find('.block_commands'), (0, _jquery2.default)(this).data('command'), evt);
  17165. }
  17166. } else {
  17167. switch ((0, _jquery2.default)(this).data('command')) {
  17168. case Models.COMMAND_TYPES.break:
  17169. CommandsManagement.createFloatingCommand(function_obj, null, (0, _jquery2.default)(this).data('command'), evt);
  17170. break;
  17171. case Models.COMMAND_TYPES.switchcase:
  17172. addCaseToSwitch(command, dom_where_render, function_obj, dom_command);
  17173. break;
  17174. }
  17175. }
  17176. });
  17177. }
  17178. function addCaseToSwitch(command, dom_where_render, function_obj, dom_command) {
  17179. if (command.cases == null) {
  17180. command.cases = [];
  17181. }
  17182. var sc = new Models.SwitchCase(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  17183. command.cases.push(sc);
  17184. SwitchManagement.renderCase(sc, command, function_obj, dom_command.find('.all_cases_div'));
  17185. }
  17186. /***/ }),
  17187. /***/ "./js/visualUI/commands/dowhiletrue.js":
  17188. /*!*********************************************!*\
  17189. !*** ./js/visualUI/commands/dowhiletrue.js ***!
  17190. \*********************************************/
  17191. /*! no static exports found */
  17192. /***/ (function(module, exports, __webpack_require__) {
  17193. "use strict";
  17194. Object.defineProperty(exports, "__esModule", {
  17195. value: true
  17196. });
  17197. exports.createFloatingCommand = createFloatingCommand;
  17198. exports.renderCommand = renderCommand;
  17199. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17200. var _jquery2 = _interopRequireDefault(_jquery);
  17201. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17202. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17203. var Models = _interopRequireWildcard(_ivprog_elements);
  17204. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17205. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17206. var GlobalsManagement = _interopRequireWildcard(_globals);
  17207. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17208. var VariablesManagement = _interopRequireWildcard(_variables);
  17209. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17210. var CommandsManagement = _interopRequireWildcard(_commands);
  17211. var _conditional_expression = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  17212. var ConditionalExpressionManagement = _interopRequireWildcard(_conditional_expression);
  17213. var _contextualized_menu = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  17214. var ContextualizedMenu = _interopRequireWildcard(_contextualized_menu);
  17215. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  17216. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17217. function createFloatingCommand() {
  17218. return (0, _jquery2.default)('<div class="ui dowhiletrue created_element"> <i class="ui icon small sync"></i> <span> ' + _localizedStringsService.LocalizedStrings.getUI('text_command_do') + ' {<br>} ' + _localizedStringsService.LocalizedStrings.getUI('text_code_while') + '(x < 10) </span></div>');
  17219. }
  17220. function renderCommand(command, function_obj) {
  17221. var ret = '';
  17222. ret += '<div class="ui dowhiletrue 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 class="span_command_spec"> ' + _localizedStringsService.LocalizedStrings.getUI('text_command_do') + ' </span>';
  17223. ret += '<div class="ui block_commands" data-subblock="" data-idcommand="">';
  17224. ret += '</div>';
  17225. ret += ' <span class="span_command_spec"> ' + _localizedStringsService.LocalizedStrings.getUI('text_code_while') + ' </span> <span class="span_command_spec"> ( </span> <div class="conditional_expression"></div> <span class="span_command_spec"> ) </span>';
  17226. ret += '</div>';
  17227. var el = (0, _jquery2.default)(ret);
  17228. el.data('command', command);
  17229. addHandlers(command, function_obj, el);
  17230. ContextualizedMenu.renderMenu(command, el.find('.context_menu'), function_obj, el);
  17231. ConditionalExpressionManagement.renderExpression(command, command.expression, function_obj, el.find('.conditional_expression'));
  17232. if (command.commands_block) {
  17233. for (var j = 0; j < command.commands_block.length; j++) {
  17234. CommandsManagement.renderCommand(command.commands_block[j], (0, _jquery2.default)(el.find('.block_commands')[0]), 3, function_obj);
  17235. }
  17236. }
  17237. return el;
  17238. }
  17239. function addHandlers(command, function_obj, dowhiletrue_dom) {
  17240. dowhiletrue_dom.find('.button_remove_command').on('click', function () {
  17241. if (CommandsManagement.removeCommand(command, function_obj, dowhiletrue_dom)) {
  17242. dowhiletrue_dom.fadeOut();
  17243. }
  17244. });
  17245. }
  17246. /***/ }),
  17247. /***/ "./js/visualUI/commands/functioncall.js":
  17248. /*!**********************************************!*\
  17249. !*** ./js/visualUI/commands/functioncall.js ***!
  17250. \**********************************************/
  17251. /*! no static exports found */
  17252. /***/ (function(module, exports, __webpack_require__) {
  17253. "use strict";
  17254. Object.defineProperty(exports, "__esModule", {
  17255. value: true
  17256. });
  17257. exports.createFloatingCommand = createFloatingCommand;
  17258. exports.renderCommand = renderCommand;
  17259. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17260. var _jquery2 = _interopRequireDefault(_jquery);
  17261. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17262. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17263. var Models = _interopRequireWildcard(_ivprog_elements);
  17264. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17265. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17266. var GlobalsManagement = _interopRequireWildcard(_globals);
  17267. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17268. var VariablesManagement = _interopRequireWildcard(_variables);
  17269. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17270. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  17271. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17272. var CommandsManagement = _interopRequireWildcard(_commands);
  17273. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  17274. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17275. function createFloatingCommand() {
  17276. return (0, _jquery2.default)('<div class="ui functioncall created_element"> <i class="hand point right icon"></i> <span> funcao() </span></div>');
  17277. }
  17278. function renderCommand(command, function_obj) {
  17279. var el = (0, _jquery2.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>');
  17280. el.data('command', command);
  17281. VariableValueMenu.renderMenu(command, command.function_called, el.find('.var_value_menu_div'), function_obj);
  17282. addHandlers(command, function_obj, el);
  17283. return el;
  17284. }
  17285. function addHandlers(command, function_obj, functioncall_dom) {
  17286. functioncall_dom.find('.button_remove_command').on('click', function () {
  17287. if (CommandsManagement.removeCommand(command, function_obj, functioncall_dom)) {
  17288. functioncall_dom.fadeOut();
  17289. }
  17290. });
  17291. }
  17292. /***/ }),
  17293. /***/ "./js/visualUI/commands/iftrue.js":
  17294. /*!****************************************!*\
  17295. !*** ./js/visualUI/commands/iftrue.js ***!
  17296. \****************************************/
  17297. /*! no static exports found */
  17298. /***/ (function(module, exports, __webpack_require__) {
  17299. "use strict";
  17300. Object.defineProperty(exports, "__esModule", {
  17301. value: true
  17302. });
  17303. exports.createFloatingCommand = createFloatingCommand;
  17304. exports.renderCommand = renderCommand;
  17305. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17306. var _jquery2 = _interopRequireDefault(_jquery);
  17307. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17308. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17309. var Models = _interopRequireWildcard(_ivprog_elements);
  17310. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17311. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17312. var GlobalsManagement = _interopRequireWildcard(_globals);
  17313. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17314. var VariablesManagement = _interopRequireWildcard(_variables);
  17315. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17316. var CommandsManagement = _interopRequireWildcard(_commands);
  17317. var _conditional_expression = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  17318. var ConditionalExpressionManagement = _interopRequireWildcard(_conditional_expression);
  17319. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  17320. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17321. function createFloatingCommand() {
  17322. return (0, _jquery2.default)('<div class="ui iftrue created_element"> <i class="ui icon small random"></i> <span> if (x < 1) { } </span></div>');
  17323. }
  17324. function renderCommand(command, function_obj) {
  17325. var ret = '';
  17326. 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>';
  17327. ret += '<span class="span_command_spec"> ' + _localizedStringsService.LocalizedStrings.getUI('text_if') + '</span>';
  17328. ret += ' <span class="span_command_spec"> ( </span> <div class="conditional_expression"></div> <span class="span_command_spec"> ) </span>';
  17329. ret += '<span> </span> ';
  17330. ret += '<div class="ui block_commands commands_if conditional_comands_block" data-if="true">';
  17331. ret += '</div></div>';
  17332. ret += '<div class="ui data_block_else" data-else="true"> <span class="span_command_spec"> ' + _localizedStringsService.LocalizedStrings.getUI('text_else') + ' </span>';
  17333. ret += '<div class="ui block_commands commands_else conditional_comands_block" data-else="true">';
  17334. ret += '</div>';
  17335. ret += '<span></span></div>';
  17336. ret += '</div>';
  17337. var el = (0, _jquery2.default)(ret);
  17338. el.data('command', command);
  17339. el.find('.block_commands').data('command', command);
  17340. el.find('.data_block_if').data('command', command);
  17341. el.find('.data_block_else').data('command', command);
  17342. addHandlers(command, function_obj, el);
  17343. ConditionalExpressionManagement.renderExpression(command, command.expression, function_obj, el.find('.conditional_expression'));
  17344. if (command.commands_block) {
  17345. for (var j = 0; j < command.commands_block.length; j++) {
  17346. CommandsManagement.renderCommand(command.commands_block[j], (0, _jquery2.default)(el.find('.commands_if')[0]), 3, function_obj);
  17347. }
  17348. }
  17349. if (command.commands_else) {
  17350. for (var j = 0; j < command.commands_else.length; j++) {
  17351. CommandsManagement.renderCommand(command.commands_else[j], (0, _jquery2.default)(el.find('.commands_else')[0]), 3, function_obj);
  17352. }
  17353. }
  17354. return el;
  17355. }
  17356. function addHandlers(command, function_obj, iftrue_dom) {
  17357. iftrue_dom.find('.button_remove_command').on('click', function () {
  17358. if (CommandsManagement.removeCommand(command, function_obj, iftrue_dom)) {
  17359. iftrue_dom.fadeOut();
  17360. }
  17361. });
  17362. }
  17363. /***/ }),
  17364. /***/ "./js/visualUI/commands/reader.js":
  17365. /*!****************************************!*\
  17366. !*** ./js/visualUI/commands/reader.js ***!
  17367. \****************************************/
  17368. /*! no static exports found */
  17369. /***/ (function(module, exports, __webpack_require__) {
  17370. "use strict";
  17371. Object.defineProperty(exports, "__esModule", {
  17372. value: true
  17373. });
  17374. exports.createFloatingCommand = createFloatingCommand;
  17375. exports.renderCommand = renderCommand;
  17376. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17377. var _jquery2 = _interopRequireDefault(_jquery);
  17378. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17379. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17380. var Models = _interopRequireWildcard(_ivprog_elements);
  17381. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17382. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17383. var GlobalsManagement = _interopRequireWildcard(_globals);
  17384. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17385. var VariablesManagement = _interopRequireWildcard(_variables);
  17386. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17387. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  17388. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17389. var CommandsManagement = _interopRequireWildcard(_commands);
  17390. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  17391. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17392. function createFloatingCommand() {
  17393. return (0, _jquery2.default)('<div class="ui reader created_element"> <i class="ui icon small download"></i> <span> ' + _localizedStringsService.LocalizedStrings.getUI('text_command_read') + ' var </span></div>');
  17394. }
  17395. function renderCommand(command, function_obj) {
  17396. 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">' + _localizedStringsService.LocalizedStrings.getUI('text_command_read') + ' ( </span> <div class="var_value_menu_div"></div> <span class="close_parentheses span_command_spec">)</span> </div>';
  17397. el = (0, _jquery2.default)(el);
  17398. el.data('command', command);
  17399. VariableValueMenu.renderMenu(command, command.variable_value_menu, el.find('.var_value_menu_div'), function_obj);
  17400. addHandlers(command, function_obj, el);
  17401. return el;
  17402. }
  17403. function addHandlers(command, function_obj, reader_dom) {
  17404. reader_dom.find('.button_remove_command').on('click', function () {
  17405. if (CommandsManagement.removeCommand(command, function_obj, reader_dom)) {
  17406. reader_dom.fadeOut();
  17407. }
  17408. });
  17409. }
  17410. /***/ }),
  17411. /***/ "./js/visualUI/commands/repeatNtimes.js":
  17412. /*!**********************************************!*\
  17413. !*** ./js/visualUI/commands/repeatNtimes.js ***!
  17414. \**********************************************/
  17415. /*! no static exports found */
  17416. /***/ (function(module, exports, __webpack_require__) {
  17417. "use strict";
  17418. Object.defineProperty(exports, "__esModule", {
  17419. value: true
  17420. });
  17421. exports.createFloatingCommand = createFloatingCommand;
  17422. exports.renderCommand = renderCommand;
  17423. exports.manageExpressionElements = manageExpressionElements;
  17424. exports.manageClearExpressionElements = manageClearExpressionElements;
  17425. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17426. var _jquery2 = _interopRequireDefault(_jquery);
  17427. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17428. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17429. var Models = _interopRequireWildcard(_ivprog_elements);
  17430. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17431. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17432. var GlobalsManagement = _interopRequireWildcard(_globals);
  17433. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17434. var VariablesManagement = _interopRequireWildcard(_variables);
  17435. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17436. var CommandsManagement = _interopRequireWildcard(_commands);
  17437. var _conditional_expression = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  17438. var ConditionalExpressionManagement = _interopRequireWildcard(_conditional_expression);
  17439. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17440. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  17441. var _contextualized_menu = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  17442. var ContextualizedMenu = _interopRequireWildcard(_contextualized_menu);
  17443. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  17444. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17445. function createFloatingCommand() {
  17446. return (0, _jquery2.default)('<div class="ui repeatNtimes created_element"> <i class="ui icon small sync"></i> <span> para (x = 0; x < 10; x ++) { } </span></div>');
  17447. }
  17448. function renderCommand(command, function_obj) {
  17449. var ret = '<div class="ui repeatNtimes 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 class="span_command_spec"> ' + _localizedStringsService.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>';
  17450. ret += '<div class="ui block_commands">';
  17451. ret += '</div>';
  17452. ret += '<span> </span>';
  17453. ret += '</div>';
  17454. var el = (0, _jquery2.default)(ret);
  17455. el.data('command', command);
  17456. addHandlers(command, function_obj, el);
  17457. ContextualizedMenu.renderMenu(command, el.find('.context_menu'), function_obj, el);
  17458. VariableValueMenu.renderMenu(command, command.var_attribution, el.find('.variable_attribution'), function_obj);
  17459. ConditionalExpressionManagement.renderExpression(command, command.expression2, function_obj, el.find('.conditional_expression'));
  17460. VariableValueMenu.renderMenu(command, command.var_incrementation, el.find('.incrementation_variable'), function_obj);
  17461. if (command.expression1) {
  17462. el.find('.text_receives').text(_localizedStringsService.LocalizedStrings.getUI('text_receives'));
  17463. VariableValueMenu.renderMenu(command, command.expression1, el.find('.var_value_expression'), function_obj);
  17464. }
  17465. if (command.expression3) {
  17466. el.find('.text_inc_receives').text(_localizedStringsService.LocalizedStrings.getUI('text_receives'));
  17467. VariableValueMenu.renderMenu(command, command.expression3.itens[0], el.find('.first_operand'), function_obj);
  17468. renderOperator(command, function_obj, el.find('.operator'), command.expression3, 1);
  17469. VariableValueMenu.renderMenu(command, command.expression3.itens[2], el.find('.second_operand'), function_obj);
  17470. }
  17471. if (command.commands_block) {
  17472. for (var j = 0; j < command.commands_block.length; j++) {
  17473. CommandsManagement.renderCommand(command.commands_block[j], (0, _jquery2.default)(el.find('.block_commands')[0]), 3, function_obj);
  17474. }
  17475. }
  17476. return el;
  17477. }
  17478. function manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element) {
  17479. if (dom_object.hasClass('variable_attribution')) {
  17480. if (!command.expression3) {
  17481. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.exp_op_exp, [command.var_attribution, Models.ARITHMETIC_TYPES.plus, new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, "1", null, null, true)]);
  17482. command.expression3 = exp;
  17483. command.var_incrementation = command.var_attribution;
  17484. var cond_exp = new Models.ArithmeticExpression(command.var_attribution, new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true), Models.ARITHMETIC_COMPARISON.less_than);
  17485. command.expression2.expression = cond_exp;
  17486. }
  17487. dom_object.parent().find('.text_receives').text(_localizedStringsService.LocalizedStrings.getUI('text_receives'));
  17488. command.expression1 = new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, "0", null, null, true);
  17489. dom_object.parent().find('.var_value_expression').empty();
  17490. VariableValueMenu.renderMenu(command, command.expression1, dom_object.parent().find('.var_value_expression'), function_obj);
  17491. renderAlgorithm();
  17492. }
  17493. if (dom_object.hasClass('incrementation_variable')) {
  17494. dom_object.parent().find('.text_inc_receives').text(_localizedStringsService.LocalizedStrings.getUI('text_receives'));
  17495. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.exp_op_exp, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true), Models.ARITHMETIC_TYPES.plus, new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
  17496. command.expression3 = exp;
  17497. VariableValueMenu.renderMenu(command, command.expression3.itens[0], dom_object.parent().find('.first_operand'), function_obj);
  17498. renderOperator(command, function_obj, dom_object.parent().find('.operator'), command.expression3, 1);
  17499. VariableValueMenu.renderMenu(command, command.expression3.itens[2], dom_object.parent().find('.second_operand'), function_obj);
  17500. }
  17501. }
  17502. function manageClearExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element) {
  17503. if (dom_object.hasClass('variable_attribution')) {
  17504. (0, _jquery2.default)(dom_object).parent().find('.text_receives').text('');
  17505. command.expression1 = null;
  17506. (0, _jquery2.default)(dom_object).parent().find('.var_value_expression').empty();
  17507. }
  17508. if (dom_object.hasClass('incrementation_variable')) {
  17509. (0, _jquery2.default)(dom_object).parent().find('.text_inc_receives').text('');
  17510. command.expression3 = null;
  17511. (0, _jquery2.default)(dom_object).parent().find('.first_operand').empty();
  17512. (0, _jquery2.default)(dom_object).parent().find('.operator').empty();
  17513. (0, _jquery2.default)(dom_object).parent().find('.second_operand').empty();
  17514. }
  17515. }
  17516. function addHandlers(command, function_obj, repeatNtimes_dom) {
  17517. repeatNtimes_dom.find('.button_remove_command').on('click', function () {
  17518. if (CommandsManagement.removeCommand(command, function_obj, repeatNtimes_dom)) {
  17519. repeatNtimes_dom.fadeOut();
  17520. }
  17521. });
  17522. }
  17523. function renderOperator(command, function_obj, temp_op, expression_element, index_op) {
  17524. var menu_operator = (0, _jquery2.default)('<div class="ui dropdown"><div class="text"></div></div>');
  17525. menu_operator.dropdown({
  17526. values: [{
  17527. name: '+',
  17528. value: Models.ARITHMETIC_TYPES.plus,
  17529. selected: expression_element.itens[index_op] == Models.ARITHMETIC_TYPES.plus
  17530. }, {
  17531. name: '-',
  17532. value: Models.ARITHMETIC_TYPES.minus,
  17533. selected: expression_element.itens[index_op] == Models.ARITHMETIC_TYPES.minus
  17534. }, {
  17535. name: '*',
  17536. value: Models.ARITHMETIC_TYPES.multiplication,
  17537. selected: expression_element.itens[index_op] == Models.ARITHMETIC_TYPES.multiplication
  17538. }, {
  17539. name: '/',
  17540. value: Models.ARITHMETIC_TYPES.division,
  17541. selected: expression_element.itens[index_op] == Models.ARITHMETIC_TYPES.division
  17542. }, {
  17543. name: '%',
  17544. value: Models.ARITHMETIC_TYPES.module,
  17545. selected: expression_element.itens[index_op] == Models.ARITHMETIC_TYPES.module
  17546. }],
  17547. onChange: function onChange(value, text, $selectedItem) {
  17548. expression_element.itens[index_op] = value;
  17549. }
  17550. });
  17551. temp_op.append(menu_operator);
  17552. }
  17553. /***/ }),
  17554. /***/ "./js/visualUI/commands/return.js":
  17555. /*!****************************************!*\
  17556. !*** ./js/visualUI/commands/return.js ***!
  17557. \****************************************/
  17558. /*! no static exports found */
  17559. /***/ (function(module, exports, __webpack_require__) {
  17560. "use strict";
  17561. Object.defineProperty(exports, "__esModule", {
  17562. value: true
  17563. });
  17564. exports.createFloatingCommand = createFloatingCommand;
  17565. exports.renderCommand = renderCommand;
  17566. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17567. var _jquery2 = _interopRequireDefault(_jquery);
  17568. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17569. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17570. var Models = _interopRequireWildcard(_ivprog_elements);
  17571. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17572. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17573. var GlobalsManagement = _interopRequireWildcard(_globals);
  17574. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17575. var VariablesManagement = _interopRequireWildcard(_variables);
  17576. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17577. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  17578. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17579. var CommandsManagement = _interopRequireWildcard(_commands);
  17580. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  17581. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17582. function createFloatingCommand() {
  17583. return (0, _jquery2.default)('<div class="ui return created_element"> <i class="ui icon small reply"></i> <span> ' + _localizedStringsService.LocalizedStrings.getUI('text_return') + ' </span></div>');
  17584. }
  17585. function renderCommand(command, function_obj) {
  17586. var el = (0, _jquery2.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"> ' + _localizedStringsService.LocalizedStrings.getUI('text_return') + ' </span> <div class="var_value_menu_div"></div></div>');
  17587. el.data('command', command);
  17588. addHandlers(command, function_obj, el);
  17589. VariableValueMenu.renderMenu(command, command.variable_value_menu, el.find('.var_value_menu_div'), function_obj);
  17590. return el;
  17591. }
  17592. function addHandlers(command, function_obj, return_dom) {
  17593. return_dom.find('.button_remove_command').on('click', function () {
  17594. if (CommandsManagement.removeCommand(command, function_obj, return_dom)) {
  17595. return_dom.fadeOut();
  17596. }
  17597. });
  17598. }
  17599. /***/ }),
  17600. /***/ "./js/visualUI/commands/switch.js":
  17601. /*!****************************************!*\
  17602. !*** ./js/visualUI/commands/switch.js ***!
  17603. \****************************************/
  17604. /*! no static exports found */
  17605. /***/ (function(module, exports, __webpack_require__) {
  17606. "use strict";
  17607. Object.defineProperty(exports, "__esModule", {
  17608. value: true
  17609. });
  17610. exports.createFloatingCommand = createFloatingCommand;
  17611. exports.renderCommand = renderCommand;
  17612. exports.renderCase = renderCase;
  17613. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17614. var _jquery2 = _interopRequireDefault(_jquery);
  17615. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17616. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17617. var Models = _interopRequireWildcard(_ivprog_elements);
  17618. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17619. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17620. var GlobalsManagement = _interopRequireWildcard(_globals);
  17621. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17622. var VariablesManagement = _interopRequireWildcard(_variables);
  17623. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17624. var CommandsManagement = _interopRequireWildcard(_commands);
  17625. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17626. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  17627. var _contextualized_menu = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  17628. var ContextualizedMenu = _interopRequireWildcard(_contextualized_menu);
  17629. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  17630. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17631. function createFloatingCommand() {
  17632. return (0, _jquery2.default)('<div class="ui switch created_element"> <i class="ui icon small random"></i> <span> ' + _localizedStringsService.LocalizedStrings.getUI('text_code_switch') + ' ( x ) { <br> ' + _localizedStringsService.LocalizedStrings.getUI('text_code_case') + ' 1: <br> ' + _localizedStringsService.LocalizedStrings.getUI('text_code_case') + ' 2: <br> } </span></div>');
  17633. }
  17634. function renderCommand(command, function_obj) {
  17635. var ret = '';
  17636. 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> ' + _localizedStringsService.LocalizedStrings.getUI('text_code_switch') + ' ( <div class="ui variable_to_switch"></div> ) <div class="ui all_cases_div"></div></span>';
  17637. ret += '</div>';
  17638. var el = (0, _jquery2.default)(ret);
  17639. el.data('command', command);
  17640. addHandlers(command, function_obj, el);
  17641. ContextualizedMenu.renderMenu(command, el.find('.context_menu'), function_obj, el);
  17642. VariableValueMenu.renderMenu(command, command.variable, el.find('.variable_to_switch'), function_obj);
  17643. if (command.cases) {
  17644. for (var i = 0; i < command.cases.length; i++) {
  17645. renderCase(command.cases[i], command, function_obj, el.find('.all_cases_div'));
  17646. }
  17647. }
  17648. return el;
  17649. }
  17650. function renderCase(switchcase, command, function_obj, el) {
  17651. var casediv = (0, _jquery2.default)('<div class="ui case_div"><i class="ui icon times red button_remove_command"></i><span>' + _localizedStringsService.LocalizedStrings.getUI('text_code_case') + '</span> <div class="ui variable_case"></div>: <div class="case_commands_block"></div></div>');
  17652. VariableValueMenu.renderMenu(command, switchcase.variable_value_menu, casediv.find('.variable_case'), function_obj);
  17653. casediv.data('switchcase', switchcase);
  17654. casediv.find('.case_commands_block').data('switchcase', switchcase);
  17655. el.append(casediv);
  17656. if (switchcase.commands_block) {
  17657. for (var j = 0; j < switchcase.commands_block.length; j++) {
  17658. CommandsManagement.renderCommand(switchcase.commands_block[j], (0, _jquery2.default)(casediv.find('.case_commands_block')[0]), 3, function_obj);
  17659. }
  17660. }
  17661. casediv.find('.button_remove_command').on('click', function () {
  17662. for (var i = 0; i < command.cases.length; i++) {
  17663. if (switchcase == command.cases[i]) {
  17664. delete command.cases[i];
  17665. command.cases.splice(i, 1);
  17666. casediv.remove();
  17667. break;
  17668. }
  17669. }
  17670. });
  17671. }
  17672. function addHandlers(command, function_obj, switch_dom) {
  17673. switch_dom.find('.button_remove_command').on('click', function () {
  17674. if (CommandsManagement.removeCommand(command, function_obj, switch_dom)) {
  17675. switch_dom.fadeOut();
  17676. }
  17677. });
  17678. }
  17679. /***/ }),
  17680. /***/ "./js/visualUI/commands/variable_value_menu.js":
  17681. /*!*****************************************************!*\
  17682. !*** ./js/visualUI/commands/variable_value_menu.js ***!
  17683. \*****************************************************/
  17684. /*! no static exports found */
  17685. /***/ (function(module, exports, __webpack_require__) {
  17686. "use strict";
  17687. Object.defineProperty(exports, "__esModule", {
  17688. value: true
  17689. });
  17690. exports.VAR_OR_VALUE_TYPES = undefined;
  17691. exports.renderMenu = renderMenu;
  17692. exports.refreshMenu = refreshMenu;
  17693. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17694. var _jquery2 = _interopRequireDefault(_jquery);
  17695. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17696. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17697. var Models = _interopRequireWildcard(_ivprog_elements);
  17698. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17699. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17700. var GlobalsManagement = _interopRequireWildcard(_globals);
  17701. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17702. var VariablesManagement = _interopRequireWildcard(_variables);
  17703. var _attribution = __webpack_require__(/*! ./attribution */ "./js/visualUI/commands/attribution.js");
  17704. var AttribuitionsManagement = _interopRequireWildcard(_attribution);
  17705. var _writer = __webpack_require__(/*! ./writer */ "./js/visualUI/commands/writer.js");
  17706. var WritersManagement = _interopRequireWildcard(_writer);
  17707. var _repeatNtimes = __webpack_require__(/*! ./repeatNtimes */ "./js/visualUI/commands/repeatNtimes.js");
  17708. var RepeatNTimesManagement = _interopRequireWildcard(_repeatNtimes);
  17709. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  17710. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17711. var VAR_OR_VALUE_TYPES = exports.VAR_OR_VALUE_TYPES = Object.freeze({ only_variable: 1, only_value: 2, only_function: 3, variable_and_function: 4, variable_and_value_opt: 5,
  17712. value_and_function: 6, all: 7 });
  17713. function renderMenu(command, ref_object, dom_object, function_obj) {
  17714. var size_field = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 2;
  17715. var expression_element = arguments[5];
  17716. // Verificar se o objeto atual trata-se de uma chamada de função e conferir se possui a quantidade correta de parâmetros
  17717. // Caso não possua, tem que adicionar as variáveis que servirão de parâmetros:
  17718. if (ref_object.function_called) {
  17719. if (ref_object.function_called.parameters_list) {
  17720. while (ref_object.function_called.parameters_list.length != ref_object.parameters_list.length) {
  17721. if (ref_object.parameters_list.length > ref_object.function_called.parameters_list.length) {
  17722. ref_object.parameters_list.pop();
  17723. } else {
  17724. ref_object.parameters_list.push(new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true));
  17725. }
  17726. }
  17727. }
  17728. }
  17729. var menu_var_or_value = '<div class="ui dropdown menu_var_or_value_dom" data-algo="12"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  17730. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_variable) {
  17731. menu_var_or_value = '<div class="ui dropdown menu_var_or_value_dom"><div class="text"></div><i class="dropdown icon"></i><div class="menu menu_only_vars">';
  17732. menu_var_or_value += '</div>';
  17733. }
  17734. 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) {
  17735. menu_var_or_value += '<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('variable');
  17736. menu_var_or_value += '<div class="menu menu_only_vars">';
  17737. menu_var_or_value += '</div></div>';
  17738. }
  17739. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_value) {
  17740. menu_var_or_value = '<input type="text" class="width-dynamic" size="' + size_field + '" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" />';
  17741. }
  17742. 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) {
  17743. menu_var_or_value += '<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_value + '">' + _localizedStringsService.LocalizedStrings.getUI('text_value') + '</div>';
  17744. }
  17745. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_function) {
  17746. menu_var_or_value = '<div class="ui dropdown menu_var_or_value_dom"><div class="text"></div><i class="dropdown icon"></i><div class="menu menu_only_functions">';
  17747. menu_var_or_value += '</div>';
  17748. }
  17749. 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) {
  17750. menu_var_or_value += '<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_function + '"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('btn_function');
  17751. menu_var_or_value += '<div class="menu menu_only_functions">';
  17752. menu_var_or_value += '</div></div>';
  17753. if (command.type == Models.COMMAND_TYPES.attribution) {
  17754. menu_var_or_value += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  17755. menu_var_or_value += '<div class="menu">';
  17756. menu_var_or_value += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  17757. menu_var_or_value += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  17758. menu_var_or_value += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  17759. menu_var_or_value += '</div></div>';
  17760. }
  17761. }
  17762. menu_var_or_value += '</div></div>';
  17763. menu_var_or_value = (0, _jquery2.default)(menu_var_or_value);
  17764. dom_object.append(menu_var_or_value);
  17765. addHandlers(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  17766. addVariablesToMenu(function_obj, menu_var_or_value, ref_object, expression_element);
  17767. addFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element);
  17768. addIVProgFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element);
  17769. if (ref_object.content || ref_object.function_called) {
  17770. if (ref_object.content) {
  17771. // Verificar se a variável ainda existe:
  17772. if (isVarInProgram(ref_object.content, function_obj)) {
  17773. renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element);
  17774. } else {
  17775. if (ref_object.content && ref_object.content.type) {
  17776. ref_object.content = null;
  17777. appendSelectText(ref_object, menu_var_or_value);
  17778. } else {
  17779. renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element);
  17780. }
  17781. }
  17782. } else if (ref_object.function_called) {
  17783. // Verificar se a função ainda existe:
  17784. if (isFunctionInProgram(ref_object.function_called)) {
  17785. renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element);
  17786. } else {
  17787. ref_object.content = null;
  17788. ref_object.row = null;
  17789. ref_object.column = null;
  17790. delete ref_object.function_called;
  17791. delete ref_object.parameters_list;
  17792. appendSelectText(ref_object, menu_var_or_value);
  17793. }
  17794. }
  17795. } else {
  17796. appendSelectText(ref_object, menu_var_or_value);
  17797. }
  17798. }
  17799. function appendSelectText(ref_object, menu_var_or_value) {
  17800. switch (ref_object.variable_and_value) {
  17801. case VAR_OR_VALUE_TYPES.only_variable:
  17802. menu_var_or_value.find('.text').append('<i>' + _localizedStringsService.LocalizedStrings.getUI('var_menu_select_var') + '</i>');
  17803. break;
  17804. case VAR_OR_VALUE_TYPES.all:
  17805. menu_var_or_value.find('.text').append('<i>' + _localizedStringsService.LocalizedStrings.getUI('var_menu_select_all') + '</i>');
  17806. break;
  17807. case VAR_OR_VALUE_TYPES.variable_and_function:
  17808. menu_var_or_value.find('.text').append('<i>' + _localizedStringsService.LocalizedStrings.getUI('var_menu_select_all') + '</i>');
  17809. break;
  17810. case VAR_OR_VALUE_TYPES.only_function:
  17811. menu_var_or_value.find('.text').append('<i>' + _localizedStringsService.LocalizedStrings.getUI('var_menu_select_function') + '</i>');
  17812. break;
  17813. }
  17814. }
  17815. function isFunctionInProgram(function_called_obj) {
  17816. if (window.program_obj.functions) {
  17817. for (var i = 0; i < window.program_obj.functions.length; i++) {
  17818. if (window.program_obj.functions[i] == function_called_obj) {
  17819. return true;
  17820. }
  17821. }
  17822. }
  17823. return false;
  17824. }
  17825. function isVarInProgram(var_obj, function_obj) {
  17826. // Verify in locals:
  17827. if (function_obj.variables_list) {
  17828. for (var i = 0; i < function_obj.variables_list.length; i++) {
  17829. if (function_obj.variables_list[i] == var_obj) {
  17830. return true;
  17831. }
  17832. }
  17833. }
  17834. // Verify in parameters:
  17835. if (function_obj.parameters_list) {
  17836. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  17837. if (function_obj.parameters_list[i] == var_obj) {
  17838. return true;
  17839. }
  17840. }
  17841. }
  17842. // Verify in globals:
  17843. if (window.program_obj.globals) {
  17844. for (var i = 0; i < window.program_obj.globals.length; i++) {
  17845. if (window.program_obj.globals[i] == var_obj) {
  17846. return true;
  17847. }
  17848. }
  17849. }
  17850. return false;
  17851. }
  17852. function refreshMenu(menu_var_or_value_dom) {
  17853. console.log('\n\n');
  17854. console.log(menu_var_or_value_dom);
  17855. console.log("olá, fui chamado! note alguns DATAS recuperados: ");
  17856. console.log(menu_var_or_value_dom.data());
  17857. console.log('\n\n\n');
  17858. }
  17859. function renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element) {
  17860. if (ref_object.function_called) {
  17861. menu_var_or_value.remove();
  17862. variableValueMenuCode(command, ref_object, dom_object, function_obj, menu_var_or_value, expression_element);
  17863. } else if (ref_object.content.type) {
  17864. menu_var_or_value.remove();
  17865. variableValueMenuCode(command, ref_object, dom_object, function_obj, menu_var_or_value, expression_element);
  17866. } else {
  17867. menu_var_or_value.remove();
  17868. variableValueMenuCode(command, ref_object, dom_object, function_obj, menu_var_or_value, expression_element);
  17869. }
  17870. }
  17871. function variableValueMenuCode(command, variable_obj, dom_object, function_obj, menu_var_or_value, expression_element) {
  17872. if (variable_obj.content || variable_obj.function_called) {
  17873. // Verificar se a variável ainda existe:
  17874. if (isVarInProgram(variable_obj.content, function_obj)) {} else {
  17875. if (variable_obj.content && variable_obj.content.type) {
  17876. variable_obj.content = null;
  17877. appendSelectText(variable_obj, menu_var_or_value);
  17878. }
  17879. }
  17880. } else {
  17881. appendSelectText(variable_obj, menu_var_or_value);
  17882. }
  17883. if (variable_obj.content == null && variable_obj.function_called == null) {
  17884. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  17885. return;
  17886. }
  17887. var ret = '';
  17888. if (variable_obj.function_called) {
  17889. if (variable_obj.function_called.parameters_list == null || variable_obj.function_called.length == 0) {
  17890. menu_var_or_value.find('.text').text(' ');
  17891. dom_object.find('.menu_var_or_value_dom').remove();
  17892. var parameters_menu;
  17893. if (variable_obj.function_called.name) {
  17894. parameters_menu = '<div class="parameters_function_called"> ' + variable_obj.function_called.name + ' <span> ( </span>';
  17895. } else {
  17896. parameters_menu = '<div class="parameters_function_called"> <i>' + _localizedStringsService.LocalizedStrings.getUI(variable_obj.function_called.category) + '.' + _localizedStringsService.LocalizedStrings.getUI(variable_obj.function_called.identifier) + '</i> <span> ( </span>';
  17897. }
  17898. parameters_menu += '<span> ) </span></div>';
  17899. parameters_menu = (0, _jquery2.default)(parameters_menu);
  17900. dom_object.append(parameters_menu);
  17901. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  17902. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  17903. if (command.type == Models.COMMAND_TYPES.attribution) {
  17904. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  17905. context_menu += '<div class="menu">';
  17906. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  17907. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  17908. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  17909. context_menu += '</div></div>';
  17910. }
  17911. context_menu += '</div></div>';
  17912. context_menu = (0, _jquery2.default)(context_menu);
  17913. context_menu.insertAfter(dom_object.find('.parameters_function_called'));
  17914. context_menu.dropdown({
  17915. onChange: function onChange(value, text, $selectedItem) {
  17916. console.log('S1');
  17917. if ($selectedItem.data('clear')) {
  17918. console.log('PP1');
  17919. dom_object.text('');
  17920. variable_obj.content = null;
  17921. variable_obj.row = null;
  17922. variable_obj.column = null;
  17923. delete variable_obj.function_called;
  17924. delete variable_obj.parameters_list;
  17925. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  17926. }
  17927. if ($selectedItem.data('exp')) {
  17928. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  17929. }
  17930. }
  17931. });
  17932. } else {
  17933. menu_var_or_value.find('.text').text(' ');
  17934. dom_object.find('.menu_var_or_value_dom').remove();
  17935. var parameters_menu;
  17936. if (variable_obj.function_called.name) {
  17937. parameters_menu = '<div class="parameters_function_called"> ' + variable_obj.function_called.name + ' <span> ( </span>';
  17938. } else {
  17939. parameters_menu = '<div class="parameters_function_called"> <i>' + _localizedStringsService.LocalizedStrings.getUI(variable_obj.function_called.category) + '.' + _localizedStringsService.LocalizedStrings.getUI(variable_obj.function_called.identifier) + '</i> <span> ( </span>';
  17940. }
  17941. for (var j = 0; j < variable_obj.function_called.parameters_list.length; j++) {
  17942. parameters_menu += '<div class="render_style_param parameter_' + j + '"></div>';
  17943. if (j + 1 != variable_obj.function_called.parameters_list.length) {
  17944. parameters_menu += ' , ';
  17945. }
  17946. }
  17947. parameters_menu += '<span> ) </span></div>';
  17948. parameters_menu = (0, _jquery2.default)(parameters_menu);
  17949. dom_object.append(parameters_menu);
  17950. for (var j = 0; j < variable_obj.function_called.parameters_list.length; j++) {
  17951. renderMenu(command, variable_obj.parameters_list[j], parameters_menu.find('.parameter_' + j), function_obj, 2, expression_element);
  17952. }
  17953. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  17954. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  17955. if (command.type == Models.COMMAND_TYPES.attribution) {
  17956. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  17957. context_menu += '<div class="menu">';
  17958. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  17959. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  17960. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  17961. context_menu += '</div></div>';
  17962. }
  17963. context_menu += '</div></div>';
  17964. context_menu = (0, _jquery2.default)(context_menu);
  17965. context_menu.insertAfter(parameters_menu);
  17966. context_menu.dropdown({
  17967. onChange: function onChange(value, text, $selectedItem) {
  17968. console.log('S2');
  17969. if ($selectedItem.data('clear')) {
  17970. console.log('PP2');
  17971. dom_object.text('');
  17972. variable_obj.content = null;
  17973. variable_obj.row = null;
  17974. variable_obj.column = null;
  17975. delete variable_obj.function_called;
  17976. delete variable_obj.parameters_list;
  17977. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  17978. }
  17979. if ($selectedItem.data('exp')) {
  17980. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  17981. }
  17982. }
  17983. });
  17984. }
  17985. } else if (variable_obj.content.type) {
  17986. var variable_render = "";
  17987. if (variable_obj.content.dimensions == 1) {
  17988. variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content.name + '</span>';
  17989. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ]</span>';
  17990. variable_render += '</div>';
  17991. variable_render = (0, _jquery2.default)(variable_render);
  17992. dom_object.append(variable_render);
  17993. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  17994. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  17995. if (command.type == Models.COMMAND_TYPES.attribution) {
  17996. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  17997. context_menu += '<div class="menu">';
  17998. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  17999. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18000. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18001. context_menu += '</div></div>';
  18002. }
  18003. context_menu += '</div></div>';
  18004. context_menu = (0, _jquery2.default)(context_menu);
  18005. variable_render.append(context_menu);
  18006. context_menu.dropdown({
  18007. onChange: function onChange(value, text, $selectedItem) {
  18008. console.log('S3');
  18009. if ($selectedItem.data('clear')) {
  18010. console.log('PP3');
  18011. dom_object.text('');
  18012. variable_obj.content = null;
  18013. variable_obj.row = null;
  18014. variable_obj.column = null;
  18015. delete variable_obj.function_called;
  18016. delete variable_obj.parameters_list;
  18017. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18018. }
  18019. if ($selectedItem.data('exp')) {
  18020. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18021. }
  18022. }
  18023. });
  18024. if (!variable_obj.column) {
  18025. variable_obj.column = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18026. }
  18027. variableValueMenuCode(command, variable_obj.column, (0, _jquery2.default)(variable_render.find('.column_container')), function_obj, menu_var_or_value, expression_element);
  18028. } else if (variable_obj.content.dimensions == 2) {
  18029. variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content.name + '</span>';
  18030. variable_render += ' <span>[ </span> <div class="row_container"></div> <span> ]</span>';
  18031. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ] </span>';
  18032. variable_render += '</div>';
  18033. variable_render = (0, _jquery2.default)(variable_render);
  18034. dom_object.append(variable_render);
  18035. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18036. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18037. if (command.type == Models.COMMAND_TYPES.attribution) {
  18038. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18039. context_menu += '<div class="menu">';
  18040. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18041. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18042. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18043. context_menu += '</div></div>';
  18044. }
  18045. context_menu += '</div></div>';
  18046. context_menu = (0, _jquery2.default)(context_menu);
  18047. variable_render.append(context_menu);
  18048. context_menu.dropdown({
  18049. onChange: function onChange(value, text, $selectedItem) {
  18050. console.log('S4');
  18051. if ($selectedItem.data('clear')) {
  18052. console.log('PP4');
  18053. dom_object.text('');
  18054. variable_obj.content = null;
  18055. variable_obj.row = null;
  18056. variable_obj.column = null;
  18057. delete variable_obj.function_called;
  18058. delete variable_obj.parameters_list;
  18059. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18060. }
  18061. if ($selectedItem.data('exp')) {
  18062. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18063. }
  18064. }
  18065. });
  18066. if (!variable_obj.column) {
  18067. variable_obj.column = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18068. }
  18069. if (!variable_obj.row) {
  18070. variable_obj.row = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18071. }
  18072. variableValueMenuCode(command, variable_obj.row, (0, _jquery2.default)(variable_render.find('.row_container')), function_obj, menu_var_or_value, expression_element);
  18073. variableValueMenuCode(command, variable_obj.column, (0, _jquery2.default)(variable_render.find('.column_container')), function_obj, menu_var_or_value, expression_element);
  18074. } else {
  18075. variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content.name + '</span>';
  18076. variable_render += '</div>';
  18077. variable_render = (0, _jquery2.default)(variable_render);
  18078. dom_object.append(variable_render);
  18079. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18080. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18081. if (command.type == Models.COMMAND_TYPES.attribution && !dom_object.hasClass('var_attributed')) {
  18082. console.log('dom_object6');
  18083. console.log(dom_object);
  18084. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18085. context_menu += '<div class="menu">';
  18086. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18087. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18088. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18089. context_menu += '</div></div>';
  18090. }
  18091. context_menu += '</div></div>';
  18092. context_menu = (0, _jquery2.default)(context_menu);
  18093. variable_render.append(context_menu);
  18094. context_menu.dropdown({
  18095. onChange: function onChange(value, text, $selectedItem) {
  18096. console.log('S5');
  18097. if ($selectedItem.data('clear')) {
  18098. console.log('PP5');
  18099. dom_object.text('');
  18100. variable_obj.content = null;
  18101. variable_obj.row = null;
  18102. variable_obj.column = null;
  18103. delete variable_obj.function_called;
  18104. delete variable_obj.parameters_list;
  18105. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18106. }
  18107. if ($selectedItem.data('exp')) {
  18108. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18109. }
  18110. }
  18111. });
  18112. }
  18113. } else {
  18114. var variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content + '</span>';
  18115. variable_render += '</div>';
  18116. variable_render = (0, _jquery2.default)(variable_render);
  18117. dom_object.append(variable_render);
  18118. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18119. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18120. if (command.type == Models.COMMAND_TYPES.attribution) {
  18121. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18122. context_menu += '<div class="menu">';
  18123. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18124. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18125. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18126. context_menu += '</div></div>';
  18127. }
  18128. context_menu += '</div></div>';
  18129. context_menu = (0, _jquery2.default)(context_menu);
  18130. if (variable_obj.variable_and_value != VAR_OR_VALUE_TYPES.only_value) {
  18131. context_menu.insertAfter(variable_render);
  18132. }
  18133. context_menu.dropdown({
  18134. onChange: function onChange(value, text, $selectedItem) {
  18135. console.log('S6');
  18136. if ($selectedItem.data('clear')) {
  18137. console.log('PP6');
  18138. dom_object.text('');
  18139. variable_obj.content = null;
  18140. variable_obj.row = null;
  18141. variable_obj.column = null;
  18142. delete variable_obj.function_called;
  18143. delete variable_obj.parameters_list;
  18144. dom_object.find('.value_rendered').remove();
  18145. dom_object.find('.context_menu_clear').remove();
  18146. dom_object.find('.width-dynamic-minus').remove();
  18147. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18148. }
  18149. if ($selectedItem.data('exp')) {
  18150. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18151. }
  18152. }
  18153. });
  18154. variable_render.on('click', function (e) {
  18155. variable_render.remove();
  18156. variable_render.empty();
  18157. variable_render.remove();
  18158. dom_object.empty();
  18159. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  18160. openInputToValue(command, variable_obj, dom_object, menu_var_or_value, function_obj, expression_element);
  18161. });
  18162. }
  18163. }
  18164. function addIVProgFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element) {
  18165. var sub_menu = menu_var_or_value.find('.menu_only_functions');
  18166. sub_menu.append('<div class="divider"></div><div class="header">' + _localizedStringsService.LocalizedStrings.getUI('text_header_ivprog_functions') + '</div>');
  18167. sub_menu.append('<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_menu_functions_math') + '<div class="menu menu_math_functions"></div></div>');
  18168. sub_menu.append('<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_menu_functions_text') + '<div class="menu menu_text_functions"></div></div>');
  18169. sub_menu.append('<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_menu_functions_arrangement') + '<div class="menu menu_arrangement_functions"></div></div>');
  18170. sub_menu.append('<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_menu_functions_conversion') + '<div class="menu menu_conversion_functions"></div></div>');
  18171. // Insert Math functions:
  18172. for (var i = 0; i < window.system_functions.length; i++) {
  18173. var t = (0, _jquery2.default)('<div class="item"></div>');
  18174. t.data('function_reference', window.system_functions[i]);
  18175. t.data('option', VAR_OR_VALUE_TYPES.only_function);
  18176. t.text(_localizedStringsService.LocalizedStrings.getUI(window.system_functions[i].identifier));
  18177. switch (window.system_functions[i].category) {
  18178. case Models.SYSTEM_FUNCTIONS_CATEGORIES.math:
  18179. sub_menu.find('.menu_math_functions').append(t);
  18180. break;
  18181. case Models.SYSTEM_FUNCTIONS_CATEGORIES.text:
  18182. sub_menu.find('.menu_text_functions').append(t);
  18183. break;
  18184. case Models.SYSTEM_FUNCTIONS_CATEGORIES.arrangement:
  18185. sub_menu.find('.menu_arrangement_functions').append(t);
  18186. break;
  18187. case Models.SYSTEM_FUNCTIONS_CATEGORIES.conversion:
  18188. sub_menu.find('.menu_conversion_functions').append(t);
  18189. break;
  18190. }
  18191. }
  18192. }
  18193. function addFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element) {
  18194. var sub_menu = menu_var_or_value.find('.menu_only_functions');
  18195. sub_menu.text('');
  18196. for (var i = 0; i < window.program_obj.functions.length; i++) {
  18197. var temp = (0, _jquery2.default)('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_function + '">' + window.program_obj.functions[i].name + ' </div>');
  18198. temp.data('function_reference', window.program_obj.functions[i]);
  18199. sub_menu.append(temp);
  18200. }
  18201. }
  18202. function addVariablesToMenu(function_obj, menu_var_or_value, ref_object, expression_element) {
  18203. var sub_menu = menu_var_or_value.find('.menu_only_vars');
  18204. sub_menu.text('');
  18205. if (window.program_obj.globals) {
  18206. if (ref_object.include_constant) {
  18207. for (var i = 0; i < window.program_obj.globals.length; i++) {
  18208. var temp = (0, _jquery2.default)('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + window.program_obj.globals[i].name + ' </div>');
  18209. temp.data('variable_reference', window.program_obj.globals[i]);
  18210. sub_menu.append(temp);
  18211. }
  18212. } else {
  18213. for (var i = 0; i < window.program_obj.globals.length; i++) {
  18214. if (!window.program_obj.globals[i].is_constant) {
  18215. var temp = (0, _jquery2.default)('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + window.program_obj.globals[i].name + ' </div>');
  18216. temp.data('variable_reference', window.program_obj.globals[i]);
  18217. sub_menu.append(temp);
  18218. }
  18219. }
  18220. }
  18221. }
  18222. if (function_obj.parameters_list) {
  18223. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  18224. var temp = (0, _jquery2.default)('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + function_obj.parameters_list[i].name + ' </div>');
  18225. temp.data('variable_reference', function_obj.parameters_list[i]);
  18226. sub_menu.append(temp);
  18227. }
  18228. }
  18229. if (function_obj.variables_list) {
  18230. for (var i = 0; i < function_obj.variables_list.length; i++) {
  18231. var temp = (0, _jquery2.default)('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + function_obj.variables_list[i].name + ' </div>');
  18232. temp.data('variable_reference', function_obj.variables_list[i]);
  18233. sub_menu.append(temp);
  18234. }
  18235. }
  18236. }
  18237. function addHandlers(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element) {
  18238. if (ref_object.variable_and_value != VAR_OR_VALUE_TYPES.only_value) {
  18239. menu_var_or_value.dropdown({
  18240. onChange: function onChange(value, text, $selectedItem) {
  18241. console.log('S7');
  18242. dom_object.find('.var_name').remove();
  18243. switch ($selectedItem.data('option')) {
  18244. case VAR_OR_VALUE_TYPES.only_function:
  18245. openInputToFunction(command, ref_object, dom_object, menu_var_or_value, function_obj, (0, _jquery2.default)($selectedItem).data('function_reference'), expression_element);
  18246. break;
  18247. case VAR_OR_VALUE_TYPES.only_value:
  18248. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  18249. break;
  18250. case VAR_OR_VALUE_TYPES.only_variable:
  18251. openInputToVariable(command, ref_object, dom_object, menu_var_or_value, function_obj, (0, _jquery2.default)($selectedItem).data('variable_reference'), expression_element);
  18252. break;
  18253. }
  18254. if ($selectedItem.data('exp')) {
  18255. AttribuitionsManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18256. }
  18257. if (command.type == Models.COMMAND_TYPES.repeatNtimes) {
  18258. RepeatNTimesManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18259. }
  18260. }
  18261. });
  18262. }
  18263. dom_object.find('.width-dynamic').on('input', function () {
  18264. var inputWidth = (0, _jquery2.default)(this).textWidth() + 10;
  18265. (0, _jquery2.default)(this).focus();
  18266. var tmpStr = (0, _jquery2.default)(this).val();
  18267. (0, _jquery2.default)(this).val('');
  18268. (0, _jquery2.default)(this).val(tmpStr);
  18269. (0, _jquery2.default)(this).css({
  18270. width: inputWidth
  18271. });
  18272. }).trigger('input');
  18273. if (command.type == Models.COMMAND_TYPES.comment) {
  18274. dom_object.parent().on('click', function (e) {
  18275. dom_object.find('.value_rendered').remove();
  18276. dom_object.find('.value_rendered').empty();
  18277. dom_object.find('.value_rendered').remove();
  18278. dom_object.empty();
  18279. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  18280. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  18281. });
  18282. }
  18283. }
  18284. function openInputToFunction(command, ref_object, dom_object, menu_var_or_value, function_obj, function_selected, expression_element) {
  18285. ref_object.function_called = function_selected;
  18286. ref_object.parameters_list = [];
  18287. if (function_selected.parameters_list != null && function_selected.parameters_list.length > 0) {
  18288. menu_var_or_value.find('.text').text(' ');
  18289. dom_object.find('.menu_var_or_value_dom').remove();
  18290. var parameters_menu;
  18291. if (function_selected.name) {
  18292. parameters_menu = '<div class="parameters_function_called"> ' + function_selected.name + ' <span> ( </span>';
  18293. } else {
  18294. parameters_menu = '<div class="parameters_function_called"> <i>' + _localizedStringsService.LocalizedStrings.getUI(function_selected.category) + '.' + _localizedStringsService.LocalizedStrings.getUI(function_selected.identifier) + '</i> <span> ( </span>';
  18295. }
  18296. for (var j = 0; j < function_selected.parameters_list.length; j++) {
  18297. parameters_menu += '<div class="render_style_param parameter_' + j + '"></div>';
  18298. if (j + 1 != function_selected.parameters_list.length) {
  18299. parameters_menu += ' , ';
  18300. }
  18301. }
  18302. parameters_menu += '<span> ) </span></div>';
  18303. parameters_menu = (0, _jquery2.default)(parameters_menu);
  18304. dom_object.append(parameters_menu);
  18305. for (var j = 0; j < function_selected.parameters_list.length; j++) {
  18306. var temp = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18307. ref_object.parameters_list.push(temp);
  18308. renderMenu(command, temp, parameters_menu.find('.parameter_' + j), function_obj, 2, expression_element);
  18309. }
  18310. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18311. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18312. if (command.type == Models.COMMAND_TYPES.attribution) {
  18313. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18314. context_menu += '<div class="menu">';
  18315. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18316. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18317. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18318. context_menu += '</div></div>';
  18319. }
  18320. context_menu += '</div></div>';
  18321. context_menu = (0, _jquery2.default)(context_menu);
  18322. context_menu.insertAfter(dom_object.find('.parameters_function_called'));
  18323. context_menu.dropdown({
  18324. onChange: function onChange(value, text, $selectedItem) {
  18325. console.log('S8');
  18326. if ($selectedItem.data('clear')) {
  18327. console.log('PP7');
  18328. dom_object.text('');
  18329. ref_object.content = null;
  18330. ref_object.row = null;
  18331. ref_object.column = null;
  18332. delete ref_object.function_called;
  18333. delete ref_object.parameters_list;
  18334. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  18335. }
  18336. if ($selectedItem.data('exp')) {
  18337. AttribuitionsManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18338. }
  18339. }
  18340. });
  18341. } else {
  18342. menu_var_or_value.find('.text').text(' ');
  18343. dom_object.find('.menu_var_or_value_dom').remove();
  18344. var parameters_menu;
  18345. if (function_selected.name) {
  18346. parameters_menu = '<div class="parameters_function_called"> ' + function_selected.name + ' <span> ( </span>';
  18347. } else {
  18348. parameters_menu = '<div class="parameters_function_called"> <i>' + _localizedStringsService.LocalizedStrings.getUI(function_selected.category) + '.' + _localizedStringsService.LocalizedStrings.getUI(function_selected.identifier) + '</i> <span> ( </span>';
  18349. }
  18350. parameters_menu += '<span> ) </span></div>';
  18351. parameters_menu = (0, _jquery2.default)(parameters_menu);
  18352. dom_object.append(parameters_menu);
  18353. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18354. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18355. if (command.type == Models.COMMAND_TYPES.attribution) {
  18356. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18357. context_menu += '<div class="menu">';
  18358. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18359. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18360. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18361. context_menu += '</div></div>';
  18362. }
  18363. context_menu += '</div></div>';
  18364. context_menu = (0, _jquery2.default)(context_menu);
  18365. context_menu.insertAfter(dom_object.find('.parameters_function_called'));
  18366. context_menu.dropdown({
  18367. onChange: function onChange(value, text, $selectedItem) {
  18368. console.log('S9');
  18369. if ($selectedItem.data('clear')) {
  18370. console.log('PP8');
  18371. dom_object.text('');
  18372. ref_object.content = null;
  18373. ref_object.row = null;
  18374. ref_object.column = null;
  18375. delete ref_object.function_called;
  18376. delete ref_object.parameters_list;
  18377. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  18378. }
  18379. if ($selectedItem.data('exp')) {
  18380. AttribuitionsManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18381. }
  18382. }
  18383. });
  18384. }
  18385. if (command.type == Models.COMMAND_TYPES.attribution) {
  18386. AttribuitionsManagement.renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj);
  18387. }
  18388. }
  18389. function openInputToVariable(command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected, expression_element) {
  18390. ref_object.content = variable_selected;
  18391. menu_var_or_value.find('.text').text(' ');
  18392. dom_object.find('.menu_var_or_value_dom').remove();
  18393. var variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_selected.name + '</span>';
  18394. if (variable_selected.dimensions == 1) {
  18395. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ]</span>';
  18396. }
  18397. if (variable_selected.dimensions == 2) {
  18398. variable_render += ' <span>[ </span> <div class="row_container"></div> <span> ]</span> ';
  18399. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ]</span>';
  18400. }
  18401. variable_render += '</div>';
  18402. variable_render = (0, _jquery2.default)(variable_render);
  18403. dom_object.append(variable_render);
  18404. if (variable_selected.dimensions == 1) {
  18405. ref_object.column = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18406. renderMenu(command, ref_object.column, variable_render.find('.column_container'), function_obj, 2, expression_element);
  18407. }
  18408. if (variable_selected.dimensions == 2) {
  18409. ref_object.row = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18410. renderMenu(command, ref_object.row, variable_render.find('.row_container'), function_obj, 2, expression_element);
  18411. ref_object.column = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18412. renderMenu(command, ref_object.column, variable_render.find('.column_container'), function_obj, 2, expression_element);
  18413. }
  18414. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18415. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18416. if (command.type == Models.COMMAND_TYPES.attribution && !dom_object.hasClass('var_attributed')) {
  18417. console.log("dom_object 10: ");
  18418. console.log(dom_object);
  18419. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18420. context_menu += '<div class="menu">';
  18421. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18422. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18423. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18424. context_menu += '</div></div>';
  18425. }
  18426. context_menu += '</div></div>';
  18427. context_menu = (0, _jquery2.default)(context_menu);
  18428. context_menu.insertAfter(dom_object.find('.variable_rendered'));
  18429. context_menu.dropdown({
  18430. onChange: function onChange(value, text, $selectedItem) {
  18431. console.log('S10');
  18432. if ($selectedItem.data('clear')) {
  18433. console.log('PP9');
  18434. dom_object.text('');
  18435. ref_object.content = null;
  18436. ref_object.row = null;
  18437. ref_object.column = null;
  18438. delete ref_object.function_called;
  18439. delete ref_object.parameters_list;
  18440. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  18441. }
  18442. if ($selectedItem.data('exp')) {
  18443. AttribuitionsManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18444. }
  18445. if (command.type == Models.COMMAND_TYPES.repeatNtimes) {
  18446. RepeatNTimesManagement.manageClearExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18447. }
  18448. }
  18449. });
  18450. if (command.type == Models.COMMAND_TYPES.attribution) {
  18451. AttribuitionsManagement.renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected);
  18452. }
  18453. }
  18454. function openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element) {
  18455. if (ref_object.content == null) {
  18456. ref_object.content = "";
  18457. }
  18458. menu_var_or_value.find('.text').text(' ');
  18459. var field = (0, _jquery2.default)('<input type="text" size="2" class="width-dynamic-minus" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" />');
  18460. field.insertBefore(dom_object.find('.menu_var_or_value_dom'));
  18461. var rendered = (0, _jquery2.default)('<div class="value_rendered"></div>');
  18462. rendered.insertBefore(field);
  18463. field.focus();
  18464. field.val(ref_object.content);
  18465. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18466. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18467. if (command.type == Models.COMMAND_TYPES.attribution) {
  18468. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18469. context_menu += '<div class="menu">';
  18470. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18471. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18472. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18473. context_menu += '</div></div>';
  18474. }
  18475. context_menu += '</div></div>';
  18476. context_menu = (0, _jquery2.default)(context_menu);
  18477. dom_object.find('.menu_var_or_value_dom').remove();
  18478. if (ref_object.variable_and_value != VAR_OR_VALUE_TYPES.only_value) {
  18479. context_menu.insertAfter(field);
  18480. }
  18481. context_menu.dropdown({
  18482. onChange: function onChange(value, text, $selectedItem) {
  18483. console.log('S11');
  18484. if ($selectedItem.data('clear')) {
  18485. console.log('PP10');
  18486. dom_object.text('');
  18487. dom_object.find('.value_rendered').remove();
  18488. dom_object.find('.context_menu_clear').remove();
  18489. dom_object.find('.width-dynamic-minus').remove();
  18490. ref_object.content = null;
  18491. ref_object.row = null;
  18492. ref_object.column = null;
  18493. delete ref_object.function_called;
  18494. delete ref_object.parameters_list;
  18495. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  18496. }
  18497. if ($selectedItem.data('exp')) {
  18498. AttribuitionsManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18499. }
  18500. }
  18501. });
  18502. dom_object.find('.width-dynamic-minus').focusout(function () {
  18503. if ((0, _jquery2.default)(this).val().trim()) {
  18504. ref_object.content = (0, _jquery2.default)(this).val().trim();
  18505. }
  18506. rendered.text(ref_object.content);
  18507. (0, _jquery2.default)(this).remove();
  18508. });
  18509. dom_object.find('.width-dynamic-minus').on('keydown', function (e) {
  18510. var code = e.keyCode || e.which;
  18511. if (code == 13) {
  18512. if ((0, _jquery2.default)(this).val().trim()) {
  18513. ref_object.content = (0, _jquery2.default)(this).val().trim();
  18514. }
  18515. rendered.text(ref_object.content);
  18516. (0, _jquery2.default)(this).remove();
  18517. }
  18518. if (code == 27) {
  18519. rendered.text(ref_object.content);
  18520. (0, _jquery2.default)(this).remove();
  18521. }
  18522. });
  18523. if (command.type == Models.COMMAND_TYPES.comment) {
  18524. rendered.parent().on('click', function (e) {
  18525. console.log("TTT14");
  18526. rendered.remove();
  18527. rendered.empty();
  18528. rendered.remove();
  18529. dom_object.empty();
  18530. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  18531. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  18532. });
  18533. }
  18534. rendered.on('click', function (e) {
  18535. console.log("TTT2");
  18536. rendered.remove();
  18537. rendered.empty();
  18538. rendered.remove();
  18539. dom_object.empty();
  18540. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  18541. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  18542. });
  18543. if (command.type == Models.COMMAND_TYPES.attribution) {
  18544. AttribuitionsManagement.renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj);
  18545. }
  18546. }
  18547. _jquery2.default.fn.textWidth = function (text, font) {
  18548. if (!_jquery2.default.fn.textWidth.fakeEl) _jquery2.default.fn.textWidth.fakeEl = (0, _jquery2.default)('<span>').hide().appendTo(document.body);
  18549. _jquery2.default.fn.textWidth.fakeEl.text(text || this.val() || this.text() || this.attr('placeholder')).css('font', font || this.css('font'));
  18550. return _jquery2.default.fn.textWidth.fakeEl.width();
  18551. };
  18552. /***/ }),
  18553. /***/ "./js/visualUI/commands/whiletrue.js":
  18554. /*!*******************************************!*\
  18555. !*** ./js/visualUI/commands/whiletrue.js ***!
  18556. \*******************************************/
  18557. /*! no static exports found */
  18558. /***/ (function(module, exports, __webpack_require__) {
  18559. "use strict";
  18560. Object.defineProperty(exports, "__esModule", {
  18561. value: true
  18562. });
  18563. exports.createFloatingCommand = createFloatingCommand;
  18564. exports.renderCommand = renderCommand;
  18565. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  18566. var _jquery2 = _interopRequireDefault(_jquery);
  18567. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  18568. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  18569. var Models = _interopRequireWildcard(_ivprog_elements);
  18570. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  18571. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  18572. var GlobalsManagement = _interopRequireWildcard(_globals);
  18573. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  18574. var VariablesManagement = _interopRequireWildcard(_variables);
  18575. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  18576. var CommandsManagement = _interopRequireWildcard(_commands);
  18577. var _conditional_expression = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  18578. var ConditionalExpressionManagement = _interopRequireWildcard(_conditional_expression);
  18579. var _contextualized_menu = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  18580. var ContextualizedMenu = _interopRequireWildcard(_contextualized_menu);
  18581. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  18582. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  18583. function createFloatingCommand() {
  18584. return (0, _jquery2.default)('<div class="ui whiletrue created_element"> <i class="ui icon small sync"></i> <span> ' + _localizedStringsService.LocalizedStrings.getUI('text_code_while') + ' ( x < 10 ) { } </span></div>');
  18585. }
  18586. function renderCommand(command, function_obj) {
  18587. var ret = '';
  18588. ret += '<div class="ui whiletrue 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 class="span_command_spec"> ' + _localizedStringsService.LocalizedStrings.getUI('text_code_while') + ' </span>';
  18589. ret += '<span class="span_command_spec"> ( </span> <div class="conditional_expression"></div> <span class="span_command_spec"> ) </span>';
  18590. ret += ' </span>';
  18591. ret += '<div class="ui block_commands">';
  18592. ret += '</div>';
  18593. ret += '<span> </span>';
  18594. ret += '</div>';
  18595. var el = (0, _jquery2.default)(ret);
  18596. el.data('command', command);
  18597. addHandlers(command, function_obj, el);
  18598. ContextualizedMenu.renderMenu(command, el.find('.context_menu'), function_obj, el);
  18599. ConditionalExpressionManagement.renderExpression(command, command.expression, function_obj, el.find('.conditional_expression'));
  18600. if (command.commands_block) {
  18601. for (var j = 0; j < command.commands_block.length; j++) {
  18602. CommandsManagement.renderCommand(command.commands_block[j], (0, _jquery2.default)(el.find('.block_commands')[0]), 3, function_obj);
  18603. }
  18604. }
  18605. return el;
  18606. }
  18607. function addHandlers(command, function_obj, whiletrue_dom) {
  18608. whiletrue_dom.find('.button_remove_command').on('click', function () {
  18609. if (CommandsManagement.removeCommand(command, function_obj, whiletrue_dom)) {
  18610. whiletrue_dom.fadeOut();
  18611. }
  18612. });
  18613. }
  18614. /***/ }),
  18615. /***/ "./js/visualUI/commands/writer.js":
  18616. /*!****************************************!*\
  18617. !*** ./js/visualUI/commands/writer.js ***!
  18618. \****************************************/
  18619. /*! no static exports found */
  18620. /***/ (function(module, exports, __webpack_require__) {
  18621. "use strict";
  18622. Object.defineProperty(exports, "__esModule", {
  18623. value: true
  18624. });
  18625. exports.createFloatingCommand = createFloatingCommand;
  18626. exports.renderCommand = renderCommand;
  18627. exports.addContent = addContent;
  18628. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  18629. var _jquery2 = _interopRequireDefault(_jquery);
  18630. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  18631. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  18632. var Models = _interopRequireWildcard(_ivprog_elements);
  18633. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  18634. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  18635. var GlobalsManagement = _interopRequireWildcard(_globals);
  18636. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  18637. var VariablesManagement = _interopRequireWildcard(_variables);
  18638. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  18639. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  18640. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  18641. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  18642. var CommandsManagement = _interopRequireWildcard(_commands);
  18643. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  18644. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  18645. function createFloatingCommand() {
  18646. return (0, _jquery2.default)('<div class="ui writer created_element"> <i class="ui icon small upload"></i> <span> ' + _localizedStringsService.LocalizedStrings.getUI('text_command_write') + ' var </span></div>');
  18647. }
  18648. function renderCommand(command, function_obj) {
  18649. var ret = '';
  18650. 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">' + _localizedStringsService.LocalizedStrings.getUI('text_command_write') + ' ( </span><div class="all_elements_write"></div> <span class="close_parentheses span_command_spec">)</span> </div>';
  18651. var el = (0, _jquery2.default)(ret);
  18652. el.data('command', command);
  18653. for (var i = 0; i < command.content.length; i++) {
  18654. var new_div_item = (0, _jquery2.default)('<div class="var_value_menu_div"></div>');
  18655. el.find('.all_elements_write').append(new_div_item);
  18656. VariableValueMenu.renderMenu(command, command.content[i], new_div_item, function_obj);
  18657. addHandlerIconAdd(el.find('.all_elements_write'), command, function_obj);
  18658. }
  18659. addHandlers(command, function_obj, el);
  18660. return el;
  18661. }
  18662. function addHandlers(command, function_obj, writer_dom) {
  18663. writer_dom.find('.button_remove_command').on('click', function () {
  18664. if (CommandsManagement.removeCommand(command, function_obj, writer_dom)) {
  18665. writer_dom.fadeOut();
  18666. }
  18667. });
  18668. }
  18669. function addHandlerIconAdd(dom_object, command, function_obj) {
  18670. var insert_after = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  18671. var after_which = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
  18672. var icon_add_item = (0, _jquery2.default)('<i class="ui icon plus square outline icon_add_item_to_writer"></i> ');
  18673. if (!insert_after) {
  18674. dom_object.append(icon_add_item);
  18675. } else {
  18676. icon_add_item.insertAfter(after_which);
  18677. }
  18678. icon_add_item.on('click', function (e) {
  18679. var new_div_item = (0, _jquery2.default)('<div class="var_value_menu_div" style="display:none;"></div>');
  18680. new_div_item.insertAfter(icon_add_item);
  18681. var new_related_menu = new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18682. VariableValueMenu.renderMenu(command, new_related_menu, new_div_item, function_obj);
  18683. addHandlerIconAdd(dom_object, command, function_obj, true, new_div_item);
  18684. var pos = 1;
  18685. dom_object.find('.icon_add_item_to_writer').each(function () {
  18686. if ((0, _jquery2.default)(this).get(0) === icon_add_item.get(0)) {
  18687. command.content.splice(pos, 0, new_related_menu);
  18688. } else {
  18689. pos++;
  18690. }
  18691. });
  18692. new_div_item.fadeIn();
  18693. });
  18694. }
  18695. function addContent(command, ref_object, dom_object, menu_var_or_value, function_obj, ref_object_content) {
  18696. if (dom_object.hasClass('var_value_menu_div')) {
  18697. var icon_add_item = (0, _jquery2.default)('<i class="ui icon plus square outline icon_add_item_to_writer"></i> ');
  18698. icon_add_item.insertAfter(dom_object);
  18699. icon_add_item.on('click', function (e) {
  18700. var new_div_item = (0, _jquery2.default)('<div class="var_value_menu_div"></div>');
  18701. new_div_item.insertAfter(icon_add_item);
  18702. var new_related_menu = new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18703. VariableValueMenu.renderMenu(command, new_related_menu, new_div_item, function_obj);
  18704. command.content.push(new_related_menu);
  18705. });
  18706. }
  18707. }
  18708. /***/ }),
  18709. /***/ "./js/visualUI/functions.js":
  18710. /*!**********************************!*\
  18711. !*** ./js/visualUI/functions.js ***!
  18712. \**********************************/
  18713. /*! no static exports found */
  18714. /***/ (function(module, exports, __webpack_require__) {
  18715. "use strict";
  18716. Object.defineProperty(exports, "__esModule", {
  18717. value: true
  18718. });
  18719. exports.renderFunction = renderFunction;
  18720. exports.initVisualUI = initVisualUI;
  18721. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  18722. var _jquery2 = _interopRequireDefault(_jquery);
  18723. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  18724. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  18725. var Models = _interopRequireWildcard(_ivprog_elements);
  18726. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  18727. var _globals = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  18728. var GlobalsManagement = _interopRequireWildcard(_globals);
  18729. var _variables = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  18730. var VariablesManagement = _interopRequireWildcard(_variables);
  18731. var _commands = __webpack_require__(/*! ./commands */ "./js/visualUI/commands.js");
  18732. var CommandsManagement = _interopRequireWildcard(_commands);
  18733. var _code_generator = __webpack_require__(/*! ./code_generator */ "./js/visualUI/code_generator.js");
  18734. var CodeManagement = _interopRequireWildcard(_code_generator);
  18735. var _variable_value_menu = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  18736. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  18737. var _domConsole = __webpack_require__(/*! ./../io/domConsole */ "./js/io/domConsole.js");
  18738. var _ivprogParser = __webpack_require__(/*! ./../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  18739. var _ivprogProcessor = __webpack_require__(/*! ./../processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  18740. var _melankeWatchjs = __webpack_require__(/*! melanke-watchjs */ "./node_modules/melanke-watchjs/src/watch.js");
  18741. var _melankeWatchjs2 = _interopRequireDefault(_melankeWatchjs);
  18742. var _semanticAnalyser = __webpack_require__(/*! ../processor/semantic/semanticAnalyser */ "./js/processor/semantic/semanticAnalyser.js");
  18743. var _ivprogAssessment = __webpack_require__(/*! ../assessment/ivprogAssessment */ "./js/assessment/ivprogAssessment.js");
  18744. var _algorithm = __webpack_require__(/*! ./algorithm */ "./js/visualUI/algorithm.js");
  18745. var AlgorithmManagement = _interopRequireWildcard(_algorithm);
  18746. __webpack_require__(/*! ../Sortable.js */ "./js/Sortable.js");
  18747. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  18748. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  18749. var counter_new_functions = 0;
  18750. var counter_new_parameters = 0;
  18751. var studentTemp = null;
  18752. var domConsole = null;
  18753. window.studentGrade = null;
  18754. var program = new Models.Program();
  18755. window.system_functions = [];
  18756. // Adding math functions:
  18757. window.system_functions.push(new Models.SystemFunction('$sin', _types.Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
  18758. window.system_functions.push(new Models.SystemFunction('$cos', _types.Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
  18759. window.system_functions.push(new Models.SystemFunction('$tan', _types.Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
  18760. window.system_functions.push(new Models.SystemFunction('$sqrt', _types.Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
  18761. window.system_functions.push(new Models.SystemFunction('$pow', _types.Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true), new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
  18762. window.system_functions.push(new Models.SystemFunction('$log', _types.Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
  18763. window.system_functions.push(new Models.SystemFunction('$abs', _types.Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
  18764. window.system_functions.push(new Models.SystemFunction('$negate', _types.Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
  18765. window.system_functions.push(new Models.SystemFunction('$invert', _types.Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
  18766. window.system_functions.push(new Models.SystemFunction('$max', _types.Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
  18767. window.system_functions.push(new Models.SystemFunction('$min', _types.Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
  18768. // Adding text functions:
  18769. window.system_functions.push(new Models.SystemFunction('$substring', _types.Types.TEXT, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true), new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true), new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.text));
  18770. window.system_functions.push(new Models.SystemFunction('$length', _types.Types.INTEGER, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.text));
  18771. window.system_functions.push(new Models.SystemFunction('$uppercase', _types.Types.TEXT, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.text));
  18772. window.system_functions.push(new Models.SystemFunction('$lowercase', _types.Types.TEXT, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.text));
  18773. window.system_functions.push(new Models.SystemFunction('$charAt', _types.Types.TEXT, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true), new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.text));
  18774. // Adding arrangement functions:
  18775. window.system_functions.push(new Models.SystemFunction('$numElements', _types.Types.INTEGER, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.arrangement));
  18776. window.system_functions.push(new Models.SystemFunction('$matrixLines', _types.Types.INTEGER, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.arrangement));
  18777. window.system_functions.push(new Models.SystemFunction('$matrixColumns', _types.Types.INTEGER, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.arrangement));
  18778. // Adding conversion functions:
  18779. window.system_functions.push(new Models.SystemFunction('$isReal', _types.Types.BOOLEAN, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.conversion));
  18780. window.system_functions.push(new Models.SystemFunction('$isInt', _types.Types.BOOLEAN, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.conversion));
  18781. window.system_functions.push(new Models.SystemFunction('$isBool', _types.Types.BOOLEAN, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.conversion));
  18782. window.system_functions.push(new Models.SystemFunction('$castReal', _types.Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.conversion));
  18783. window.system_functions.push(new Models.SystemFunction('$castInt', _types.Types.INTEGER, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.conversion));
  18784. window.system_functions.push(new Models.SystemFunction('$castBool', _types.Types.BOOLEAN, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.conversion));
  18785. window.system_functions.push(new Models.SystemFunction('$castString', _types.Types.TEXT, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.conversion));
  18786. /*const variable1 = new Models.Variable(Types.INTEGER, "a", 1);
  18787. const parameter1 = new Models.Variable(Types.INTEGER, "par_1", 1);
  18788. const command1 = new Models.Comment(new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.only_value, "Testing rendering commands"));
  18789. const sumFunction = new Models.Function("soma", Types.INTEGER, 0, [parameter1], false, false, [], null, [command1]);
  18790. program.addFunction(sumFunction);
  18791. */
  18792. console.log(' ___ ___ ________ \n / / / / / ____/ \n / / / / / / \n / / / / ______ ___ / /__ \n / / / / / \\ / / / ___/ \n / /______ / / / /\\ \\/ / / / \n / / / / / / \\ / / /____ \n/__________/ /___/ /___/ \\___/ /________/ ');
  18793. var mainFunction = new Models.Function(_localizedStringsService.LocalizedStrings.getUI("start"), _types.Types.VOID, 0, [], true, false);
  18794. mainFunction.function_comment = new Models.Comment(_localizedStringsService.LocalizedStrings.getUI('text_comment_main'));
  18795. program.addFunction(mainFunction);
  18796. window.program_obj = program;
  18797. window.generator = CodeManagement.generate;
  18798. window.runCodeAssessment = runCodeAssessment;
  18799. window.renderAlgorithm = AlgorithmManagement.renderAlgorithm;
  18800. window.insertContext = false;
  18801. _melankeWatchjs2.default.watch(program.globals, function () {
  18802. if (window.insertContext) {
  18803. setTimeout(function () {
  18804. AlgorithmManagement.renderAlgorithm();
  18805. }, 300);
  18806. window.insertContext = false;
  18807. } else {
  18808. AlgorithmManagement.renderAlgorithm();
  18809. }
  18810. }, 1);
  18811. function addFunctionHandler() {
  18812. var new_function = new Models.Function(_localizedStringsService.LocalizedStrings.getUI("new_function") + "_" + counter_new_functions, _types.Types.VOID, 0, [], false, false, [], new Models.Comment(_localizedStringsService.LocalizedStrings.getUI('text_comment_start')));
  18813. program.addFunction(new_function);
  18814. counter_new_functions++;
  18815. var newe = renderFunction(new_function);
  18816. newe.css('display', 'none');
  18817. newe.fadeIn();
  18818. }
  18819. function addParameter(function_obj, function_container) {
  18820. var is_from_click = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  18821. if (function_obj.parameters_list == null) {
  18822. function_obj.parameters_list = [];
  18823. }
  18824. var new_parameter = new Models.Variable(_types.Types.INTEGER, _localizedStringsService.LocalizedStrings.getUI("new_parameter") + "_" + counter_new_parameters);
  18825. function_obj.parameters_list.push(new_parameter);
  18826. counter_new_parameters++;
  18827. var newe = renderParameter(function_obj, new_parameter, function_container);
  18828. if (is_from_click) {
  18829. newe.css('display', 'none');
  18830. newe.fadeIn();
  18831. }
  18832. }
  18833. function updateReturnType(function_obj, new_type) {
  18834. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  18835. function_obj.return_type = new_type;
  18836. function_obj.return_dimensions = new_dimensions;
  18837. }
  18838. function removeFunction(function_obj) {
  18839. var index = program.functions.indexOf(function_obj);
  18840. if (index > -1) {
  18841. program.functions.splice(index, 1);
  18842. }
  18843. }
  18844. function minimizeFunction(function_obj) {
  18845. function_obj.is_hidden = !function_obj.is_hidden;
  18846. }
  18847. function addHandlers(function_obj, function_container) {
  18848. function_container.find('.ui.dropdown.function_return').dropdown({
  18849. onChange: function onChange(value, text, $selectedItem) {
  18850. if ($selectedItem.data('dimensions')) {
  18851. updateReturnType(function_obj, _types.Types[$selectedItem.data('type')], $selectedItem.data('dimensions'));
  18852. } else {
  18853. updateReturnType(function_obj, _types.Types[$selectedItem.data('type')]);
  18854. }
  18855. }
  18856. });
  18857. function_container.find(".name_function_updated").on('click', function (e) {
  18858. enableNameFunctionUpdate(function_obj, function_container);
  18859. });
  18860. function_container.find(".add_parameter_button").on('click', function (e) {
  18861. window.insertContext = true;
  18862. addParameter(function_obj, function_container, true);
  18863. });
  18864. function_container.find('.menu_commands').dropdown({
  18865. on: 'hover'
  18866. });
  18867. function_container.find('.menu_commands a').on('click', function (evt) {
  18868. if (function_obj.commands == null || function_obj.commands.length == 0) {
  18869. function_obj.commands = [];
  18870. var new_cmd = CommandsManagement.genericCreateCommand((0, _jquery2.default)(this).data('command'));
  18871. function_obj.commands.push(new_cmd);
  18872. CommandsManagement.renderCommand(new_cmd, function_container.find('.commands_list_div'), 3, function_obj);
  18873. } else {
  18874. CommandsManagement.createFloatingCommand(function_obj, function_container, (0, _jquery2.default)(this).data('command'), evt);
  18875. }
  18876. });
  18877. function_container.find('.add_var_button_function').on('click', function (e) {
  18878. window.insertContext = true;
  18879. VariablesManagement.addVariable(function_obj, function_container, true);
  18880. });
  18881. function_container.find('.remove_function_button').on('click', function (e) {
  18882. removeFunction(function_obj);
  18883. function_container.fadeOut();
  18884. });
  18885. function_container.find('.minimize_function_button').on('click', function (e) {
  18886. minimizeFunction(function_obj);
  18887. if (function_obj.is_hidden) {
  18888. function_container.find(".add_var_button_function").toggle();
  18889. function_container.find(".inline_add_command").toggle();
  18890. function_container.find(".function_area").slideToggle();
  18891. } else {
  18892. function_container.find(".function_area").slideToggle(function () {
  18893. function_container.find(".add_var_button_function").toggle();
  18894. function_container.find(".inline_add_command").toggle();
  18895. });
  18896. }
  18897. });
  18898. }
  18899. // Essa função imprime o tipo de retorno da função e cria o menu do tipo 'select' para alteração
  18900. function renderFunctionReturn(function_obj, function_element) {
  18901. var ret = '<div class="ui dropdown function_return">';
  18902. if (function_obj.return_dimensions > 0) {
  18903. ret += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI("vector") + ':' + _localizedStringsService.LocalizedStrings.getUI(function_obj.return_type);
  18904. if (function_obj.return_dimensions == 1) {
  18905. ret += ' [ ] ';
  18906. } else {
  18907. ret += ' [ ] [ ] ';
  18908. }
  18909. ret += '</div>';
  18910. } else {
  18911. ret += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI(function_obj.return_type) + '</div>';
  18912. }
  18913. ret += '<div class="menu">';
  18914. for (var tm in _types.Types) {
  18915. ret += '<div class="item ' + (function_obj.return_type == tm.toLowerCase() && function_obj.return_dimensions < 1 ? ' selected ' : '') + '" data-type="' + tm + '" >' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + '</div>';
  18916. }
  18917. for (var tm in _types.Types) {
  18918. if (tm == _types.Types.VOID.toUpperCase()) {
  18919. continue;
  18920. }
  18921. ret += '<div class="item">' + '<i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + '<div class="menu">' + '<div class="item ' + (function_obj.return_type == tm.toLowerCase() && function_obj.return_dimensions > 0 ? ' selected ' : '') + '" data-text="' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.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="' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + ' [ ] [ ] " data-type="' + tm + '" data-dimensions="2">[ ] [ ] </div>' + '</div>' + '</div>';
  18922. }
  18923. ret += '</div></div>';
  18924. ret = (0, _jquery2.default)(ret);
  18925. function_element.find('.function_return').append(ret);
  18926. }
  18927. function renderFunction(function_obj) {
  18928. var appender = '<div class="ui secondary segment function_div list-group-item">';
  18929. if (function_obj.function_comment) {
  18930. //appender += renderComment(function_obj.function_comment, sequence, true, -1);
  18931. }
  18932. appender += '<span class="glyphicon glyphicon-move move_function" aria-hidden="true"><i class="icon sort alternate vertical"></i></span>';
  18933. 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>';
  18934. appender += '<div class="function_signature_div">' + _localizedStringsService.LocalizedStrings.getUI("function") + ' ';
  18935. if (function_obj.is_main) {
  18936. appender += '<div class="function_name_div"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' + _localizedStringsService.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">';
  18937. } else {
  18938. appender += '<div class="ui function_return"></div>';
  18939. 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">';
  18940. }
  18941. appender += '</div> <span class="parethesis_function"> ) </span> </div>' + (function_obj.is_hidden ? ' <div class="function_area" style="display: none;"> ' : ' <div class="function_area"> ');
  18942. 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>';
  18943. appender += '<div class="ui top attached segment variables_list_div"></div>';
  18944. appender += '<div class="ui inline_add_command"><i class="icon plus circle purple"></i><i class="icon circle white back"></i><div class="ui icon button dropdown menu_commands orange" style="float: left;" ><i class="icon code"></i> <div class="menu"> ';
  18945. appender += '<a class="item" data-command="' + Models.COMMAND_TYPES.reader + '"><i class="download icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_read_var') + '</a>' + '<a class="item" data-command="' + Models.COMMAND_TYPES.writer + '"><i class="upload icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_write_var') + '</a>' + '<a class="item" data-command="' + Models.COMMAND_TYPES.comment + '"><i class="quote left icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_comment') + '</a>' + '<a class="item" data-command="' + Models.COMMAND_TYPES.attribution + '"><i class="arrow left icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_attribution') + '</a>' + '<a class="item" data-command="' + Models.COMMAND_TYPES.functioncall + '"><i class="hand point right icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_functioncall') + '</a>' + '<a class="item" data-command="' + Models.COMMAND_TYPES.iftrue + '" ><i class="random icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_iftrue') + '</a>' + '<a class="item" data-command="' + Models.COMMAND_TYPES.repeatNtimes + '"><i class="sync icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_repeatNtimes') + '</a>' + '<a class="item" data-command="' + Models.COMMAND_TYPES.whiletrue + '"><i class="sync icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_whiletrue') + '</a>' + '<a class="item" data-command="' + Models.COMMAND_TYPES.dowhiletrue + '"><i class="sync icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_dowhiletrue') + '</a>' + '<a class="item" data-command="' + Models.COMMAND_TYPES.switch + '"><i class="list icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_switch') + '</a>' + '<a class="item" data-command="' + Models.COMMAND_TYPES.return + '"><i class="reply icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_btn_return') + '</a>' + '</div></div></div>';
  18946. appender += '<div class="ui bottom attached segment commands_list_div"></div>';
  18947. appender += '</div></div>';
  18948. appender = (0, _jquery2.default)(appender);
  18949. (0, _jquery2.default)('.all_functions').append(appender);
  18950. appender.data('fun', function_obj);
  18951. appender.find('.commands_list_div').data('fun', function_obj);
  18952. renderFunctionReturn(function_obj, appender);
  18953. addHandlers(function_obj, appender);
  18954. // Rendering parameters:
  18955. for (var j = 0; j < function_obj.parameters_list.length; j++) {
  18956. renderParameter(function_obj, function_obj.parameters_list[j], appender);
  18957. }
  18958. // Rendering variables:
  18959. for (var j = 0; j < function_obj.variables_list.length; j++) {
  18960. VariablesManagement.renderVariable(appender, function_obj.variables_list[j], function_obj);
  18961. }
  18962. // Rendering commands:
  18963. for (var j = 0; j < function_obj.commands.length; j++) {
  18964. CommandsManagement.renderCommand(function_obj.commands[j], (0, _jquery2.default)(appender.find('.commands_list_div')[0]), 3, function_obj);
  18965. }
  18966. (0, _jquery2.default)('.minimize_function_button').popup({
  18967. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_minimize"),
  18968. delay: {
  18969. show: 750,
  18970. hide: 0
  18971. }
  18972. });
  18973. Sortable.create(appender.find(".variables_list_div")[0], {
  18974. handle: '.ellipsis',
  18975. animation: 100,
  18976. ghostClass: 'ghost',
  18977. group: 'local_vars_drag_' + program.functions.indexOf(function_obj),
  18978. onEnd: function onEnd(evt) {
  18979. updateSequenceLocals(evt.oldIndex, evt.newIndex, function_obj);
  18980. }
  18981. });
  18982. Sortable.create(appender.find(".commands_list_div")[0], {
  18983. handle: '.command_drag',
  18984. animation: 100,
  18985. ghostClass: 'ghost',
  18986. group: 'commands_drag_' + program.functions.indexOf(function_obj),
  18987. onEnd: function onEnd(evt) {
  18988. //updateSequenceLocals(evt.oldIndex, evt.newIndex, function_obj);
  18989. }
  18990. });
  18991. if (!function_obj.is_main) {
  18992. Sortable.create(appender.find(".container_parameters_list")[0], {
  18993. handle: '.ellipsis',
  18994. animation: 100,
  18995. ghostClass: 'ghost',
  18996. group: 'parameters_drag_' + program.functions.indexOf(function_obj),
  18997. onEnd: function onEnd(evt) {
  18998. updateSequenceParameters(evt.oldIndex, evt.newIndex, function_obj);
  18999. }
  19000. });
  19001. }
  19002. return appender;
  19003. }
  19004. function initVisualUI() {
  19005. // MUST USE CONST, LET, OR VAR !!!!!!
  19006. var mainDiv = (0, _jquery2.default)('#visual-main-div');
  19007. // fill mainDiv with functions and globals...
  19008. // renderAlgorithm()...
  19009. (0, _jquery2.default)('.add_function_button').on('click', function () {
  19010. addFunctionHandler();
  19011. });
  19012. (0, _jquery2.default)('.add_global_button').on('click', function () {
  19013. window.insertContext = true;
  19014. GlobalsManagement.addGlobal(program, true);
  19015. });
  19016. (0, _jquery2.default)('.run_button').on('click', function () {
  19017. runCode();
  19018. });
  19019. (0, _jquery2.default)('.visual_coding_button').on('click', function () {
  19020. toggleVisualCoding();
  19021. });
  19022. (0, _jquery2.default)('.textual_coding_button').on('click', function () {
  19023. toggleTextualCoding();
  19024. });
  19025. (0, _jquery2.default)('.assessment').on('click', function () {
  19026. runCodeAssessment();
  19027. is_iassign = true;
  19028. });
  19029. (0, _jquery2.default)('.div_toggle_console').on('click', function () {
  19030. toggleConsole();
  19031. });
  19032. }
  19033. var is_iassign = false;
  19034. (0, _jquery2.default)(document).ready(function () {
  19035. for (var i = 0; i < program.functions.length; i++) {
  19036. renderFunction(program.functions[i]);
  19037. }
  19038. var time_show = 750;
  19039. (0, _jquery2.default)('.visual_coding_button').popup({
  19040. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_visual"),
  19041. delay: {
  19042. show: time_show,
  19043. hide: 0
  19044. }
  19045. });
  19046. (0, _jquery2.default)('.textual_coding_button').popup({
  19047. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_textual"),
  19048. delay: {
  19049. show: time_show,
  19050. hide: 0
  19051. }
  19052. });
  19053. (0, _jquery2.default)('.upload_file_button').popup({
  19054. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_upload"),
  19055. delay: {
  19056. show: time_show,
  19057. hide: 0
  19058. }
  19059. });
  19060. (0, _jquery2.default)('.download_file_button').popup({
  19061. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_download"),
  19062. delay: {
  19063. show: time_show,
  19064. hide: 0
  19065. }
  19066. });
  19067. (0, _jquery2.default)('.undo_button').popup({
  19068. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_undo"),
  19069. delay: {
  19070. show: time_show,
  19071. hide: 0
  19072. }
  19073. });
  19074. (0, _jquery2.default)('.redo_button').popup({
  19075. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_redo"),
  19076. delay: {
  19077. show: time_show,
  19078. hide: 0
  19079. }
  19080. });
  19081. (0, _jquery2.default)('.run_button').popup({
  19082. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_run"),
  19083. delay: {
  19084. show: time_show,
  19085. hide: 0
  19086. }
  19087. });
  19088. (0, _jquery2.default)('.assessment_button').popup({
  19089. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_evaluate"),
  19090. delay: {
  19091. show: time_show,
  19092. hide: 0
  19093. }
  19094. });
  19095. (0, _jquery2.default)('.help_button').popup({
  19096. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_help"),
  19097. delay: {
  19098. show: time_show,
  19099. hide: 0
  19100. }
  19101. });
  19102. (0, _jquery2.default)('.add_global_button').popup({
  19103. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_add_global"),
  19104. delay: {
  19105. show: time_show,
  19106. hide: 0
  19107. }
  19108. });
  19109. (0, _jquery2.default)('.div_toggle_console').popup({
  19110. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_console"),
  19111. delay: {
  19112. show: time_show,
  19113. hide: 0
  19114. }
  19115. });
  19116. Sortable.create(listWithHandle, {
  19117. handle: '.glyphicon-move',
  19118. animation: 100,
  19119. ghostClass: 'ghost',
  19120. group: 'functions_divs_drag',
  19121. onEnd: function onEnd(evt) {
  19122. updateSequenceFunction(evt.oldIndex, evt.newIndex);
  19123. }
  19124. });
  19125. var listGlobalsHandle = document.getElementById("listGlobalsHandle");
  19126. Sortable.create(listGlobalsHandle, {
  19127. handle: '.ellipsis',
  19128. animation: 100,
  19129. ghostClass: 'ghost',
  19130. group: 'globals_divs_drag',
  19131. onEnd: function onEnd(evt) {
  19132. updateSequenceGlobals(evt.oldIndex, evt.newIndex);
  19133. }
  19134. });
  19135. });
  19136. function updateSequenceParameters(oldIndex, newIndex, function_obj) {
  19137. function_obj.parameters_list.splice(newIndex, 0, function_obj.parameters_list.splice(oldIndex, 1)[0]);
  19138. }
  19139. function updateSequenceLocals(oldIndex, newIndex, function_obj) {
  19140. function_obj.variables_list.splice(newIndex, 0, function_obj.variables_list.splice(oldIndex, 1)[0]);
  19141. }
  19142. function updateSequenceGlobals(oldIndex, newIndex) {
  19143. program_obj.globals.splice(newIndex, 0, program_obj.globals.splice(oldIndex, 1)[0]);
  19144. }
  19145. function updateSequenceFunction(oldIndex, newIndex) {
  19146. program_obj.functions.splice(newIndex, 0, program_obj.functions.splice(oldIndex, 1)[0]);
  19147. }
  19148. function runCodeAssessment() {
  19149. toggleConsole(true);
  19150. window.studentGrade = null;
  19151. studentTemp = null;
  19152. var strCode = CodeManagement.generate();
  19153. if (strCode == null) {
  19154. return;
  19155. }
  19156. if (domConsole == null) domConsole = new _domConsole.DOMConsole("#ivprog-term");
  19157. (0, _jquery2.default)("#ivprog-term").slideDown(500);
  19158. var runner = new _ivprogAssessment.IVProgAssessment(strCode, testCases, domConsole);
  19159. runner.runTest().then(function (grade) {
  19160. if (!is_iassign) {
  19161. parent.getEvaluationCallback(grade);
  19162. } else {
  19163. is_iassign = false;
  19164. }
  19165. }).catch(function (err) {
  19166. return domConsole.err(err.message);
  19167. });
  19168. }
  19169. function runCode() {
  19170. toggleConsole(true);
  19171. var strCode = CodeManagement.generate();
  19172. if (strCode == null) {
  19173. return;
  19174. }
  19175. if (domConsole == null) domConsole = new _domConsole.DOMConsole("#ivprog-term");
  19176. (0, _jquery2.default)("#ivprog-term").slideDown(500);
  19177. try {
  19178. var parser = _ivprogParser.IVProgParser.createParser(strCode);
  19179. var analyser = new _semanticAnalyser.SemanticAnalyser(parser.parseTree());
  19180. var data = analyser.analyseTree();
  19181. var proc = new _ivprogProcessor.IVProgProcessor(data);
  19182. proc.registerInput(domConsole);
  19183. proc.registerOutput(domConsole);
  19184. (0, _jquery2.default)("#ivprog-term").addClass('ivprog-term-active');
  19185. proc.interpretAST().then(function (_) {
  19186. domConsole.info("Programa executado com sucesso!");
  19187. (0, _jquery2.default)("#ivprog-term").removeClass('ivprog-term-active');
  19188. }).catch(function (err) {
  19189. domConsole.err(err.message);
  19190. (0, _jquery2.default)("#ivprog-term").removeClass('ivprog-term-active');
  19191. });
  19192. } catch (error) {
  19193. domConsole.err(error.message);
  19194. console.log(error);
  19195. }
  19196. }
  19197. function toggleConsole(is_running) {
  19198. if (is_running) {
  19199. (0, _jquery2.default)('.ivprog-term-div').css('display', 'block');
  19200. (0, _jquery2.default)('#ivprog-term').css('min-height', '160px');
  19201. (0, _jquery2.default)('#ivprog-term').css('margin-top', '-170px');
  19202. return;
  19203. }
  19204. if ((0, _jquery2.default)('#ivprog-term').css('min-height') == '160px') {
  19205. // esconder
  19206. (0, _jquery2.default)('.ivprog-term-div').css('display', 'none');
  19207. (0, _jquery2.default)('#ivprog-term').css('min-height', '0');
  19208. (0, _jquery2.default)('#ivprog-term').css('margin-top', '-30px');
  19209. (0, _jquery2.default)('#ivprog-term').css('padding', '5px');
  19210. } else {
  19211. // mostrar
  19212. (0, _jquery2.default)('.ivprog-term-div').css('display', 'block');
  19213. (0, _jquery2.default)('#ivprog-term').css('min-height', '160px');
  19214. (0, _jquery2.default)('#ivprog-term').css('margin-top', '-170px');
  19215. }
  19216. }
  19217. function waitToCloseConsole() {
  19218. domConsole.info("Aperte qualquer tecla para fechar...");
  19219. var p = new Promise(function (resolve, _) {
  19220. domConsole.requestInput(resolve, true);
  19221. });
  19222. p.then(function (_) {
  19223. domConsole.dispose();
  19224. domConsole = null;
  19225. (0, _jquery2.default)("#ivprog-term").hide();
  19226. });
  19227. }
  19228. function toggleTextualCoding() {
  19229. var code = CodeManagement.generate();
  19230. (0, _jquery2.default)('.ivprog_visual_panel').css('display', 'none');
  19231. (0, _jquery2.default)('.ivprog_textual_panel').css('display', 'block');
  19232. (0, _jquery2.default)('.ivprog_textual_panel').removeClass('loading');
  19233. (0, _jquery2.default)('.ivprog_textual_code').text(code);
  19234. (0, _jquery2.default)('.visual_coding_button').removeClass('active');
  19235. (0, _jquery2.default)('.textual_coding_button').addClass('active');
  19236. }
  19237. function toggleVisualCoding() {
  19238. (0, _jquery2.default)('.ivprog_textual_panel').addClass('loading');
  19239. (0, _jquery2.default)('.ivprog_textual_panel').css('display', 'none');
  19240. (0, _jquery2.default)('.ivprog_visual_panel').css('display', 'block');
  19241. (0, _jquery2.default)('.textual_coding_button').removeClass('active');
  19242. (0, _jquery2.default)('.visual_coding_button').addClass('active');
  19243. }
  19244. function removeParameter(function_obj, parameter_obj, parameter_container) {
  19245. var index = function_obj.parameters_list.indexOf(parameter_obj);
  19246. if (index > -1) {
  19247. window.insertContext = true;
  19248. function_obj.parameters_list.splice(index, 1);
  19249. }
  19250. (0, _jquery2.default)(parameter_container).fadeOut();
  19251. }
  19252. function updateParameterType(parameter_obj, new_type) {
  19253. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  19254. parameter_obj.type = new_type;
  19255. parameter_obj.dimensions = new_dimensions;
  19256. if (new_dimensions > 0) {
  19257. parameter_obj.rows = new_dimensions;
  19258. parameter_obj.columns = 2;
  19259. }
  19260. }
  19261. function renderParameter(function_obj, parameter_obj, function_container) {
  19262. var ret = "";
  19263. ret += '<div class="ui label function_name_parameter pink"><i class="ui icon ellipsis vertical inverted"></i>';
  19264. ret += '<div class="ui dropdown parameter_type">';
  19265. if (parameter_obj.dimensions > 0) {
  19266. ret += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(parameter_obj.type);
  19267. if (parameter_obj.dimensions == 1) {
  19268. ret += ' [ ] ';
  19269. } else {
  19270. ret += ' [ ] [ ] ';
  19271. }
  19272. ret += '</div>';
  19273. } else {
  19274. ret += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI(parameter_obj.type) + '</div>';
  19275. }
  19276. ret += '<div class="menu">';
  19277. for (var tm in _types.Types) {
  19278. if (tm == _types.Types.VOID.toUpperCase()) {
  19279. continue;
  19280. }
  19281. ret += '<div class="item ' + (parameter_obj.type == tm.toLowerCase() ? ' selected ' : '') + '" data-type="' + tm + '" >' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + '</div>';
  19282. }
  19283. for (var tm in _types.Types) {
  19284. if (tm == _types.Types.VOID.toUpperCase()) {
  19285. continue;
  19286. }
  19287. ret += '<div class="item">' + '<i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + '<div class="menu">' + '<div class="item" data-text="' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + ' [ ] " data-type="' + tm + '" data-dimensions="1">[ ]</div>' + '<div class="item" data-text="' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + ' [ ] [ ] " data-type="' + tm + '" data-dimensions="2">[ ] [ ] </div>' + '</div>' + '</div>';
  19288. }
  19289. ret += '</div></div>';
  19290. ret += '<div class="parameter_div_edit"><span class="span_name_parameter label_enable_name_parameter">' + parameter_obj.name + '</span></div> ';
  19291. ret += ' <i class="yellow inverted icon times remove_parameter"></i></div>';
  19292. ret = (0, _jquery2.default)(ret);
  19293. function_container.find('.container_parameters_list').append(ret);
  19294. ret.find('.remove_parameter').on('click', function (e) {
  19295. removeParameter(function_obj, parameter_obj, ret);
  19296. });
  19297. ret.find('.ui.dropdown.parameter_type').dropdown({
  19298. onChange: function onChange(value, text, $selectedItem) {
  19299. if ($selectedItem.data('dimensions')) {
  19300. updateParameterType(parameter_obj, _types.Types[$selectedItem.data('type')], $selectedItem.data('dimensions'));
  19301. } else {
  19302. updateParameterType(parameter_obj, _types.Types[$selectedItem.data('type')]);
  19303. }
  19304. }
  19305. });
  19306. ret.find('.label_enable_name_parameter').on('click', function (e) {
  19307. enableNameParameterUpdate(parameter_obj, ret);
  19308. });
  19309. return ret;
  19310. }
  19311. var opened_name_parameter = false;
  19312. var opened_input_parameter = null;
  19313. function enableNameParameterUpdate(parameter_obj, parent_node) {
  19314. if (opened_name_parameter) {
  19315. opened_input_parameter.focus();
  19316. return;
  19317. }
  19318. opened_name_parameter = true;
  19319. parent_node = (0, _jquery2.default)(parent_node);
  19320. var input_field;
  19321. parent_node.find('.span_name_parameter').text('');
  19322. input_field = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + parameter_obj.name + "' />");
  19323. input_field.insertBefore(parent_node.find('.span_name_parameter'));
  19324. input_field.on('input', function () {
  19325. var inputWidth = input_field.textWidth() + 10;
  19326. opened_input_parameter = input_field;
  19327. input_field.focus();
  19328. var tmpStr = input_field.val();
  19329. input_field.val('');
  19330. input_field.val(tmpStr);
  19331. input_field.css({
  19332. width: inputWidth
  19333. });
  19334. }).trigger('input');
  19335. input_field.focusout(function () {
  19336. /// update array:
  19337. if (input_field.val().trim()) {
  19338. parameter_obj.name = input_field.val().trim();
  19339. parent_node.find('.span_name_parameter').text(parameter_obj.name);
  19340. }
  19341. input_field.off();
  19342. input_field.remove();
  19343. /// update elements:
  19344. opened_name_parameter = false;
  19345. opened_input_parameter = false;
  19346. });
  19347. input_field.on('keydown', function (e) {
  19348. var code = e.keyCode || e.which;
  19349. if (code == 13) {
  19350. if (input_field.val().trim()) {
  19351. parameter_obj.name = input_field.val().trim();
  19352. parent_node.find('.span_name_parameter').text(parameter_obj.name);
  19353. }
  19354. input_field.off();
  19355. input_field.remove();
  19356. /// update elements:
  19357. opened_name_parameter = false;
  19358. opened_input_parameter = false;
  19359. }
  19360. if (code == 27) {
  19361. parent_node.find('.span_name_parameter').text(parameter_obj.name);
  19362. input_field.off();
  19363. input_field.remove();
  19364. /// update elements:
  19365. opened_name_parameter = false;
  19366. opened_input_parameter = false;
  19367. }
  19368. });
  19369. input_field.select();
  19370. }
  19371. var opened_name_function = false;
  19372. var opened_input = null;
  19373. var previousPadding = null;
  19374. function enableNameFunctionUpdate(function_obj, parent_node) {
  19375. if (opened_name_function) {
  19376. opened_input.focus();
  19377. return;
  19378. }
  19379. parent_node = (0, _jquery2.default)(parent_node);
  19380. parent_node.find('.span_name_function').text('');
  19381. var input_field;
  19382. if (!previousPadding) {
  19383. previousPadding = parent_node.find('.span_name_function').css('padding-left');
  19384. }
  19385. parent_node.find('.span_name_function').css('padding-left', '0');
  19386. parent_node.find('.span_name_function').css('padding-right', '0');
  19387. input_field = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + function_obj.name + "' />");
  19388. input_field.insertBefore(parent_node.find('.span_name_function'));
  19389. input_field.on('input', function () {
  19390. var inputWidth = input_field.textWidth() + 10;
  19391. opened_input = input_field;
  19392. input_field.focus();
  19393. var tmpStr = input_field.val();
  19394. input_field.val('');
  19395. input_field.val(tmpStr);
  19396. input_field.css({
  19397. width: inputWidth
  19398. });
  19399. }).trigger('input');
  19400. input_field.focusout(function () {
  19401. /// update array:
  19402. if (input_field.val().trim()) {
  19403. function_obj.name = input_field.val().trim();
  19404. }
  19405. input_field.off();
  19406. input_field.remove();
  19407. parent_node.find('.span_name_function').css('padding-left', previousPadding);
  19408. parent_node.find('.span_name_function').css('padding-right', previousPadding);
  19409. parent_node.find('.span_name_function').text(function_obj.name);
  19410. /// update elements:
  19411. opened_name_function = false;
  19412. opened_input = false;
  19413. });
  19414. input_field.on('keydown', function (e) {
  19415. var code = e.keyCode || e.which;
  19416. if (code == 13) {
  19417. if (input_field.val().trim()) {
  19418. function_obj.name = input_field.val().trim();
  19419. }
  19420. input_field.off();
  19421. input_field.remove();
  19422. parent_node.find('.span_name_function').css('padding-left', previousPadding);
  19423. parent_node.find('.span_name_function').css('padding-right', previousPadding);
  19424. parent_node.find('.span_name_function').text(function_obj.name);
  19425. /// update elements:
  19426. opened_name_function = false;
  19427. opened_input = false;
  19428. }
  19429. if (code == 27) {
  19430. input_field.off();
  19431. input_field.remove();
  19432. parent_node.find('.span_name_function').css('padding-left', previousPadding);
  19433. parent_node.find('.span_name_function').css('padding-right', previousPadding);
  19434. parent_node.find('.span_name_function').text(function_obj.name);
  19435. /// update elements:
  19436. opened_name_function = false;
  19437. opened_input = false;
  19438. }
  19439. });
  19440. input_field.select();
  19441. }
  19442. /***/ }),
  19443. /***/ "./js/visualUI/globals.js":
  19444. /*!********************************!*\
  19445. !*** ./js/visualUI/globals.js ***!
  19446. \********************************/
  19447. /*! no static exports found */
  19448. /***/ (function(module, exports, __webpack_require__) {
  19449. "use strict";
  19450. Object.defineProperty(exports, "__esModule", {
  19451. value: true
  19452. });
  19453. exports.addGlobal = addGlobal;
  19454. exports.renderGlobal = renderGlobal;
  19455. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  19456. var _jquery2 = _interopRequireDefault(_jquery);
  19457. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  19458. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  19459. var Models = _interopRequireWildcard(_ivprog_elements);
  19460. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  19461. __webpack_require__(/*! ../semantic/semantic.min.js */ "./js/semantic/semantic.min.js");
  19462. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  19463. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  19464. window.jQuery = _jquery2.default;
  19465. var counter_new_globals = 0;
  19466. function addGlobal(program) {
  19467. var is_from_click = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  19468. var new_global = new Models.Variable(_types.Types.INTEGER, _localizedStringsService.LocalizedStrings.getUI('new_global') + '_' + counter_new_globals, 1);
  19469. counter_new_globals++;
  19470. program.addGlobal(new_global);
  19471. var newe = renderGlobal(new_global);
  19472. if (is_from_click) {
  19473. newe.css('display', 'none');
  19474. newe.fadeIn();
  19475. }
  19476. }
  19477. function toggleConstant(global_var) {
  19478. global_var.is_constant = !global_var.is_constant;
  19479. }
  19480. function updateName(global_var, new_name) {
  19481. global_var.name = new_name;
  19482. }
  19483. function updateType(global_var, new_type) {
  19484. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  19485. global_var.type = new_type;
  19486. global_var.dimensions = new_dimensions;
  19487. if (new_dimensions > 0) {
  19488. global_var.rows = new_dimensions;
  19489. global_var.columns = 2;
  19490. }
  19491. updateInitialValues(global_var);
  19492. }
  19493. function removeGlobal(global_var, global_container) {
  19494. var index = window.program_obj.globals.indexOf(global_var);
  19495. if (index > -1) {
  19496. window.insertContext = true;
  19497. window.program_obj.globals.splice(index, 1);
  19498. }
  19499. global_container.children().off();
  19500. global_container.off();
  19501. global_container.fadeOut();
  19502. }
  19503. function updateInitialValues(global_var) {
  19504. if (global_var.type == _types.Types.INTEGER) {
  19505. if (global_var.dimensions == 0) {
  19506. global_var.value = 1;
  19507. }
  19508. if (global_var.dimensions == 1) {
  19509. global_var.value = [1, 1];
  19510. }
  19511. if (global_var.dimensions == 2) {
  19512. global_var.value = [[1, 1], [1, 1]];
  19513. }
  19514. }
  19515. if (global_var.type == _types.Types.REAL) {
  19516. if (global_var.dimensions == 0) {
  19517. global_var.value = 1.0;
  19518. }
  19519. if (global_var.dimensions == 1) {
  19520. global_var.value = [1.0, 1.0];
  19521. }
  19522. if (global_var.dimensions == 2) {
  19523. global_var.value = [[1.0, 1.0], [1.0, 1.0]];
  19524. }
  19525. }
  19526. if (global_var.type == _types.Types.TEXT) {
  19527. if (global_var.dimensions == 0) {
  19528. global_var.value = _localizedStringsService.LocalizedStrings.getUI('text_start');
  19529. }
  19530. if (global_var.dimensions == 1) {
  19531. global_var.value = [_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')];
  19532. }
  19533. if (global_var.dimensions == 2) {
  19534. global_var.value = [[_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')], [_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')]];
  19535. }
  19536. }
  19537. if (global_var.type == _types.Types.BOOLEAN) {
  19538. if (global_var.dimensions == 0) {
  19539. global_var.value = true;
  19540. }
  19541. if (global_var.dimensions == 1) {
  19542. global_var.value = [true, true];
  19543. }
  19544. if (global_var.dimensions == 2) {
  19545. global_var.value = [[true, true], [true, true]];
  19546. }
  19547. }
  19548. }
  19549. function alternateBooleanGlobalValue(global_var, value_container) {
  19550. global_var.value = !global_var.value;
  19551. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(global_var.value));
  19552. }
  19553. function alternateBooleanGlobalVectorValue(global_var, index, value_container) {
  19554. global_var.value[index] = !global_var.value[index];
  19555. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(global_var.value[index]));
  19556. }
  19557. function removeGlobalColumnVector(global_var) {
  19558. if (global_var.columns == 0) {
  19559. return;
  19560. }
  19561. global_var.columns--;
  19562. global_var.value.splice(global_var.value.length - 1, 1);
  19563. }
  19564. function addGlobalColumnVector(global_var) {
  19565. global_var.columns++;
  19566. if (global_var.type == _types.Types.INTEGER) {
  19567. global_var.value.push(1);
  19568. }
  19569. if (global_var.type == _types.Types.REAL) {
  19570. global_var.value.push(1.0);
  19571. }
  19572. if (global_var.type == _types.Types.TEXT) {
  19573. global_var.value.push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  19574. }
  19575. if (global_var.type == _types.Types.BOOLEAN) {
  19576. global_var.value.push(true);
  19577. }
  19578. }
  19579. function removeColumnGlobalMatrix(global_var) {
  19580. if (global_var.columns == 0) {
  19581. return;
  19582. }
  19583. global_var.columns--;
  19584. for (var i = 0; i < global_var.rows; i++) {
  19585. global_var.value[i].splice(global_var.value[i].length - 1, 1);
  19586. }
  19587. }
  19588. function addColumnGlobalMatrix(global_var) {
  19589. global_var.columns++;
  19590. if (global_var.type == _types.Types.INTEGER) {
  19591. for (var i = 0; i < global_var.rows; i++) {
  19592. global_var.value[i].push(1);
  19593. }
  19594. }
  19595. if (global_var.type == _types.Types.REAL) {
  19596. for (var i = 0; i < global_var.rows; i++) {
  19597. global_var.value[i].push(1.0);
  19598. }
  19599. }
  19600. if (global_var.type == _types.Types.TEXT) {
  19601. for (var i = 0; i < global_var.rows; i++) {
  19602. global_var.value[i].push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  19603. }
  19604. }
  19605. if (global_var.type == _types.Types.BOOLEAN) {
  19606. for (var i = 0; i < global_var.rows; i++) {
  19607. global_var.value[i].push(true);
  19608. }
  19609. }
  19610. }
  19611. function removeLineGlobalMatrix(global_var) {
  19612. if (global_var.rows == 0) {
  19613. return;
  19614. }
  19615. global_var.rows--;
  19616. global_var.value.splice(global_var.value.length - 1, 1);
  19617. }
  19618. function addLineGlobalMatrix(global_var) {
  19619. global_var.rows++;
  19620. if (global_var.type == _types.Types.INTEGER) {
  19621. var n_l = [];
  19622. for (var i = 0; i < global_var.columns; i++) {
  19623. n_l.push(1);
  19624. }
  19625. global_var.value.push(n_l);
  19626. }
  19627. if (global_var.type == _types.Types.REAL) {
  19628. var n_l = [];
  19629. for (i = 0; i < global_var.columns; i++) {
  19630. n_l.push(1.0);
  19631. }
  19632. global_var.value.push(n_l);
  19633. }
  19634. if (global_var.type == _types.Types.TEXT) {
  19635. var n_l = [];
  19636. for (i = 0; i < global_var.columns; i++) {
  19637. n_l.push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  19638. }
  19639. global_var.value.push(n_l);
  19640. }
  19641. if (global_var.type == _types.Types.BOOLEAN) {
  19642. var n_l = [];
  19643. for (i = 0; i < global_var.columns; i++) {
  19644. n_l.push(true);
  19645. }
  19646. global_var.value.push(n_l);
  19647. }
  19648. }
  19649. function alternateBooleanGlobalMatrixValue(global_var, row, index, value_container) {
  19650. global_var.value[row][index] = !global_var.value[row][index];
  19651. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(global_var.value[row][index]));
  19652. }
  19653. function renderValues(global_var, global_container) {
  19654. var ret = "";
  19655. var j = 0;
  19656. if (global_var.dimensions == 0) {
  19657. if (global_var.type == _types.Types.REAL) {
  19658. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + global_var.value.toFixed(1) + '</span> </div> ';
  19659. } else {
  19660. if (global_var.type == _types.Types.BOOLEAN) {
  19661. ret += '<div class="created_div_valor_var"><span class="span_value_variable boolean_simple_type">' + _localizedStringsService.LocalizedStrings.getUI(global_var.value) + '</span> </div> ';
  19662. } else {
  19663. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + global_var.value + '</span> </div> ';
  19664. }
  19665. }
  19666. } else {
  19667. ret += '<table class="tabela_var">';
  19668. if (global_var.dimensions == 1) {
  19669. ret += '<tr>';
  19670. if (global_var.type == _types.Types.REAL) {
  19671. for (var k = 0; k < global_var.columns; k++) {
  19672. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + global_var.value[k].toFixed(1) + '</span></td>';
  19673. }
  19674. } else {
  19675. for (var k = 0; k < global_var.columns; k++) {
  19676. if (global_var.type == _types.Types.BOOLEAN) {
  19677. ret += '<td><span class="span_value_variable boolean_vector_var" data-index="' + k + '">' + _localizedStringsService.LocalizedStrings.getUI(global_var.value[k]) + '</span></td>';
  19678. } else {
  19679. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + global_var.value[k] + '</span>' + '</td>';
  19680. }
  19681. }
  19682. }
  19683. ret += '</tr>';
  19684. ret += '</table>';
  19685. 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>';
  19686. }
  19687. if (global_var.dimensions == 2) {
  19688. if (global_var.type == _types.Types.REAL) {
  19689. for (var l = 0; l < global_var.rows; l++) {
  19690. ret += '<tr>';
  19691. for (var k = 0; k < global_var.columns; k++) {
  19692. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + global_var.value[l][k].toFixed(1) + '</span>' + '</td>';
  19693. }
  19694. ret += '</tr>';
  19695. }
  19696. } else {
  19697. for (var l = 0; l < global_var.rows; l++) {
  19698. ret += '<tr>';
  19699. for (var k = 0; k < global_var.columns; k++) {
  19700. if (global_var.type == _types.Types.BOOLEAN) {
  19701. ret += '<td><span class="span_value_variable boolean_matrix_var" data-index="' + k + '" data-row="' + l + '">' + _localizedStringsService.LocalizedStrings.getUI(global_var.value[l][k]) + '</span></td>';
  19702. } else {
  19703. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + global_var.value[l][k] + '</span></td>';
  19704. }
  19705. }
  19706. ret += '</tr>';
  19707. }
  19708. }
  19709. if (global_var.rows == 0) {
  19710. ret += '<tr><td></td></tr>';
  19711. }
  19712. 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>';
  19713. ret += '</table>';
  19714. 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>';
  19715. }
  19716. }
  19717. global_container.find(".div_valor_var").html('');
  19718. ret = (0, _jquery2.default)(ret);
  19719. ret.find('.span_value_variable').data('associatedOject', global_var);
  19720. ret.find(".boolean_simple_type").on('click', function (e) {
  19721. alternateBooleanGlobalValue(global_var, this.parentNode);
  19722. });
  19723. ret.find(".simple_var").on('click', function (e) {
  19724. enableGlobalValueUpdate(global_var, this.parentNode);
  19725. });
  19726. ret.find(".boolean_vector_var").on('click', function (e) {
  19727. alternateBooleanGlobalVectorValue(global_var, (0, _jquery2.default)(this).data('index'), this.parentNode);
  19728. });
  19729. ret.find(".vector_var").on('click', function (e) {
  19730. enableGlobalVectorValueUpdate(global_var, (0, _jquery2.default)(this).data('index'), this.parentNode);
  19731. });
  19732. ret.find(".remove_global_vector_column").on('click', function (e) {
  19733. removeGlobalColumnVector(global_var);
  19734. global_container.find(".div_valor_var").html('');
  19735. renderValues(global_var, global_container);
  19736. });
  19737. ret.find(".add_global_vector_column").on('click', function (e) {
  19738. addGlobalColumnVector(global_var);
  19739. global_container.find(".div_valor_var").html('');
  19740. renderValues(global_var, global_container);
  19741. });
  19742. ret.find(".remove_global_matrix_column").on('click', function (e) {
  19743. removeColumnGlobalMatrix(global_var);
  19744. global_container.find(".div_valor_var").html('');
  19745. renderValues(global_var, global_container);
  19746. });
  19747. ret.find(".add_global_matrix_column").on('click', function (e) {
  19748. addColumnGlobalMatrix(global_var);
  19749. global_container.find(".div_valor_var").html('');
  19750. renderValues(global_var, global_container);
  19751. });
  19752. ret.find(".remove_global_matrix_line").on('click', function (e) {
  19753. removeLineGlobalMatrix(global_var);
  19754. global_container.find(".div_valor_var").html('');
  19755. renderValues(global_var, global_container);
  19756. });
  19757. ret.find(".add_global_matrix_line").on('click', function (e) {
  19758. addLineGlobalMatrix(global_var);
  19759. global_container.find(".div_valor_var").html('');
  19760. renderValues(global_var, global_container);
  19761. });
  19762. ret.find(".boolean_matrix_var").on('click', function (e) {
  19763. alternateBooleanGlobalMatrixValue(global_var, (0, _jquery2.default)(this).data('row'), (0, _jquery2.default)(this).data('index'), this.parentNode);
  19764. });
  19765. ret.find(".matrix_var").on('click', function (e) {
  19766. enableGlobalMatrixValueUpdate(global_var, (0, _jquery2.default)(this).data('row'), (0, _jquery2.default)(this).data('index'), this.parentNode);
  19767. });
  19768. global_container.find(".div_valor_var").append(ret);
  19769. updateColumnsAndRowsText(global_container, global_var);
  19770. }
  19771. function addHandlers(global_container) {
  19772. var global_var = global_container.data('associatedOject');
  19773. // Manage constant option:
  19774. global_container.find(".alternate_constant").on('click', function (e) {
  19775. toggleConstant(global_var);
  19776. (0, _jquery2.default)(this).removeClass("on off");
  19777. if (global_var.is_constant) {
  19778. (0, _jquery2.default)(this).addClass("on");
  19779. } else {
  19780. (0, _jquery2.default)(this).addClass("off");
  19781. }
  19782. });
  19783. // Manage global name:
  19784. global_container.find(".enable_edit_name_parameter").on('click', function (e) {
  19785. enableNameUpdate(global_container);
  19786. });
  19787. // Menu to change type:
  19788. global_container.find('.ui.dropdown.global_type').dropdown({
  19789. onChange: function onChange(value, text, $selectedItem) {
  19790. if ($selectedItem.data('dimensions')) {
  19791. updateType(global_var, _types.Types[$selectedItem.data('type')], $selectedItem.data('dimensions'));
  19792. } else {
  19793. updateType(global_var, _types.Types[$selectedItem.data('type')]);
  19794. }
  19795. renderValues(global_var, global_container);
  19796. }
  19797. });
  19798. // Remove global:
  19799. global_container.find(".remove_global").on('click', function (e) {
  19800. removeGlobal(global_var, global_container);
  19801. });
  19802. }
  19803. function updateColumnsAndRowsText(global_container, global_var) {
  19804. var prev = global_container.find('.text').text().split('[');
  19805. if (prev.length == 2) {
  19806. var ff = prev[0] + '[ ' + global_var.columns + ' ] ';
  19807. global_container.find('.text').empty();
  19808. global_container.find('.text').text(ff);
  19809. }
  19810. if (prev.length == 3) {
  19811. var ff = prev[0] + '[ ' + global_var.columns + ' ] [ ' + global_var.rows + ' ] ';
  19812. global_container.find('.text').empty();
  19813. global_container.find('.text').text(ff);
  19814. }
  19815. }
  19816. function renderGlobal(global_var) {
  19817. var element = '<div class="ui label global_container pink"><i class="ui icon ellipsis vertical inverted"></i><div class="global_const">const: ';
  19818. element += '<i class="ui icon toggle ' + (global_var.is_constant ? "on" : "off") + ' alternate_constant"></i></div>';
  19819. element += '<div class="ui dropdown global_type">';
  19820. if (global_var.dimensions > 0) {
  19821. element += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(global_var.type);
  19822. for (var i = 0; i < global_var.dimensions; i++) {
  19823. element += ' [ <span class="dimensions_' + i + '"></span> ] ';
  19824. }
  19825. element += '</div>';
  19826. } else {
  19827. element += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI(global_var.type.toLowerCase()) + '</div>';
  19828. }
  19829. element += '<div class="menu">';
  19830. for (var tm in _types.Types) {
  19831. if (tm == _types.Types.VOID.toUpperCase()) {
  19832. continue;
  19833. }
  19834. element += '<div class="item ' + (global_var.type == tm.toLowerCase() ? ' selected ' : '') + '" data-type="' + tm + '" >' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + '</div>';
  19835. }
  19836. for (var tm in _types.Types) {
  19837. if (tm == _types.Types.VOID.toUpperCase()) {
  19838. continue;
  19839. }
  19840. element += '<div class="item">' + '<i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + '<div class="menu">' + '<div class="item" data-text="' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + ' [ ] " data-type="' + tm + '" data-dimensions="1">[ ]</div>' + '<div class="item" data-text="' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + ' [ ] [ ] " data-type="' + tm + '" data-dimensions="2">[ ] [ ] </div>' + '</div>' + '</div>';
  19841. }
  19842. 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> ';
  19843. element += '<div class="ui div_valor_var">' + global_var.value + '</div>';
  19844. element += ' <i class="yellow inverted icon times remove_global"></i></div>';
  19845. var complete_element = (0, _jquery2.default)(element);
  19846. complete_element.data('associatedOject', global_var);
  19847. (0, _jquery2.default)('.list_globals').append(complete_element);
  19848. addHandlers(complete_element);
  19849. renderValues(global_var, complete_element);
  19850. if (global_var.dimensions == 1) {
  19851. complete_element.find('.dimensions_0').text(global_var.columns);
  19852. }
  19853. if (global_var.dimensions == 2) {
  19854. complete_element.find('.dimensions_0').text(global_var.columns);
  19855. complete_element.find('.dimensions_1').text(global_var.rows);
  19856. }
  19857. return complete_element;
  19858. }
  19859. var opened_name_value_matrix_global_v = false;
  19860. var opened_input_value_matrix_global_v = null;
  19861. function enableGlobalMatrixValueUpdate(global_var, row, index, parent_node) {
  19862. if (opened_name_value_matrix_global_v) {
  19863. opened_input_value_matrix_global_v.focus();
  19864. return;
  19865. }
  19866. parent_node = (0, _jquery2.default)(parent_node);
  19867. opened_name_value_matrix_global_v = true;
  19868. parent_node.find('.span_value_variable').text('');
  19869. var input_field;
  19870. if (global_var.type == _types.Types.REAL) {
  19871. input_field = (0, _jquery2.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) + "' />");
  19872. input_field.insertBefore(parent_node.find('.span_value_variable'));
  19873. } else {
  19874. input_field = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.value[row][index] + "' />");
  19875. input_field.insertBefore(parent_node.find('.span_value_variable'));
  19876. }
  19877. input_field.on('input', function () {
  19878. var inputWidth = input_field.textWidth() + 10;
  19879. opened_input_value_matrix_global_v = input_field;
  19880. input_field.focus();
  19881. var tmpStr = input_field.val();
  19882. input_field.val('');
  19883. input_field.val(tmpStr);
  19884. input_field.css({
  19885. width: inputWidth
  19886. });
  19887. }).trigger('input');
  19888. input_field.focusout(function () {
  19889. /// update array:
  19890. if (input_field.val().trim()) {
  19891. if (global_var.type == _types.Types.REAL) {
  19892. global_var.value[row][index] = parseFloat(input_field.val().trim());
  19893. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  19894. } else {
  19895. if (global_var.type == _types.Types.INTEGER) {
  19896. global_var.value[row][index] = parseInt(input_field.val().trim());
  19897. } else {
  19898. global_var.value[row][index] = input_field.val().trim();
  19899. }
  19900. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  19901. }
  19902. } else {
  19903. if (global_var.type == _types.Types.REAL) {
  19904. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  19905. } else {
  19906. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  19907. }
  19908. }
  19909. if (global_var.type == _types.Types.TEXT) {
  19910. global_var.value[row][index] = input_field.val();
  19911. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  19912. }
  19913. input_field.off();
  19914. input_field.remove();
  19915. /// update elements:
  19916. opened_name_value_matrix_global_v = false;
  19917. opened_input_value_matrix_global_v = false;
  19918. });
  19919. input_field.on('keydown', function (e) {
  19920. var code = e.keyCode || e.which;
  19921. if (code == 13) {
  19922. if (input_field.val().trim()) {
  19923. if (global_var.type == _types.Types.REAL) {
  19924. global_var.value[row][index] = parseFloat(input_field.val().trim());
  19925. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  19926. } else {
  19927. if (global_var.type == _types.Types.INTEGER) {
  19928. global_var.value[row][index] = parseInt(input_field.val().trim());
  19929. } else {
  19930. global_var.value[row][index] = input_field.val().trim();
  19931. }
  19932. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  19933. }
  19934. } else {
  19935. if (global_var.type == _types.Types.REAL) {
  19936. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  19937. } else {
  19938. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  19939. }
  19940. }
  19941. if (global_var.type == _types.Types.TEXT) {
  19942. global_var.value[row][index] = input_field.val();
  19943. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  19944. }
  19945. input_field.off();
  19946. input_field.remove();
  19947. /// update elements:
  19948. opened_name_value_matrix_global_v = false;
  19949. opened_input_value_matrix_global_v = false;
  19950. }
  19951. if (code == 27) {
  19952. if (global_var.type == _types.Types.REAL) {
  19953. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  19954. } else {
  19955. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  19956. }
  19957. input_field.off();
  19958. input_field.remove();
  19959. /// update elements:
  19960. opened_name_value_matrix_global_v = false;
  19961. opened_input_value_matrix_global_v = false;
  19962. }
  19963. });
  19964. input_field.select();
  19965. }
  19966. var opened_name_value_global_var = false;
  19967. var opened_input_value_global_ar = null;
  19968. function enableGlobalValueUpdate(global_var, parent_node) {
  19969. if (opened_name_value_global_var) {
  19970. opened_input_value_global_ar.focus();
  19971. return;
  19972. }
  19973. parent_node = (0, _jquery2.default)(parent_node);
  19974. opened_name_value_global_var = true;
  19975. parent_node.find('.span_value_variable').text('');
  19976. var input_field;
  19977. if (global_var.type == _types.Types.REAL) {
  19978. input_field = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.value.toFixed(1) + "' />");
  19979. input_field.insertBefore(parent_node.find('.span_value_variable'));
  19980. } else {
  19981. input_field = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.value + "' />");
  19982. input_field.insertBefore(parent_node.find('.span_value_variable'));
  19983. }
  19984. input_field.on('input', function () {
  19985. var inputWidth = input_field.textWidth() + 10;
  19986. opened_input_value_global_ar = input_field;
  19987. input_field.focus();
  19988. var tmpStr = input_field.val();
  19989. input_field.val('');
  19990. input_field.val(tmpStr);
  19991. input_field.css({
  19992. width: inputWidth
  19993. });
  19994. }).trigger('input');
  19995. input_field.focusout(function () {
  19996. /// update array:
  19997. if (input_field.val().trim()) {
  19998. if (global_var.type == _types.Types.REAL) {
  19999. global_var.value = parseFloat(input_field.val().trim());
  20000. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  20001. } else {
  20002. if (global_var.type == _types.Types.INTEGER) {
  20003. global_var.value = parseInt(input_field.val().trim());
  20004. } else {
  20005. global_var.value = input_field.val().trim();
  20006. }
  20007. parent_node.find('.span_value_variable').text(global_var.value);
  20008. }
  20009. } else {
  20010. if (global_var.type == _types.Types.REAL) {
  20011. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  20012. } else {
  20013. parent_node.find('.span_value_variable').text(global_var.value);
  20014. }
  20015. }
  20016. if (global_var.type == _types.Types.TEXT) {
  20017. global_var.value = input_field.val();
  20018. parent_node.find('.span_value_variable').text(global_var.value);
  20019. }
  20020. input_field.off();
  20021. input_field.remove();
  20022. /// update elements:
  20023. opened_name_value_global_var = false;
  20024. opened_input_value_global_ar = false;
  20025. });
  20026. input_field.on('keydown', function (e) {
  20027. var code = e.keyCode || e.which;
  20028. if (code == 13) {
  20029. if (input_field.val().trim()) {
  20030. if (global_var.type == _types.Types.REAL) {
  20031. global_var.value = parseFloat(input_field.val().trim());
  20032. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  20033. } else {
  20034. if (global_var.type == _types.Types.INTEGER) {
  20035. global_var.value = parseInt(input_field.val().trim());
  20036. } else {
  20037. global_var.value = input_field.val().trim();
  20038. }
  20039. parent_node.find('.span_value_variable').text(global_var.value);
  20040. }
  20041. } else {
  20042. if (global_var.type == _types.Types.REAL) {
  20043. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  20044. } else {
  20045. parent_node.find('.span_value_variable').text(global_var.value);
  20046. }
  20047. }
  20048. if (global_var.type == _types.Types.TEXT) {
  20049. global_var.value = input_field.val();
  20050. parent_node.find('.span_value_variable').text(global_var.value);
  20051. }
  20052. input_field.off();
  20053. input_field.remove();
  20054. /// update elements:
  20055. opened_name_value_global_var = false;
  20056. opened_input_value_global_ar = false;
  20057. }
  20058. if (code == 27) {
  20059. if (global_var.type == _types.Types.REAL) {
  20060. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  20061. } else {
  20062. parent_node.find('.span_value_variable').text(global_var.value);
  20063. }
  20064. input_field.off();
  20065. input_field.remove();
  20066. /// update elements:
  20067. opened_name_value_global_var = false;
  20068. opened_input_value_global_ar = false;
  20069. }
  20070. });
  20071. input_field.select();
  20072. }
  20073. var opened_name_global = false;
  20074. var opened_input_global = null;
  20075. function enableNameUpdate(global_container) {
  20076. var global_var = global_container.data('associatedOject');
  20077. if (opened_name_global) {
  20078. opened_input_global.focus();
  20079. return;
  20080. }
  20081. opened_name_global = true;
  20082. global_container.find('.span_name_variable').text('');
  20083. var input_name = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.name + "' />");
  20084. input_name.insertBefore(global_container.find('.span_name_variable'));
  20085. input_name.on('input', function () {
  20086. var inputWidth = input_name.textWidth() + 10;
  20087. opened_input_global = input_name;
  20088. opened_input_global.focus();
  20089. opened_input_global.css({
  20090. width: inputWidth
  20091. });
  20092. }).trigger('input');
  20093. input_name.focusout(function () {
  20094. /// update array:
  20095. if (input_name.val().trim().length > 0) {
  20096. updateName(global_var, input_name.val().trim());
  20097. global_container.find('.span_name_variable').text(global_var.name);
  20098. } else {
  20099. global_container.find('.span_name_variable').text(global_var.name);
  20100. }
  20101. input_name.off();
  20102. input_name.remove();
  20103. /// update elements:
  20104. opened_name_global = false;
  20105. opened_input_global = false;
  20106. });
  20107. input_name.on('keydown', function (e) {
  20108. var code = e.keyCode || e.which;
  20109. if (code == 13) {
  20110. if (input_name.val().trim()) {
  20111. updateName(global_var, input_name.val().trim());
  20112. global_container.find('.span_name_variable').text(global_var.name);
  20113. } else {
  20114. global_container.find('.span_name_variable').text(global_var.name);
  20115. }
  20116. input_name.off();
  20117. input_name.remove();
  20118. /// update elements:
  20119. opened_name_global = false;
  20120. opened_input_global = false;
  20121. }
  20122. if (code == 27) {
  20123. global_container.find('.span_name_variable').text(global_var.name);
  20124. input_name.off();
  20125. input_name.remove();
  20126. /// update elements:
  20127. opened_name_global = false;
  20128. opened_input_global = false;
  20129. }
  20130. });
  20131. input_name.select();
  20132. }
  20133. var opened_name_value_vector_global_ = false;
  20134. var opened_input_value_vector_global_ = null;
  20135. function enableGlobalVectorValueUpdate(global_var, index, parent_node) {
  20136. if (opened_name_value_vector_global_) {
  20137. opened_input_value_vector_global_.focus();
  20138. return;
  20139. }
  20140. parent_node = (0, _jquery2.default)(parent_node);
  20141. opened_name_value_vector_global_ = true;
  20142. parent_node.find('.span_value_variable').text('');
  20143. var input_field;
  20144. if (global_var.type == _types.Types.REAL) {
  20145. input_field = (0, _jquery2.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) + "' />");
  20146. input_field.insertBefore(parent_node.find('.span_value_variable'));
  20147. } else {
  20148. input_field = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.value[index] + "' />");
  20149. input_field.insertBefore(parent_node.find('.span_value_variable'));
  20150. }
  20151. input_field.on('input', function () {
  20152. var inputWidth = input_field.textWidth() + 10;
  20153. opened_input_value_vector_global_ = input_field;
  20154. input_field.focus();
  20155. var tmpStr = input_field.val();
  20156. input_field.val('');
  20157. input_field.val(tmpStr);
  20158. input_field.css({
  20159. width: inputWidth
  20160. });
  20161. }).trigger('input');
  20162. input_field.focusout(function () {
  20163. /// update array:
  20164. if (input_field.val().trim()) {
  20165. if (global_var.type == _types.Types.REAL) {
  20166. global_var.value[index] = parseFloat(input_field.val().trim());
  20167. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  20168. } else {
  20169. if (global_var.type == _types.Types.INTEGER) {
  20170. global_var.value[index] = parseInt(input_field.val().trim());
  20171. } else {
  20172. global_var.value[index] = input_field.val().trim();
  20173. }
  20174. parent_node.find('.span_value_variable').text(global_var.value[index]);
  20175. }
  20176. } else {
  20177. if (global_var.type == _types.Types.REAL) {
  20178. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  20179. } else {
  20180. parent_node.find('.span_value_variable').text(global_var.value[index]);
  20181. }
  20182. }
  20183. if (global_var.type == _types.Types.TEXT) {
  20184. global_var.value[index] = input_field.val();
  20185. parent_node.find('.span_value_variable').text(global_var.value[index]);
  20186. }
  20187. input_field.off();
  20188. input_field.remove();
  20189. /// update elements:
  20190. opened_name_value_vector_global_ = false;
  20191. opened_input_value_vector_global_ = false;
  20192. });
  20193. input_field.on('keydown', function (e) {
  20194. var code = e.keyCode || e.which;
  20195. if (code == 13) {
  20196. if (input_field.val().trim()) {
  20197. if (global_var.type == _types.Types.REAL) {
  20198. global_var.value[index] = parseFloat(input_field.val().trim());
  20199. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  20200. } else {
  20201. if (global_var.type == _types.Types.INTEGER) {
  20202. global_var.value[index] = parseInt(input_field.val().trim());
  20203. } else {
  20204. global_var.value[index] = input_field.val().trim();
  20205. }
  20206. parent_node.find('.span_value_variable').text(global_var.value[index]);
  20207. }
  20208. } else {
  20209. if (global_var.type == _types.Types.REAL) {
  20210. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  20211. } else {
  20212. parent_node.find('.span_value_variable').text(global_var.value[index]);
  20213. }
  20214. }
  20215. if (global_var.type == _types.Types.TEXT) {
  20216. global_var.value[index] = input_field.val();
  20217. parent_node.find('.span_value_variable').text(global_var.value[index]);
  20218. }
  20219. input_field.off();
  20220. input_field.remove();
  20221. /// update elements:
  20222. opened_name_value_vector_global_ = false;
  20223. opened_input_value_vector_global_ = false;
  20224. }
  20225. if (code == 27) {
  20226. if (global_var.type == _types.Types.REAL) {
  20227. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  20228. } else {
  20229. parent_node.find('.span_value_variable').text(global_var.value[index]);
  20230. }
  20231. input_field.off();
  20232. input_field.remove();
  20233. /// update elements:
  20234. opened_name_value_vector_global_ = false;
  20235. opened_input_value_vector_global_ = false;
  20236. }
  20237. });
  20238. input_field.select();
  20239. }
  20240. _jquery2.default.fn.textWidth = function (text, font) {
  20241. if (!_jquery2.default.fn.textWidth.fakeEl) _jquery2.default.fn.textWidth.fakeEl = (0, _jquery2.default)('<span>').hide().appendTo(document.body);
  20242. _jquery2.default.fn.textWidth.fakeEl.text(text || this.val() || this.text() || this.attr('placeholder')).css('font', font || this.css('font'));
  20243. return _jquery2.default.fn.textWidth.fakeEl.width();
  20244. };
  20245. /***/ }),
  20246. /***/ "./js/visualUI/ivprog_elements.js":
  20247. /*!****************************************!*\
  20248. !*** ./js/visualUI/ivprog_elements.js ***!
  20249. \****************************************/
  20250. /*! no static exports found */
  20251. /***/ (function(module, exports, __webpack_require__) {
  20252. "use strict";
  20253. Object.defineProperty(exports, "__esModule", {
  20254. value: true
  20255. });
  20256. exports.Program = exports.FunctionCallMenu = exports.VariableValueMenu = exports.FunctionCall = exports.SwitchCase = exports.Return = exports.Switch = exports.DoWhileTrue = exports.WhileTrue = exports.RepeatNTimes = exports.IfTrue = exports.ArithmeticExpression = exports.LogicExpression = exports.ConditionalExpression = exports.ExpressionElement = exports.Attribution = exports.Writer = exports.Reader = exports.Break = exports.Comment = exports.SystemFunction = exports.Function = exports.Variable = exports.SYSTEM_FUNCTIONS_CATEGORIES = exports.LOGIC_COMPARISON = exports.ARITHMETIC_COMPARISON = exports.EXPRESSION_TYPES = exports.EXPRESSION_ELEMENTS = exports.ARITHMETIC_TYPES = exports.COMMAND_TYPES = undefined;
  20257. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  20258. var _variable_value_menu = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  20259. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  20260. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  20261. var _melankeWatchjs = __webpack_require__(/*! melanke-watchjs */ "./node_modules/melanke-watchjs/src/watch.js");
  20262. var _melankeWatchjs2 = _interopRequireDefault(_melankeWatchjs);
  20263. var _algorithm = __webpack_require__(/*! ./algorithm */ "./js/visualUI/algorithm.js");
  20264. var AlgorithmManagement = _interopRequireWildcard(_algorithm);
  20265. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  20266. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  20267. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  20268. var COMMAND_TYPES = exports.COMMAND_TYPES = Object.freeze({ function: "function", comment: "comment", reader: "reader", writer: "writer", attribution: "attribution", iftrue: "iftrue",
  20269. repeatNtimes: "repeatNtimes", whiletrue: "whiletrue", dowhiletrue: "dowhiletrue", switch: "switch", switchcase: "switchcase", functioncall: "functioncall", break: "break",
  20270. return: "return" });
  20271. var ARITHMETIC_TYPES = exports.ARITHMETIC_TYPES = Object.freeze({ plus: "plus", minus: "minus", multiplication: "multiplication", division: "division", module: "module", none: "none" });
  20272. var EXPRESSION_ELEMENTS = exports.EXPRESSION_ELEMENTS = Object.freeze({ exp_op_exp: "exp_op_exp", op_exp: "op_exp", par_exp_par: "par_exp_par", start_point: "start_point" });
  20273. var EXPRESSION_TYPES = exports.EXPRESSION_TYPES = Object.freeze({ exp_conditional: "exp_conditional", exp_logic: "exp_logic", exp_arithmetic: "exp_arithmetic" });
  20274. var ARITHMETIC_COMPARISON = exports.ARITHMETIC_COMPARISON = Object.freeze({ greater_than: "greater_than", less_than: "less_than", equals_to: "equals_to", not_equals_to: "not_equals_to", greater_than_or_equals_to: "greater_than_or_equals_to", less_than_or_equals_to: "less_than_or_equals_to" });
  20275. var LOGIC_COMPARISON = exports.LOGIC_COMPARISON = Object.freeze({ equals_to: "equals_to", not_equals_to: "not_equals_to", and: "and", or: "or" });
  20276. var SYSTEM_FUNCTIONS_CATEGORIES = exports.SYSTEM_FUNCTIONS_CATEGORIES = Object.freeze({ math: "math", text: "text_t", arrangement: "arrangement", conversion: "conversion" });
  20277. var Variable = exports.Variable = function Variable(type, name, value) {
  20278. var dimensions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
  20279. var is_constant = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  20280. var rows = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  20281. var columns = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 0;
  20282. _classCallCheck(this, Variable);
  20283. this.type = type;
  20284. this.name = name;
  20285. this.value = value;
  20286. this.dimensions = dimensions;
  20287. this.is_constant = is_constant;
  20288. this.rows = rows;
  20289. this.columns = columns;
  20290. };
  20291. var Function = exports.Function = function Function(name) {
  20292. var return_type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _types.Types.VOID;
  20293. var return_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  20294. var parameters_list = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
  20295. var is_main = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  20296. var is_hidden = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
  20297. var variables_list = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : [];
  20298. var function_comment = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
  20299. var commands = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : [];
  20300. _classCallCheck(this, Function);
  20301. this.type = COMMAND_TYPES.function;
  20302. this.name = name;
  20303. this.return_type = return_type;
  20304. this.return_dimensions = return_dimensions;
  20305. this.parameters_list = parameters_list;
  20306. this.is_main = is_main;
  20307. this.is_hidden = is_hidden;
  20308. this.variables_list = variables_list;
  20309. this.function_comment = function_comment;
  20310. this.commands = commands;
  20311. };
  20312. var SystemFunction = exports.SystemFunction = function SystemFunction(identifier, return_type, return_dimensions, parameters_list) {
  20313. var function_comment = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
  20314. var category = arguments[5];
  20315. _classCallCheck(this, SystemFunction);
  20316. this.type = COMMAND_TYPES.function;
  20317. this.identifier = identifier;
  20318. this.return_type = return_type;
  20319. this.return_dimensions = return_dimensions;
  20320. this.parameters_list = parameters_list;
  20321. this.function_comment = function_comment;
  20322. this.category = category;
  20323. };
  20324. var Comment = exports.Comment = function Comment(comment_text) {
  20325. _classCallCheck(this, Comment);
  20326. this.type = COMMAND_TYPES.comment;
  20327. this.comment_text = comment_text;
  20328. };
  20329. var Break = exports.Break = function Break() {
  20330. _classCallCheck(this, Break);
  20331. this.type = COMMAND_TYPES.break;
  20332. };
  20333. var Reader = exports.Reader = function Reader() {
  20334. var variable_value_menu = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new VariableValueMenu();
  20335. _classCallCheck(this, Reader);
  20336. this.type = COMMAND_TYPES.reader;
  20337. this.variable_value_menu = variable_value_menu;
  20338. };
  20339. var Writer = exports.Writer = function Writer(content) {
  20340. _classCallCheck(this, Writer);
  20341. this.type = COMMAND_TYPES.writer;
  20342. this.content = content;
  20343. };
  20344. var Attribution = exports.Attribution = function Attribution(variable) {
  20345. var expression = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  20346. _classCallCheck(this, Attribution);
  20347. this.type = COMMAND_TYPES.attribution;
  20348. this.variable = variable;
  20349. this.expression = expression;
  20350. };
  20351. var ExpressionElement = exports.ExpressionElement = function ExpressionElement(type_exp) {
  20352. var itens = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  20353. _classCallCheck(this, ExpressionElement);
  20354. this.type_exp = type_exp;
  20355. this.itens = itens;
  20356. };
  20357. var ConditionalExpression = exports.ConditionalExpression = function ConditionalExpression(expression) {
  20358. _classCallCheck(this, ConditionalExpression);
  20359. this.type = EXPRESSION_TYPES.exp_conditional;
  20360. this.expression = expression;
  20361. };
  20362. var LogicExpression = exports.LogicExpression = function LogicExpression(has_neg, first_operand, second_operand, operator) {
  20363. _classCallCheck(this, LogicExpression);
  20364. this.type = EXPRESSION_TYPES.exp_logic;
  20365. this.has_neg = has_neg;
  20366. this.first_operand = first_operand;
  20367. this.second_operand = second_operand;
  20368. this.operator = operator;
  20369. };
  20370. var ArithmeticExpression = exports.ArithmeticExpression = function ArithmeticExpression(first_operand, second_operand, operator) {
  20371. _classCallCheck(this, ArithmeticExpression);
  20372. this.type = EXPRESSION_TYPES.exp_arithmetic;
  20373. this.first_operand = first_operand;
  20374. this.second_operand = second_operand;
  20375. this.operator = operator;
  20376. };
  20377. var IfTrue = exports.IfTrue = function IfTrue(expression, commands_block, commands_else) {
  20378. _classCallCheck(this, IfTrue);
  20379. this.type = COMMAND_TYPES.iftrue;
  20380. this.expression = expression;
  20381. this.commands_block = commands_block;
  20382. this.commands_else = commands_else;
  20383. };
  20384. var RepeatNTimes = exports.RepeatNTimes = function RepeatNTimes(var_attribution, var_incrementation, expression1, expression2, expression3, commands_block) {
  20385. _classCallCheck(this, RepeatNTimes);
  20386. this.type = COMMAND_TYPES.repeatNtimes;
  20387. this.var_attribution = var_attribution;
  20388. this.var_incrementation = var_incrementation;
  20389. this.expression1 = expression1;
  20390. this.expression2 = expression2;
  20391. this.expression3 = expression3;
  20392. this.commands_block = commands_block;
  20393. };
  20394. var WhileTrue = exports.WhileTrue = function WhileTrue(expression, commands_block) {
  20395. _classCallCheck(this, WhileTrue);
  20396. this.type = COMMAND_TYPES.whiletrue;
  20397. this.expression = expression;
  20398. this.commands_block = commands_block;
  20399. };
  20400. var DoWhileTrue = exports.DoWhileTrue = function DoWhileTrue(expression, commands_block) {
  20401. _classCallCheck(this, DoWhileTrue);
  20402. this.type = COMMAND_TYPES.dowhiletrue;
  20403. this.expression = expression;
  20404. this.commands_block = commands_block;
  20405. };
  20406. var Switch = exports.Switch = function Switch(variable) {
  20407. var cases = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  20408. _classCallCheck(this, Switch);
  20409. this.type = COMMAND_TYPES.switch;
  20410. this.variable = variable;
  20411. this.cases = cases;
  20412. };
  20413. var Return = exports.Return = function Return(variable_value_menu) {
  20414. _classCallCheck(this, Return);
  20415. this.type = COMMAND_TYPES.return;
  20416. this.variable_value_menu = variable_value_menu;
  20417. };
  20418. var SwitchCase = exports.SwitchCase = function SwitchCase(variable_value_menu) {
  20419. var commands_block = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  20420. _classCallCheck(this, SwitchCase);
  20421. this.type = COMMAND_TYPES.switchcase;
  20422. this.variable_value_menu = variable_value_menu;
  20423. this.commands_block = commands_block;
  20424. };
  20425. var FunctionCall = exports.FunctionCall = function FunctionCall(function_called, parameters_list) {
  20426. _classCallCheck(this, FunctionCall);
  20427. this.type = COMMAND_TYPES.functioncall;
  20428. this.function_called = function_called;
  20429. this.parameters_list = parameters_list;
  20430. };
  20431. var VariableValueMenu = exports.VariableValueMenu = function VariableValueMenu() {
  20432. var variable_and_value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 7;
  20433. var content = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  20434. var row = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  20435. var column = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  20436. var include_constant = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
  20437. _classCallCheck(this, VariableValueMenu);
  20438. this.type = "var_value";
  20439. this.variable_and_value = variable_and_value;
  20440. this.content = content;
  20441. this.row = row;
  20442. this.column = column;
  20443. this.include_constant = include_constant;
  20444. };
  20445. var FunctionCallMenu = exports.FunctionCallMenu = function FunctionCallMenu() {
  20446. var function_called = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  20447. var parameters_list = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  20448. _classCallCheck(this, FunctionCallMenu);
  20449. this.type = "function_call";
  20450. this.function_called = function_called;
  20451. this.parameters_list = parameters_list;
  20452. };
  20453. var Program = exports.Program = function () {
  20454. function Program() {
  20455. _classCallCheck(this, Program);
  20456. this.functions = [];
  20457. this.globals = [];
  20458. }
  20459. _createClass(Program, [{
  20460. key: 'addFunction',
  20461. value: function addFunction(function_to_add) {
  20462. _melankeWatchjs2.default.watch(function_to_add.parameters_list, function () {
  20463. if (window.insertContext) {
  20464. setTimeout(function () {
  20465. AlgorithmManagement.renderAlgorithm();
  20466. }, 300);
  20467. window.insertContext = false;
  20468. } else {
  20469. AlgorithmManagement.renderAlgorithm();
  20470. }
  20471. }, 1);
  20472. _melankeWatchjs2.default.watch(function_to_add.variables_list, function () {
  20473. if (window.insertContext) {
  20474. setTimeout(function () {
  20475. AlgorithmManagement.renderAlgorithm();
  20476. }, 300);
  20477. window.insertContext = false;
  20478. } else {
  20479. AlgorithmManagement.renderAlgorithm();
  20480. }
  20481. }, 1);
  20482. this.functions.push(function_to_add);
  20483. }
  20484. }, {
  20485. key: 'addVariable',
  20486. value: function addVariable(function_to_receive, variable) {
  20487. if (this.functions[function_to_receive].variable === null) {
  20488. this.functions[function_to_receive].variables_list = [];
  20489. }
  20490. this.functions[function_to_receive].variables_list.push(variable);
  20491. }
  20492. }, {
  20493. key: 'addGlobal',
  20494. value: function addGlobal(variable) {
  20495. this.globals.push(variable);
  20496. }
  20497. }]);
  20498. return Program;
  20499. }();
  20500. /***/ }),
  20501. /***/ "./js/visualUI/types.js":
  20502. /*!******************************!*\
  20503. !*** ./js/visualUI/types.js ***!
  20504. \******************************/
  20505. /*! no static exports found */
  20506. /***/ (function(module, exports, __webpack_require__) {
  20507. "use strict";
  20508. Object.defineProperty(exports, "__esModule", {
  20509. value: true
  20510. });
  20511. var Types = exports.Types = Object.freeze({
  20512. INTEGER: "integer",
  20513. REAL: "real",
  20514. TEXT: "text",
  20515. BOOLEAN: "boolean",
  20516. VOID: "void"
  20517. });
  20518. /***/ }),
  20519. /***/ "./js/visualUI/variables.js":
  20520. /*!**********************************!*\
  20521. !*** ./js/visualUI/variables.js ***!
  20522. \**********************************/
  20523. /*! no static exports found */
  20524. /***/ (function(module, exports, __webpack_require__) {
  20525. "use strict";
  20526. Object.defineProperty(exports, "__esModule", {
  20527. value: true
  20528. });
  20529. exports.addVariable = addVariable;
  20530. exports.renderVariable = renderVariable;
  20531. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  20532. var _jquery2 = _interopRequireDefault(_jquery);
  20533. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  20534. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  20535. var Models = _interopRequireWildcard(_ivprog_elements);
  20536. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  20537. __webpack_require__(/*! ../semantic/semantic.min.js */ "./js/semantic/semantic.min.js");
  20538. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  20539. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  20540. window.jQuery = _jquery2.default;
  20541. var counter_new_variables = 0;
  20542. function addVariable(function_obj, function_container) {
  20543. var is_in_click = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  20544. var new_var = new Models.Variable(_types.Types.INTEGER, _localizedStringsService.LocalizedStrings.getUI('new_variable') + '_' + counter_new_variables, 1);
  20545. if (function_obj.variables_list == null) {
  20546. function_obj.variables_list = [];
  20547. }
  20548. function_obj.variables_list.push(new_var);
  20549. counter_new_variables++;
  20550. var newe = renderVariable(function_container, new_var, function_obj);
  20551. if (is_in_click) {
  20552. newe.css('display', 'none');
  20553. newe.fadeIn();
  20554. }
  20555. }
  20556. function updateName(variable_obj, new_name) {
  20557. variable_obj.name = new_name;
  20558. }
  20559. function removeVariable(variable_obj, variable_container) {
  20560. var function_associated = variable_container.data('associatedFunction');
  20561. var index = function_associated.variables_list.indexOf(variable_obj);
  20562. if (index > -1) {
  20563. window.insertContext = true;
  20564. delete function_associated.variables_list[index];
  20565. function_associated.variables_list.splice(index, 1);
  20566. }
  20567. variable_container.children().off();
  20568. variable_container.off();
  20569. variable_container.fadeOut();
  20570. }
  20571. function updateType(variable_obj, new_type) {
  20572. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  20573. variable_obj.type = new_type;
  20574. variable_obj.dimensions = new_dimensions;
  20575. if (new_dimensions > 0) {
  20576. variable_obj.rows = new_dimensions;
  20577. variable_obj.columns = 2;
  20578. }
  20579. updateInitialValues(variable_obj);
  20580. }
  20581. function addHandlers(variable_obj, variable_container) {
  20582. // Manage variable name:
  20583. variable_container.find(".enable_edit_name_variable").on('click', function (e) {
  20584. enableNameUpdate(variable_obj, variable_container);
  20585. });
  20586. // Menu to change type:
  20587. variable_container.find('.ui.dropdown.variable_type').dropdown({
  20588. onChange: function onChange(value, text, $selectedItem) {
  20589. if ($selectedItem.data('dimensions')) {
  20590. updateType(variable_obj, _types.Types[$selectedItem.data('type')], $selectedItem.data('dimensions'));
  20591. } else {
  20592. updateType(variable_obj, _types.Types[$selectedItem.data('type')]);
  20593. }
  20594. renderValues(variable_obj, variable_container);
  20595. }
  20596. });
  20597. // Remove variable:
  20598. variable_container.find(".remove_variable").on('click', function (e) {
  20599. removeVariable(variable_obj, variable_container);
  20600. });
  20601. }
  20602. function renderVariable(function_container, new_var, function_obj) {
  20603. var element = '<div class="ui label variable_container pink"><i class="ui icon ellipsis vertical inverted"></i>';
  20604. element += '<div class="ui dropdown variable_type">';
  20605. if (new_var.dimensions > 0) {
  20606. element += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(new_var.type.toLowerCase());
  20607. for (var i = 0; i < new_var.dimensions; i++) {
  20608. element += ' [ ] ';
  20609. }
  20610. element += '</div>';
  20611. } else {
  20612. element += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI(new_var.type.toLowerCase()) + '</div>';
  20613. }
  20614. element += '<div class="menu">';
  20615. for (var tm in _types.Types) {
  20616. if (tm == _types.Types.VOID.toUpperCase()) {
  20617. continue;
  20618. }
  20619. element += '<div class="item ' + (new_var.type == tm.toLowerCase() ? ' selected ' : '') + '" data-type="' + tm + '" >' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + '</div>';
  20620. }
  20621. for (var tm in _types.Types) {
  20622. if (tm == _types.Types.VOID.toUpperCase()) {
  20623. continue;
  20624. }
  20625. element += '<div class="item">' + '<i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + '<div class="menu">' + '<div class="item" data-text="' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + ' [ ] " data-type="' + tm + '" data-dimensions="1">[ ]</div>' + '<div class="item" data-text="' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + ' [ ] [ ] " data-type="' + tm + '" data-dimensions="2">[ ] [ ] </div>' + '</div>' + '</div>';
  20626. }
  20627. element += '</div></div> ';
  20628. element += '<div class="editing_name_var"><span class="span_name_variable enable_edit_name_variable">' + new_var.name + '</span> </div>';
  20629. element += ' <span class="character_equals"> = </span> <div class="ui div_valor_var">' + new_var.value + '</div>';
  20630. element += ' <i class="yellow inverted icon times remove_variable"></i></div>';
  20631. element = (0, _jquery2.default)(element);
  20632. element.data('associatedFunction', function_obj);
  20633. function_container.find('.variables_list_div').append(element);
  20634. addHandlers(new_var, element);
  20635. renderValues(new_var, element);
  20636. return element;
  20637. }
  20638. function updateColumnsAndRowsText(variable_container, variable_var) {
  20639. var prev = variable_container.find('.text').text().split('[');
  20640. if (prev.length == 2) {
  20641. var ff = prev[0] + '[ ' + variable_var.columns + ' ] ';
  20642. variable_container.find('.text').empty();
  20643. variable_container.find('.text').text(ff);
  20644. }
  20645. if (prev.length == 3) {
  20646. var ff = prev[0] + '[ ' + variable_var.columns + ' ] [ ' + variable_var.rows + ' ] ';
  20647. variable_container.find('.text').empty();
  20648. variable_container.find('.text').text(ff);
  20649. }
  20650. }
  20651. function renderValues(new_var, variable_container) {
  20652. var ret = "";
  20653. var j = 0;
  20654. if (new_var.dimensions == 0) {
  20655. if (new_var.type == _types.Types.REAL) {
  20656. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + new_var.value.toFixed(1) + '</span> </div> ';
  20657. } else {
  20658. if (new_var.type == _types.Types.BOOLEAN) {
  20659. ret += '<div class="created_div_valor_var"><span class="span_value_variable boolean_simple_type">' + _localizedStringsService.LocalizedStrings.getUI(new_var.value) + '</span> </div> ';
  20660. } else {
  20661. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + new_var.value + '</span> </div> ';
  20662. }
  20663. }
  20664. } else {
  20665. ret += '<table class="tabela_var">';
  20666. if (new_var.dimensions == 1) {
  20667. ret += '<tr>';
  20668. if (new_var.type == _types.Types.REAL) {
  20669. for (var k = 0; k < new_var.columns; k++) {
  20670. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + new_var.value[k].toFixed(1) + '</span></td>';
  20671. }
  20672. } else {
  20673. for (var k = 0; k < new_var.columns; k++) {
  20674. if (new_var.type == _types.Types.BOOLEAN) {
  20675. ret += '<td><span class="span_value_variable boolean_vector_var" data-index="' + k + '">' + _localizedStringsService.LocalizedStrings.getUI(new_var.value[k]) + '</span></td>';
  20676. } else {
  20677. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + new_var.value[k] + '</span>' + '</td>';
  20678. }
  20679. }
  20680. }
  20681. ret += '</tr>';
  20682. ret += '</table>';
  20683. 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>';
  20684. }
  20685. if (new_var.dimensions == 2) {
  20686. if (new_var.type == _types.Types.REAL) {
  20687. for (var l = 0; l < new_var.rows; l++) {
  20688. ret += '<tr>';
  20689. for (var k = 0; k < new_var.columns; k++) {
  20690. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + new_var.value[l][k].toFixed(1) + '</span>' + '</td>';
  20691. }
  20692. ret += '</tr>';
  20693. }
  20694. } else {
  20695. for (var l = 0; l < new_var.rows; l++) {
  20696. ret += '<tr>';
  20697. for (var k = 0; k < new_var.columns; k++) {
  20698. if (new_var.type == _types.Types.BOOLEAN) {
  20699. ret += '<td><span class="span_value_variable boolean_matrix_var" data-index="' + k + '" data-row="' + l + '">' + _localizedStringsService.LocalizedStrings.getUI(new_var.value[l][k]) + '</span></td>';
  20700. } else {
  20701. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + new_var.value[l][k] + '</span></td>';
  20702. }
  20703. }
  20704. ret += '</tr>';
  20705. }
  20706. }
  20707. if (new_var.rows == 0) {
  20708. ret += '<tr><td></td></tr>';
  20709. }
  20710. 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>';
  20711. ret += '</table>';
  20712. 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>';
  20713. }
  20714. }
  20715. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  20716. ret = (0, _jquery2.default)(ret);
  20717. (0, _jquery2.default)(ret).find('.span_value_variable').data('associatedOject', new_var);
  20718. (0, _jquery2.default)(ret).find(".boolean_simple_type").on('click', function (e) {
  20719. alternateBooleanValue(new_var, this.parentNode);
  20720. });
  20721. (0, _jquery2.default)(ret).find(".simple_var").on('click', function (e) {
  20722. enableValueUpdate(new_var, this.parentNode);
  20723. });
  20724. (0, _jquery2.default)(ret).find(".boolean_vector_var").on('click', function (e) {
  20725. alternateBooleanVectorValue(new_var, (0, _jquery2.default)(this).data('index'), this.parentNode);
  20726. });
  20727. (0, _jquery2.default)(ret).find(".vector_var").on('click', function (e) {
  20728. enableVectorValueUpdate(new_var, (0, _jquery2.default)(this).data('index'), this.parentNode);
  20729. });
  20730. (0, _jquery2.default)(ret).find(".remove_global_vector_column").on('click', function (e) {
  20731. removeColumnVector(new_var);
  20732. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  20733. renderValues(new_var, variable_container);
  20734. });
  20735. (0, _jquery2.default)(ret).find(".add_global_vector_column").on('click', function (e) {
  20736. addColumnVector(new_var);
  20737. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  20738. renderValues(new_var, variable_container);
  20739. });
  20740. (0, _jquery2.default)(ret).find(".remove_global_matrix_column").on('click', function (e) {
  20741. removeColumnMatrix(new_var);
  20742. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  20743. renderValues(new_var, variable_container);
  20744. });
  20745. (0, _jquery2.default)(ret).find(".add_global_matrix_column").on('click', function (e) {
  20746. addColumnMatrix(new_var);
  20747. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  20748. renderValues(new_var, variable_container);
  20749. });
  20750. (0, _jquery2.default)(ret).find(".remove_global_matrix_line").on('click', function (e) {
  20751. removeLineMatrix(new_var);
  20752. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  20753. renderValues(new_var, variable_container);
  20754. });
  20755. (0, _jquery2.default)(ret).find(".add_global_matrix_line").on('click', function (e) {
  20756. addLineMatrix(new_var);
  20757. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  20758. renderValues(new_var, variable_container);
  20759. });
  20760. (0, _jquery2.default)(ret).find(".boolean_matrix_var").on('click', function (e) {
  20761. alternateBooleanMatrixValue(new_var, (0, _jquery2.default)(this).data('row'), (0, _jquery2.default)(this).data('index'), this.parentNode);
  20762. });
  20763. (0, _jquery2.default)(ret).find(".matrix_var").on('click', function (e) {
  20764. enableMatrixValueUpdate(new_var, (0, _jquery2.default)(this).data('row'), (0, _jquery2.default)(this).data('index'), this.parentNode);
  20765. });
  20766. (0, _jquery2.default)(variable_container).find(".div_valor_var").append(ret);
  20767. updateColumnsAndRowsText(variable_container, new_var);
  20768. }
  20769. function alternateBooleanMatrixValue(var_obj, row, index, value_container) {
  20770. var_obj.value[row][index] = !var_obj.value[row][index];
  20771. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(var_obj.value[row][index]));
  20772. }
  20773. function addLineMatrix(var_obj) {
  20774. var_obj.rows++;
  20775. if (var_obj.type == _types.Types.INTEGER) {
  20776. var n_l = [];
  20777. for (var i = 0; i < var_obj.columns; i++) {
  20778. n_l.push(1);
  20779. }
  20780. var_obj.value.push(n_l);
  20781. }
  20782. if (var_obj.type == _types.Types.REAL) {
  20783. var n_l = [];
  20784. for (i = 0; i < var_obj.columns; i++) {
  20785. n_l.push(1.0);
  20786. }
  20787. var_obj.value.push(n_l);
  20788. }
  20789. if (var_obj.type == _types.Types.TEXT) {
  20790. var n_l = [];
  20791. for (i = 0; i < var_obj.columns; i++) {
  20792. n_l.push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  20793. }
  20794. var_obj.value.push(n_l);
  20795. }
  20796. if (var_obj.type == _types.Types.BOOLEAN) {
  20797. var n_l = [];
  20798. for (i = 0; i < var_obj.columns; i++) {
  20799. n_l.push(true);
  20800. }
  20801. var_obj.value.push(n_l);
  20802. }
  20803. }
  20804. function removeLineMatrix(var_obj) {
  20805. if (var_obj.rows == 0) {
  20806. return;
  20807. }
  20808. var_obj.rows--;
  20809. var_obj.value.splice(var_obj.value.length - 1, 1);
  20810. }
  20811. function addColumnMatrix(var_obj) {
  20812. var_obj.columns++;
  20813. if (var_obj.type == _types.Types.INTEGER) {
  20814. for (var i = 0; i < var_obj.rows; i++) {
  20815. var_obj.value[i].push(1);
  20816. }
  20817. }
  20818. if (var_obj.type == _types.Types.REAL) {
  20819. for (var i = 0; i < var_obj.rows; i++) {
  20820. var_obj.value[i].push(1.0);
  20821. }
  20822. }
  20823. if (var_obj.type == _types.Types.TEXT) {
  20824. for (var i = 0; i < var_obj.rows; i++) {
  20825. var_obj.value[i].push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  20826. }
  20827. }
  20828. if (var_obj.type == _types.Types.BOOLEAN) {
  20829. for (var i = 0; i < var_obj.rows; i++) {
  20830. var_obj.value[i].push(true);
  20831. }
  20832. }
  20833. }
  20834. function removeColumnMatrix(var_obj) {
  20835. if (var_obj.columns == 0) {
  20836. return;
  20837. }
  20838. var_obj.columns--;
  20839. for (var i = 0; i < var_obj.rows; i++) {
  20840. var_obj.value[i].splice(var_obj.value[i].length - 1, 1);
  20841. }
  20842. }
  20843. function addColumnVector(var_obj) {
  20844. var_obj.columns++;
  20845. if (var_obj.type == _types.Types.INTEGER) {
  20846. var_obj.value.push(1);
  20847. }
  20848. if (var_obj.type == _types.Types.REAL) {
  20849. var_obj.value.push(1.0);
  20850. }
  20851. if (var_obj.type == _types.Types.TEXT) {
  20852. var_obj.value.push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  20853. }
  20854. if (var_obj.type == _types.Types.BOOLEAN) {
  20855. var_obj.value.push(true);
  20856. }
  20857. }
  20858. function removeColumnVector(var_obj) {
  20859. if (var_obj.columns == 0) {
  20860. return;
  20861. }
  20862. var_obj.columns--;
  20863. var_obj.value.splice(var_obj.value.length - 1, 1);
  20864. }
  20865. function alternateBooleanValue(var_obj, value_container) {
  20866. var_obj.value = !var_obj.value;
  20867. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(var_obj.value));
  20868. }
  20869. function alternateBooleanVectorValue(var_obj, index, value_container) {
  20870. var_obj.value[index] = !var_obj.value[index];
  20871. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(var_obj.value[index]));
  20872. }
  20873. function updateInitialValues(variable_obj) {
  20874. if (variable_obj.type == _types.Types.INTEGER) {
  20875. if (variable_obj.dimensions == 0) {
  20876. variable_obj.value = 1;
  20877. }
  20878. if (variable_obj.dimensions == 1) {
  20879. variable_obj.value = [1, 1];
  20880. }
  20881. if (variable_obj.dimensions == 2) {
  20882. variable_obj.value = [[1, 1], [1, 1]];
  20883. }
  20884. }
  20885. if (variable_obj.type == _types.Types.REAL) {
  20886. if (variable_obj.dimensions == 0) {
  20887. variable_obj.value = 1.0;
  20888. }
  20889. if (variable_obj.dimensions == 1) {
  20890. variable_obj.value = [1.0, 1.0];
  20891. }
  20892. if (variable_obj.dimensions == 2) {
  20893. variable_obj.value = [[1.0, 1.0], [1.0, 1.0]];
  20894. }
  20895. }
  20896. if (variable_obj.type == _types.Types.TEXT) {
  20897. if (variable_obj.dimensions == 0) {
  20898. variable_obj.value = _localizedStringsService.LocalizedStrings.getUI('text_start');
  20899. }
  20900. if (variable_obj.dimensions == 1) {
  20901. variable_obj.value = [_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')];
  20902. }
  20903. if (variable_obj.dimensions == 2) {
  20904. variable_obj.value = [[_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')], [_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')]];
  20905. }
  20906. }
  20907. if (variable_obj.type == _types.Types.BOOLEAN) {
  20908. if (variable_obj.dimensions == 0) {
  20909. variable_obj.value = true;
  20910. }
  20911. if (variable_obj.dimensions == 1) {
  20912. variable_obj.value = [true, true];
  20913. }
  20914. if (variable_obj.dimensions == 2) {
  20915. variable_obj.value = [[true, true], [true, true]];
  20916. }
  20917. }
  20918. }
  20919. var opened_name_value_vector_global_ = false;
  20920. var opened_input_value_vector_global_ = null;
  20921. function enableVectorValueUpdate(var_obj, index, parent_node) {
  20922. if (opened_name_value_vector_global_) {
  20923. opened_input_value_vector_global_.focus();
  20924. return;
  20925. }
  20926. parent_node = (0, _jquery2.default)(parent_node);
  20927. opened_name_value_vector_global_ = true;
  20928. parent_node.find('.span_value_variable').text('');
  20929. var input_field;
  20930. if (var_obj.type == _types.Types.REAL) {
  20931. input_field = (0, _jquery2.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) + "' />");
  20932. input_field.insertBefore(parent_node.find('.span_value_variable'));
  20933. } else {
  20934. input_field = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + var_obj.value[index] + "' />");
  20935. input_field.insertBefore(parent_node.find('.span_value_variable'));
  20936. }
  20937. input_field.on('input', function () {
  20938. var inputWidth = input_field.textWidth() + 10;
  20939. opened_input_value_vector_global_ = input_field;
  20940. input_field.focus();
  20941. var tmpStr = input_field.val();
  20942. input_field.val('');
  20943. input_field.val(tmpStr);
  20944. input_field.css({
  20945. width: inputWidth
  20946. });
  20947. }).trigger('input');
  20948. input_field.focusout(function () {
  20949. /// update array:
  20950. if (input_field.val().trim()) {
  20951. if (var_obj.type == _types.Types.REAL) {
  20952. var_obj.value[index] = parseFloat(input_field.val().trim());
  20953. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  20954. } else {
  20955. if (var_obj.type == _types.Types.INTEGER) {
  20956. var_obj.value[index] = parseInt(input_field.val().trim());
  20957. } else {
  20958. var_obj.value[index] = input_field.val().trim();
  20959. }
  20960. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  20961. }
  20962. } else {
  20963. if (var_obj.type == _types.Types.REAL) {
  20964. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  20965. } else {
  20966. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  20967. }
  20968. }
  20969. if (var_obj.type == _types.Types.TEXT) {
  20970. var_obj.value[index] = input_field.val();
  20971. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  20972. }
  20973. input_field.off();
  20974. input_field.remove();
  20975. /// update elements:
  20976. opened_name_value_vector_global_ = false;
  20977. opened_input_value_vector_global_ = false;
  20978. });
  20979. input_field.on('keydown', function (e) {
  20980. var code = e.keyCode || e.which;
  20981. if (code == 13) {
  20982. if (input_field.val().trim()) {
  20983. if (var_obj.type == _types.Types.REAL) {
  20984. var_obj.value[index] = parseFloat(input_field.val().trim());
  20985. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  20986. } else {
  20987. if (var_obj.type == _types.Types.INTEGER) {
  20988. var_obj.value[index] = parseInt(input_field.val().trim());
  20989. } else {
  20990. var_obj.value[index] = input_field.val().trim();
  20991. }
  20992. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  20993. }
  20994. } else {
  20995. if (var_obj.type == _types.Types.REAL) {
  20996. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  20997. } else {
  20998. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  20999. }
  21000. }
  21001. if (var_obj.type == _types.Types.TEXT) {
  21002. var_obj.value[index] = input_field.val();
  21003. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  21004. }
  21005. input_field.off();
  21006. input_field.remove();
  21007. /// update elements:
  21008. opened_name_value_vector_global_ = false;
  21009. opened_input_value_vector_global_ = false;
  21010. }
  21011. if (code == 27) {
  21012. if (var_obj.type == _types.Types.REAL) {
  21013. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  21014. } else {
  21015. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  21016. }
  21017. input_field.off();
  21018. input_field.remove();
  21019. /// update elements:
  21020. opened_name_value_vector_global_ = false;
  21021. opened_input_value_vector_global_ = false;
  21022. }
  21023. });
  21024. input_field.select();
  21025. }
  21026. var opened_name_value_global_var = false;
  21027. var opened_input_value_global_ar = null;
  21028. function enableValueUpdate(var_obj, parent_node) {
  21029. if (opened_name_value_global_var) {
  21030. opened_input_value_global_ar.focus();
  21031. return;
  21032. }
  21033. parent_node = (0, _jquery2.default)(parent_node);
  21034. opened_name_value_global_var = true;
  21035. var input_field;
  21036. parent_node.find('.span_value_variable').text('');
  21037. if (var_obj.type == _types.Types.REAL) {
  21038. input_field = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + var_obj.value.toFixed(1) + "' />");
  21039. input_field.insertBefore(parent_node.find('.span_value_variable'));
  21040. } else {
  21041. input_field = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + var_obj.value + "' />");
  21042. input_field.insertBefore(parent_node.find('.span_value_variable'));
  21043. }
  21044. input_field.on('input', function () {
  21045. var inputWidth = input_field.textWidth() + 10;
  21046. opened_input_value_global_ar = input_field;
  21047. input_field.focus();
  21048. var tmpStr = input_field.val();
  21049. input_field.val('');
  21050. input_field.val(tmpStr);
  21051. input_field.css({
  21052. width: inputWidth
  21053. });
  21054. }).trigger('input');
  21055. input_field.focusout(function () {
  21056. /// update array:
  21057. if (input_field.val().trim()) {
  21058. if (var_obj.type == _types.Types.REAL) {
  21059. var_obj.value = parseFloat(input_field.val().trim());
  21060. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  21061. } else {
  21062. if (var_obj.type == _types.Types.INTEGER) {
  21063. var_obj.value = parseInt(input_field.val().trim());
  21064. } else {
  21065. var_obj.value = input_field.val().trim();
  21066. }
  21067. parent_node.find('.span_value_variable').text(var_obj.value);
  21068. }
  21069. } else {
  21070. if (var_obj.type == _types.Types.REAL) {
  21071. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  21072. } else {
  21073. parent_node.find('.span_value_variable').text(var_obj.value);
  21074. }
  21075. }
  21076. if (var_obj.type == _types.Types.TEXT) {
  21077. var_obj.value = input_field.val();
  21078. parent_node.find('.span_value_variable').text(var_obj.value);
  21079. }
  21080. input_field.off();
  21081. input_field.remove();
  21082. /// update elements:
  21083. opened_name_value_global_var = false;
  21084. opened_input_value_global_ar = false;
  21085. });
  21086. input_field.on('keydown', function (e) {
  21087. var code = e.keyCode || e.which;
  21088. if (code == 13) {
  21089. if (input_field.val().trim()) {
  21090. if (var_obj.type == _types.Types.REAL) {
  21091. var_obj.value = parseFloat(input_field.val().trim());
  21092. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  21093. } else {
  21094. if (var_obj.type == _types.Types.INTEGER) {
  21095. var_obj.value = parseInt(input_field.val().trim());
  21096. } else {
  21097. var_obj.value = input_field.val().trim();
  21098. }
  21099. parent_node.find('.span_value_variable').text(var_obj.value);
  21100. }
  21101. } else {
  21102. if (var_obj.type == _types.Types.REAL) {
  21103. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  21104. } else {
  21105. parent_node.find('.span_value_variable').text(var_obj.value);
  21106. }
  21107. }
  21108. if (var_obj.type == _types.Types.TEXT) {
  21109. var_obj.value = input_field.val();
  21110. parent_node.find('.span_value_variable').text(var_obj.value);
  21111. }
  21112. input_field.off();
  21113. input_field.remove();
  21114. /// update elements:
  21115. opened_name_value_global_var = false;
  21116. opened_input_value_global_ar = false;
  21117. }
  21118. if (code == 27) {
  21119. if (var_obj.type == _types.Types.REAL) {
  21120. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  21121. } else {
  21122. parent_node.find('.span_value_variable').text(var_obj.value);
  21123. }
  21124. input_field.off();
  21125. input_field.remove();
  21126. /// update elements:
  21127. opened_name_value_global_var = false;
  21128. opened_input_value_global_ar = false;
  21129. }
  21130. });
  21131. input_field.select();
  21132. }
  21133. var opened_name_global = false;
  21134. var opened_input_global = null;
  21135. function enableNameUpdate(variable_obj, variable_container) {
  21136. if (opened_name_global) {
  21137. opened_input_global.focus();
  21138. return;
  21139. }
  21140. opened_name_global = true;
  21141. variable_container.find('.span_name_variable').text('');
  21142. var input_name;
  21143. input_name = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + variable_obj.name + "' />");
  21144. input_name.insertBefore(variable_container.find('.span_name_variable'));
  21145. input_name.on('input', function () {
  21146. var inputWidth = input_name.textWidth() + 10;
  21147. opened_input_global = input_name;
  21148. input_name.focus();
  21149. var tmpStr = input_name.val();
  21150. input_name.val('');
  21151. input_name.val(tmpStr);
  21152. input_name.css({
  21153. width: inputWidth
  21154. });
  21155. }).trigger('input');
  21156. input_name.focusout(function () {
  21157. /// update array:
  21158. if (input_name.val().trim().length > 0) {
  21159. updateName(variable_obj, input_name.val().trim());
  21160. variable_container.find('.span_name_variable').text(variable_obj.name);
  21161. } else {
  21162. variable_container.find('.span_name_variable').text(variable_obj.name);
  21163. }
  21164. input_name.off();
  21165. input_name.remove();
  21166. /// update elements:
  21167. opened_name_global = false;
  21168. opened_input_global = false;
  21169. });
  21170. input_name.on('keydown', function (e) {
  21171. var code = e.keyCode || e.which;
  21172. if (code == 13) {
  21173. if (input_name.val().trim().length > 0) {
  21174. updateName(variable_obj, input_name.val().trim());
  21175. variable_container.find('.span_name_variable').text(variable_obj.name);
  21176. } else {
  21177. variable_container.find('.span_name_variable').text(variable_obj.name);
  21178. }
  21179. input_name.off();
  21180. input_name.remove();
  21181. /// update elements:
  21182. opened_name_global = false;
  21183. opened_input_global = false;
  21184. }
  21185. if (code == 27) {
  21186. variable_container.find('.span_name_variable').text(variable_obj.name);
  21187. input_name.off();
  21188. input_name.remove();
  21189. /// update elements:
  21190. opened_name_global = false;
  21191. opened_input_global = false;
  21192. }
  21193. });
  21194. input_name.select();
  21195. }
  21196. var opened_name_value_matrix_global_v = false;
  21197. var opened_input_value_matrix_global_v = null;
  21198. function enableMatrixValueUpdate(var_obj, row, index, parent_node) {
  21199. if (opened_name_value_matrix_global_v) {
  21200. opened_input_value_matrix_global_v.focus();
  21201. return;
  21202. }
  21203. parent_node = (0, _jquery2.default)(parent_node);
  21204. opened_name_value_matrix_global_v = true;
  21205. parent_node.find('.span_value_variable').text('');
  21206. var input_field;
  21207. if (var_obj.type == _types.Types.REAL) {
  21208. input_field = (0, _jquery2.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) + "' />");
  21209. input_field.insertBefore(parent_node.find('.span_value_variable'));
  21210. } else {
  21211. input_field = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + var_obj.value[row][index] + "' />");
  21212. input_field.insertBefore(parent_node.find('.span_value_variable'));
  21213. }
  21214. input_field.on('input', function () {
  21215. var inputWidth = input_field.textWidth() + 10;
  21216. opened_input_value_matrix_global_v = input_field;
  21217. input_field.focus();
  21218. var tmpStr = input_field.val();
  21219. input_field.val('');
  21220. input_field.val(tmpStr);
  21221. input_field.css({
  21222. width: inputWidth
  21223. });
  21224. }).trigger('input');
  21225. input_field.focusout(function () {
  21226. /// update array:
  21227. if (input_field.val().trim()) {
  21228. if (var_obj.type == _types.Types.REAL) {
  21229. var_obj.value[row][index] = parseFloat(input_field.val().trim());
  21230. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  21231. } else {
  21232. if (var_obj.type == _types.Types.INTEGER) {
  21233. var_obj.value[row][index] = parseInt(input_field.val().trim());
  21234. } else {
  21235. var_obj.value[row][index] = input_field.val().trim();
  21236. }
  21237. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  21238. }
  21239. } else {
  21240. if (var_obj.type == _types.Types.REAL) {
  21241. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  21242. } else {
  21243. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  21244. }
  21245. }
  21246. if (var_obj.type == _types.Types.TEXT) {
  21247. var_obj.value[row][index] = input_field.val();
  21248. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  21249. }
  21250. input_field.off();
  21251. input_field.remove();
  21252. /// update elements:
  21253. opened_name_value_matrix_global_v = false;
  21254. opened_input_value_matrix_global_v = false;
  21255. });
  21256. input_field.on('keydown', function (e) {
  21257. var code = e.keyCode || e.which;
  21258. if (code == 13) {
  21259. if (input_field.val().trim()) {
  21260. if (var_obj.type == _types.Types.REAL) {
  21261. var_obj.value[row][index] = parseFloat(input_field.val().trim());
  21262. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  21263. } else {
  21264. if (var_obj.type == _types.Types.INTEGER) {
  21265. var_obj.value[row][index] = parseInt(input_field.val().trim());
  21266. } else {
  21267. var_obj.value[row][index] = input_field.val().trim();
  21268. }
  21269. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  21270. }
  21271. } else {
  21272. if (var_obj.type == _types.Types.REAL) {
  21273. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  21274. } else {
  21275. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  21276. }
  21277. }
  21278. if (var_obj.type == _types.Types.TEXT) {
  21279. var_obj.value[row][index] = input_field.val();
  21280. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  21281. }
  21282. input_field.off();
  21283. input_field.remove();
  21284. /// update elements:
  21285. opened_name_value_matrix_global_v = false;
  21286. opened_input_value_matrix_global_v = false;
  21287. }
  21288. if (code == 27) {
  21289. if (var_obj.type == _types.Types.REAL) {
  21290. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  21291. } else {
  21292. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  21293. }
  21294. input_field.off();
  21295. input_field.remove();
  21296. /// update elements:
  21297. opened_name_value_matrix_global_v = false;
  21298. opened_input_value_matrix_global_v = false;
  21299. }
  21300. });
  21301. input_field.select();
  21302. }
  21303. /***/ }),
  21304. /***/ "./node_modules/antlr4/BufferedTokenStream.js":
  21305. /*!****************************************************!*\
  21306. !*** ./node_modules/antlr4/BufferedTokenStream.js ***!
  21307. \****************************************************/
  21308. /*! no static exports found */
  21309. /***/ (function(module, exports, __webpack_require__) {
  21310. "use strict";
  21311. //
  21312. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  21313. * Use of this file is governed by the BSD 3-clause license that
  21314. * can be found in the LICENSE.txt file in the project root.
  21315. */
  21316. // This implementation of {@link TokenStream} loads tokens from a
  21317. // {@link TokenSource} on-demand, and places the tokens in a buffer to provide
  21318. // access to any previous token by index.
  21319. //
  21320. // <p>
  21321. // This token stream ignores the value of {@link Token//getChannel}. If your
  21322. // parser requires the token stream filter tokens to only those on a particular
  21323. // channel, such as {@link Token//DEFAULT_CHANNEL} or
  21324. // {@link Token//HIDDEN_CHANNEL}, use a filtering token stream such a
  21325. // {@link CommonTokenStream}.</p>
  21326. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  21327. var Lexer = __webpack_require__(/*! ./Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  21328. var Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  21329. // this is just to keep meaningful parameter types to Parser
  21330. function TokenStream() {
  21331. return this;
  21332. }
  21333. function BufferedTokenStream(tokenSource) {
  21334. TokenStream.call(this);
  21335. // The {@link TokenSource} from which tokens for this stream are fetched.
  21336. this.tokenSource = tokenSource;
  21337. // A collection of all tokens fetched from the token source. The list is
  21338. // considered a complete view of the input once {@link //fetchedEOF} is set
  21339. // to {@code true}.
  21340. this.tokens = [];
  21341. // The index into {@link //tokens} of the current token (next token to
  21342. // {@link //consume}). {@link //tokens}{@code [}{@link //p}{@code ]} should
  21343. // be
  21344. // {@link //LT LT(1)}.
  21345. //
  21346. // <p>This field is set to -1 when the stream is first constructed or when
  21347. // {@link //setTokenSource} is called, indicating that the first token has
  21348. // not yet been fetched from the token source. For additional information,
  21349. // see the documentation of {@link IntStream} for a description of
  21350. // Initializing Methods.</p>
  21351. this.index = -1;
  21352. // Indicates whether the {@link Token//EOF} token has been fetched from
  21353. // {@link //tokenSource} and added to {@link //tokens}. This field improves
  21354. // performance for the following cases:
  21355. //
  21356. // <ul>
  21357. // <li>{@link //consume}: The lookahead check in {@link //consume} to
  21358. // prevent
  21359. // consuming the EOF symbol is optimized by checking the values of
  21360. // {@link //fetchedEOF} and {@link //p} instead of calling {@link
  21361. // //LA}.</li>
  21362. // <li>{@link //fetch}: The check to prevent adding multiple EOF symbols
  21363. // into
  21364. // {@link //tokens} is trivial with this field.</li>
  21365. // <ul>
  21366. this.fetchedEOF = false;
  21367. return this;
  21368. }
  21369. BufferedTokenStream.prototype = Object.create(TokenStream.prototype);
  21370. BufferedTokenStream.prototype.constructor = BufferedTokenStream;
  21371. BufferedTokenStream.prototype.mark = function () {
  21372. return 0;
  21373. };
  21374. BufferedTokenStream.prototype.release = function (marker) {
  21375. // no resources to release
  21376. };
  21377. BufferedTokenStream.prototype.reset = function () {
  21378. this.seek(0);
  21379. };
  21380. BufferedTokenStream.prototype.seek = function (index) {
  21381. this.lazyInit();
  21382. this.index = this.adjustSeekIndex(index);
  21383. };
  21384. BufferedTokenStream.prototype.get = function (index) {
  21385. this.lazyInit();
  21386. return this.tokens[index];
  21387. };
  21388. BufferedTokenStream.prototype.consume = function () {
  21389. var skipEofCheck = false;
  21390. if (this.index >= 0) {
  21391. if (this.fetchedEOF) {
  21392. // the last token in tokens is EOF. skip check if p indexes any
  21393. // fetched token except the last.
  21394. skipEofCheck = this.index < this.tokens.length - 1;
  21395. } else {
  21396. // no EOF token in tokens. skip check if p indexes a fetched token.
  21397. skipEofCheck = this.index < this.tokens.length;
  21398. }
  21399. } else {
  21400. // not yet initialized
  21401. skipEofCheck = false;
  21402. }
  21403. if (!skipEofCheck && this.LA(1) === Token.EOF) {
  21404. throw "cannot consume EOF";
  21405. }
  21406. if (this.sync(this.index + 1)) {
  21407. this.index = this.adjustSeekIndex(this.index + 1);
  21408. }
  21409. };
  21410. // Make sure index {@code i} in tokens has a token.
  21411. //
  21412. // @return {@code true} if a token is located at index {@code i}, otherwise
  21413. // {@code false}.
  21414. // @see //get(int i)
  21415. // /
  21416. BufferedTokenStream.prototype.sync = function (i) {
  21417. var n = i - this.tokens.length + 1; // how many more elements we need?
  21418. if (n > 0) {
  21419. var fetched = this.fetch(n);
  21420. return fetched >= n;
  21421. }
  21422. return true;
  21423. };
  21424. // Add {@code n} elements to buffer.
  21425. //
  21426. // @return The actual number of elements added to the buffer.
  21427. // /
  21428. BufferedTokenStream.prototype.fetch = function (n) {
  21429. if (this.fetchedEOF) {
  21430. return 0;
  21431. }
  21432. for (var i = 0; i < n; i++) {
  21433. var t = this.tokenSource.nextToken();
  21434. t.tokenIndex = this.tokens.length;
  21435. this.tokens.push(t);
  21436. if (t.type === Token.EOF) {
  21437. this.fetchedEOF = true;
  21438. return i + 1;
  21439. }
  21440. }
  21441. return n;
  21442. };
  21443. // Get all tokens from start..stop inclusively///
  21444. BufferedTokenStream.prototype.getTokens = function (start, stop, types) {
  21445. if (types === undefined) {
  21446. types = null;
  21447. }
  21448. if (start < 0 || stop < 0) {
  21449. return null;
  21450. }
  21451. this.lazyInit();
  21452. var subset = [];
  21453. if (stop >= this.tokens.length) {
  21454. stop = this.tokens.length - 1;
  21455. }
  21456. for (var i = start; i < stop; i++) {
  21457. var t = this.tokens[i];
  21458. if (t.type === Token.EOF) {
  21459. break;
  21460. }
  21461. if (types === null || types.contains(t.type)) {
  21462. subset.push(t);
  21463. }
  21464. }
  21465. return subset;
  21466. };
  21467. BufferedTokenStream.prototype.LA = function (i) {
  21468. return this.LT(i).type;
  21469. };
  21470. BufferedTokenStream.prototype.LB = function (k) {
  21471. if (this.index - k < 0) {
  21472. return null;
  21473. }
  21474. return this.tokens[this.index - k];
  21475. };
  21476. BufferedTokenStream.prototype.LT = function (k) {
  21477. this.lazyInit();
  21478. if (k === 0) {
  21479. return null;
  21480. }
  21481. if (k < 0) {
  21482. return this.LB(-k);
  21483. }
  21484. var i = this.index + k - 1;
  21485. this.sync(i);
  21486. if (i >= this.tokens.length) {
  21487. // return EOF token
  21488. // EOF must be last token
  21489. return this.tokens[this.tokens.length - 1];
  21490. }
  21491. return this.tokens[i];
  21492. };
  21493. // Allowed derived classes to modify the behavior of operations which change
  21494. // the current stream position by adjusting the target token index of a seek
  21495. // operation. The default implementation simply returns {@code i}. If an
  21496. // exception is thrown in this method, the current stream index should not be
  21497. // changed.
  21498. //
  21499. // <p>For example, {@link CommonTokenStream} overrides this method to ensure
  21500. // that
  21501. // the seek target is always an on-channel token.</p>
  21502. //
  21503. // @param i The target token index.
  21504. // @return The adjusted target token index.
  21505. BufferedTokenStream.prototype.adjustSeekIndex = function (i) {
  21506. return i;
  21507. };
  21508. BufferedTokenStream.prototype.lazyInit = function () {
  21509. if (this.index === -1) {
  21510. this.setup();
  21511. }
  21512. };
  21513. BufferedTokenStream.prototype.setup = function () {
  21514. this.sync(0);
  21515. this.index = this.adjustSeekIndex(0);
  21516. };
  21517. // Reset this token stream by setting its token source.///
  21518. BufferedTokenStream.prototype.setTokenSource = function (tokenSource) {
  21519. this.tokenSource = tokenSource;
  21520. this.tokens = [];
  21521. this.index = -1;
  21522. this.fetchedEOF = false;
  21523. };
  21524. // Given a starting index, return the index of the next token on channel.
  21525. // Return i if tokens[i] is on channel. Return -1 if there are no tokens
  21526. // on channel between i and EOF.
  21527. // /
  21528. BufferedTokenStream.prototype.nextTokenOnChannel = function (i, channel) {
  21529. this.sync(i);
  21530. if (i >= this.tokens.length) {
  21531. return -1;
  21532. }
  21533. var token = this.tokens[i];
  21534. while (token.channel !== this.channel) {
  21535. if (token.type === Token.EOF) {
  21536. return -1;
  21537. }
  21538. i += 1;
  21539. this.sync(i);
  21540. token = this.tokens[i];
  21541. }
  21542. return i;
  21543. };
  21544. // Given a starting index, return the index of the previous token on channel.
  21545. // Return i if tokens[i] is on channel. Return -1 if there are no tokens
  21546. // on channel between i and 0.
  21547. BufferedTokenStream.prototype.previousTokenOnChannel = function (i, channel) {
  21548. while (i >= 0 && this.tokens[i].channel !== channel) {
  21549. i -= 1;
  21550. }
  21551. return i;
  21552. };
  21553. // Collect all tokens on specified channel to the right of
  21554. // the current token up until we see a token on DEFAULT_TOKEN_CHANNEL or
  21555. // EOF. If channel is -1, find any non default channel token.
  21556. BufferedTokenStream.prototype.getHiddenTokensToRight = function (tokenIndex, channel) {
  21557. if (channel === undefined) {
  21558. channel = -1;
  21559. }
  21560. this.lazyInit();
  21561. if (tokenIndex < 0 || tokenIndex >= this.tokens.length) {
  21562. throw "" + tokenIndex + " not in 0.." + this.tokens.length - 1;
  21563. }
  21564. var nextOnChannel = this.nextTokenOnChannel(tokenIndex + 1, Lexer.DEFAULT_TOKEN_CHANNEL);
  21565. var from_ = tokenIndex + 1;
  21566. // if none onchannel to right, nextOnChannel=-1 so set to = last token
  21567. var to = nextOnChannel === -1 ? this.tokens.length - 1 : nextOnChannel;
  21568. return this.filterForChannel(from_, to, channel);
  21569. };
  21570. // Collect all tokens on specified channel to the left of
  21571. // the current token up until we see a token on DEFAULT_TOKEN_CHANNEL.
  21572. // If channel is -1, find any non default channel token.
  21573. BufferedTokenStream.prototype.getHiddenTokensToLeft = function (tokenIndex, channel) {
  21574. if (channel === undefined) {
  21575. channel = -1;
  21576. }
  21577. this.lazyInit();
  21578. if (tokenIndex < 0 || tokenIndex >= this.tokens.length) {
  21579. throw "" + tokenIndex + " not in 0.." + this.tokens.length - 1;
  21580. }
  21581. var prevOnChannel = this.previousTokenOnChannel(tokenIndex - 1, Lexer.DEFAULT_TOKEN_CHANNEL);
  21582. if (prevOnChannel === tokenIndex - 1) {
  21583. return null;
  21584. }
  21585. // if none on channel to left, prevOnChannel=-1 then from=0
  21586. var from_ = prevOnChannel + 1;
  21587. var to = tokenIndex - 1;
  21588. return this.filterForChannel(from_, to, channel);
  21589. };
  21590. BufferedTokenStream.prototype.filterForChannel = function (left, right, channel) {
  21591. var hidden = [];
  21592. for (var i = left; i < right + 1; i++) {
  21593. var t = this.tokens[i];
  21594. if (channel === -1) {
  21595. if (t.channel !== Lexer.DEFAULT_TOKEN_CHANNEL) {
  21596. hidden.push(t);
  21597. }
  21598. } else if (t.channel === channel) {
  21599. hidden.push(t);
  21600. }
  21601. }
  21602. if (hidden.length === 0) {
  21603. return null;
  21604. }
  21605. return hidden;
  21606. };
  21607. BufferedTokenStream.prototype.getSourceName = function () {
  21608. return this.tokenSource.getSourceName();
  21609. };
  21610. // Get the text of all tokens in this buffer.///
  21611. BufferedTokenStream.prototype.getText = function (interval) {
  21612. this.lazyInit();
  21613. this.fill();
  21614. if (interval === undefined || interval === null) {
  21615. interval = new Interval(0, this.tokens.length - 1);
  21616. }
  21617. var start = interval.start;
  21618. if (start instanceof Token) {
  21619. start = start.tokenIndex;
  21620. }
  21621. var stop = interval.stop;
  21622. if (stop instanceof Token) {
  21623. stop = stop.tokenIndex;
  21624. }
  21625. if (start === null || stop === null || start < 0 || stop < 0) {
  21626. return "";
  21627. }
  21628. if (stop >= this.tokens.length) {
  21629. stop = this.tokens.length - 1;
  21630. }
  21631. var s = "";
  21632. for (var i = start; i < stop + 1; i++) {
  21633. var t = this.tokens[i];
  21634. if (t.type === Token.EOF) {
  21635. break;
  21636. }
  21637. s = s + t.text;
  21638. }
  21639. return s;
  21640. };
  21641. // Get all tokens from lexer until EOF///
  21642. BufferedTokenStream.prototype.fill = function () {
  21643. this.lazyInit();
  21644. while (this.fetch(1000) === 1000) {
  21645. continue;
  21646. }
  21647. };
  21648. exports.BufferedTokenStream = BufferedTokenStream;
  21649. /***/ }),
  21650. /***/ "./node_modules/antlr4/CharStreams.js":
  21651. /*!********************************************!*\
  21652. !*** ./node_modules/antlr4/CharStreams.js ***!
  21653. \********************************************/
  21654. /*! no static exports found */
  21655. /***/ (function(module, exports, __webpack_require__) {
  21656. "use strict";
  21657. //
  21658. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  21659. * Use of this file is governed by the BSD 3-clause license that
  21660. * can be found in the LICENSE.txt file in the project root.
  21661. */
  21662. //
  21663. var InputStream = __webpack_require__(/*! ./InputStream */ "./node_modules/antlr4/InputStream.js").InputStream;
  21664. var isNodeJs = typeof window === 'undefined' && typeof importScripts === 'undefined';
  21665. var fs = isNodeJs ? __webpack_require__(/*! fs */ "./node_modules/node-libs-browser/mock/empty.js") : null;
  21666. // Utility functions to create InputStreams from various sources.
  21667. //
  21668. // All returned InputStreams support the full range of Unicode
  21669. // up to U+10FFFF (the default behavior of InputStream only supports
  21670. // code points up to U+FFFF).
  21671. var CharStreams = {
  21672. // Creates an InputStream from a string.
  21673. fromString: function fromString(str) {
  21674. return new InputStream(str, true);
  21675. },
  21676. // Asynchronously creates an InputStream from a blob given the
  21677. // encoding of the bytes in that blob (defaults to 'utf8' if
  21678. // encoding is null).
  21679. //
  21680. // Invokes onLoad(result) on success, onError(error) on
  21681. // failure.
  21682. fromBlob: function fromBlob(blob, encoding, onLoad, onError) {
  21683. var reader = FileReader();
  21684. reader.onload = function (e) {
  21685. var is = new InputStream(e.target.result, true);
  21686. onLoad(is);
  21687. };
  21688. reader.onerror = onError;
  21689. reader.readAsText(blob, encoding);
  21690. },
  21691. // Creates an InputStream from a Buffer given the
  21692. // encoding of the bytes in that buffer (defaults to 'utf8' if
  21693. // encoding is null).
  21694. fromBuffer: function fromBuffer(buffer, encoding) {
  21695. return new InputStream(buffer.toString(encoding), true);
  21696. },
  21697. // Asynchronously creates an InputStream from a file on disk given
  21698. // the encoding of the bytes in that file (defaults to 'utf8' if
  21699. // encoding is null).
  21700. //
  21701. // Invokes callback(error, result) on completion.
  21702. fromPath: function fromPath(path, encoding, callback) {
  21703. fs.readFile(path, encoding, function (err, data) {
  21704. var is = null;
  21705. if (data !== null) {
  21706. is = new InputStream(data, true);
  21707. }
  21708. callback(err, is);
  21709. });
  21710. },
  21711. // Synchronously creates an InputStream given a path to a file
  21712. // on disk and the encoding of the bytes in that file (defaults to
  21713. // 'utf8' if encoding is null).
  21714. fromPathSync: function fromPathSync(path, encoding) {
  21715. var data = fs.readFileSync(path, encoding);
  21716. return new InputStream(data, true);
  21717. }
  21718. };
  21719. exports.CharStreams = CharStreams;
  21720. /***/ }),
  21721. /***/ "./node_modules/antlr4/CommonTokenFactory.js":
  21722. /*!***************************************************!*\
  21723. !*** ./node_modules/antlr4/CommonTokenFactory.js ***!
  21724. \***************************************************/
  21725. /*! no static exports found */
  21726. /***/ (function(module, exports, __webpack_require__) {
  21727. "use strict";
  21728. //
  21729. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  21730. * Use of this file is governed by the BSD 3-clause license that
  21731. * can be found in the LICENSE.txt file in the project root.
  21732. */
  21733. //
  21734. //
  21735. // This default implementation of {@link TokenFactory} creates
  21736. // {@link CommonToken} objects.
  21737. //
  21738. var CommonToken = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").CommonToken;
  21739. function TokenFactory() {
  21740. return this;
  21741. }
  21742. function CommonTokenFactory(copyText) {
  21743. TokenFactory.call(this);
  21744. // Indicates whether {@link CommonToken//setText} should be called after
  21745. // constructing tokens to explicitly set the text. This is useful for cases
  21746. // where the input stream might not be able to provide arbitrary substrings
  21747. // of text from the input after the lexer creates a token (e.g. the
  21748. // implementation of {@link CharStream//getText} in
  21749. // {@link UnbufferedCharStream} throws an
  21750. // {@link UnsupportedOperationException}). Explicitly setting the token text
  21751. // allows {@link Token//getText} to be called at any time regardless of the
  21752. // input stream implementation.
  21753. //
  21754. // <p>
  21755. // The default value is {@code false} to avoid the performance and memory
  21756. // overhead of copying text for every token unless explicitly requested.</p>
  21757. //
  21758. this.copyText = copyText === undefined ? false : copyText;
  21759. return this;
  21760. }
  21761. CommonTokenFactory.prototype = Object.create(TokenFactory.prototype);
  21762. CommonTokenFactory.prototype.constructor = CommonTokenFactory;
  21763. //
  21764. // The default {@link CommonTokenFactory} instance.
  21765. //
  21766. // <p>
  21767. // This token factory does not explicitly copy token text when constructing
  21768. // tokens.</p>
  21769. //
  21770. CommonTokenFactory.DEFAULT = new CommonTokenFactory();
  21771. CommonTokenFactory.prototype.create = function (source, type, text, channel, start, stop, line, column) {
  21772. var t = new CommonToken(source, type, channel, start, stop);
  21773. t.line = line;
  21774. t.column = column;
  21775. if (text !== null) {
  21776. t.text = text;
  21777. } else if (this.copyText && source[1] !== null) {
  21778. t.text = source[1].getText(start, stop);
  21779. }
  21780. return t;
  21781. };
  21782. CommonTokenFactory.prototype.createThin = function (type, text) {
  21783. var t = new CommonToken(null, type);
  21784. t.text = text;
  21785. return t;
  21786. };
  21787. exports.CommonTokenFactory = CommonTokenFactory;
  21788. /***/ }),
  21789. /***/ "./node_modules/antlr4/CommonTokenStream.js":
  21790. /*!**************************************************!*\
  21791. !*** ./node_modules/antlr4/CommonTokenStream.js ***!
  21792. \**************************************************/
  21793. /*! no static exports found */
  21794. /***/ (function(module, exports, __webpack_require__) {
  21795. "use strict";
  21796. //
  21797. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  21798. * Use of this file is governed by the BSD 3-clause license that
  21799. * can be found in the LICENSE.txt file in the project root.
  21800. */
  21801. ///
  21802. //
  21803. // This class extends {@link BufferedTokenStream} with functionality to filter
  21804. // token streams to tokens on a particular channel (tokens where
  21805. // {@link Token//getChannel} returns a particular value).
  21806. //
  21807. // <p>
  21808. // This token stream provides access to all tokens by index or when calling
  21809. // methods like {@link //getText}. The channel filtering is only used for code
  21810. // accessing tokens via the lookahead methods {@link //LA}, {@link //LT}, and
  21811. // {@link //LB}.</p>
  21812. //
  21813. // <p>
  21814. // By default, tokens are placed on the default channel
  21815. // ({@link Token//DEFAULT_CHANNEL}), but may be reassigned by using the
  21816. // {@code ->channel(HIDDEN)} lexer command, or by using an embedded action to
  21817. // call {@link Lexer//setChannel}.
  21818. // </p>
  21819. //
  21820. // <p>
  21821. // Note: lexer rules which use the {@code ->skip} lexer command or call
  21822. // {@link Lexer//skip} do not produce tokens at all, so input text matched by
  21823. // such a rule will not be available as part of the token stream, regardless of
  21824. // channel.</p>
  21825. ///
  21826. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  21827. var BufferedTokenStream = __webpack_require__(/*! ./BufferedTokenStream */ "./node_modules/antlr4/BufferedTokenStream.js").BufferedTokenStream;
  21828. function CommonTokenStream(lexer, channel) {
  21829. BufferedTokenStream.call(this, lexer);
  21830. this.channel = channel === undefined ? Token.DEFAULT_CHANNEL : channel;
  21831. return this;
  21832. }
  21833. CommonTokenStream.prototype = Object.create(BufferedTokenStream.prototype);
  21834. CommonTokenStream.prototype.constructor = CommonTokenStream;
  21835. CommonTokenStream.prototype.adjustSeekIndex = function (i) {
  21836. return this.nextTokenOnChannel(i, this.channel);
  21837. };
  21838. CommonTokenStream.prototype.LB = function (k) {
  21839. if (k === 0 || this.index - k < 0) {
  21840. return null;
  21841. }
  21842. var i = this.index;
  21843. var n = 1;
  21844. // find k good tokens looking backwards
  21845. while (n <= k) {
  21846. // skip off-channel tokens
  21847. i = this.previousTokenOnChannel(i - 1, this.channel);
  21848. n += 1;
  21849. }
  21850. if (i < 0) {
  21851. return null;
  21852. }
  21853. return this.tokens[i];
  21854. };
  21855. CommonTokenStream.prototype.LT = function (k) {
  21856. this.lazyInit();
  21857. if (k === 0) {
  21858. return null;
  21859. }
  21860. if (k < 0) {
  21861. return this.LB(-k);
  21862. }
  21863. var i = this.index;
  21864. var n = 1; // we know tokens[pos] is a good one
  21865. // find k good tokens
  21866. while (n < k) {
  21867. // skip off-channel tokens, but make sure to not look past EOF
  21868. if (this.sync(i + 1)) {
  21869. i = this.nextTokenOnChannel(i + 1, this.channel);
  21870. }
  21871. n += 1;
  21872. }
  21873. return this.tokens[i];
  21874. };
  21875. // Count EOF just once.///
  21876. CommonTokenStream.prototype.getNumberOfOnChannelTokens = function () {
  21877. var n = 0;
  21878. this.fill();
  21879. for (var i = 0; i < this.tokens.length; i++) {
  21880. var t = this.tokens[i];
  21881. if (t.channel === this.channel) {
  21882. n += 1;
  21883. }
  21884. if (t.type === Token.EOF) {
  21885. break;
  21886. }
  21887. }
  21888. return n;
  21889. };
  21890. exports.CommonTokenStream = CommonTokenStream;
  21891. /***/ }),
  21892. /***/ "./node_modules/antlr4/FileStream.js":
  21893. /*!*******************************************!*\
  21894. !*** ./node_modules/antlr4/FileStream.js ***!
  21895. \*******************************************/
  21896. /*! no static exports found */
  21897. /***/ (function(module, exports, __webpack_require__) {
  21898. "use strict";
  21899. //
  21900. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  21901. * Use of this file is governed by the BSD 3-clause license that
  21902. * can be found in the LICENSE.txt file in the project root.
  21903. */
  21904. //
  21905. //
  21906. // This is an InputStream that is loaded from a file all at once
  21907. // when you construct the object.
  21908. //
  21909. var InputStream = __webpack_require__(/*! ./InputStream */ "./node_modules/antlr4/InputStream.js").InputStream;
  21910. var isNodeJs = typeof window === 'undefined' && typeof importScripts === 'undefined';
  21911. var fs = isNodeJs ? __webpack_require__(/*! fs */ "./node_modules/node-libs-browser/mock/empty.js") : null;
  21912. function FileStream(fileName, decodeToUnicodeCodePoints) {
  21913. var data = fs.readFileSync(fileName, "utf8");
  21914. InputStream.call(this, data, decodeToUnicodeCodePoints);
  21915. this.fileName = fileName;
  21916. return this;
  21917. }
  21918. FileStream.prototype = Object.create(InputStream.prototype);
  21919. FileStream.prototype.constructor = FileStream;
  21920. exports.FileStream = FileStream;
  21921. /***/ }),
  21922. /***/ "./node_modules/antlr4/InputStream.js":
  21923. /*!********************************************!*\
  21924. !*** ./node_modules/antlr4/InputStream.js ***!
  21925. \********************************************/
  21926. /*! no static exports found */
  21927. /***/ (function(module, exports, __webpack_require__) {
  21928. "use strict";
  21929. //
  21930. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  21931. * Use of this file is governed by the BSD 3-clause license that
  21932. * can be found in the LICENSE.txt file in the project root.
  21933. */
  21934. //
  21935. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  21936. __webpack_require__(/*! ./polyfills/codepointat */ "./node_modules/antlr4/polyfills/codepointat.js");
  21937. __webpack_require__(/*! ./polyfills/fromcodepoint */ "./node_modules/antlr4/polyfills/fromcodepoint.js");
  21938. // Vacuum all input from a string and then treat it like a buffer.
  21939. function _loadString(stream, decodeToUnicodeCodePoints) {
  21940. stream._index = 0;
  21941. stream.data = [];
  21942. if (stream.decodeToUnicodeCodePoints) {
  21943. for (var i = 0; i < stream.strdata.length;) {
  21944. var codePoint = stream.strdata.codePointAt(i);
  21945. stream.data.push(codePoint);
  21946. i += codePoint <= 0xFFFF ? 1 : 2;
  21947. }
  21948. } else {
  21949. for (var i = 0; i < stream.strdata.length; i++) {
  21950. var codeUnit = stream.strdata.charCodeAt(i);
  21951. stream.data.push(codeUnit);
  21952. }
  21953. }
  21954. stream._size = stream.data.length;
  21955. }
  21956. // If decodeToUnicodeCodePoints is true, the input is treated
  21957. // as a series of Unicode code points.
  21958. //
  21959. // Otherwise, the input is treated as a series of 16-bit UTF-16 code
  21960. // units.
  21961. function InputStream(data, decodeToUnicodeCodePoints) {
  21962. this.name = "<empty>";
  21963. this.strdata = data;
  21964. this.decodeToUnicodeCodePoints = decodeToUnicodeCodePoints || false;
  21965. _loadString(this);
  21966. return this;
  21967. }
  21968. Object.defineProperty(InputStream.prototype, "index", {
  21969. get: function get() {
  21970. return this._index;
  21971. }
  21972. });
  21973. Object.defineProperty(InputStream.prototype, "size", {
  21974. get: function get() {
  21975. return this._size;
  21976. }
  21977. });
  21978. // Reset the stream so that it's in the same state it was
  21979. // when the object was created *except* the data array is not
  21980. // touched.
  21981. //
  21982. InputStream.prototype.reset = function () {
  21983. this._index = 0;
  21984. };
  21985. InputStream.prototype.consume = function () {
  21986. if (this._index >= this._size) {
  21987. // assert this.LA(1) == Token.EOF
  21988. throw "cannot consume EOF";
  21989. }
  21990. this._index += 1;
  21991. };
  21992. InputStream.prototype.LA = function (offset) {
  21993. if (offset === 0) {
  21994. return 0; // undefined
  21995. }
  21996. if (offset < 0) {
  21997. offset += 1; // e.g., translate LA(-1) to use offset=0
  21998. }
  21999. var pos = this._index + offset - 1;
  22000. if (pos < 0 || pos >= this._size) {
  22001. // invalid
  22002. return Token.EOF;
  22003. }
  22004. return this.data[pos];
  22005. };
  22006. InputStream.prototype.LT = function (offset) {
  22007. return this.LA(offset);
  22008. };
  22009. // mark/release do nothing; we have entire buffer
  22010. InputStream.prototype.mark = function () {
  22011. return -1;
  22012. };
  22013. InputStream.prototype.release = function (marker) {};
  22014. // consume() ahead until p==_index; can't just set p=_index as we must
  22015. // update line and column. If we seek backwards, just set p
  22016. //
  22017. InputStream.prototype.seek = function (_index) {
  22018. if (_index <= this._index) {
  22019. this._index = _index; // just jump; don't update stream state (line,
  22020. // ...)
  22021. return;
  22022. }
  22023. // seek forward
  22024. this._index = Math.min(_index, this._size);
  22025. };
  22026. InputStream.prototype.getText = function (start, stop) {
  22027. if (stop >= this._size) {
  22028. stop = this._size - 1;
  22029. }
  22030. if (start >= this._size) {
  22031. return "";
  22032. } else {
  22033. if (this.decodeToUnicodeCodePoints) {
  22034. var result = "";
  22035. for (var i = start; i <= stop; i++) {
  22036. result += String.fromCodePoint(this.data[i]);
  22037. }
  22038. return result;
  22039. } else {
  22040. return this.strdata.slice(start, stop + 1);
  22041. }
  22042. }
  22043. };
  22044. InputStream.prototype.toString = function () {
  22045. return this.strdata;
  22046. };
  22047. exports.InputStream = InputStream;
  22048. /***/ }),
  22049. /***/ "./node_modules/antlr4/IntervalSet.js":
  22050. /*!********************************************!*\
  22051. !*** ./node_modules/antlr4/IntervalSet.js ***!
  22052. \********************************************/
  22053. /*! no static exports found */
  22054. /***/ (function(module, exports, __webpack_require__) {
  22055. "use strict";
  22056. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  22057. * Use of this file is governed by the BSD 3-clause license that
  22058. * can be found in the LICENSE.txt file in the project root.
  22059. */
  22060. /*jslint smarttabs:true */
  22061. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  22062. /* stop is not included! */
  22063. function Interval(start, stop) {
  22064. this.start = start;
  22065. this.stop = stop;
  22066. return this;
  22067. }
  22068. Interval.prototype.contains = function (item) {
  22069. return item >= this.start && item < this.stop;
  22070. };
  22071. Interval.prototype.toString = function () {
  22072. if (this.start === this.stop - 1) {
  22073. return this.start.toString();
  22074. } else {
  22075. return this.start.toString() + ".." + (this.stop - 1).toString();
  22076. }
  22077. };
  22078. Object.defineProperty(Interval.prototype, "length", {
  22079. get: function get() {
  22080. return this.stop - this.start;
  22081. }
  22082. });
  22083. function IntervalSet() {
  22084. this.intervals = null;
  22085. this.readOnly = false;
  22086. }
  22087. IntervalSet.prototype.first = function (v) {
  22088. if (this.intervals === null || this.intervals.length === 0) {
  22089. return Token.INVALID_TYPE;
  22090. } else {
  22091. return this.intervals[0].start;
  22092. }
  22093. };
  22094. IntervalSet.prototype.addOne = function (v) {
  22095. this.addInterval(new Interval(v, v + 1));
  22096. };
  22097. IntervalSet.prototype.addRange = function (l, h) {
  22098. this.addInterval(new Interval(l, h + 1));
  22099. };
  22100. IntervalSet.prototype.addInterval = function (v) {
  22101. if (this.intervals === null) {
  22102. this.intervals = [];
  22103. this.intervals.push(v);
  22104. } else {
  22105. // find insert pos
  22106. for (var k = 0; k < this.intervals.length; k++) {
  22107. var i = this.intervals[k];
  22108. // distinct range -> insert
  22109. if (v.stop < i.start) {
  22110. this.intervals.splice(k, 0, v);
  22111. return;
  22112. }
  22113. // contiguous range -> adjust
  22114. else if (v.stop === i.start) {
  22115. this.intervals[k].start = v.start;
  22116. return;
  22117. }
  22118. // overlapping range -> adjust and reduce
  22119. else if (v.start <= i.stop) {
  22120. this.intervals[k] = new Interval(Math.min(i.start, v.start), Math.max(i.stop, v.stop));
  22121. this.reduce(k);
  22122. return;
  22123. }
  22124. }
  22125. // greater than any existing
  22126. this.intervals.push(v);
  22127. }
  22128. };
  22129. IntervalSet.prototype.addSet = function (other) {
  22130. if (other.intervals !== null) {
  22131. for (var k = 0; k < other.intervals.length; k++) {
  22132. var i = other.intervals[k];
  22133. this.addInterval(new Interval(i.start, i.stop));
  22134. }
  22135. }
  22136. return this;
  22137. };
  22138. IntervalSet.prototype.reduce = function (k) {
  22139. // only need to reduce if k is not the last
  22140. if (k < this.intervalslength - 1) {
  22141. var l = this.intervals[k];
  22142. var r = this.intervals[k + 1];
  22143. // if r contained in l
  22144. if (l.stop >= r.stop) {
  22145. this.intervals.pop(k + 1);
  22146. this.reduce(k);
  22147. } else if (l.stop >= r.start) {
  22148. this.intervals[k] = new Interval(l.start, r.stop);
  22149. this.intervals.pop(k + 1);
  22150. }
  22151. }
  22152. };
  22153. IntervalSet.prototype.complement = function (start, stop) {
  22154. var result = new IntervalSet();
  22155. result.addInterval(new Interval(start, stop + 1));
  22156. for (var i = 0; i < this.intervals.length; i++) {
  22157. result.removeRange(this.intervals[i]);
  22158. }
  22159. return result;
  22160. };
  22161. IntervalSet.prototype.contains = function (item) {
  22162. if (this.intervals === null) {
  22163. return false;
  22164. } else {
  22165. for (var k = 0; k < this.intervals.length; k++) {
  22166. if (this.intervals[k].contains(item)) {
  22167. return true;
  22168. }
  22169. }
  22170. return false;
  22171. }
  22172. };
  22173. Object.defineProperty(IntervalSet.prototype, "length", {
  22174. get: function get() {
  22175. var len = 0;
  22176. this.intervals.map(function (i) {
  22177. len += i.length;
  22178. });
  22179. return len;
  22180. }
  22181. });
  22182. IntervalSet.prototype.removeRange = function (v) {
  22183. if (v.start === v.stop - 1) {
  22184. this.removeOne(v.start);
  22185. } else if (this.intervals !== null) {
  22186. var k = 0;
  22187. for (var n = 0; n < this.intervals.length; n++) {
  22188. var i = this.intervals[k];
  22189. // intervals are ordered
  22190. if (v.stop <= i.start) {
  22191. return;
  22192. }
  22193. // check for including range, split it
  22194. else if (v.start > i.start && v.stop < i.stop) {
  22195. this.intervals[k] = new Interval(i.start, v.start);
  22196. var x = new Interval(v.stop, i.stop);
  22197. this.intervals.splice(k, 0, x);
  22198. return;
  22199. }
  22200. // check for included range, remove it
  22201. else if (v.start <= i.start && v.stop >= i.stop) {
  22202. this.intervals.splice(k, 1);
  22203. k = k - 1; // need another pass
  22204. }
  22205. // check for lower boundary
  22206. else if (v.start < i.stop) {
  22207. this.intervals[k] = new Interval(i.start, v.start);
  22208. }
  22209. // check for upper boundary
  22210. else if (v.stop < i.stop) {
  22211. this.intervals[k] = new Interval(v.stop, i.stop);
  22212. }
  22213. k += 1;
  22214. }
  22215. }
  22216. };
  22217. IntervalSet.prototype.removeOne = function (v) {
  22218. if (this.intervals !== null) {
  22219. for (var k = 0; k < this.intervals.length; k++) {
  22220. var i = this.intervals[k];
  22221. // intervals is ordered
  22222. if (v < i.start) {
  22223. return;
  22224. }
  22225. // check for single value range
  22226. else if (v === i.start && v === i.stop - 1) {
  22227. this.intervals.splice(k, 1);
  22228. return;
  22229. }
  22230. // check for lower boundary
  22231. else if (v === i.start) {
  22232. this.intervals[k] = new Interval(i.start + 1, i.stop);
  22233. return;
  22234. }
  22235. // check for upper boundary
  22236. else if (v === i.stop - 1) {
  22237. this.intervals[k] = new Interval(i.start, i.stop - 1);
  22238. return;
  22239. }
  22240. // split existing range
  22241. else if (v < i.stop - 1) {
  22242. var x = new Interval(i.start, v);
  22243. i.start = v + 1;
  22244. this.intervals.splice(k, 0, x);
  22245. return;
  22246. }
  22247. }
  22248. }
  22249. };
  22250. IntervalSet.prototype.toString = function (literalNames, symbolicNames, elemsAreChar) {
  22251. literalNames = literalNames || null;
  22252. symbolicNames = symbolicNames || null;
  22253. elemsAreChar = elemsAreChar || false;
  22254. if (this.intervals === null) {
  22255. return "{}";
  22256. } else if (literalNames !== null || symbolicNames !== null) {
  22257. return this.toTokenString(literalNames, symbolicNames);
  22258. } else if (elemsAreChar) {
  22259. return this.toCharString();
  22260. } else {
  22261. return this.toIndexString();
  22262. }
  22263. };
  22264. IntervalSet.prototype.toCharString = function () {
  22265. var names = [];
  22266. for (var i = 0; i < this.intervals.length; i++) {
  22267. var v = this.intervals[i];
  22268. if (v.stop === v.start + 1) {
  22269. if (v.start === Token.EOF) {
  22270. names.push("<EOF>");
  22271. } else {
  22272. names.push("'" + String.fromCharCode(v.start) + "'");
  22273. }
  22274. } else {
  22275. names.push("'" + String.fromCharCode(v.start) + "'..'" + String.fromCharCode(v.stop - 1) + "'");
  22276. }
  22277. }
  22278. if (names.length > 1) {
  22279. return "{" + names.join(", ") + "}";
  22280. } else {
  22281. return names[0];
  22282. }
  22283. };
  22284. IntervalSet.prototype.toIndexString = function () {
  22285. var names = [];
  22286. for (var i = 0; i < this.intervals.length; i++) {
  22287. var v = this.intervals[i];
  22288. if (v.stop === v.start + 1) {
  22289. if (v.start === Token.EOF) {
  22290. names.push("<EOF>");
  22291. } else {
  22292. names.push(v.start.toString());
  22293. }
  22294. } else {
  22295. names.push(v.start.toString() + ".." + (v.stop - 1).toString());
  22296. }
  22297. }
  22298. if (names.length > 1) {
  22299. return "{" + names.join(", ") + "}";
  22300. } else {
  22301. return names[0];
  22302. }
  22303. };
  22304. IntervalSet.prototype.toTokenString = function (literalNames, symbolicNames) {
  22305. var names = [];
  22306. for (var i = 0; i < this.intervals.length; i++) {
  22307. var v = this.intervals[i];
  22308. for (var j = v.start; j < v.stop; j++) {
  22309. names.push(this.elementName(literalNames, symbolicNames, j));
  22310. }
  22311. }
  22312. if (names.length > 1) {
  22313. return "{" + names.join(", ") + "}";
  22314. } else {
  22315. return names[0];
  22316. }
  22317. };
  22318. IntervalSet.prototype.elementName = function (literalNames, symbolicNames, a) {
  22319. if (a === Token.EOF) {
  22320. return "<EOF>";
  22321. } else if (a === Token.EPSILON) {
  22322. return "<EPSILON>";
  22323. } else {
  22324. return literalNames[a] || symbolicNames[a];
  22325. }
  22326. };
  22327. exports.Interval = Interval;
  22328. exports.IntervalSet = IntervalSet;
  22329. /***/ }),
  22330. /***/ "./node_modules/antlr4/LL1Analyzer.js":
  22331. /*!********************************************!*\
  22332. !*** ./node_modules/antlr4/LL1Analyzer.js ***!
  22333. \********************************************/
  22334. /*! no static exports found */
  22335. /***/ (function(module, exports, __webpack_require__) {
  22336. "use strict";
  22337. //
  22338. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  22339. * Use of this file is governed by the BSD 3-clause license that
  22340. * can be found in the LICENSE.txt file in the project root.
  22341. */
  22342. ///
  22343. var Set = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js").Set;
  22344. var BitSet = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js").BitSet;
  22345. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  22346. var ATNConfig = __webpack_require__(/*! ./atn/ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").ATNConfig;
  22347. var Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  22348. var IntervalSet = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  22349. var RuleStopState = __webpack_require__(/*! ./atn/ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  22350. var RuleTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").RuleTransition;
  22351. var NotSetTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").NotSetTransition;
  22352. var WildcardTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").WildcardTransition;
  22353. var AbstractPredicateTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").AbstractPredicateTransition;
  22354. var pc = __webpack_require__(/*! ./PredictionContext */ "./node_modules/antlr4/PredictionContext.js");
  22355. var predictionContextFromRuleContext = pc.predictionContextFromRuleContext;
  22356. var PredictionContext = pc.PredictionContext;
  22357. var SingletonPredictionContext = pc.SingletonPredictionContext;
  22358. function LL1Analyzer(atn) {
  22359. this.atn = atn;
  22360. }
  22361. //* Special value added to the lookahead sets to indicate that we hit
  22362. // a predicate during analysis if {@code seeThruPreds==false}.
  22363. ///
  22364. LL1Analyzer.HIT_PRED = Token.INVALID_TYPE;
  22365. //*
  22366. // Calculates the SLL(1) expected lookahead set for each outgoing transition
  22367. // of an {@link ATNState}. The returned array has one element for each
  22368. // outgoing transition in {@code s}. If the closure from transition
  22369. // <em>i</em> leads to a semantic predicate before matching a symbol, the
  22370. // element at index <em>i</em> of the result will be {@code null}.
  22371. //
  22372. // @param s the ATN state
  22373. // @return the expected symbols for each outgoing transition of {@code s}.
  22374. ///
  22375. LL1Analyzer.prototype.getDecisionLookahead = function (s) {
  22376. if (s === null) {
  22377. return null;
  22378. }
  22379. var count = s.transitions.length;
  22380. var look = [];
  22381. for (var alt = 0; alt < count; alt++) {
  22382. look[alt] = new IntervalSet();
  22383. var lookBusy = new Set();
  22384. var seeThruPreds = false; // fail to get lookahead upon pred
  22385. this._LOOK(s.transition(alt).target, null, PredictionContext.EMPTY, look[alt], lookBusy, new BitSet(), seeThruPreds, false);
  22386. // Wipe out lookahead for this alternative if we found nothing
  22387. // or we had a predicate when we !seeThruPreds
  22388. if (look[alt].length === 0 || look[alt].contains(LL1Analyzer.HIT_PRED)) {
  22389. look[alt] = null;
  22390. }
  22391. }
  22392. return look;
  22393. };
  22394. //*
  22395. // Compute set of tokens that can follow {@code s} in the ATN in the
  22396. // specified {@code ctx}.
  22397. //
  22398. // <p>If {@code ctx} is {@code null} and the end of the rule containing
  22399. // {@code s} is reached, {@link Token//EPSILON} is added to the result set.
  22400. // If {@code ctx} is not {@code null} and the end of the outermost rule is
  22401. // reached, {@link Token//EOF} is added to the result set.</p>
  22402. //
  22403. // @param s the ATN state
  22404. // @param stopState the ATN state to stop at. This can be a
  22405. // {@link BlockEndState} to detect epsilon paths through a closure.
  22406. // @param ctx the complete parser context, or {@code null} if the context
  22407. // should be ignored
  22408. //
  22409. // @return The set of tokens that can follow {@code s} in the ATN in the
  22410. // specified {@code ctx}.
  22411. ///
  22412. LL1Analyzer.prototype.LOOK = function (s, stopState, ctx) {
  22413. var r = new IntervalSet();
  22414. var seeThruPreds = true; // ignore preds; get all lookahead
  22415. ctx = ctx || null;
  22416. var lookContext = ctx !== null ? predictionContextFromRuleContext(s.atn, ctx) : null;
  22417. this._LOOK(s, stopState, lookContext, r, new Set(), new BitSet(), seeThruPreds, true);
  22418. return r;
  22419. };
  22420. //*
  22421. // Compute set of tokens that can follow {@code s} in the ATN in the
  22422. // specified {@code ctx}.
  22423. //
  22424. // <p>If {@code ctx} is {@code null} and {@code stopState} or the end of the
  22425. // rule containing {@code s} is reached, {@link Token//EPSILON} is added to
  22426. // the result set. If {@code ctx} is not {@code null} and {@code addEOF} is
  22427. // {@code true} and {@code stopState} or the end of the outermost rule is
  22428. // reached, {@link Token//EOF} is added to the result set.</p>
  22429. //
  22430. // @param s the ATN state.
  22431. // @param stopState the ATN state to stop at. This can be a
  22432. // {@link BlockEndState} to detect epsilon paths through a closure.
  22433. // @param ctx The outer context, or {@code null} if the outer context should
  22434. // not be used.
  22435. // @param look The result lookahead set.
  22436. // @param lookBusy A set used for preventing epsilon closures in the ATN
  22437. // from causing a stack overflow. Outside code should pass
  22438. // {@code new Set<ATNConfig>} for this argument.
  22439. // @param calledRuleStack A set used for preventing left recursion in the
  22440. // ATN from causing a stack overflow. Outside code should pass
  22441. // {@code new BitSet()} for this argument.
  22442. // @param seeThruPreds {@code true} to true semantic predicates as
  22443. // implicitly {@code true} and "see through them", otherwise {@code false}
  22444. // to treat semantic predicates as opaque and add {@link //HIT_PRED} to the
  22445. // result if one is encountered.
  22446. // @param addEOF Add {@link Token//EOF} to the result if the end of the
  22447. // outermost context is reached. This parameter has no effect if {@code ctx}
  22448. // is {@code null}.
  22449. ///
  22450. LL1Analyzer.prototype._LOOK = function (s, stopState, ctx, look, lookBusy, calledRuleStack, seeThruPreds, addEOF) {
  22451. var c = new ATNConfig({ state: s, alt: 0, context: ctx }, null);
  22452. if (lookBusy.contains(c)) {
  22453. return;
  22454. }
  22455. lookBusy.add(c);
  22456. if (s === stopState) {
  22457. if (ctx === null) {
  22458. look.addOne(Token.EPSILON);
  22459. return;
  22460. } else if (ctx.isEmpty() && addEOF) {
  22461. look.addOne(Token.EOF);
  22462. return;
  22463. }
  22464. }
  22465. if (s instanceof RuleStopState) {
  22466. if (ctx === null) {
  22467. look.addOne(Token.EPSILON);
  22468. return;
  22469. } else if (ctx.isEmpty() && addEOF) {
  22470. look.addOne(Token.EOF);
  22471. return;
  22472. }
  22473. if (ctx !== PredictionContext.EMPTY) {
  22474. // run thru all possible stack tops in ctx
  22475. for (var i = 0; i < ctx.length; i++) {
  22476. var returnState = this.atn.states[ctx.getReturnState(i)];
  22477. var removed = calledRuleStack.contains(returnState.ruleIndex);
  22478. try {
  22479. calledRuleStack.remove(returnState.ruleIndex);
  22480. this._LOOK(returnState, stopState, ctx.getParent(i), look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  22481. } finally {
  22482. if (removed) {
  22483. calledRuleStack.add(returnState.ruleIndex);
  22484. }
  22485. }
  22486. }
  22487. return;
  22488. }
  22489. }
  22490. for (var j = 0; j < s.transitions.length; j++) {
  22491. var t = s.transitions[j];
  22492. if (t.constructor === RuleTransition) {
  22493. if (calledRuleStack.contains(t.target.ruleIndex)) {
  22494. continue;
  22495. }
  22496. var newContext = SingletonPredictionContext.create(ctx, t.followState.stateNumber);
  22497. try {
  22498. calledRuleStack.add(t.target.ruleIndex);
  22499. this._LOOK(t.target, stopState, newContext, look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  22500. } finally {
  22501. calledRuleStack.remove(t.target.ruleIndex);
  22502. }
  22503. } else if (t instanceof AbstractPredicateTransition) {
  22504. if (seeThruPreds) {
  22505. this._LOOK(t.target, stopState, ctx, look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  22506. } else {
  22507. look.addOne(LL1Analyzer.HIT_PRED);
  22508. }
  22509. } else if (t.isEpsilon) {
  22510. this._LOOK(t.target, stopState, ctx, look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  22511. } else if (t.constructor === WildcardTransition) {
  22512. look.addRange(Token.MIN_USER_TOKEN_TYPE, this.atn.maxTokenType);
  22513. } else {
  22514. var set = t.label;
  22515. if (set !== null) {
  22516. if (t instanceof NotSetTransition) {
  22517. set = set.complement(Token.MIN_USER_TOKEN_TYPE, this.atn.maxTokenType);
  22518. }
  22519. look.addSet(set);
  22520. }
  22521. }
  22522. }
  22523. };
  22524. exports.LL1Analyzer = LL1Analyzer;
  22525. /***/ }),
  22526. /***/ "./node_modules/antlr4/Lexer.js":
  22527. /*!**************************************!*\
  22528. !*** ./node_modules/antlr4/Lexer.js ***!
  22529. \**************************************/
  22530. /*! no static exports found */
  22531. /***/ (function(module, exports, __webpack_require__) {
  22532. "use strict";
  22533. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  22534. * Use of this file is governed by the BSD 3-clause license that
  22535. * can be found in the LICENSE.txt file in the project root.
  22536. */
  22537. ///
  22538. // A lexer is recognizer that draws input symbols from a character stream.
  22539. // lexer grammars result in a subclass of this object. A Lexer object
  22540. // uses simplified match() and error recovery mechanisms in the interest of speed.
  22541. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  22542. var Recognizer = __webpack_require__(/*! ./Recognizer */ "./node_modules/antlr4/Recognizer.js").Recognizer;
  22543. var CommonTokenFactory = __webpack_require__(/*! ./CommonTokenFactory */ "./node_modules/antlr4/CommonTokenFactory.js").CommonTokenFactory;
  22544. var RecognitionException = __webpack_require__(/*! ./error/Errors */ "./node_modules/antlr4/error/Errors.js").RecognitionException;
  22545. var LexerNoViableAltException = __webpack_require__(/*! ./error/Errors */ "./node_modules/antlr4/error/Errors.js").LexerNoViableAltException;
  22546. function TokenSource() {
  22547. return this;
  22548. }
  22549. function Lexer(input) {
  22550. Recognizer.call(this);
  22551. this._input = input;
  22552. this._factory = CommonTokenFactory.DEFAULT;
  22553. this._tokenFactorySourcePair = [this, input];
  22554. this._interp = null; // child classes must populate this
  22555. // The goal of all lexer rules/methods is to create a token object.
  22556. // this is an instance variable as multiple rules may collaborate to
  22557. // create a single token. nextToken will return this object after
  22558. // matching lexer rule(s). If you subclass to allow multiple token
  22559. // emissions, then set this to the last token to be matched or
  22560. // something nonnull so that the auto token emit mechanism will not
  22561. // emit another token.
  22562. this._token = null;
  22563. // What character index in the stream did the current token start at?
  22564. // Needed, for example, to get the text for current token. Set at
  22565. // the start of nextToken.
  22566. this._tokenStartCharIndex = -1;
  22567. // The line on which the first character of the token resides///
  22568. this._tokenStartLine = -1;
  22569. // The character position of first character within the line///
  22570. this._tokenStartColumn = -1;
  22571. // Once we see EOF on char stream, next token will be EOF.
  22572. // If you have DONE : EOF ; then you see DONE EOF.
  22573. this._hitEOF = false;
  22574. // The channel number for the current token///
  22575. this._channel = Token.DEFAULT_CHANNEL;
  22576. // The token type for the current token///
  22577. this._type = Token.INVALID_TYPE;
  22578. this._modeStack = [];
  22579. this._mode = Lexer.DEFAULT_MODE;
  22580. // You can set the text for the current token to override what is in
  22581. // the input char buffer. Use setText() or can set this instance var.
  22582. // /
  22583. this._text = null;
  22584. return this;
  22585. }
  22586. Lexer.prototype = Object.create(Recognizer.prototype);
  22587. Lexer.prototype.constructor = Lexer;
  22588. Lexer.DEFAULT_MODE = 0;
  22589. Lexer.MORE = -2;
  22590. Lexer.SKIP = -3;
  22591. Lexer.DEFAULT_TOKEN_CHANNEL = Token.DEFAULT_CHANNEL;
  22592. Lexer.HIDDEN = Token.HIDDEN_CHANNEL;
  22593. Lexer.MIN_CHAR_VALUE = 0x0000;
  22594. Lexer.MAX_CHAR_VALUE = 0x10FFFF;
  22595. Lexer.prototype.reset = function () {
  22596. // wack Lexer state variables
  22597. if (this._input !== null) {
  22598. this._input.seek(0); // rewind the input
  22599. }
  22600. this._token = null;
  22601. this._type = Token.INVALID_TYPE;
  22602. this._channel = Token.DEFAULT_CHANNEL;
  22603. this._tokenStartCharIndex = -1;
  22604. this._tokenStartColumn = -1;
  22605. this._tokenStartLine = -1;
  22606. this._text = null;
  22607. this._hitEOF = false;
  22608. this._mode = Lexer.DEFAULT_MODE;
  22609. this._modeStack = [];
  22610. this._interp.reset();
  22611. };
  22612. // Return a token from this source; i.e., match a token on the char stream.
  22613. Lexer.prototype.nextToken = function () {
  22614. if (this._input === null) {
  22615. throw "nextToken requires a non-null input stream.";
  22616. }
  22617. // Mark start location in char stream so unbuffered streams are
  22618. // guaranteed at least have text of current token
  22619. var tokenStartMarker = this._input.mark();
  22620. try {
  22621. while (true) {
  22622. if (this._hitEOF) {
  22623. this.emitEOF();
  22624. return this._token;
  22625. }
  22626. this._token = null;
  22627. this._channel = Token.DEFAULT_CHANNEL;
  22628. this._tokenStartCharIndex = this._input.index;
  22629. this._tokenStartColumn = this._interp.column;
  22630. this._tokenStartLine = this._interp.line;
  22631. this._text = null;
  22632. var continueOuter = false;
  22633. while (true) {
  22634. this._type = Token.INVALID_TYPE;
  22635. var ttype = Lexer.SKIP;
  22636. try {
  22637. ttype = this._interp.match(this._input, this._mode);
  22638. } catch (e) {
  22639. if (e instanceof RecognitionException) {
  22640. this.notifyListeners(e); // report error
  22641. this.recover(e);
  22642. } else {
  22643. console.log(e.stack);
  22644. throw e;
  22645. }
  22646. }
  22647. if (this._input.LA(1) === Token.EOF) {
  22648. this._hitEOF = true;
  22649. }
  22650. if (this._type === Token.INVALID_TYPE) {
  22651. this._type = ttype;
  22652. }
  22653. if (this._type === Lexer.SKIP) {
  22654. continueOuter = true;
  22655. break;
  22656. }
  22657. if (this._type !== Lexer.MORE) {
  22658. break;
  22659. }
  22660. }
  22661. if (continueOuter) {
  22662. continue;
  22663. }
  22664. if (this._token === null) {
  22665. this.emit();
  22666. }
  22667. return this._token;
  22668. }
  22669. } finally {
  22670. // make sure we release marker after match or
  22671. // unbuffered char stream will keep buffering
  22672. this._input.release(tokenStartMarker);
  22673. }
  22674. };
  22675. // Instruct the lexer to skip creating a token for current lexer rule
  22676. // and look for another token. nextToken() knows to keep looking when
  22677. // a lexer rule finishes with token set to SKIP_TOKEN. Recall that
  22678. // if token==null at end of any token rule, it creates one for you
  22679. // and emits it.
  22680. // /
  22681. Lexer.prototype.skip = function () {
  22682. this._type = Lexer.SKIP;
  22683. };
  22684. Lexer.prototype.more = function () {
  22685. this._type = Lexer.MORE;
  22686. };
  22687. Lexer.prototype.mode = function (m) {
  22688. this._mode = m;
  22689. };
  22690. Lexer.prototype.pushMode = function (m) {
  22691. if (this._interp.debug) {
  22692. console.log("pushMode " + m);
  22693. }
  22694. this._modeStack.push(this._mode);
  22695. this.mode(m);
  22696. };
  22697. Lexer.prototype.popMode = function () {
  22698. if (this._modeStack.length === 0) {
  22699. throw "Empty Stack";
  22700. }
  22701. if (this._interp.debug) {
  22702. console.log("popMode back to " + this._modeStack.slice(0, -1));
  22703. }
  22704. this.mode(this._modeStack.pop());
  22705. return this._mode;
  22706. };
  22707. // Set the char stream and reset the lexer
  22708. Object.defineProperty(Lexer.prototype, "inputStream", {
  22709. get: function get() {
  22710. return this._input;
  22711. },
  22712. set: function set(input) {
  22713. this._input = null;
  22714. this._tokenFactorySourcePair = [this, this._input];
  22715. this.reset();
  22716. this._input = input;
  22717. this._tokenFactorySourcePair = [this, this._input];
  22718. }
  22719. });
  22720. Object.defineProperty(Lexer.prototype, "sourceName", {
  22721. get: function sourceName() {
  22722. return this._input.sourceName;
  22723. }
  22724. });
  22725. // By default does not support multiple emits per nextToken invocation
  22726. // for efficiency reasons. Subclass and override this method, nextToken,
  22727. // and getToken (to push tokens into a list and pull from that list
  22728. // rather than a single variable as this implementation does).
  22729. // /
  22730. Lexer.prototype.emitToken = function (token) {
  22731. this._token = token;
  22732. };
  22733. // The standard method called to automatically emit a token at the
  22734. // outermost lexical rule. The token object should point into the
  22735. // char buffer start..stop. If there is a text override in 'text',
  22736. // use that to set the token's text. Override this method to emit
  22737. // custom Token objects or provide a new factory.
  22738. // /
  22739. Lexer.prototype.emit = function () {
  22740. var t = this._factory.create(this._tokenFactorySourcePair, this._type, this._text, this._channel, this._tokenStartCharIndex, this.getCharIndex() - 1, this._tokenStartLine, this._tokenStartColumn);
  22741. this.emitToken(t);
  22742. return t;
  22743. };
  22744. Lexer.prototype.emitEOF = function () {
  22745. var cpos = this.column;
  22746. var lpos = this.line;
  22747. var eof = this._factory.create(this._tokenFactorySourcePair, Token.EOF, null, Token.DEFAULT_CHANNEL, this._input.index, this._input.index - 1, lpos, cpos);
  22748. this.emitToken(eof);
  22749. return eof;
  22750. };
  22751. Object.defineProperty(Lexer.prototype, "type", {
  22752. get: function get() {
  22753. return this.type;
  22754. },
  22755. set: function set(type) {
  22756. this._type = type;
  22757. }
  22758. });
  22759. Object.defineProperty(Lexer.prototype, "line", {
  22760. get: function get() {
  22761. return this._interp.line;
  22762. },
  22763. set: function set(line) {
  22764. this._interp.line = line;
  22765. }
  22766. });
  22767. Object.defineProperty(Lexer.prototype, "column", {
  22768. get: function get() {
  22769. return this._interp.column;
  22770. },
  22771. set: function set(column) {
  22772. this._interp.column = column;
  22773. }
  22774. });
  22775. // What is the index of the current character of lookahead?///
  22776. Lexer.prototype.getCharIndex = function () {
  22777. return this._input.index;
  22778. };
  22779. // Return the text matched so far for the current token or any text override.
  22780. //Set the complete text of this token; it wipes any previous changes to the text.
  22781. Object.defineProperty(Lexer.prototype, "text", {
  22782. get: function get() {
  22783. if (this._text !== null) {
  22784. return this._text;
  22785. } else {
  22786. return this._interp.getText(this._input);
  22787. }
  22788. },
  22789. set: function set(text) {
  22790. this._text = text;
  22791. }
  22792. });
  22793. // Return a list of all Token objects in input char stream.
  22794. // Forces load of all tokens. Does not include EOF token.
  22795. // /
  22796. Lexer.prototype.getAllTokens = function () {
  22797. var tokens = [];
  22798. var t = this.nextToken();
  22799. while (t.type !== Token.EOF) {
  22800. tokens.push(t);
  22801. t = this.nextToken();
  22802. }
  22803. return tokens;
  22804. };
  22805. Lexer.prototype.notifyListeners = function (e) {
  22806. var start = this._tokenStartCharIndex;
  22807. var stop = this._input.index;
  22808. var text = this._input.getText(start, stop);
  22809. var msg = "token recognition error at: '" + this.getErrorDisplay(text) + "'";
  22810. var listener = this.getErrorListenerDispatch();
  22811. listener.syntaxError(this, null, this._tokenStartLine, this._tokenStartColumn, msg, e);
  22812. };
  22813. Lexer.prototype.getErrorDisplay = function (s) {
  22814. var d = [];
  22815. for (var i = 0; i < s.length; i++) {
  22816. d.push(s[i]);
  22817. }
  22818. return d.join('');
  22819. };
  22820. Lexer.prototype.getErrorDisplayForChar = function (c) {
  22821. if (c.charCodeAt(0) === Token.EOF) {
  22822. return "<EOF>";
  22823. } else if (c === '\n') {
  22824. return "\\n";
  22825. } else if (c === '\t') {
  22826. return "\\t";
  22827. } else if (c === '\r') {
  22828. return "\\r";
  22829. } else {
  22830. return c;
  22831. }
  22832. };
  22833. Lexer.prototype.getCharErrorDisplay = function (c) {
  22834. return "'" + this.getErrorDisplayForChar(c) + "'";
  22835. };
  22836. // Lexers can normally match any char in it's vocabulary after matching
  22837. // a token, so do the easy thing and just kill a character and hope
  22838. // it all works out. You can instead use the rule invocation stack
  22839. // to do sophisticated error recovery if you are in a fragment rule.
  22840. // /
  22841. Lexer.prototype.recover = function (re) {
  22842. if (this._input.LA(1) !== Token.EOF) {
  22843. if (re instanceof LexerNoViableAltException) {
  22844. // skip a char and try again
  22845. this._interp.consume(this._input);
  22846. } else {
  22847. // TODO: Do we lose character or line position information?
  22848. this._input.consume();
  22849. }
  22850. }
  22851. };
  22852. exports.Lexer = Lexer;
  22853. /***/ }),
  22854. /***/ "./node_modules/antlr4/Parser.js":
  22855. /*!***************************************!*\
  22856. !*** ./node_modules/antlr4/Parser.js ***!
  22857. \***************************************/
  22858. /*! no static exports found */
  22859. /***/ (function(module, exports, __webpack_require__) {
  22860. "use strict";
  22861. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  22862. * Use of this file is governed by the BSD 3-clause license that
  22863. * can be found in the LICENSE.txt file in the project root.
  22864. */
  22865. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  22866. var ParseTreeListener = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").ParseTreeListener;
  22867. var Recognizer = __webpack_require__(/*! ./Recognizer */ "./node_modules/antlr4/Recognizer.js").Recognizer;
  22868. var DefaultErrorStrategy = __webpack_require__(/*! ./error/ErrorStrategy */ "./node_modules/antlr4/error/ErrorStrategy.js").DefaultErrorStrategy;
  22869. var ATNDeserializer = __webpack_require__(/*! ./atn/ATNDeserializer */ "./node_modules/antlr4/atn/ATNDeserializer.js").ATNDeserializer;
  22870. var ATNDeserializationOptions = __webpack_require__(/*! ./atn/ATNDeserializationOptions */ "./node_modules/antlr4/atn/ATNDeserializationOptions.js").ATNDeserializationOptions;
  22871. var TerminalNode = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").TerminalNode;
  22872. var ErrorNode = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").ErrorNode;
  22873. function TraceListener(parser) {
  22874. ParseTreeListener.call(this);
  22875. this.parser = parser;
  22876. return this;
  22877. }
  22878. TraceListener.prototype = Object.create(ParseTreeListener.prototype);
  22879. TraceListener.prototype.constructor = TraceListener;
  22880. TraceListener.prototype.enterEveryRule = function (ctx) {
  22881. console.log("enter " + this.parser.ruleNames[ctx.ruleIndex] + ", LT(1)=" + this.parser._input.LT(1).text);
  22882. };
  22883. TraceListener.prototype.visitTerminal = function (node) {
  22884. console.log("consume " + node.symbol + " rule " + this.parser.ruleNames[this.parser._ctx.ruleIndex]);
  22885. };
  22886. TraceListener.prototype.exitEveryRule = function (ctx) {
  22887. console.log("exit " + this.parser.ruleNames[ctx.ruleIndex] + ", LT(1)=" + this.parser._input.LT(1).text);
  22888. };
  22889. // this is all the parsing support code essentially; most of it is error
  22890. // recovery stuff.//
  22891. function Parser(input) {
  22892. Recognizer.call(this);
  22893. // The input stream.
  22894. this._input = null;
  22895. // The error handling strategy for the parser. The default value is a new
  22896. // instance of {@link DefaultErrorStrategy}.
  22897. this._errHandler = new DefaultErrorStrategy();
  22898. this._precedenceStack = [];
  22899. this._precedenceStack.push(0);
  22900. // The {@link ParserRuleContext} object for the currently executing rule.
  22901. // this is always non-null during the parsing process.
  22902. this._ctx = null;
  22903. // Specifies whether or not the parser should construct a parse tree during
  22904. // the parsing process. The default value is {@code true}.
  22905. this.buildParseTrees = true;
  22906. // When {@link //setTrace}{@code (true)} is called, a reference to the
  22907. // {@link TraceListener} is stored here so it can be easily removed in a
  22908. // later call to {@link //setTrace}{@code (false)}. The listener itself is
  22909. // implemented as a parser listener so this field is not directly used by
  22910. // other parser methods.
  22911. this._tracer = null;
  22912. // The list of {@link ParseTreeListener} listeners registered to receive
  22913. // events during the parse.
  22914. this._parseListeners = null;
  22915. // The number of syntax errors reported during parsing. this value is
  22916. // incremented each time {@link //notifyErrorListeners} is called.
  22917. this._syntaxErrors = 0;
  22918. this.setInputStream(input);
  22919. return this;
  22920. }
  22921. Parser.prototype = Object.create(Recognizer.prototype);
  22922. Parser.prototype.contructor = Parser;
  22923. // this field maps from the serialized ATN string to the deserialized {@link
  22924. // ATN} with
  22925. // bypass alternatives.
  22926. //
  22927. // @see ATNDeserializationOptions//isGenerateRuleBypassTransitions()
  22928. //
  22929. Parser.bypassAltsAtnCache = {};
  22930. // reset the parser's state//
  22931. Parser.prototype.reset = function () {
  22932. if (this._input !== null) {
  22933. this._input.seek(0);
  22934. }
  22935. this._errHandler.reset(this);
  22936. this._ctx = null;
  22937. this._syntaxErrors = 0;
  22938. this.setTrace(false);
  22939. this._precedenceStack = [];
  22940. this._precedenceStack.push(0);
  22941. if (this._interp !== null) {
  22942. this._interp.reset();
  22943. }
  22944. };
  22945. // Match current input symbol against {@code ttype}. If the symbol type
  22946. // matches, {@link ANTLRErrorStrategy//reportMatch} and {@link //consume} are
  22947. // called to complete the match process.
  22948. //
  22949. // <p>If the symbol type does not match,
  22950. // {@link ANTLRErrorStrategy//recoverInline} is called on the current error
  22951. // strategy to attempt recovery. If {@link //getBuildParseTree} is
  22952. // {@code true} and the token index of the symbol returned by
  22953. // {@link ANTLRErrorStrategy//recoverInline} is -1, the symbol is added to
  22954. // the parse tree by calling {@link ParserRuleContext//addErrorNode}.</p>
  22955. //
  22956. // @param ttype the token type to match
  22957. // @return the matched symbol
  22958. // @throws RecognitionException if the current input symbol did not match
  22959. // {@code ttype} and the error strategy could not recover from the
  22960. // mismatched symbol
  22961. Parser.prototype.match = function (ttype) {
  22962. var t = this.getCurrentToken();
  22963. if (t.type === ttype) {
  22964. this._errHandler.reportMatch(this);
  22965. this.consume();
  22966. } else {
  22967. t = this._errHandler.recoverInline(this);
  22968. if (this.buildParseTrees && t.tokenIndex === -1) {
  22969. // we must have conjured up a new token during single token
  22970. // insertion
  22971. // if it's not the current symbol
  22972. this._ctx.addErrorNode(t);
  22973. }
  22974. }
  22975. return t;
  22976. };
  22977. // Match current input symbol as a wildcard. If the symbol type matches
  22978. // (i.e. has a value greater than 0), {@link ANTLRErrorStrategy//reportMatch}
  22979. // and {@link //consume} are called to complete the match process.
  22980. //
  22981. // <p>If the symbol type does not match,
  22982. // {@link ANTLRErrorStrategy//recoverInline} is called on the current error
  22983. // strategy to attempt recovery. If {@link //getBuildParseTree} is
  22984. // {@code true} and the token index of the symbol returned by
  22985. // {@link ANTLRErrorStrategy//recoverInline} is -1, the symbol is added to
  22986. // the parse tree by calling {@link ParserRuleContext//addErrorNode}.</p>
  22987. //
  22988. // @return the matched symbol
  22989. // @throws RecognitionException if the current input symbol did not match
  22990. // a wildcard and the error strategy could not recover from the mismatched
  22991. // symbol
  22992. Parser.prototype.matchWildcard = function () {
  22993. var t = this.getCurrentToken();
  22994. if (t.type > 0) {
  22995. this._errHandler.reportMatch(this);
  22996. this.consume();
  22997. } else {
  22998. t = this._errHandler.recoverInline(this);
  22999. if (this._buildParseTrees && t.tokenIndex === -1) {
  23000. // we must have conjured up a new token during single token
  23001. // insertion
  23002. // if it's not the current symbol
  23003. this._ctx.addErrorNode(t);
  23004. }
  23005. }
  23006. return t;
  23007. };
  23008. Parser.prototype.getParseListeners = function () {
  23009. return this._parseListeners || [];
  23010. };
  23011. // Registers {@code listener} to receive events during the parsing process.
  23012. //
  23013. // <p>To support output-preserving grammar transformations (including but not
  23014. // limited to left-recursion removal, automated left-factoring, and
  23015. // optimized code generation), calls to listener methods during the parse
  23016. // may differ substantially from calls made by
  23017. // {@link ParseTreeWalker//DEFAULT} used after the parse is complete. In
  23018. // particular, rule entry and exit events may occur in a different order
  23019. // during the parse than after the parser. In addition, calls to certain
  23020. // rule entry methods may be omitted.</p>
  23021. //
  23022. // <p>With the following specific exceptions, calls to listener events are
  23023. // <em>deterministic</em>, i.e. for identical input the calls to listener
  23024. // methods will be the same.</p>
  23025. //
  23026. // <ul>
  23027. // <li>Alterations to the grammar used to generate code may change the
  23028. // behavior of the listener calls.</li>
  23029. // <li>Alterations to the command line options passed to ANTLR 4 when
  23030. // generating the parser may change the behavior of the listener calls.</li>
  23031. // <li>Changing the version of the ANTLR Tool used to generate the parser
  23032. // may change the behavior of the listener calls.</li>
  23033. // </ul>
  23034. //
  23035. // @param listener the listener to add
  23036. //
  23037. // @throws NullPointerException if {@code} listener is {@code null}
  23038. //
  23039. Parser.prototype.addParseListener = function (listener) {
  23040. if (listener === null) {
  23041. throw "listener";
  23042. }
  23043. if (this._parseListeners === null) {
  23044. this._parseListeners = [];
  23045. }
  23046. this._parseListeners.push(listener);
  23047. };
  23048. //
  23049. // Remove {@code listener} from the list of parse listeners.
  23050. //
  23051. // <p>If {@code listener} is {@code null} or has not been added as a parse
  23052. // listener, this method does nothing.</p>
  23053. // @param listener the listener to remove
  23054. //
  23055. Parser.prototype.removeParseListener = function (listener) {
  23056. if (this._parseListeners !== null) {
  23057. var idx = this._parseListeners.indexOf(listener);
  23058. if (idx >= 0) {
  23059. this._parseListeners.splice(idx, 1);
  23060. }
  23061. if (this._parseListeners.length === 0) {
  23062. this._parseListeners = null;
  23063. }
  23064. }
  23065. };
  23066. // Remove all parse listeners.
  23067. Parser.prototype.removeParseListeners = function () {
  23068. this._parseListeners = null;
  23069. };
  23070. // Notify any parse listeners of an enter rule event.
  23071. Parser.prototype.triggerEnterRuleEvent = function () {
  23072. if (this._parseListeners !== null) {
  23073. var ctx = this._ctx;
  23074. this._parseListeners.map(function (listener) {
  23075. listener.enterEveryRule(ctx);
  23076. ctx.enterRule(listener);
  23077. });
  23078. }
  23079. };
  23080. //
  23081. // Notify any parse listeners of an exit rule event.
  23082. //
  23083. // @see //addParseListener
  23084. //
  23085. Parser.prototype.triggerExitRuleEvent = function () {
  23086. if (this._parseListeners !== null) {
  23087. // reverse order walk of listeners
  23088. var ctx = this._ctx;
  23089. this._parseListeners.slice(0).reverse().map(function (listener) {
  23090. ctx.exitRule(listener);
  23091. listener.exitEveryRule(ctx);
  23092. });
  23093. }
  23094. };
  23095. Parser.prototype.getTokenFactory = function () {
  23096. return this._input.tokenSource._factory;
  23097. };
  23098. // Tell our token source and error strategy about a new way to create tokens.//
  23099. Parser.prototype.setTokenFactory = function (factory) {
  23100. this._input.tokenSource._factory = factory;
  23101. };
  23102. // The ATN with bypass alternatives is expensive to create so we create it
  23103. // lazily.
  23104. //
  23105. // @throws UnsupportedOperationException if the current parser does not
  23106. // implement the {@link //getSerializedATN()} method.
  23107. //
  23108. Parser.prototype.getATNWithBypassAlts = function () {
  23109. var serializedAtn = this.getSerializedATN();
  23110. if (serializedAtn === null) {
  23111. throw "The current parser does not support an ATN with bypass alternatives.";
  23112. }
  23113. var result = this.bypassAltsAtnCache[serializedAtn];
  23114. if (result === null) {
  23115. var deserializationOptions = new ATNDeserializationOptions();
  23116. deserializationOptions.generateRuleBypassTransitions = true;
  23117. result = new ATNDeserializer(deserializationOptions).deserialize(serializedAtn);
  23118. this.bypassAltsAtnCache[serializedAtn] = result;
  23119. }
  23120. return result;
  23121. };
  23122. // The preferred method of getting a tree pattern. For example, here's a
  23123. // sample use:
  23124. //
  23125. // <pre>
  23126. // ParseTree t = parser.expr();
  23127. // ParseTreePattern p = parser.compileParseTreePattern("&lt;ID&gt;+0",
  23128. // MyParser.RULE_expr);
  23129. // ParseTreeMatch m = p.match(t);
  23130. // String id = m.get("ID");
  23131. // </pre>
  23132. var Lexer = __webpack_require__(/*! ./Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  23133. Parser.prototype.compileParseTreePattern = function (pattern, patternRuleIndex, lexer) {
  23134. lexer = lexer || null;
  23135. if (lexer === null) {
  23136. if (this.getTokenStream() !== null) {
  23137. var tokenSource = this.getTokenStream().tokenSource;
  23138. if (tokenSource instanceof Lexer) {
  23139. lexer = tokenSource;
  23140. }
  23141. }
  23142. }
  23143. if (lexer === null) {
  23144. throw "Parser can't discover a lexer to use";
  23145. }
  23146. var m = new ParseTreePatternMatcher(lexer, this);
  23147. return m.compile(pattern, patternRuleIndex);
  23148. };
  23149. Parser.prototype.getInputStream = function () {
  23150. return this.getTokenStream();
  23151. };
  23152. Parser.prototype.setInputStream = function (input) {
  23153. this.setTokenStream(input);
  23154. };
  23155. Parser.prototype.getTokenStream = function () {
  23156. return this._input;
  23157. };
  23158. // Set the token stream and reset the parser.//
  23159. Parser.prototype.setTokenStream = function (input) {
  23160. this._input = null;
  23161. this.reset();
  23162. this._input = input;
  23163. };
  23164. // Match needs to return the current input symbol, which gets put
  23165. // into the label for the associated token ref; e.g., x=ID.
  23166. //
  23167. Parser.prototype.getCurrentToken = function () {
  23168. return this._input.LT(1);
  23169. };
  23170. Parser.prototype.notifyErrorListeners = function (msg, offendingToken, err) {
  23171. offendingToken = offendingToken || null;
  23172. err = err || null;
  23173. if (offendingToken === null) {
  23174. offendingToken = this.getCurrentToken();
  23175. }
  23176. this._syntaxErrors += 1;
  23177. var line = offendingToken.line;
  23178. var column = offendingToken.column;
  23179. var listener = this.getErrorListenerDispatch();
  23180. listener.syntaxError(this, offendingToken, line, column, msg, err);
  23181. };
  23182. //
  23183. // Consume and return the {@linkplain //getCurrentToken current symbol}.
  23184. //
  23185. // <p>E.g., given the following input with {@code A} being the current
  23186. // lookahead symbol, this function moves the cursor to {@code B} and returns
  23187. // {@code A}.</p>
  23188. //
  23189. // <pre>
  23190. // A B
  23191. // ^
  23192. // </pre>
  23193. //
  23194. // If the parser is not in error recovery mode, the consumed symbol is added
  23195. // to the parse tree using {@link ParserRuleContext//addChild(Token)}, and
  23196. // {@link ParseTreeListener//visitTerminal} is called on any parse listeners.
  23197. // If the parser <em>is</em> in error recovery mode, the consumed symbol is
  23198. // added to the parse tree using
  23199. // {@link ParserRuleContext//addErrorNode(Token)}, and
  23200. // {@link ParseTreeListener//visitErrorNode} is called on any parse
  23201. // listeners.
  23202. //
  23203. Parser.prototype.consume = function () {
  23204. var o = this.getCurrentToken();
  23205. if (o.type !== Token.EOF) {
  23206. this.getInputStream().consume();
  23207. }
  23208. var hasListener = this._parseListeners !== null && this._parseListeners.length > 0;
  23209. if (this.buildParseTrees || hasListener) {
  23210. var node;
  23211. if (this._errHandler.inErrorRecoveryMode(this)) {
  23212. node = this._ctx.addErrorNode(o);
  23213. } else {
  23214. node = this._ctx.addTokenNode(o);
  23215. }
  23216. node.invokingState = this.state;
  23217. if (hasListener) {
  23218. this._parseListeners.map(function (listener) {
  23219. if (node instanceof ErrorNode || node.isErrorNode !== undefined && node.isErrorNode()) {
  23220. listener.visitErrorNode(node);
  23221. } else if (node instanceof TerminalNode) {
  23222. listener.visitTerminal(node);
  23223. }
  23224. });
  23225. }
  23226. }
  23227. return o;
  23228. };
  23229. Parser.prototype.addContextToParseTree = function () {
  23230. // add current context to parent if we have a parent
  23231. if (this._ctx.parentCtx !== null) {
  23232. this._ctx.parentCtx.addChild(this._ctx);
  23233. }
  23234. };
  23235. // Always called by generated parsers upon entry to a rule. Access field
  23236. // {@link //_ctx} get the current context.
  23237. Parser.prototype.enterRule = function (localctx, state, ruleIndex) {
  23238. this.state = state;
  23239. this._ctx = localctx;
  23240. this._ctx.start = this._input.LT(1);
  23241. if (this.buildParseTrees) {
  23242. this.addContextToParseTree();
  23243. }
  23244. if (this._parseListeners !== null) {
  23245. this.triggerEnterRuleEvent();
  23246. }
  23247. };
  23248. Parser.prototype.exitRule = function () {
  23249. this._ctx.stop = this._input.LT(-1);
  23250. // trigger event on _ctx, before it reverts to parent
  23251. if (this._parseListeners !== null) {
  23252. this.triggerExitRuleEvent();
  23253. }
  23254. this.state = this._ctx.invokingState;
  23255. this._ctx = this._ctx.parentCtx;
  23256. };
  23257. Parser.prototype.enterOuterAlt = function (localctx, altNum) {
  23258. localctx.setAltNumber(altNum);
  23259. // if we have new localctx, make sure we replace existing ctx
  23260. // that is previous child of parse tree
  23261. if (this.buildParseTrees && this._ctx !== localctx) {
  23262. if (this._ctx.parentCtx !== null) {
  23263. this._ctx.parentCtx.removeLastChild();
  23264. this._ctx.parentCtx.addChild(localctx);
  23265. }
  23266. }
  23267. this._ctx = localctx;
  23268. };
  23269. // Get the precedence level for the top-most precedence rule.
  23270. //
  23271. // @return The precedence level for the top-most precedence rule, or -1 if
  23272. // the parser context is not nested within a precedence rule.
  23273. Parser.prototype.getPrecedence = function () {
  23274. if (this._precedenceStack.length === 0) {
  23275. return -1;
  23276. } else {
  23277. return this._precedenceStack[this._precedenceStack.length - 1];
  23278. }
  23279. };
  23280. Parser.prototype.enterRecursionRule = function (localctx, state, ruleIndex, precedence) {
  23281. this.state = state;
  23282. this._precedenceStack.push(precedence);
  23283. this._ctx = localctx;
  23284. this._ctx.start = this._input.LT(1);
  23285. if (this._parseListeners !== null) {
  23286. this.triggerEnterRuleEvent(); // simulates rule entry for
  23287. // left-recursive rules
  23288. }
  23289. };
  23290. //
  23291. // Like {@link //enterRule} but for recursive rules.
  23292. Parser.prototype.pushNewRecursionContext = function (localctx, state, ruleIndex) {
  23293. var previous = this._ctx;
  23294. previous.parentCtx = localctx;
  23295. previous.invokingState = state;
  23296. previous.stop = this._input.LT(-1);
  23297. this._ctx = localctx;
  23298. this._ctx.start = previous.start;
  23299. if (this.buildParseTrees) {
  23300. this._ctx.addChild(previous);
  23301. }
  23302. if (this._parseListeners !== null) {
  23303. this.triggerEnterRuleEvent(); // simulates rule entry for
  23304. // left-recursive rules
  23305. }
  23306. };
  23307. Parser.prototype.unrollRecursionContexts = function (parentCtx) {
  23308. this._precedenceStack.pop();
  23309. this._ctx.stop = this._input.LT(-1);
  23310. var retCtx = this._ctx; // save current ctx (return value)
  23311. // unroll so _ctx is as it was before call to recursive method
  23312. if (this._parseListeners !== null) {
  23313. while (this._ctx !== parentCtx) {
  23314. this.triggerExitRuleEvent();
  23315. this._ctx = this._ctx.parentCtx;
  23316. }
  23317. } else {
  23318. this._ctx = parentCtx;
  23319. }
  23320. // hook into tree
  23321. retCtx.parentCtx = parentCtx;
  23322. if (this.buildParseTrees && parentCtx !== null) {
  23323. // add return ctx into invoking rule's tree
  23324. parentCtx.addChild(retCtx);
  23325. }
  23326. };
  23327. Parser.prototype.getInvokingContext = function (ruleIndex) {
  23328. var ctx = this._ctx;
  23329. while (ctx !== null) {
  23330. if (ctx.ruleIndex === ruleIndex) {
  23331. return ctx;
  23332. }
  23333. ctx = ctx.parentCtx;
  23334. }
  23335. return null;
  23336. };
  23337. Parser.prototype.precpred = function (localctx, precedence) {
  23338. return precedence >= this._precedenceStack[this._precedenceStack.length - 1];
  23339. };
  23340. Parser.prototype.inContext = function (context) {
  23341. // TODO: useful in parser?
  23342. return false;
  23343. };
  23344. //
  23345. // Checks whether or not {@code symbol} can follow the current state in the
  23346. // ATN. The behavior of this method is equivalent to the following, but is
  23347. // implemented such that the complete context-sensitive follow set does not
  23348. // need to be explicitly constructed.
  23349. //
  23350. // <pre>
  23351. // return getExpectedTokens().contains(symbol);
  23352. // </pre>
  23353. //
  23354. // @param symbol the symbol type to check
  23355. // @return {@code true} if {@code symbol} can follow the current state in
  23356. // the ATN, otherwise {@code false}.
  23357. Parser.prototype.isExpectedToken = function (symbol) {
  23358. var atn = this._interp.atn;
  23359. var ctx = this._ctx;
  23360. var s = atn.states[this.state];
  23361. var following = atn.nextTokens(s);
  23362. if (following.contains(symbol)) {
  23363. return true;
  23364. }
  23365. if (!following.contains(Token.EPSILON)) {
  23366. return false;
  23367. }
  23368. while (ctx !== null && ctx.invokingState >= 0 && following.contains(Token.EPSILON)) {
  23369. var invokingState = atn.states[ctx.invokingState];
  23370. var rt = invokingState.transitions[0];
  23371. following = atn.nextTokens(rt.followState);
  23372. if (following.contains(symbol)) {
  23373. return true;
  23374. }
  23375. ctx = ctx.parentCtx;
  23376. }
  23377. if (following.contains(Token.EPSILON) && symbol === Token.EOF) {
  23378. return true;
  23379. } else {
  23380. return false;
  23381. }
  23382. };
  23383. // Computes the set of input symbols which could follow the current parser
  23384. // state and context, as given by {@link //getState} and {@link //getContext},
  23385. // respectively.
  23386. //
  23387. // @see ATN//getExpectedTokens(int, RuleContext)
  23388. //
  23389. Parser.prototype.getExpectedTokens = function () {
  23390. return this._interp.atn.getExpectedTokens(this.state, this._ctx);
  23391. };
  23392. Parser.prototype.getExpectedTokensWithinCurrentRule = function () {
  23393. var atn = this._interp.atn;
  23394. var s = atn.states[this.state];
  23395. return atn.nextTokens(s);
  23396. };
  23397. // Get a rule's index (i.e., {@code RULE_ruleName} field) or -1 if not found.//
  23398. Parser.prototype.getRuleIndex = function (ruleName) {
  23399. var ruleIndex = this.getRuleIndexMap()[ruleName];
  23400. if (ruleIndex !== null) {
  23401. return ruleIndex;
  23402. } else {
  23403. return -1;
  23404. }
  23405. };
  23406. // Return List&lt;String&gt; of the rule names in your parser instance
  23407. // leading up to a call to the current rule. You could override if
  23408. // you want more details such as the file/line info of where
  23409. // in the ATN a rule is invoked.
  23410. //
  23411. // this is very useful for error messages.
  23412. //
  23413. Parser.prototype.getRuleInvocationStack = function (p) {
  23414. p = p || null;
  23415. if (p === null) {
  23416. p = this._ctx;
  23417. }
  23418. var stack = [];
  23419. while (p !== null) {
  23420. // compute what follows who invoked us
  23421. var ruleIndex = p.ruleIndex;
  23422. if (ruleIndex < 0) {
  23423. stack.push("n/a");
  23424. } else {
  23425. stack.push(this.ruleNames[ruleIndex]);
  23426. }
  23427. p = p.parentCtx;
  23428. }
  23429. return stack;
  23430. };
  23431. // For debugging and other purposes.//
  23432. Parser.prototype.getDFAStrings = function () {
  23433. return this._interp.decisionToDFA.toString();
  23434. };
  23435. // For debugging and other purposes.//
  23436. Parser.prototype.dumpDFA = function () {
  23437. var seenOne = false;
  23438. for (var i = 0; i < this._interp.decisionToDFA.length; i++) {
  23439. var dfa = this._interp.decisionToDFA[i];
  23440. if (dfa.states.length > 0) {
  23441. if (seenOne) {
  23442. console.log();
  23443. }
  23444. this.printer.println("Decision " + dfa.decision + ":");
  23445. this.printer.print(dfa.toString(this.literalNames, this.symbolicNames));
  23446. seenOne = true;
  23447. }
  23448. }
  23449. };
  23450. /*
  23451. " printer = function() {\r\n" +
  23452. " this.println = function(s) { document.getElementById('output') += s + '\\n'; }\r\n" +
  23453. " this.print = function(s) { document.getElementById('output') += s; }\r\n" +
  23454. " };\r\n" +
  23455. */
  23456. Parser.prototype.getSourceName = function () {
  23457. return this._input.sourceName;
  23458. };
  23459. // During a parse is sometimes useful to listen in on the rule entry and exit
  23460. // events as well as token matches. this is for quick and dirty debugging.
  23461. //
  23462. Parser.prototype.setTrace = function (trace) {
  23463. if (!trace) {
  23464. this.removeParseListener(this._tracer);
  23465. this._tracer = null;
  23466. } else {
  23467. if (this._tracer !== null) {
  23468. this.removeParseListener(this._tracer);
  23469. }
  23470. this._tracer = new TraceListener(this);
  23471. this.addParseListener(this._tracer);
  23472. }
  23473. };
  23474. exports.Parser = Parser;
  23475. /***/ }),
  23476. /***/ "./node_modules/antlr4/ParserRuleContext.js":
  23477. /*!**************************************************!*\
  23478. !*** ./node_modules/antlr4/ParserRuleContext.js ***!
  23479. \**************************************************/
  23480. /*! no static exports found */
  23481. /***/ (function(module, exports, __webpack_require__) {
  23482. "use strict";
  23483. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  23484. * Use of this file is governed by the BSD 3-clause license that
  23485. * can be found in the LICENSE.txt file in the project root.
  23486. */
  23487. //* A rule invocation record for parsing.
  23488. //
  23489. // Contains all of the information about the current rule not stored in the
  23490. // RuleContext. It handles parse tree children list, Any ATN state
  23491. // tracing, and the default values available for rule indications:
  23492. // start, stop, rule index, current alt number, current
  23493. // ATN state.
  23494. //
  23495. // Subclasses made for each rule and grammar track the parameters,
  23496. // return values, locals, and labels specific to that rule. These
  23497. // are the objects that are returned from rules.
  23498. //
  23499. // Note text is not an actual field of a rule return value; it is computed
  23500. // from start and stop using the input stream's toString() method. I
  23501. // could add a ctor to this so that we can pass in and store the input
  23502. // stream, but I'm not sure we want to do that. It would seem to be undefined
  23503. // to get the .text property anyway if the rule matches tokens from multiple
  23504. // input streams.
  23505. //
  23506. // I do not use getters for fields of objects that are used simply to
  23507. // group values such as this aggregate. The getters/setters are there to
  23508. // satisfy the superclass interface.
  23509. var RuleContext = __webpack_require__(/*! ./RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  23510. var Tree = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js");
  23511. var INVALID_INTERVAL = Tree.INVALID_INTERVAL;
  23512. var TerminalNode = Tree.TerminalNode;
  23513. var TerminalNodeImpl = Tree.TerminalNodeImpl;
  23514. var ErrorNodeImpl = Tree.ErrorNodeImpl;
  23515. var Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  23516. function ParserRuleContext(parent, invokingStateNumber) {
  23517. parent = parent || null;
  23518. invokingStateNumber = invokingStateNumber || null;
  23519. RuleContext.call(this, parent, invokingStateNumber);
  23520. this.ruleIndex = -1;
  23521. // * If we are debugging or building a parse tree for a visitor,
  23522. // we need to track all of the tokens and rule invocations associated
  23523. // with this rule's context. This is empty for parsing w/o tree constr.
  23524. // operation because we don't the need to track the details about
  23525. // how we parse this rule.
  23526. // /
  23527. this.children = null;
  23528. this.start = null;
  23529. this.stop = null;
  23530. // The exception that forced this rule to return. If the rule successfully
  23531. // completed, this is {@code null}.
  23532. this.exception = null;
  23533. }
  23534. ParserRuleContext.prototype = Object.create(RuleContext.prototype);
  23535. ParserRuleContext.prototype.constructor = ParserRuleContext;
  23536. // * COPY a ctx (I'm deliberately not using copy constructor)///
  23537. ParserRuleContext.prototype.copyFrom = function (ctx) {
  23538. // from RuleContext
  23539. this.parentCtx = ctx.parentCtx;
  23540. this.invokingState = ctx.invokingState;
  23541. this.children = null;
  23542. this.start = ctx.start;
  23543. this.stop = ctx.stop;
  23544. // copy any error nodes to alt label node
  23545. if (ctx.children) {
  23546. this.children = [];
  23547. // reset parent pointer for any error nodes
  23548. ctx.children.map(function (child) {
  23549. if (child instanceof ErrorNodeImpl) {
  23550. this.children.push(child);
  23551. child.parentCtx = this;
  23552. }
  23553. }, this);
  23554. }
  23555. };
  23556. // Double dispatch methods for listeners
  23557. ParserRuleContext.prototype.enterRule = function (listener) {};
  23558. ParserRuleContext.prototype.exitRule = function (listener) {};
  23559. // * Does not set parent link; other add methods do that///
  23560. ParserRuleContext.prototype.addChild = function (child) {
  23561. if (this.children === null) {
  23562. this.children = [];
  23563. }
  23564. this.children.push(child);
  23565. return child;
  23566. };
  23567. // * Used by enterOuterAlt to toss out a RuleContext previously added as
  23568. // we entered a rule. If we have // label, we will need to remove
  23569. // generic ruleContext object.
  23570. // /
  23571. ParserRuleContext.prototype.removeLastChild = function () {
  23572. if (this.children !== null) {
  23573. this.children.pop();
  23574. }
  23575. };
  23576. ParserRuleContext.prototype.addTokenNode = function (token) {
  23577. var node = new TerminalNodeImpl(token);
  23578. this.addChild(node);
  23579. node.parentCtx = this;
  23580. return node;
  23581. };
  23582. ParserRuleContext.prototype.addErrorNode = function (badToken) {
  23583. var node = new ErrorNodeImpl(badToken);
  23584. this.addChild(node);
  23585. node.parentCtx = this;
  23586. return node;
  23587. };
  23588. ParserRuleContext.prototype.getChild = function (i, type) {
  23589. type = type || null;
  23590. if (this.children === null || i < 0 || i >= this.children.length) {
  23591. return null;
  23592. }
  23593. if (type === null) {
  23594. return this.children[i];
  23595. } else {
  23596. for (var j = 0; j < this.children.length; j++) {
  23597. var child = this.children[j];
  23598. if (child instanceof type) {
  23599. if (i === 0) {
  23600. return child;
  23601. } else {
  23602. i -= 1;
  23603. }
  23604. }
  23605. }
  23606. return null;
  23607. }
  23608. };
  23609. ParserRuleContext.prototype.getToken = function (ttype, i) {
  23610. if (this.children === null || i < 0 || i >= this.children.length) {
  23611. return null;
  23612. }
  23613. for (var j = 0; j < this.children.length; j++) {
  23614. var child = this.children[j];
  23615. if (child instanceof TerminalNode) {
  23616. if (child.symbol.type === ttype) {
  23617. if (i === 0) {
  23618. return child;
  23619. } else {
  23620. i -= 1;
  23621. }
  23622. }
  23623. }
  23624. }
  23625. return null;
  23626. };
  23627. ParserRuleContext.prototype.getTokens = function (ttype) {
  23628. if (this.children === null) {
  23629. return [];
  23630. } else {
  23631. var tokens = [];
  23632. for (var j = 0; j < this.children.length; j++) {
  23633. var child = this.children[j];
  23634. if (child instanceof TerminalNode) {
  23635. if (child.symbol.type === ttype) {
  23636. tokens.push(child);
  23637. }
  23638. }
  23639. }
  23640. return tokens;
  23641. }
  23642. };
  23643. ParserRuleContext.prototype.getTypedRuleContext = function (ctxType, i) {
  23644. return this.getChild(i, ctxType);
  23645. };
  23646. ParserRuleContext.prototype.getTypedRuleContexts = function (ctxType) {
  23647. if (this.children === null) {
  23648. return [];
  23649. } else {
  23650. var contexts = [];
  23651. for (var j = 0; j < this.children.length; j++) {
  23652. var child = this.children[j];
  23653. if (child instanceof ctxType) {
  23654. contexts.push(child);
  23655. }
  23656. }
  23657. return contexts;
  23658. }
  23659. };
  23660. ParserRuleContext.prototype.getChildCount = function () {
  23661. if (this.children === null) {
  23662. return 0;
  23663. } else {
  23664. return this.children.length;
  23665. }
  23666. };
  23667. ParserRuleContext.prototype.getSourceInterval = function () {
  23668. if (this.start === null || this.stop === null) {
  23669. return INVALID_INTERVAL;
  23670. } else {
  23671. return new Interval(this.start.tokenIndex, this.stop.tokenIndex);
  23672. }
  23673. };
  23674. RuleContext.EMPTY = new ParserRuleContext();
  23675. function InterpreterRuleContext(parent, invokingStateNumber, ruleIndex) {
  23676. ParserRuleContext.call(parent, invokingStateNumber);
  23677. this.ruleIndex = ruleIndex;
  23678. return this;
  23679. }
  23680. InterpreterRuleContext.prototype = Object.create(ParserRuleContext.prototype);
  23681. InterpreterRuleContext.prototype.constructor = InterpreterRuleContext;
  23682. exports.ParserRuleContext = ParserRuleContext;
  23683. /***/ }),
  23684. /***/ "./node_modules/antlr4/PredictionContext.js":
  23685. /*!**************************************************!*\
  23686. !*** ./node_modules/antlr4/PredictionContext.js ***!
  23687. \**************************************************/
  23688. /*! no static exports found */
  23689. /***/ (function(module, exports, __webpack_require__) {
  23690. "use strict";
  23691. //
  23692. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  23693. * Use of this file is governed by the BSD 3-clause license that
  23694. * can be found in the LICENSE.txt file in the project root.
  23695. */
  23696. ///
  23697. var RuleContext = __webpack_require__(/*! ./RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  23698. var Hash = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js").Hash;
  23699. function PredictionContext(cachedHashCode) {
  23700. this.cachedHashCode = cachedHashCode;
  23701. }
  23702. // Represents {@code $} in local context prediction, which means wildcard.
  23703. // {@code//+x =//}.
  23704. // /
  23705. PredictionContext.EMPTY = null;
  23706. // Represents {@code $} in an array in full context mode, when {@code $}
  23707. // doesn't mean wildcard: {@code $ + x = [$,x]}. Here,
  23708. // {@code $} = {@link //EMPTY_RETURN_STATE}.
  23709. // /
  23710. PredictionContext.EMPTY_RETURN_STATE = 0x7FFFFFFF;
  23711. PredictionContext.globalNodeCount = 1;
  23712. PredictionContext.id = PredictionContext.globalNodeCount;
  23713. // Stores the computed hash code of this {@link PredictionContext}. The hash
  23714. // code is computed in parts to match the following reference algorithm.
  23715. //
  23716. // <pre>
  23717. // private int referenceHashCode() {
  23718. // int hash = {@link MurmurHash//initialize MurmurHash.initialize}({@link
  23719. // //INITIAL_HASH});
  23720. //
  23721. // for (int i = 0; i &lt; {@link //size()}; i++) {
  23722. // hash = {@link MurmurHash//update MurmurHash.update}(hash, {@link //getParent
  23723. // getParent}(i));
  23724. // }
  23725. //
  23726. // for (int i = 0; i &lt; {@link //size()}; i++) {
  23727. // hash = {@link MurmurHash//update MurmurHash.update}(hash, {@link
  23728. // //getReturnState getReturnState}(i));
  23729. // }
  23730. //
  23731. // hash = {@link MurmurHash//finish MurmurHash.finish}(hash, 2// {@link
  23732. // //size()});
  23733. // return hash;
  23734. // }
  23735. // </pre>
  23736. // /
  23737. // This means only the {@link //EMPTY} context is in set.
  23738. PredictionContext.prototype.isEmpty = function () {
  23739. return this === PredictionContext.EMPTY;
  23740. };
  23741. PredictionContext.prototype.hasEmptyPath = function () {
  23742. return this.getReturnState(this.length - 1) === PredictionContext.EMPTY_RETURN_STATE;
  23743. };
  23744. PredictionContext.prototype.hashCode = function () {
  23745. return this.cachedHashCode;
  23746. };
  23747. PredictionContext.prototype.updateHashCode = function (hash) {
  23748. hash.update(this.cachedHashCode);
  23749. };
  23750. /*
  23751. function calculateHashString(parent, returnState) {
  23752. return "" + parent + returnState;
  23753. }
  23754. */
  23755. // Used to cache {@link PredictionContext} objects. Its used for the shared
  23756. // context cash associated with contexts in DFA states. This cache
  23757. // can be used for both lexers and parsers.
  23758. function PredictionContextCache() {
  23759. this.cache = {};
  23760. return this;
  23761. }
  23762. // Add a context to the cache and return it. If the context already exists,
  23763. // return that one instead and do not add a new context to the cache.
  23764. // Protect shared cache from unsafe thread access.
  23765. //
  23766. PredictionContextCache.prototype.add = function (ctx) {
  23767. if (ctx === PredictionContext.EMPTY) {
  23768. return PredictionContext.EMPTY;
  23769. }
  23770. var existing = this.cache[ctx] || null;
  23771. if (existing !== null) {
  23772. return existing;
  23773. }
  23774. this.cache[ctx] = ctx;
  23775. return ctx;
  23776. };
  23777. PredictionContextCache.prototype.get = function (ctx) {
  23778. return this.cache[ctx] || null;
  23779. };
  23780. Object.defineProperty(PredictionContextCache.prototype, "length", {
  23781. get: function get() {
  23782. return this.cache.length;
  23783. }
  23784. });
  23785. function SingletonPredictionContext(parent, returnState) {
  23786. var hashCode = 0;
  23787. if (parent !== null) {
  23788. var hash = new Hash();
  23789. hash.update(parent, returnState);
  23790. hashCode = hash.finish();
  23791. }
  23792. PredictionContext.call(this, hashCode);
  23793. this.parentCtx = parent;
  23794. this.returnState = returnState;
  23795. }
  23796. SingletonPredictionContext.prototype = Object.create(PredictionContext.prototype);
  23797. SingletonPredictionContext.prototype.contructor = SingletonPredictionContext;
  23798. SingletonPredictionContext.create = function (parent, returnState) {
  23799. if (returnState === PredictionContext.EMPTY_RETURN_STATE && parent === null) {
  23800. // someone can pass in the bits of an array ctx that mean $
  23801. return PredictionContext.EMPTY;
  23802. } else {
  23803. return new SingletonPredictionContext(parent, returnState);
  23804. }
  23805. };
  23806. Object.defineProperty(SingletonPredictionContext.prototype, "length", {
  23807. get: function get() {
  23808. return 1;
  23809. }
  23810. });
  23811. SingletonPredictionContext.prototype.getParent = function (index) {
  23812. return this.parentCtx;
  23813. };
  23814. SingletonPredictionContext.prototype.getReturnState = function (index) {
  23815. return this.returnState;
  23816. };
  23817. SingletonPredictionContext.prototype.equals = function (other) {
  23818. if (this === other) {
  23819. return true;
  23820. } else if (!(other instanceof SingletonPredictionContext)) {
  23821. return false;
  23822. } else if (this.hashCode() !== other.hashCode()) {
  23823. return false; // can't be same if hash is different
  23824. } else {
  23825. if (this.returnState !== other.returnState) return false;else if (this.parentCtx == null) return other.parentCtx == null;else return this.parentCtx.equals(other.parentCtx);
  23826. }
  23827. };
  23828. SingletonPredictionContext.prototype.toString = function () {
  23829. var up = this.parentCtx === null ? "" : this.parentCtx.toString();
  23830. if (up.length === 0) {
  23831. if (this.returnState === PredictionContext.EMPTY_RETURN_STATE) {
  23832. return "$";
  23833. } else {
  23834. return "" + this.returnState;
  23835. }
  23836. } else {
  23837. return "" + this.returnState + " " + up;
  23838. }
  23839. };
  23840. function EmptyPredictionContext() {
  23841. SingletonPredictionContext.call(this, null, PredictionContext.EMPTY_RETURN_STATE);
  23842. return this;
  23843. }
  23844. EmptyPredictionContext.prototype = Object.create(SingletonPredictionContext.prototype);
  23845. EmptyPredictionContext.prototype.constructor = EmptyPredictionContext;
  23846. EmptyPredictionContext.prototype.isEmpty = function () {
  23847. return true;
  23848. };
  23849. EmptyPredictionContext.prototype.getParent = function (index) {
  23850. return null;
  23851. };
  23852. EmptyPredictionContext.prototype.getReturnState = function (index) {
  23853. return this.returnState;
  23854. };
  23855. EmptyPredictionContext.prototype.equals = function (other) {
  23856. return this === other;
  23857. };
  23858. EmptyPredictionContext.prototype.toString = function () {
  23859. return "$";
  23860. };
  23861. PredictionContext.EMPTY = new EmptyPredictionContext();
  23862. function ArrayPredictionContext(parents, returnStates) {
  23863. // Parent can be null only if full ctx mode and we make an array
  23864. // from {@link //EMPTY} and non-empty. We merge {@link //EMPTY} by using
  23865. // null parent and
  23866. // returnState == {@link //EMPTY_RETURN_STATE}.
  23867. var h = new Hash();
  23868. h.update(parents, returnStates);
  23869. var hashCode = h.finish();
  23870. PredictionContext.call(this, hashCode);
  23871. this.parents = parents;
  23872. this.returnStates = returnStates;
  23873. return this;
  23874. }
  23875. ArrayPredictionContext.prototype = Object.create(PredictionContext.prototype);
  23876. ArrayPredictionContext.prototype.constructor = ArrayPredictionContext;
  23877. ArrayPredictionContext.prototype.isEmpty = function () {
  23878. // since EMPTY_RETURN_STATE can only appear in the last position, we
  23879. // don't need to verify that size==1
  23880. return this.returnStates[0] === PredictionContext.EMPTY_RETURN_STATE;
  23881. };
  23882. Object.defineProperty(ArrayPredictionContext.prototype, "length", {
  23883. get: function get() {
  23884. return this.returnStates.length;
  23885. }
  23886. });
  23887. ArrayPredictionContext.prototype.getParent = function (index) {
  23888. return this.parents[index];
  23889. };
  23890. ArrayPredictionContext.prototype.getReturnState = function (index) {
  23891. return this.returnStates[index];
  23892. };
  23893. ArrayPredictionContext.prototype.equals = function (other) {
  23894. if (this === other) {
  23895. return true;
  23896. } else if (!(other instanceof ArrayPredictionContext)) {
  23897. return false;
  23898. } else if (this.hashCode() !== other.hashCode()) {
  23899. return false; // can't be same if hash is different
  23900. } else {
  23901. return this.returnStates === other.returnStates && this.parents === other.parents;
  23902. }
  23903. };
  23904. ArrayPredictionContext.prototype.toString = function () {
  23905. if (this.isEmpty()) {
  23906. return "[]";
  23907. } else {
  23908. var s = "[";
  23909. for (var i = 0; i < this.returnStates.length; i++) {
  23910. if (i > 0) {
  23911. s = s + ", ";
  23912. }
  23913. if (this.returnStates[i] === PredictionContext.EMPTY_RETURN_STATE) {
  23914. s = s + "$";
  23915. continue;
  23916. }
  23917. s = s + this.returnStates[i];
  23918. if (this.parents[i] !== null) {
  23919. s = s + " " + this.parents[i];
  23920. } else {
  23921. s = s + "null";
  23922. }
  23923. }
  23924. return s + "]";
  23925. }
  23926. };
  23927. // Convert a {@link RuleContext} tree to a {@link PredictionContext} graph.
  23928. // Return {@link //EMPTY} if {@code outerContext} is empty or null.
  23929. // /
  23930. function predictionContextFromRuleContext(atn, outerContext) {
  23931. if (outerContext === undefined || outerContext === null) {
  23932. outerContext = RuleContext.EMPTY;
  23933. }
  23934. // if we are in RuleContext of start rule, s, then PredictionContext
  23935. // is EMPTY. Nobody called us. (if we are empty, return empty)
  23936. if (outerContext.parentCtx === null || outerContext === RuleContext.EMPTY) {
  23937. return PredictionContext.EMPTY;
  23938. }
  23939. // If we have a parent, convert it to a PredictionContext graph
  23940. var parent = predictionContextFromRuleContext(atn, outerContext.parentCtx);
  23941. var state = atn.states[outerContext.invokingState];
  23942. var transition = state.transitions[0];
  23943. return SingletonPredictionContext.create(parent, transition.followState.stateNumber);
  23944. }
  23945. /*
  23946. function calculateListsHashString(parents, returnStates) {
  23947. var s = "";
  23948. parents.map(function(p) {
  23949. s = s + p;
  23950. });
  23951. returnStates.map(function(r) {
  23952. s = s + r;
  23953. });
  23954. return s;
  23955. }
  23956. */
  23957. function merge(a, b, rootIsWildcard, mergeCache) {
  23958. // share same graph if both same
  23959. if (a === b) {
  23960. return a;
  23961. }
  23962. if (a instanceof SingletonPredictionContext && b instanceof SingletonPredictionContext) {
  23963. return mergeSingletons(a, b, rootIsWildcard, mergeCache);
  23964. }
  23965. // At least one of a or b is array
  23966. // If one is $ and rootIsWildcard, return $ as// wildcard
  23967. if (rootIsWildcard) {
  23968. if (a instanceof EmptyPredictionContext) {
  23969. return a;
  23970. }
  23971. if (b instanceof EmptyPredictionContext) {
  23972. return b;
  23973. }
  23974. }
  23975. // convert singleton so both are arrays to normalize
  23976. if (a instanceof SingletonPredictionContext) {
  23977. a = new ArrayPredictionContext([a.getParent()], [a.returnState]);
  23978. }
  23979. if (b instanceof SingletonPredictionContext) {
  23980. b = new ArrayPredictionContext([b.getParent()], [b.returnState]);
  23981. }
  23982. return mergeArrays(a, b, rootIsWildcard, mergeCache);
  23983. }
  23984. //
  23985. // Merge two {@link SingletonPredictionContext} instances.
  23986. //
  23987. // <p>Stack tops equal, parents merge is same; return left graph.<br>
  23988. // <embed src="images/SingletonMerge_SameRootSamePar.svg"
  23989. // type="image/svg+xml"/></p>
  23990. //
  23991. // <p>Same stack top, parents differ; merge parents giving array node, then
  23992. // remainders of those graphs. A new root node is created to point to the
  23993. // merged parents.<br>
  23994. // <embed src="images/SingletonMerge_SameRootDiffPar.svg"
  23995. // type="image/svg+xml"/></p>
  23996. //
  23997. // <p>Different stack tops pointing to same parent. Make array node for the
  23998. // root where both element in the root point to the same (original)
  23999. // parent.<br>
  24000. // <embed src="images/SingletonMerge_DiffRootSamePar.svg"
  24001. // type="image/svg+xml"/></p>
  24002. //
  24003. // <p>Different stack tops pointing to different parents. Make array node for
  24004. // the root where each element points to the corresponding original
  24005. // parent.<br>
  24006. // <embed src="images/SingletonMerge_DiffRootDiffPar.svg"
  24007. // type="image/svg+xml"/></p>
  24008. //
  24009. // @param a the first {@link SingletonPredictionContext}
  24010. // @param b the second {@link SingletonPredictionContext}
  24011. // @param rootIsWildcard {@code true} if this is a local-context merge,
  24012. // otherwise false to indicate a full-context merge
  24013. // @param mergeCache
  24014. // /
  24015. function mergeSingletons(a, b, rootIsWildcard, mergeCache) {
  24016. if (mergeCache !== null) {
  24017. var previous = mergeCache.get(a, b);
  24018. if (previous !== null) {
  24019. return previous;
  24020. }
  24021. previous = mergeCache.get(b, a);
  24022. if (previous !== null) {
  24023. return previous;
  24024. }
  24025. }
  24026. var rootMerge = mergeRoot(a, b, rootIsWildcard);
  24027. if (rootMerge !== null) {
  24028. if (mergeCache !== null) {
  24029. mergeCache.set(a, b, rootMerge);
  24030. }
  24031. return rootMerge;
  24032. }
  24033. if (a.returnState === b.returnState) {
  24034. var parent = merge(a.parentCtx, b.parentCtx, rootIsWildcard, mergeCache);
  24035. // if parent is same as existing a or b parent or reduced to a parent,
  24036. // return it
  24037. if (parent === a.parentCtx) {
  24038. return a; // ax + bx = ax, if a=b
  24039. }
  24040. if (parent === b.parentCtx) {
  24041. return b; // ax + bx = bx, if a=b
  24042. }
  24043. // else: ax + ay = a'[x,y]
  24044. // merge parents x and y, giving array node with x,y then remainders
  24045. // of those graphs. dup a, a' points at merged array
  24046. // new joined parent so create new singleton pointing to it, a'
  24047. var spc = SingletonPredictionContext.create(parent, a.returnState);
  24048. if (mergeCache !== null) {
  24049. mergeCache.set(a, b, spc);
  24050. }
  24051. return spc;
  24052. } else {
  24053. // a != b payloads differ
  24054. // see if we can collapse parents due to $+x parents if local ctx
  24055. var singleParent = null;
  24056. if (a === b || a.parentCtx !== null && a.parentCtx === b.parentCtx) {
  24057. // ax +
  24058. // bx =
  24059. // [a,b]x
  24060. singleParent = a.parentCtx;
  24061. }
  24062. if (singleParent !== null) {
  24063. // parents are same
  24064. // sort payloads and use same parent
  24065. var payloads = [a.returnState, b.returnState];
  24066. if (a.returnState > b.returnState) {
  24067. payloads[0] = b.returnState;
  24068. payloads[1] = a.returnState;
  24069. }
  24070. var parents = [singleParent, singleParent];
  24071. var apc = new ArrayPredictionContext(parents, payloads);
  24072. if (mergeCache !== null) {
  24073. mergeCache.set(a, b, apc);
  24074. }
  24075. return apc;
  24076. }
  24077. // parents differ and can't merge them. Just pack together
  24078. // into array; can't merge.
  24079. // ax + by = [ax,by]
  24080. var payloads = [a.returnState, b.returnState];
  24081. var parents = [a.parentCtx, b.parentCtx];
  24082. if (a.returnState > b.returnState) {
  24083. // sort by payload
  24084. payloads[0] = b.returnState;
  24085. payloads[1] = a.returnState;
  24086. parents = [b.parentCtx, a.parentCtx];
  24087. }
  24088. var a_ = new ArrayPredictionContext(parents, payloads);
  24089. if (mergeCache !== null) {
  24090. mergeCache.set(a, b, a_);
  24091. }
  24092. return a_;
  24093. }
  24094. }
  24095. //
  24096. // Handle case where at least one of {@code a} or {@code b} is
  24097. // {@link //EMPTY}. In the following diagrams, the symbol {@code $} is used
  24098. // to represent {@link //EMPTY}.
  24099. //
  24100. // <h2>Local-Context Merges</h2>
  24101. //
  24102. // <p>These local-context merge operations are used when {@code rootIsWildcard}
  24103. // is true.</p>
  24104. //
  24105. // <p>{@link //EMPTY} is superset of any graph; return {@link //EMPTY}.<br>
  24106. // <embed src="images/LocalMerge_EmptyRoot.svg" type="image/svg+xml"/></p>
  24107. //
  24108. // <p>{@link //EMPTY} and anything is {@code //EMPTY}, so merged parent is
  24109. // {@code //EMPTY}; return left graph.<br>
  24110. // <embed src="images/LocalMerge_EmptyParent.svg" type="image/svg+xml"/></p>
  24111. //
  24112. // <p>Special case of last merge if local context.<br>
  24113. // <embed src="images/LocalMerge_DiffRoots.svg" type="image/svg+xml"/></p>
  24114. //
  24115. // <h2>Full-Context Merges</h2>
  24116. //
  24117. // <p>These full-context merge operations are used when {@code rootIsWildcard}
  24118. // is false.</p>
  24119. //
  24120. // <p><embed src="images/FullMerge_EmptyRoots.svg" type="image/svg+xml"/></p>
  24121. //
  24122. // <p>Must keep all contexts; {@link //EMPTY} in array is a special value (and
  24123. // null parent).<br>
  24124. // <embed src="images/FullMerge_EmptyRoot.svg" type="image/svg+xml"/></p>
  24125. //
  24126. // <p><embed src="images/FullMerge_SameRoot.svg" type="image/svg+xml"/></p>
  24127. //
  24128. // @param a the first {@link SingletonPredictionContext}
  24129. // @param b the second {@link SingletonPredictionContext}
  24130. // @param rootIsWildcard {@code true} if this is a local-context merge,
  24131. // otherwise false to indicate a full-context merge
  24132. // /
  24133. function mergeRoot(a, b, rootIsWildcard) {
  24134. if (rootIsWildcard) {
  24135. if (a === PredictionContext.EMPTY) {
  24136. return PredictionContext.EMPTY; // // + b =//
  24137. }
  24138. if (b === PredictionContext.EMPTY) {
  24139. return PredictionContext.EMPTY; // a +// =//
  24140. }
  24141. } else {
  24142. if (a === PredictionContext.EMPTY && b === PredictionContext.EMPTY) {
  24143. return PredictionContext.EMPTY; // $ + $ = $
  24144. } else if (a === PredictionContext.EMPTY) {
  24145. // $ + x = [$,x]
  24146. var payloads = [b.returnState, PredictionContext.EMPTY_RETURN_STATE];
  24147. var parents = [b.parentCtx, null];
  24148. return new ArrayPredictionContext(parents, payloads);
  24149. } else if (b === PredictionContext.EMPTY) {
  24150. // x + $ = [$,x] ($ is always first if present)
  24151. var payloads = [a.returnState, PredictionContext.EMPTY_RETURN_STATE];
  24152. var parents = [a.parentCtx, null];
  24153. return new ArrayPredictionContext(parents, payloads);
  24154. }
  24155. }
  24156. return null;
  24157. }
  24158. //
  24159. // Merge two {@link ArrayPredictionContext} instances.
  24160. //
  24161. // <p>Different tops, different parents.<br>
  24162. // <embed src="images/ArrayMerge_DiffTopDiffPar.svg" type="image/svg+xml"/></p>
  24163. //
  24164. // <p>Shared top, same parents.<br>
  24165. // <embed src="images/ArrayMerge_ShareTopSamePar.svg" type="image/svg+xml"/></p>
  24166. //
  24167. // <p>Shared top, different parents.<br>
  24168. // <embed src="images/ArrayMerge_ShareTopDiffPar.svg" type="image/svg+xml"/></p>
  24169. //
  24170. // <p>Shared top, all shared parents.<br>
  24171. // <embed src="images/ArrayMerge_ShareTopSharePar.svg"
  24172. // type="image/svg+xml"/></p>
  24173. //
  24174. // <p>Equal tops, merge parents and reduce top to
  24175. // {@link SingletonPredictionContext}.<br>
  24176. // <embed src="images/ArrayMerge_EqualTop.svg" type="image/svg+xml"/></p>
  24177. // /
  24178. function mergeArrays(a, b, rootIsWildcard, mergeCache) {
  24179. if (mergeCache !== null) {
  24180. var previous = mergeCache.get(a, b);
  24181. if (previous !== null) {
  24182. return previous;
  24183. }
  24184. previous = mergeCache.get(b, a);
  24185. if (previous !== null) {
  24186. return previous;
  24187. }
  24188. }
  24189. // merge sorted payloads a + b => M
  24190. var i = 0; // walks a
  24191. var j = 0; // walks b
  24192. var k = 0; // walks target M array
  24193. var mergedReturnStates = [];
  24194. var mergedParents = [];
  24195. // walk and merge to yield mergedParents, mergedReturnStates
  24196. while (i < a.returnStates.length && j < b.returnStates.length) {
  24197. var a_parent = a.parents[i];
  24198. var b_parent = b.parents[j];
  24199. if (a.returnStates[i] === b.returnStates[j]) {
  24200. // same payload (stack tops are equal), must yield merged singleton
  24201. var payload = a.returnStates[i];
  24202. // $+$ = $
  24203. var bothDollars = payload === PredictionContext.EMPTY_RETURN_STATE && a_parent === null && b_parent === null;
  24204. var ax_ax = a_parent !== null && b_parent !== null && a_parent === b_parent; // ax+ax
  24205. // ->
  24206. // ax
  24207. if (bothDollars || ax_ax) {
  24208. mergedParents[k] = a_parent; // choose left
  24209. mergedReturnStates[k] = payload;
  24210. } else {
  24211. // ax+ay -> a'[x,y]
  24212. var mergedParent = merge(a_parent, b_parent, rootIsWildcard, mergeCache);
  24213. mergedParents[k] = mergedParent;
  24214. mergedReturnStates[k] = payload;
  24215. }
  24216. i += 1; // hop over left one as usual
  24217. j += 1; // but also skip one in right side since we merge
  24218. } else if (a.returnStates[i] < b.returnStates[j]) {
  24219. // copy a[i] to M
  24220. mergedParents[k] = a_parent;
  24221. mergedReturnStates[k] = a.returnStates[i];
  24222. i += 1;
  24223. } else {
  24224. // b > a, copy b[j] to M
  24225. mergedParents[k] = b_parent;
  24226. mergedReturnStates[k] = b.returnStates[j];
  24227. j += 1;
  24228. }
  24229. k += 1;
  24230. }
  24231. // copy over any payloads remaining in either array
  24232. if (i < a.returnStates.length) {
  24233. for (var p = i; p < a.returnStates.length; p++) {
  24234. mergedParents[k] = a.parents[p];
  24235. mergedReturnStates[k] = a.returnStates[p];
  24236. k += 1;
  24237. }
  24238. } else {
  24239. for (var p = j; p < b.returnStates.length; p++) {
  24240. mergedParents[k] = b.parents[p];
  24241. mergedReturnStates[k] = b.returnStates[p];
  24242. k += 1;
  24243. }
  24244. }
  24245. // trim merged if we combined a few that had same stack tops
  24246. if (k < mergedParents.length) {
  24247. // write index < last position; trim
  24248. if (k === 1) {
  24249. // for just one merged element, return singleton top
  24250. var a_ = SingletonPredictionContext.create(mergedParents[0], mergedReturnStates[0]);
  24251. if (mergeCache !== null) {
  24252. mergeCache.set(a, b, a_);
  24253. }
  24254. return a_;
  24255. }
  24256. mergedParents = mergedParents.slice(0, k);
  24257. mergedReturnStates = mergedReturnStates.slice(0, k);
  24258. }
  24259. var M = new ArrayPredictionContext(mergedParents, mergedReturnStates);
  24260. // if we created same array as a or b, return that instead
  24261. // TODO: track whether this is possible above during merge sort for speed
  24262. if (M === a) {
  24263. if (mergeCache !== null) {
  24264. mergeCache.set(a, b, a);
  24265. }
  24266. return a;
  24267. }
  24268. if (M === b) {
  24269. if (mergeCache !== null) {
  24270. mergeCache.set(a, b, b);
  24271. }
  24272. return b;
  24273. }
  24274. combineCommonParents(mergedParents);
  24275. if (mergeCache !== null) {
  24276. mergeCache.set(a, b, M);
  24277. }
  24278. return M;
  24279. }
  24280. //
  24281. // Make pass over all <em>M</em> {@code parents}; merge any {@code equals()}
  24282. // ones.
  24283. // /
  24284. function combineCommonParents(parents) {
  24285. var uniqueParents = {};
  24286. for (var p = 0; p < parents.length; p++) {
  24287. var parent = parents[p];
  24288. if (!(parent in uniqueParents)) {
  24289. uniqueParents[parent] = parent;
  24290. }
  24291. }
  24292. for (var q = 0; q < parents.length; q++) {
  24293. parents[q] = uniqueParents[parents[q]];
  24294. }
  24295. }
  24296. function getCachedPredictionContext(context, contextCache, visited) {
  24297. if (context.isEmpty()) {
  24298. return context;
  24299. }
  24300. var existing = visited[context] || null;
  24301. if (existing !== null) {
  24302. return existing;
  24303. }
  24304. existing = contextCache.get(context);
  24305. if (existing !== null) {
  24306. visited[context] = existing;
  24307. return existing;
  24308. }
  24309. var changed = false;
  24310. var parents = [];
  24311. for (var i = 0; i < parents.length; i++) {
  24312. var parent = getCachedPredictionContext(context.getParent(i), contextCache, visited);
  24313. if (changed || parent !== context.getParent(i)) {
  24314. if (!changed) {
  24315. parents = [];
  24316. for (var j = 0; j < context.length; j++) {
  24317. parents[j] = context.getParent(j);
  24318. }
  24319. changed = true;
  24320. }
  24321. parents[i] = parent;
  24322. }
  24323. }
  24324. if (!changed) {
  24325. contextCache.add(context);
  24326. visited[context] = context;
  24327. return context;
  24328. }
  24329. var updated = null;
  24330. if (parents.length === 0) {
  24331. updated = PredictionContext.EMPTY;
  24332. } else if (parents.length === 1) {
  24333. updated = SingletonPredictionContext.create(parents[0], context.getReturnState(0));
  24334. } else {
  24335. updated = new ArrayPredictionContext(parents, context.returnStates);
  24336. }
  24337. contextCache.add(updated);
  24338. visited[updated] = updated;
  24339. visited[context] = updated;
  24340. return updated;
  24341. }
  24342. // ter's recursive version of Sam's getAllNodes()
  24343. function getAllContextNodes(context, nodes, visited) {
  24344. if (nodes === null) {
  24345. nodes = [];
  24346. return getAllContextNodes(context, nodes, visited);
  24347. } else if (visited === null) {
  24348. visited = {};
  24349. return getAllContextNodes(context, nodes, visited);
  24350. } else {
  24351. if (context === null || visited[context] !== null) {
  24352. return nodes;
  24353. }
  24354. visited[context] = context;
  24355. nodes.push(context);
  24356. for (var i = 0; i < context.length; i++) {
  24357. getAllContextNodes(context.getParent(i), nodes, visited);
  24358. }
  24359. return nodes;
  24360. }
  24361. }
  24362. exports.merge = merge;
  24363. exports.PredictionContext = PredictionContext;
  24364. exports.PredictionContextCache = PredictionContextCache;
  24365. exports.SingletonPredictionContext = SingletonPredictionContext;
  24366. exports.predictionContextFromRuleContext = predictionContextFromRuleContext;
  24367. exports.getCachedPredictionContext = getCachedPredictionContext;
  24368. /***/ }),
  24369. /***/ "./node_modules/antlr4/Recognizer.js":
  24370. /*!*******************************************!*\
  24371. !*** ./node_modules/antlr4/Recognizer.js ***!
  24372. \*******************************************/
  24373. /*! no static exports found */
  24374. /***/ (function(module, exports, __webpack_require__) {
  24375. "use strict";
  24376. //
  24377. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  24378. * Use of this file is governed by the BSD 3-clause license that
  24379. * can be found in the LICENSE.txt file in the project root.
  24380. */
  24381. //
  24382. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  24383. var ConsoleErrorListener = __webpack_require__(/*! ./error/ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ConsoleErrorListener;
  24384. var ProxyErrorListener = __webpack_require__(/*! ./error/ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ProxyErrorListener;
  24385. function Recognizer() {
  24386. this._listeners = [ConsoleErrorListener.INSTANCE];
  24387. this._interp = null;
  24388. this._stateNumber = -1;
  24389. return this;
  24390. }
  24391. Recognizer.tokenTypeMapCache = {};
  24392. Recognizer.ruleIndexMapCache = {};
  24393. Recognizer.prototype.checkVersion = function (toolVersion) {
  24394. var runtimeVersion = "4.7.1";
  24395. if (runtimeVersion !== toolVersion) {
  24396. console.log("ANTLR runtime and generated code versions disagree: " + runtimeVersion + "!=" + toolVersion);
  24397. }
  24398. };
  24399. Recognizer.prototype.addErrorListener = function (listener) {
  24400. this._listeners.push(listener);
  24401. };
  24402. Recognizer.prototype.removeErrorListeners = function () {
  24403. this._listeners = [];
  24404. };
  24405. Recognizer.prototype.getTokenTypeMap = function () {
  24406. var tokenNames = this.getTokenNames();
  24407. if (tokenNames === null) {
  24408. throw "The current recognizer does not provide a list of token names.";
  24409. }
  24410. var result = this.tokenTypeMapCache[tokenNames];
  24411. if (result === undefined) {
  24412. result = tokenNames.reduce(function (o, k, i) {
  24413. o[k] = i;
  24414. });
  24415. result.EOF = Token.EOF;
  24416. this.tokenTypeMapCache[tokenNames] = result;
  24417. }
  24418. return result;
  24419. };
  24420. // Get a map from rule names to rule indexes.
  24421. //
  24422. // <p>Used for XPath and tree pattern compilation.</p>
  24423. //
  24424. Recognizer.prototype.getRuleIndexMap = function () {
  24425. var ruleNames = this.ruleNames;
  24426. if (ruleNames === null) {
  24427. throw "The current recognizer does not provide a list of rule names.";
  24428. }
  24429. var result = this.ruleIndexMapCache[ruleNames];
  24430. if (result === undefined) {
  24431. result = ruleNames.reduce(function (o, k, i) {
  24432. o[k] = i;
  24433. });
  24434. this.ruleIndexMapCache[ruleNames] = result;
  24435. }
  24436. return result;
  24437. };
  24438. Recognizer.prototype.getTokenType = function (tokenName) {
  24439. var ttype = this.getTokenTypeMap()[tokenName];
  24440. if (ttype !== undefined) {
  24441. return ttype;
  24442. } else {
  24443. return Token.INVALID_TYPE;
  24444. }
  24445. };
  24446. // What is the error header, normally line/character position information?//
  24447. Recognizer.prototype.getErrorHeader = function (e) {
  24448. var line = e.getOffendingToken().line;
  24449. var column = e.getOffendingToken().column;
  24450. return "line " + line + ":" + column;
  24451. };
  24452. // How should a token be displayed in an error message? The default
  24453. // is to display just the text, but during development you might
  24454. // want to have a lot of information spit out. Override in that case
  24455. // to use t.toString() (which, for CommonToken, dumps everything about
  24456. // the token). This is better than forcing you to override a method in
  24457. // your token objects because you don't have to go modify your lexer
  24458. // so that it creates a new Java type.
  24459. //
  24460. // @deprecated This method is not called by the ANTLR 4 Runtime. Specific
  24461. // implementations of {@link ANTLRErrorStrategy} may provide a similar
  24462. // feature when necessary. For example, see
  24463. // {@link DefaultErrorStrategy//getTokenErrorDisplay}.
  24464. //
  24465. Recognizer.prototype.getTokenErrorDisplay = function (t) {
  24466. if (t === null) {
  24467. return "<no token>";
  24468. }
  24469. var s = t.text;
  24470. if (s === null) {
  24471. if (t.type === Token.EOF) {
  24472. s = "<EOF>";
  24473. } else {
  24474. s = "<" + t.type + ">";
  24475. }
  24476. }
  24477. s = s.replace("\n", "\\n").replace("\r", "\\r").replace("\t", "\\t");
  24478. return "'" + s + "'";
  24479. };
  24480. Recognizer.prototype.getErrorListenerDispatch = function () {
  24481. return new ProxyErrorListener(this._listeners);
  24482. };
  24483. // subclass needs to override these if there are sempreds or actions
  24484. // that the ATN interp needs to execute
  24485. Recognizer.prototype.sempred = function (localctx, ruleIndex, actionIndex) {
  24486. return true;
  24487. };
  24488. Recognizer.prototype.precpred = function (localctx, precedence) {
  24489. return true;
  24490. };
  24491. //Indicate that the recognizer has changed internal state that is
  24492. //consistent with the ATN state passed in. This way we always know
  24493. //where we are in the ATN as the parser goes along. The rule
  24494. //context objects form a stack that lets us see the stack of
  24495. //invoking rules. Combine this and we have complete ATN
  24496. //configuration information.
  24497. Object.defineProperty(Recognizer.prototype, "state", {
  24498. get: function get() {
  24499. return this._stateNumber;
  24500. },
  24501. set: function set(state) {
  24502. this._stateNumber = state;
  24503. }
  24504. });
  24505. exports.Recognizer = Recognizer;
  24506. /***/ }),
  24507. /***/ "./node_modules/antlr4/RuleContext.js":
  24508. /*!********************************************!*\
  24509. !*** ./node_modules/antlr4/RuleContext.js ***!
  24510. \********************************************/
  24511. /*! no static exports found */
  24512. /***/ (function(module, exports, __webpack_require__) {
  24513. "use strict";
  24514. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  24515. * Use of this file is governed by the BSD 3-clause license that
  24516. * can be found in the LICENSE.txt file in the project root.
  24517. */
  24518. ///
  24519. // A rule context is a record of a single rule invocation. It knows
  24520. // which context invoked it, if any. If there is no parent context, then
  24521. // naturally the invoking state is not valid. The parent link
  24522. // provides a chain upwards from the current rule invocation to the root
  24523. // of the invocation tree, forming a stack. We actually carry no
  24524. // information about the rule associated with this context (except
  24525. // when parsing). We keep only the state number of the invoking state from
  24526. // the ATN submachine that invoked this. Contrast this with the s
  24527. // pointer inside ParserRuleContext that tracks the current state
  24528. // being "executed" for the current rule.
  24529. //
  24530. // The parent contexts are useful for computing lookahead sets and
  24531. // getting error information.
  24532. //
  24533. // These objects are used during parsing and prediction.
  24534. // For the special case of parsers, we use the subclass
  24535. // ParserRuleContext.
  24536. //
  24537. // @see ParserRuleContext
  24538. ///
  24539. var RuleNode = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").RuleNode;
  24540. var INVALID_INTERVAL = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").INVALID_INTERVAL;
  24541. var INVALID_ALT_NUMBER = __webpack_require__(/*! ./atn/ATN */ "./node_modules/antlr4/atn/ATN.js").INVALID_ALT_NUMBER;
  24542. function RuleContext(parent, invokingState) {
  24543. RuleNode.call(this);
  24544. // What context invoked this rule?
  24545. this.parentCtx = parent || null;
  24546. // What state invoked the rule associated with this context?
  24547. // The "return address" is the followState of invokingState
  24548. // If parent is null, this should be -1.
  24549. this.invokingState = invokingState || -1;
  24550. return this;
  24551. }
  24552. RuleContext.prototype = Object.create(RuleNode.prototype);
  24553. RuleContext.prototype.constructor = RuleContext;
  24554. RuleContext.prototype.depth = function () {
  24555. var n = 0;
  24556. var p = this;
  24557. while (p !== null) {
  24558. p = p.parentCtx;
  24559. n += 1;
  24560. }
  24561. return n;
  24562. };
  24563. // A context is empty if there is no invoking state; meaning nobody call
  24564. // current context.
  24565. RuleContext.prototype.isEmpty = function () {
  24566. return this.invokingState === -1;
  24567. };
  24568. // satisfy the ParseTree / SyntaxTree interface
  24569. RuleContext.prototype.getSourceInterval = function () {
  24570. return INVALID_INTERVAL;
  24571. };
  24572. RuleContext.prototype.getRuleContext = function () {
  24573. return this;
  24574. };
  24575. RuleContext.prototype.getPayload = function () {
  24576. return this;
  24577. };
  24578. // Return the combined text of all child nodes. This method only considers
  24579. // tokens which have been added to the parse tree.
  24580. // <p>
  24581. // Since tokens on hidden channels (e.g. whitespace or comments) are not
  24582. // added to the parse trees, they will not appear in the output of this
  24583. // method.
  24584. // /
  24585. RuleContext.prototype.getText = function () {
  24586. if (this.getChildCount() === 0) {
  24587. return "";
  24588. } else {
  24589. return this.children.map(function (child) {
  24590. return child.getText();
  24591. }).join("");
  24592. }
  24593. };
  24594. // For rule associated with this parse tree internal node, return
  24595. // the outer alternative number used to match the input. Default
  24596. // implementation does not compute nor store this alt num. Create
  24597. // a subclass of ParserRuleContext with backing field and set
  24598. // option contextSuperClass.
  24599. // to set it.
  24600. RuleContext.prototype.getAltNumber = function () {
  24601. return INVALID_ALT_NUMBER;
  24602. };
  24603. // Set the outer alternative number for this context node. Default
  24604. // implementation does nothing to avoid backing field overhead for
  24605. // trees that don't need it. Create
  24606. // a subclass of ParserRuleContext with backing field and set
  24607. // option contextSuperClass.
  24608. RuleContext.prototype.setAltNumber = function (altNumber) {};
  24609. RuleContext.prototype.getChild = function (i) {
  24610. return null;
  24611. };
  24612. RuleContext.prototype.getChildCount = function () {
  24613. return 0;
  24614. };
  24615. RuleContext.prototype.accept = function (visitor) {
  24616. return visitor.visitChildren(this);
  24617. };
  24618. //need to manage circular dependencies, so export now
  24619. exports.RuleContext = RuleContext;
  24620. var Trees = __webpack_require__(/*! ./tree/Trees */ "./node_modules/antlr4/tree/Trees.js").Trees;
  24621. // Print out a whole tree, not just a node, in LISP format
  24622. // (root child1 .. childN). Print just a node if this is a leaf.
  24623. //
  24624. RuleContext.prototype.toStringTree = function (ruleNames, recog) {
  24625. return Trees.toStringTree(this, ruleNames, recog);
  24626. };
  24627. RuleContext.prototype.toString = function (ruleNames, stop) {
  24628. ruleNames = ruleNames || null;
  24629. stop = stop || null;
  24630. var p = this;
  24631. var s = "[";
  24632. while (p !== null && p !== stop) {
  24633. if (ruleNames === null) {
  24634. if (!p.isEmpty()) {
  24635. s += p.invokingState;
  24636. }
  24637. } else {
  24638. var ri = p.ruleIndex;
  24639. var ruleName = ri >= 0 && ri < ruleNames.length ? ruleNames[ri] : "" + ri;
  24640. s += ruleName;
  24641. }
  24642. if (p.parentCtx !== null && (ruleNames !== null || !p.parentCtx.isEmpty())) {
  24643. s += " ";
  24644. }
  24645. p = p.parentCtx;
  24646. }
  24647. s += "]";
  24648. return s;
  24649. };
  24650. /***/ }),
  24651. /***/ "./node_modules/antlr4/Token.js":
  24652. /*!**************************************!*\
  24653. !*** ./node_modules/antlr4/Token.js ***!
  24654. \**************************************/
  24655. /*! no static exports found */
  24656. /***/ (function(module, exports, __webpack_require__) {
  24657. "use strict";
  24658. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  24659. * Use of this file is governed by the BSD 3-clause license that
  24660. * can be found in the LICENSE.txt file in the project root.
  24661. */
  24662. //
  24663. // A token has properties: text, type, line, character position in the line
  24664. // (so we can ignore tabs), token channel, index, and source from which
  24665. // we obtained this token.
  24666. function Token() {
  24667. this.source = null;
  24668. this.type = null; // token type of the token
  24669. this.channel = null; // The parser ignores everything not on DEFAULT_CHANNEL
  24670. this.start = null; // optional; return -1 if not implemented.
  24671. this.stop = null; // optional; return -1 if not implemented.
  24672. this.tokenIndex = null; // from 0..n-1 of the token object in the input stream
  24673. this.line = null; // line=1..n of the 1st character
  24674. this.column = null; // beginning of the line at which it occurs, 0..n-1
  24675. this._text = null; // text of the token.
  24676. return this;
  24677. }
  24678. Token.INVALID_TYPE = 0;
  24679. // During lookahead operations, this "token" signifies we hit rule end ATN state
  24680. // and did not follow it despite needing to.
  24681. Token.EPSILON = -2;
  24682. Token.MIN_USER_TOKEN_TYPE = 1;
  24683. Token.EOF = -1;
  24684. // All tokens go to the parser (unless skip() is called in that rule)
  24685. // on a particular "channel". The parser tunes to a particular channel
  24686. // so that whitespace etc... can go to the parser on a "hidden" channel.
  24687. Token.DEFAULT_CHANNEL = 0;
  24688. // Anything on different channel than DEFAULT_CHANNEL is not parsed
  24689. // by parser.
  24690. Token.HIDDEN_CHANNEL = 1;
  24691. // Explicitly set the text for this token. If {code text} is not
  24692. // {@code null}, then {@link //getText} will return this value rather than
  24693. // extracting the text from the input.
  24694. //
  24695. // @param text The explicit text of the token, or {@code null} if the text
  24696. // should be obtained from the input along with the start and stop indexes
  24697. // of the token.
  24698. Object.defineProperty(Token.prototype, "text", {
  24699. get: function get() {
  24700. return this._text;
  24701. },
  24702. set: function set(text) {
  24703. this._text = text;
  24704. }
  24705. });
  24706. Token.prototype.getTokenSource = function () {
  24707. return this.source[0];
  24708. };
  24709. Token.prototype.getInputStream = function () {
  24710. return this.source[1];
  24711. };
  24712. function CommonToken(source, type, channel, start, stop) {
  24713. Token.call(this);
  24714. this.source = source !== undefined ? source : CommonToken.EMPTY_SOURCE;
  24715. this.type = type !== undefined ? type : null;
  24716. this.channel = channel !== undefined ? channel : Token.DEFAULT_CHANNEL;
  24717. this.start = start !== undefined ? start : -1;
  24718. this.stop = stop !== undefined ? stop : -1;
  24719. this.tokenIndex = -1;
  24720. if (this.source[0] !== null) {
  24721. this.line = source[0].line;
  24722. this.column = source[0].column;
  24723. } else {
  24724. this.column = -1;
  24725. }
  24726. return this;
  24727. }
  24728. CommonToken.prototype = Object.create(Token.prototype);
  24729. CommonToken.prototype.constructor = CommonToken;
  24730. // An empty {@link Pair} which is used as the default value of
  24731. // {@link //source} for tokens that do not have a source.
  24732. CommonToken.EMPTY_SOURCE = [null, null];
  24733. // Constructs a new {@link CommonToken} as a copy of another {@link Token}.
  24734. //
  24735. // <p>
  24736. // If {@code oldToken} is also a {@link CommonToken} instance, the newly
  24737. // constructed token will share a reference to the {@link //text} field and
  24738. // the {@link Pair} stored in {@link //source}. Otherwise, {@link //text} will
  24739. // be assigned the result of calling {@link //getText}, and {@link //source}
  24740. // will be constructed from the result of {@link Token//getTokenSource} and
  24741. // {@link Token//getInputStream}.</p>
  24742. //
  24743. // @param oldToken The token to copy.
  24744. //
  24745. CommonToken.prototype.clone = function () {
  24746. var t = new CommonToken(this.source, this.type, this.channel, this.start, this.stop);
  24747. t.tokenIndex = this.tokenIndex;
  24748. t.line = this.line;
  24749. t.column = this.column;
  24750. t.text = this.text;
  24751. return t;
  24752. };
  24753. Object.defineProperty(CommonToken.prototype, "text", {
  24754. get: function get() {
  24755. if (this._text !== null) {
  24756. return this._text;
  24757. }
  24758. var input = this.getInputStream();
  24759. if (input === null) {
  24760. return null;
  24761. }
  24762. var n = input.size;
  24763. if (this.start < n && this.stop < n) {
  24764. return input.getText(this.start, this.stop);
  24765. } else {
  24766. return "<EOF>";
  24767. }
  24768. },
  24769. set: function set(text) {
  24770. this._text = text;
  24771. }
  24772. });
  24773. CommonToken.prototype.toString = function () {
  24774. var txt = this.text;
  24775. if (txt !== null) {
  24776. txt = txt.replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\t/g, "\\t");
  24777. } else {
  24778. txt = "<no text>";
  24779. }
  24780. return "[@" + this.tokenIndex + "," + this.start + ":" + this.stop + "='" + txt + "',<" + this.type + ">" + (this.channel > 0 ? ",channel=" + this.channel : "") + "," + this.line + ":" + this.column + "]";
  24781. };
  24782. exports.Token = Token;
  24783. exports.CommonToken = CommonToken;
  24784. /***/ }),
  24785. /***/ "./node_modules/antlr4/Utils.js":
  24786. /*!**************************************!*\
  24787. !*** ./node_modules/antlr4/Utils.js ***!
  24788. \**************************************/
  24789. /*! no static exports found */
  24790. /***/ (function(module, exports, __webpack_require__) {
  24791. "use strict";
  24792. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  24793. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  24794. * Use of this file is governed by the BSD 3-clause license that
  24795. * can be found in the LICENSE.txt file in the project root.
  24796. */
  24797. function arrayToString(a) {
  24798. return "[" + a.join(", ") + "]";
  24799. }
  24800. String.prototype.seed = String.prototype.seed || Math.round(Math.random() * Math.pow(2, 32));
  24801. String.prototype.hashCode = function () {
  24802. var remainder,
  24803. bytes,
  24804. h1,
  24805. h1b,
  24806. c1,
  24807. c1b,
  24808. c2,
  24809. c2b,
  24810. k1,
  24811. i,
  24812. key = this.toString();
  24813. remainder = key.length & 3; // key.length % 4
  24814. bytes = key.length - remainder;
  24815. h1 = String.prototype.seed;
  24816. c1 = 0xcc9e2d51;
  24817. c2 = 0x1b873593;
  24818. i = 0;
  24819. while (i < bytes) {
  24820. k1 = key.charCodeAt(i) & 0xff | (key.charCodeAt(++i) & 0xff) << 8 | (key.charCodeAt(++i) & 0xff) << 16 | (key.charCodeAt(++i) & 0xff) << 24;
  24821. ++i;
  24822. k1 = (k1 & 0xffff) * c1 + (((k1 >>> 16) * c1 & 0xffff) << 16) & 0xffffffff;
  24823. k1 = k1 << 15 | k1 >>> 17;
  24824. k1 = (k1 & 0xffff) * c2 + (((k1 >>> 16) * c2 & 0xffff) << 16) & 0xffffffff;
  24825. h1 ^= k1;
  24826. h1 = h1 << 13 | h1 >>> 19;
  24827. h1b = (h1 & 0xffff) * 5 + (((h1 >>> 16) * 5 & 0xffff) << 16) & 0xffffffff;
  24828. h1 = (h1b & 0xffff) + 0x6b64 + (((h1b >>> 16) + 0xe654 & 0xffff) << 16);
  24829. }
  24830. k1 = 0;
  24831. switch (remainder) {
  24832. case 3:
  24833. k1 ^= (key.charCodeAt(i + 2) & 0xff) << 16;
  24834. case 2:
  24835. k1 ^= (key.charCodeAt(i + 1) & 0xff) << 8;
  24836. case 1:
  24837. k1 ^= key.charCodeAt(i) & 0xff;
  24838. k1 = (k1 & 0xffff) * c1 + (((k1 >>> 16) * c1 & 0xffff) << 16) & 0xffffffff;
  24839. k1 = k1 << 15 | k1 >>> 17;
  24840. k1 = (k1 & 0xffff) * c2 + (((k1 >>> 16) * c2 & 0xffff) << 16) & 0xffffffff;
  24841. h1 ^= k1;
  24842. }
  24843. h1 ^= key.length;
  24844. h1 ^= h1 >>> 16;
  24845. h1 = (h1 & 0xffff) * 0x85ebca6b + (((h1 >>> 16) * 0x85ebca6b & 0xffff) << 16) & 0xffffffff;
  24846. h1 ^= h1 >>> 13;
  24847. h1 = (h1 & 0xffff) * 0xc2b2ae35 + (((h1 >>> 16) * 0xc2b2ae35 & 0xffff) << 16) & 0xffffffff;
  24848. h1 ^= h1 >>> 16;
  24849. return h1 >>> 0;
  24850. };
  24851. function standardEqualsFunction(a, b) {
  24852. return a.equals(b);
  24853. }
  24854. function standardHashCodeFunction(a) {
  24855. return a.hashCode();
  24856. }
  24857. function Set(hashFunction, equalsFunction) {
  24858. this.data = {};
  24859. this.hashFunction = hashFunction || standardHashCodeFunction;
  24860. this.equalsFunction = equalsFunction || standardEqualsFunction;
  24861. return this;
  24862. }
  24863. Object.defineProperty(Set.prototype, "length", {
  24864. get: function get() {
  24865. var l = 0;
  24866. for (var key in this.data) {
  24867. if (key.indexOf("hash_") === 0) {
  24868. l = l + this.data[key].length;
  24869. }
  24870. }
  24871. return l;
  24872. }
  24873. });
  24874. Set.prototype.add = function (value) {
  24875. var hash = this.hashFunction(value);
  24876. var key = "hash_" + hash;
  24877. if (key in this.data) {
  24878. var values = this.data[key];
  24879. for (var i = 0; i < values.length; i++) {
  24880. if (this.equalsFunction(value, values[i])) {
  24881. return values[i];
  24882. }
  24883. }
  24884. values.push(value);
  24885. return value;
  24886. } else {
  24887. this.data[key] = [value];
  24888. return value;
  24889. }
  24890. };
  24891. Set.prototype.contains = function (value) {
  24892. return this.get(value) != null;
  24893. };
  24894. Set.prototype.get = function (value) {
  24895. var hash = this.hashFunction(value);
  24896. var key = "hash_" + hash;
  24897. if (key in this.data) {
  24898. var values = this.data[key];
  24899. for (var i = 0; i < values.length; i++) {
  24900. if (this.equalsFunction(value, values[i])) {
  24901. return values[i];
  24902. }
  24903. }
  24904. }
  24905. return null;
  24906. };
  24907. Set.prototype.values = function () {
  24908. var l = [];
  24909. for (var key in this.data) {
  24910. if (key.indexOf("hash_") === 0) {
  24911. l = l.concat(this.data[key]);
  24912. }
  24913. }
  24914. return l;
  24915. };
  24916. Set.prototype.toString = function () {
  24917. return arrayToString(this.values());
  24918. };
  24919. function BitSet() {
  24920. this.data = [];
  24921. return this;
  24922. }
  24923. BitSet.prototype.add = function (value) {
  24924. this.data[value] = true;
  24925. };
  24926. BitSet.prototype.or = function (set) {
  24927. var bits = this;
  24928. Object.keys(set.data).map(function (alt) {
  24929. bits.add(alt);
  24930. });
  24931. };
  24932. BitSet.prototype.remove = function (value) {
  24933. delete this.data[value];
  24934. };
  24935. BitSet.prototype.contains = function (value) {
  24936. return this.data[value] === true;
  24937. };
  24938. BitSet.prototype.values = function () {
  24939. return Object.keys(this.data);
  24940. };
  24941. BitSet.prototype.minValue = function () {
  24942. return Math.min.apply(null, this.values());
  24943. };
  24944. BitSet.prototype.hashCode = function () {
  24945. var hash = new Hash();
  24946. hash.update(this.values());
  24947. return hash.finish();
  24948. };
  24949. BitSet.prototype.equals = function (other) {
  24950. if (!(other instanceof BitSet)) {
  24951. return false;
  24952. }
  24953. return this.hashCode() === other.hashCode();
  24954. };
  24955. Object.defineProperty(BitSet.prototype, "length", {
  24956. get: function get() {
  24957. return this.values().length;
  24958. }
  24959. });
  24960. BitSet.prototype.toString = function () {
  24961. return "{" + this.values().join(", ") + "}";
  24962. };
  24963. function Map(hashFunction, equalsFunction) {
  24964. this.data = {};
  24965. this.hashFunction = hashFunction || standardHashCodeFunction;
  24966. this.equalsFunction = equalsFunction || standardEqualsFunction;
  24967. return this;
  24968. }
  24969. Object.defineProperty(Map.prototype, "length", {
  24970. get: function get() {
  24971. var l = 0;
  24972. for (var hashKey in this.data) {
  24973. if (hashKey.indexOf("hash_") === 0) {
  24974. l = l + this.data[hashKey].length;
  24975. }
  24976. }
  24977. return l;
  24978. }
  24979. });
  24980. Map.prototype.put = function (key, value) {
  24981. var hashKey = "hash_" + this.hashFunction(key);
  24982. if (hashKey in this.data) {
  24983. var entries = this.data[hashKey];
  24984. for (var i = 0; i < entries.length; i++) {
  24985. var entry = entries[i];
  24986. if (this.equalsFunction(key, entry.key)) {
  24987. var oldValue = entry.value;
  24988. entry.value = value;
  24989. return oldValue;
  24990. }
  24991. }
  24992. entries.push({ key: key, value: value });
  24993. return value;
  24994. } else {
  24995. this.data[hashKey] = [{ key: key, value: value }];
  24996. return value;
  24997. }
  24998. };
  24999. Map.prototype.containsKey = function (key) {
  25000. var hashKey = "hash_" + this.hashFunction(key);
  25001. if (hashKey in this.data) {
  25002. var entries = this.data[hashKey];
  25003. for (var i = 0; i < entries.length; i++) {
  25004. var entry = entries[i];
  25005. if (this.equalsFunction(key, entry.key)) return true;
  25006. }
  25007. }
  25008. return false;
  25009. };
  25010. Map.prototype.get = function (key) {
  25011. var hashKey = "hash_" + this.hashFunction(key);
  25012. if (hashKey in this.data) {
  25013. var entries = this.data[hashKey];
  25014. for (var i = 0; i < entries.length; i++) {
  25015. var entry = entries[i];
  25016. if (this.equalsFunction(key, entry.key)) return entry.value;
  25017. }
  25018. }
  25019. return null;
  25020. };
  25021. Map.prototype.entries = function () {
  25022. var l = [];
  25023. for (var key in this.data) {
  25024. if (key.indexOf("hash_") === 0) {
  25025. l = l.concat(this.data[key]);
  25026. }
  25027. }
  25028. return l;
  25029. };
  25030. Map.prototype.getKeys = function () {
  25031. return this.entries().map(function (e) {
  25032. return e.key;
  25033. });
  25034. };
  25035. Map.prototype.getValues = function () {
  25036. return this.entries().map(function (e) {
  25037. return e.value;
  25038. });
  25039. };
  25040. Map.prototype.toString = function () {
  25041. var ss = this.entries().map(function (entry) {
  25042. return '{' + entry.key + ':' + entry.value + '}';
  25043. });
  25044. return '[' + ss.join(", ") + ']';
  25045. };
  25046. function AltDict() {
  25047. this.data = {};
  25048. return this;
  25049. }
  25050. AltDict.prototype.get = function (key) {
  25051. key = "k-" + key;
  25052. if (key in this.data) {
  25053. return this.data[key];
  25054. } else {
  25055. return null;
  25056. }
  25057. };
  25058. AltDict.prototype.put = function (key, value) {
  25059. key = "k-" + key;
  25060. this.data[key] = value;
  25061. };
  25062. AltDict.prototype.values = function () {
  25063. var data = this.data;
  25064. var keys = Object.keys(this.data);
  25065. return keys.map(function (key) {
  25066. return data[key];
  25067. });
  25068. };
  25069. function DoubleDict() {
  25070. return this;
  25071. }
  25072. function Hash() {
  25073. this.count = 0;
  25074. this.hash = 0;
  25075. return this;
  25076. }
  25077. Hash.prototype.update = function () {
  25078. for (var i = 0; i < arguments.length; i++) {
  25079. var value = arguments[i];
  25080. if (value == null) continue;
  25081. if (Array.isArray(value)) this.update.apply(value);else {
  25082. var k = 0;
  25083. switch (typeof value === "undefined" ? "undefined" : _typeof(value)) {
  25084. case 'undefined':
  25085. case 'function':
  25086. continue;
  25087. case 'number':
  25088. case 'boolean':
  25089. k = value;
  25090. break;
  25091. case 'string':
  25092. k = value.hashCode();
  25093. break;
  25094. default:
  25095. value.updateHashCode(this);
  25096. continue;
  25097. }
  25098. k = k * 0xCC9E2D51;
  25099. k = k << 15 | k >>> 32 - 15;
  25100. k = k * 0x1B873593;
  25101. this.count = this.count + 1;
  25102. var hash = this.hash ^ k;
  25103. hash = hash << 13 | hash >>> 32 - 13;
  25104. hash = hash * 5 + 0xE6546B64;
  25105. this.hash = hash;
  25106. }
  25107. }
  25108. };
  25109. Hash.prototype.finish = function () {
  25110. var hash = this.hash ^ this.count * 4;
  25111. hash = hash ^ hash >>> 16;
  25112. hash = hash * 0x85EBCA6B;
  25113. hash = hash ^ hash >>> 13;
  25114. hash = hash * 0xC2B2AE35;
  25115. hash = hash ^ hash >>> 16;
  25116. return hash;
  25117. };
  25118. function hashStuff() {
  25119. var hash = new Hash();
  25120. hash.update.apply(arguments);
  25121. return hash.finish();
  25122. }
  25123. DoubleDict.prototype.get = function (a, b) {
  25124. var d = this[a] || null;
  25125. return d === null ? null : d[b] || null;
  25126. };
  25127. DoubleDict.prototype.set = function (a, b, o) {
  25128. var d = this[a] || null;
  25129. if (d === null) {
  25130. d = {};
  25131. this[a] = d;
  25132. }
  25133. d[b] = o;
  25134. };
  25135. function escapeWhitespace(s, escapeSpaces) {
  25136. s = s.replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\r/g, "\\r");
  25137. if (escapeSpaces) {
  25138. s = s.replace(/ /g, "\xB7");
  25139. }
  25140. return s;
  25141. }
  25142. function titleCase(str) {
  25143. return str.replace(/\w\S*/g, function (txt) {
  25144. return txt.charAt(0).toUpperCase() + txt.substr(1);
  25145. });
  25146. };
  25147. function equalArrays(a, b) {
  25148. if (!Array.isArray(a) || !Array.isArray(b)) return false;
  25149. if (a == b) return true;
  25150. if (a.length != b.length) return false;
  25151. for (var i = 0; i < a.length; i++) {
  25152. if (a[i] == b[i]) continue;
  25153. if (!a[i].equals(b[i])) return false;
  25154. }
  25155. return true;
  25156. };
  25157. exports.Hash = Hash;
  25158. exports.Set = Set;
  25159. exports.Map = Map;
  25160. exports.BitSet = BitSet;
  25161. exports.AltDict = AltDict;
  25162. exports.DoubleDict = DoubleDict;
  25163. exports.hashStuff = hashStuff;
  25164. exports.escapeWhitespace = escapeWhitespace;
  25165. exports.arrayToString = arrayToString;
  25166. exports.titleCase = titleCase;
  25167. exports.equalArrays = equalArrays;
  25168. /***/ }),
  25169. /***/ "./node_modules/antlr4/atn/ATN.js":
  25170. /*!****************************************!*\
  25171. !*** ./node_modules/antlr4/atn/ATN.js ***!
  25172. \****************************************/
  25173. /*! no static exports found */
  25174. /***/ (function(module, exports, __webpack_require__) {
  25175. "use strict";
  25176. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  25177. * Use of this file is governed by the BSD 3-clause license that
  25178. * can be found in the LICENSE.txt file in the project root.
  25179. */
  25180. var LL1Analyzer = __webpack_require__(/*! ./../LL1Analyzer */ "./node_modules/antlr4/LL1Analyzer.js").LL1Analyzer;
  25181. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  25182. function ATN(grammarType, maxTokenType) {
  25183. // Used for runtime deserialization of ATNs from strings///
  25184. // The type of the ATN.
  25185. this.grammarType = grammarType;
  25186. // The maximum value for any symbol recognized by a transition in the ATN.
  25187. this.maxTokenType = maxTokenType;
  25188. this.states = [];
  25189. // Each subrule/rule is a decision point and we must track them so we
  25190. // can go back later and build DFA predictors for them. This includes
  25191. // all the rules, subrules, optional blocks, ()+, ()* etc...
  25192. this.decisionToState = [];
  25193. // Maps from rule index to starting state number.
  25194. this.ruleToStartState = [];
  25195. // Maps from rule index to stop state number.
  25196. this.ruleToStopState = null;
  25197. this.modeNameToStartState = {};
  25198. // For lexer ATNs, this maps the rule index to the resulting token type.
  25199. // For parser ATNs, this maps the rule index to the generated bypass token
  25200. // type if the
  25201. // {@link ATNDeserializationOptions//isGenerateRuleBypassTransitions}
  25202. // deserialization option was specified; otherwise, this is {@code null}.
  25203. this.ruleToTokenType = null;
  25204. // For lexer ATNs, this is an array of {@link LexerAction} objects which may
  25205. // be referenced by action transitions in the ATN.
  25206. this.lexerActions = null;
  25207. this.modeToStartState = [];
  25208. return this;
  25209. }
  25210. // Compute the set of valid tokens that can occur starting in state {@code s}.
  25211. // If {@code ctx} is null, the set of tokens will not include what can follow
  25212. // the rule surrounding {@code s}. In other words, the set will be
  25213. // restricted to tokens reachable staying within {@code s}'s rule.
  25214. ATN.prototype.nextTokensInContext = function (s, ctx) {
  25215. var anal = new LL1Analyzer(this);
  25216. return anal.LOOK(s, null, ctx);
  25217. };
  25218. // Compute the set of valid tokens that can occur starting in {@code s} and
  25219. // staying in same rule. {@link Token//EPSILON} is in set if we reach end of
  25220. // rule.
  25221. ATN.prototype.nextTokensNoContext = function (s) {
  25222. if (s.nextTokenWithinRule !== null) {
  25223. return s.nextTokenWithinRule;
  25224. }
  25225. s.nextTokenWithinRule = this.nextTokensInContext(s, null);
  25226. s.nextTokenWithinRule.readOnly = true;
  25227. return s.nextTokenWithinRule;
  25228. };
  25229. ATN.prototype.nextTokens = function (s, ctx) {
  25230. if (ctx === undefined) {
  25231. return this.nextTokensNoContext(s);
  25232. } else {
  25233. return this.nextTokensInContext(s, ctx);
  25234. }
  25235. };
  25236. ATN.prototype.addState = function (state) {
  25237. if (state !== null) {
  25238. state.atn = this;
  25239. state.stateNumber = this.states.length;
  25240. }
  25241. this.states.push(state);
  25242. };
  25243. ATN.prototype.removeState = function (state) {
  25244. this.states[state.stateNumber] = null; // just free mem, don't shift states in list
  25245. };
  25246. ATN.prototype.defineDecisionState = function (s) {
  25247. this.decisionToState.push(s);
  25248. s.decision = this.decisionToState.length - 1;
  25249. return s.decision;
  25250. };
  25251. ATN.prototype.getDecisionState = function (decision) {
  25252. if (this.decisionToState.length === 0) {
  25253. return null;
  25254. } else {
  25255. return this.decisionToState[decision];
  25256. }
  25257. };
  25258. // Computes the set of input symbols which could follow ATN state number
  25259. // {@code stateNumber} in the specified full {@code context}. This method
  25260. // considers the complete parser context, but does not evaluate semantic
  25261. // predicates (i.e. all predicates encountered during the calculation are
  25262. // assumed true). If a path in the ATN exists from the starting state to the
  25263. // {@link RuleStopState} of the outermost context without matching any
  25264. // symbols, {@link Token//EOF} is added to the returned set.
  25265. //
  25266. // <p>If {@code context} is {@code null}, it is treated as
  25267. // {@link ParserRuleContext//EMPTY}.</p>
  25268. //
  25269. // @param stateNumber the ATN state number
  25270. // @param context the full parse context
  25271. // @return The set of potentially valid input symbols which could follow the
  25272. // specified state in the specified context.
  25273. // @throws IllegalArgumentException if the ATN does not contain a state with
  25274. // number {@code stateNumber}
  25275. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  25276. ATN.prototype.getExpectedTokens = function (stateNumber, ctx) {
  25277. if (stateNumber < 0 || stateNumber >= this.states.length) {
  25278. throw "Invalid state number.";
  25279. }
  25280. var s = this.states[stateNumber];
  25281. var following = this.nextTokens(s);
  25282. if (!following.contains(Token.EPSILON)) {
  25283. return following;
  25284. }
  25285. var expected = new IntervalSet();
  25286. expected.addSet(following);
  25287. expected.removeOne(Token.EPSILON);
  25288. while (ctx !== null && ctx.invokingState >= 0 && following.contains(Token.EPSILON)) {
  25289. var invokingState = this.states[ctx.invokingState];
  25290. var rt = invokingState.transitions[0];
  25291. following = this.nextTokens(rt.followState);
  25292. expected.addSet(following);
  25293. expected.removeOne(Token.EPSILON);
  25294. ctx = ctx.parentCtx;
  25295. }
  25296. if (following.contains(Token.EPSILON)) {
  25297. expected.addOne(Token.EOF);
  25298. }
  25299. return expected;
  25300. };
  25301. ATN.INVALID_ALT_NUMBER = 0;
  25302. exports.ATN = ATN;
  25303. /***/ }),
  25304. /***/ "./node_modules/antlr4/atn/ATNConfig.js":
  25305. /*!**********************************************!*\
  25306. !*** ./node_modules/antlr4/atn/ATNConfig.js ***!
  25307. \**********************************************/
  25308. /*! no static exports found */
  25309. /***/ (function(module, exports, __webpack_require__) {
  25310. "use strict";
  25311. //
  25312. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  25313. * Use of this file is governed by the BSD 3-clause license that
  25314. * can be found in the LICENSE.txt file in the project root.
  25315. */
  25316. ///
  25317. // A tuple: (ATN state, predicted alt, syntactic, semantic context).
  25318. // The syntactic context is a graph-structured stack node whose
  25319. // path(s) to the root is the rule invocation(s)
  25320. // chain used to arrive at the state. The semantic context is
  25321. // the tree of semantic predicates encountered before reaching
  25322. // an ATN state.
  25323. ///
  25324. var DecisionState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").DecisionState;
  25325. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  25326. var Hash = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").Hash;
  25327. function checkParams(params, isCfg) {
  25328. if (params === null) {
  25329. var result = { state: null, alt: null, context: null, semanticContext: null };
  25330. if (isCfg) {
  25331. result.reachesIntoOuterContext = 0;
  25332. }
  25333. return result;
  25334. } else {
  25335. var props = {};
  25336. props.state = params.state || null;
  25337. props.alt = params.alt === undefined ? null : params.alt;
  25338. props.context = params.context || null;
  25339. props.semanticContext = params.semanticContext || null;
  25340. if (isCfg) {
  25341. props.reachesIntoOuterContext = params.reachesIntoOuterContext || 0;
  25342. props.precedenceFilterSuppressed = params.precedenceFilterSuppressed || false;
  25343. }
  25344. return props;
  25345. }
  25346. }
  25347. function ATNConfig(params, config) {
  25348. this.checkContext(params, config);
  25349. params = checkParams(params);
  25350. config = checkParams(config, true);
  25351. // The ATN state associated with this configuration///
  25352. this.state = params.state !== null ? params.state : config.state;
  25353. // What alt (or lexer rule) is predicted by this configuration///
  25354. this.alt = params.alt !== null ? params.alt : config.alt;
  25355. // The stack of invoking states leading to the rule/states associated
  25356. // with this config. We track only those contexts pushed during
  25357. // execution of the ATN simulator.
  25358. this.context = params.context !== null ? params.context : config.context;
  25359. this.semanticContext = params.semanticContext !== null ? params.semanticContext : config.semanticContext !== null ? config.semanticContext : SemanticContext.NONE;
  25360. // We cannot execute predicates dependent upon local context unless
  25361. // we know for sure we are in the correct context. Because there is
  25362. // no way to do this efficiently, we simply cannot evaluate
  25363. // dependent predicates unless we are in the rule that initially
  25364. // invokes the ATN simulator.
  25365. //
  25366. // closure() tracks the depth of how far we dip into the
  25367. // outer context: depth &gt; 0. Note that it may not be totally
  25368. // accurate depth since I don't ever decrement. TODO: make it a boolean then
  25369. this.reachesIntoOuterContext = config.reachesIntoOuterContext;
  25370. this.precedenceFilterSuppressed = config.precedenceFilterSuppressed;
  25371. return this;
  25372. }
  25373. ATNConfig.prototype.checkContext = function (params, config) {
  25374. if ((params.context === null || params.context === undefined) && (config === null || config.context === null || config.context === undefined)) {
  25375. this.context = null;
  25376. }
  25377. };
  25378. ATNConfig.prototype.hashCode = function () {
  25379. var hash = new Hash();
  25380. this.updateHashCode(hash);
  25381. return hash.finish();
  25382. };
  25383. ATNConfig.prototype.updateHashCode = function (hash) {
  25384. hash.update(this.state.stateNumber, this.alt, this.context, this.semanticContext);
  25385. };
  25386. // An ATN configuration is equal to another if both have
  25387. // the same state, they predict the same alternative, and
  25388. // syntactic/semantic contexts are the same.
  25389. ATNConfig.prototype.equals = function (other) {
  25390. if (this === other) {
  25391. return true;
  25392. } else if (!(other instanceof ATNConfig)) {
  25393. return false;
  25394. } else {
  25395. return this.state.stateNumber === other.state.stateNumber && this.alt === other.alt && (this.context === null ? other.context === null : this.context.equals(other.context)) && this.semanticContext.equals(other.semanticContext) && this.precedenceFilterSuppressed === other.precedenceFilterSuppressed;
  25396. }
  25397. };
  25398. ATNConfig.prototype.hashCodeForConfigSet = function () {
  25399. var hash = new Hash();
  25400. hash.update(this.state.stateNumber, this.alt, this.semanticContext);
  25401. return hash.finish();
  25402. };
  25403. ATNConfig.prototype.equalsForConfigSet = function (other) {
  25404. if (this === other) {
  25405. return true;
  25406. } else if (!(other instanceof ATNConfig)) {
  25407. return false;
  25408. } else {
  25409. return this.state.stateNumber === other.state.stateNumber && this.alt === other.alt && this.semanticContext.equals(other.semanticContext);
  25410. }
  25411. };
  25412. ATNConfig.prototype.toString = function () {
  25413. return "(" + this.state + "," + this.alt + (this.context !== null ? ",[" + this.context.toString() + "]" : "") + (this.semanticContext !== SemanticContext.NONE ? "," + this.semanticContext.toString() : "") + (this.reachesIntoOuterContext > 0 ? ",up=" + this.reachesIntoOuterContext : "") + ")";
  25414. };
  25415. function LexerATNConfig(params, config) {
  25416. ATNConfig.call(this, params, config);
  25417. // This is the backing field for {@link //getLexerActionExecutor}.
  25418. var lexerActionExecutor = params.lexerActionExecutor || null;
  25419. this.lexerActionExecutor = lexerActionExecutor || (config !== null ? config.lexerActionExecutor : null);
  25420. this.passedThroughNonGreedyDecision = config !== null ? this.checkNonGreedyDecision(config, this.state) : false;
  25421. return this;
  25422. }
  25423. LexerATNConfig.prototype = Object.create(ATNConfig.prototype);
  25424. LexerATNConfig.prototype.constructor = LexerATNConfig;
  25425. LexerATNConfig.prototype.updateHashCode = function (hash) {
  25426. hash.update(this.state.stateNumber, this.alt, this.context, this.semanticContext, this.passedThroughNonGreedyDecision, this.lexerActionExecutor);
  25427. };
  25428. LexerATNConfig.prototype.equals = function (other) {
  25429. return this === other || other instanceof LexerATNConfig && this.passedThroughNonGreedyDecision == other.passedThroughNonGreedyDecision && (this.lexerActionExecutor ? this.lexerActionExecutor.equals(other.lexerActionExecutor) : !other.lexerActionExecutor) && ATNConfig.prototype.equals.call(this, other);
  25430. };
  25431. LexerATNConfig.prototype.hashCodeForConfigSet = LexerATNConfig.prototype.hashCode;
  25432. LexerATNConfig.prototype.equalsForConfigSet = LexerATNConfig.prototype.equals;
  25433. LexerATNConfig.prototype.checkNonGreedyDecision = function (source, target) {
  25434. return source.passedThroughNonGreedyDecision || target instanceof DecisionState && target.nonGreedy;
  25435. };
  25436. exports.ATNConfig = ATNConfig;
  25437. exports.LexerATNConfig = LexerATNConfig;
  25438. /***/ }),
  25439. /***/ "./node_modules/antlr4/atn/ATNConfigSet.js":
  25440. /*!*************************************************!*\
  25441. !*** ./node_modules/antlr4/atn/ATNConfigSet.js ***!
  25442. \*************************************************/
  25443. /*! no static exports found */
  25444. /***/ (function(module, exports, __webpack_require__) {
  25445. "use strict";
  25446. //
  25447. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  25448. * Use of this file is governed by the BSD 3-clause license that
  25449. * can be found in the LICENSE.txt file in the project root.
  25450. */
  25451. //
  25452. // Specialized {@link Set}{@code <}{@link ATNConfig}{@code >} that can track
  25453. // info about the set, with support for combining similar configurations using a
  25454. // graph-structured stack.
  25455. ///
  25456. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  25457. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  25458. var Hash = Utils.Hash;
  25459. var Set = Utils.Set;
  25460. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  25461. var merge = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").merge;
  25462. function hashATNConfig(c) {
  25463. return c.hashCodeForConfigSet();
  25464. }
  25465. function equalATNConfigs(a, b) {
  25466. if (a === b) {
  25467. return true;
  25468. } else if (a === null || b === null) {
  25469. return false;
  25470. } else return a.equalsForConfigSet(b);
  25471. }
  25472. function ATNConfigSet(fullCtx) {
  25473. //
  25474. // The reason that we need this is because we don't want the hash map to use
  25475. // the standard hash code and equals. We need all configurations with the
  25476. // same
  25477. // {@code (s,i,_,semctx)} to be equal. Unfortunately, this key effectively
  25478. // doubles
  25479. // the number of objects associated with ATNConfigs. The other solution is
  25480. // to
  25481. // use a hash table that lets us specify the equals/hashcode operation.
  25482. // All configs but hashed by (s, i, _, pi) not including context. Wiped out
  25483. // when we go readonly as this set becomes a DFA state.
  25484. this.configLookup = new Set(hashATNConfig, equalATNConfigs);
  25485. // Indicates that this configuration set is part of a full context
  25486. // LL prediction. It will be used to determine how to merge $. With SLL
  25487. // it's a wildcard whereas it is not for LL context merge.
  25488. this.fullCtx = fullCtx === undefined ? true : fullCtx;
  25489. // Indicates that the set of configurations is read-only. Do not
  25490. // allow any code to manipulate the set; DFA states will point at
  25491. // the sets and they must not change. This does not protect the other
  25492. // fields; in particular, conflictingAlts is set after
  25493. // we've made this readonly.
  25494. this.readOnly = false;
  25495. // Track the elements as they are added to the set; supports get(i)///
  25496. this.configs = [];
  25497. // TODO: these fields make me pretty uncomfortable but nice to pack up info
  25498. // together, saves recomputation
  25499. // TODO: can we track conflicts as they are added to save scanning configs
  25500. // later?
  25501. this.uniqueAlt = 0;
  25502. this.conflictingAlts = null;
  25503. // Used in parser and lexer. In lexer, it indicates we hit a pred
  25504. // while computing a closure operation. Don't make a DFA state from this.
  25505. this.hasSemanticContext = false;
  25506. this.dipsIntoOuterContext = false;
  25507. this.cachedHashCode = -1;
  25508. return this;
  25509. }
  25510. // Adding a new config means merging contexts with existing configs for
  25511. // {@code (s, i, pi, _)}, where {@code s} is the
  25512. // {@link ATNConfig//state}, {@code i} is the {@link ATNConfig//alt}, and
  25513. // {@code pi} is the {@link ATNConfig//semanticContext}. We use
  25514. // {@code (s,i,pi)} as key.
  25515. //
  25516. // <p>This method updates {@link //dipsIntoOuterContext} and
  25517. // {@link //hasSemanticContext} when necessary.</p>
  25518. // /
  25519. ATNConfigSet.prototype.add = function (config, mergeCache) {
  25520. if (mergeCache === undefined) {
  25521. mergeCache = null;
  25522. }
  25523. if (this.readOnly) {
  25524. throw "This set is readonly";
  25525. }
  25526. if (config.semanticContext !== SemanticContext.NONE) {
  25527. this.hasSemanticContext = true;
  25528. }
  25529. if (config.reachesIntoOuterContext > 0) {
  25530. this.dipsIntoOuterContext = true;
  25531. }
  25532. var existing = this.configLookup.add(config);
  25533. if (existing === config) {
  25534. this.cachedHashCode = -1;
  25535. this.configs.push(config); // track order here
  25536. return true;
  25537. }
  25538. // a previous (s,i,pi,_), merge with it and save result
  25539. var rootIsWildcard = !this.fullCtx;
  25540. var merged = merge(existing.context, config.context, rootIsWildcard, mergeCache);
  25541. // no need to check for existing.context, config.context in cache
  25542. // since only way to create new graphs is "call rule" and here. We
  25543. // cache at both places.
  25544. existing.reachesIntoOuterContext = Math.max(existing.reachesIntoOuterContext, config.reachesIntoOuterContext);
  25545. // make sure to preserve the precedence filter suppression during the merge
  25546. if (config.precedenceFilterSuppressed) {
  25547. existing.precedenceFilterSuppressed = true;
  25548. }
  25549. existing.context = merged; // replace context; no need to alt mapping
  25550. return true;
  25551. };
  25552. ATNConfigSet.prototype.getStates = function () {
  25553. var states = new Set();
  25554. for (var i = 0; i < this.configs.length; i++) {
  25555. states.add(this.configs[i].state);
  25556. }
  25557. return states;
  25558. };
  25559. ATNConfigSet.prototype.getPredicates = function () {
  25560. var preds = [];
  25561. for (var i = 0; i < this.configs.length; i++) {
  25562. var c = this.configs[i].semanticContext;
  25563. if (c !== SemanticContext.NONE) {
  25564. preds.push(c.semanticContext);
  25565. }
  25566. }
  25567. return preds;
  25568. };
  25569. Object.defineProperty(ATNConfigSet.prototype, "items", {
  25570. get: function get() {
  25571. return this.configs;
  25572. }
  25573. });
  25574. ATNConfigSet.prototype.optimizeConfigs = function (interpreter) {
  25575. if (this.readOnly) {
  25576. throw "This set is readonly";
  25577. }
  25578. if (this.configLookup.length === 0) {
  25579. return;
  25580. }
  25581. for (var i = 0; i < this.configs.length; i++) {
  25582. var config = this.configs[i];
  25583. config.context = interpreter.getCachedContext(config.context);
  25584. }
  25585. };
  25586. ATNConfigSet.prototype.addAll = function (coll) {
  25587. for (var i = 0; i < coll.length; i++) {
  25588. this.add(coll[i]);
  25589. }
  25590. return false;
  25591. };
  25592. ATNConfigSet.prototype.equals = function (other) {
  25593. return this === other || other instanceof ATNConfigSet && Utils.equalArrays(this.configs, other.configs) && this.fullCtx === other.fullCtx && this.uniqueAlt === other.uniqueAlt && this.conflictingAlts === other.conflictingAlts && this.hasSemanticContext === other.hasSemanticContext && this.dipsIntoOuterContext === other.dipsIntoOuterContext;
  25594. };
  25595. ATNConfigSet.prototype.hashCode = function () {
  25596. var hash = new Hash();
  25597. this.updateHashCode(hash);
  25598. return hash.finish();
  25599. };
  25600. ATNConfigSet.prototype.updateHashCode = function (hash) {
  25601. if (this.readOnly) {
  25602. if (this.cachedHashCode === -1) {
  25603. var hash = new Hash();
  25604. hash.update(this.configs);
  25605. this.cachedHashCode = hash.finish();
  25606. }
  25607. hash.update(this.cachedHashCode);
  25608. } else {
  25609. hash.update(this.configs);
  25610. }
  25611. };
  25612. Object.defineProperty(ATNConfigSet.prototype, "length", {
  25613. get: function get() {
  25614. return this.configs.length;
  25615. }
  25616. });
  25617. ATNConfigSet.prototype.isEmpty = function () {
  25618. return this.configs.length === 0;
  25619. };
  25620. ATNConfigSet.prototype.contains = function (item) {
  25621. if (this.configLookup === null) {
  25622. throw "This method is not implemented for readonly sets.";
  25623. }
  25624. return this.configLookup.contains(item);
  25625. };
  25626. ATNConfigSet.prototype.containsFast = function (item) {
  25627. if (this.configLookup === null) {
  25628. throw "This method is not implemented for readonly sets.";
  25629. }
  25630. return this.configLookup.containsFast(item);
  25631. };
  25632. ATNConfigSet.prototype.clear = function () {
  25633. if (this.readOnly) {
  25634. throw "This set is readonly";
  25635. }
  25636. this.configs = [];
  25637. this.cachedHashCode = -1;
  25638. this.configLookup = new Set();
  25639. };
  25640. ATNConfigSet.prototype.setReadonly = function (readOnly) {
  25641. this.readOnly = readOnly;
  25642. if (readOnly) {
  25643. this.configLookup = null; // can't mod, no need for lookup cache
  25644. }
  25645. };
  25646. ATNConfigSet.prototype.toString = function () {
  25647. return Utils.arrayToString(this.configs) + (this.hasSemanticContext ? ",hasSemanticContext=" + this.hasSemanticContext : "") + (this.uniqueAlt !== ATN.INVALID_ALT_NUMBER ? ",uniqueAlt=" + this.uniqueAlt : "") + (this.conflictingAlts !== null ? ",conflictingAlts=" + this.conflictingAlts : "") + (this.dipsIntoOuterContext ? ",dipsIntoOuterContext" : "");
  25648. };
  25649. function OrderedATNConfigSet() {
  25650. ATNConfigSet.call(this);
  25651. this.configLookup = new Set();
  25652. return this;
  25653. }
  25654. OrderedATNConfigSet.prototype = Object.create(ATNConfigSet.prototype);
  25655. OrderedATNConfigSet.prototype.constructor = OrderedATNConfigSet;
  25656. exports.ATNConfigSet = ATNConfigSet;
  25657. exports.OrderedATNConfigSet = OrderedATNConfigSet;
  25658. /***/ }),
  25659. /***/ "./node_modules/antlr4/atn/ATNDeserializationOptions.js":
  25660. /*!**************************************************************!*\
  25661. !*** ./node_modules/antlr4/atn/ATNDeserializationOptions.js ***!
  25662. \**************************************************************/
  25663. /*! no static exports found */
  25664. /***/ (function(module, exports, __webpack_require__) {
  25665. "use strict";
  25666. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  25667. * Use of this file is governed by the BSD 3-clause license that
  25668. * can be found in the LICENSE.txt file in the project root.
  25669. */
  25670. function ATNDeserializationOptions(copyFrom) {
  25671. if (copyFrom === undefined) {
  25672. copyFrom = null;
  25673. }
  25674. this.readOnly = false;
  25675. this.verifyATN = copyFrom === null ? true : copyFrom.verifyATN;
  25676. this.generateRuleBypassTransitions = copyFrom === null ? false : copyFrom.generateRuleBypassTransitions;
  25677. return this;
  25678. }
  25679. ATNDeserializationOptions.defaultOptions = new ATNDeserializationOptions();
  25680. ATNDeserializationOptions.defaultOptions.readOnly = true;
  25681. // def __setattr__(self, key, value):
  25682. // if key!="readOnly" and self.readOnly:
  25683. // raise Exception("The object is read only.")
  25684. // super(type(self), self).__setattr__(key,value)
  25685. exports.ATNDeserializationOptions = ATNDeserializationOptions;
  25686. /***/ }),
  25687. /***/ "./node_modules/antlr4/atn/ATNDeserializer.js":
  25688. /*!****************************************************!*\
  25689. !*** ./node_modules/antlr4/atn/ATNDeserializer.js ***!
  25690. \****************************************************/
  25691. /*! no static exports found */
  25692. /***/ (function(module, exports, __webpack_require__) {
  25693. "use strict";
  25694. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  25695. * Use of this file is governed by the BSD 3-clause license that
  25696. * can be found in the LICENSE.txt file in the project root.
  25697. */
  25698. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  25699. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  25700. var ATNType = __webpack_require__(/*! ./ATNType */ "./node_modules/antlr4/atn/ATNType.js").ATNType;
  25701. var ATNStates = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js");
  25702. var ATNState = ATNStates.ATNState;
  25703. var BasicState = ATNStates.BasicState;
  25704. var DecisionState = ATNStates.DecisionState;
  25705. var BlockStartState = ATNStates.BlockStartState;
  25706. var BlockEndState = ATNStates.BlockEndState;
  25707. var LoopEndState = ATNStates.LoopEndState;
  25708. var RuleStartState = ATNStates.RuleStartState;
  25709. var RuleStopState = ATNStates.RuleStopState;
  25710. var TokensStartState = ATNStates.TokensStartState;
  25711. var PlusLoopbackState = ATNStates.PlusLoopbackState;
  25712. var StarLoopbackState = ATNStates.StarLoopbackState;
  25713. var StarLoopEntryState = ATNStates.StarLoopEntryState;
  25714. var PlusBlockStartState = ATNStates.PlusBlockStartState;
  25715. var StarBlockStartState = ATNStates.StarBlockStartState;
  25716. var BasicBlockStartState = ATNStates.BasicBlockStartState;
  25717. var Transitions = __webpack_require__(/*! ./Transition */ "./node_modules/antlr4/atn/Transition.js");
  25718. var Transition = Transitions.Transition;
  25719. var AtomTransition = Transitions.AtomTransition;
  25720. var SetTransition = Transitions.SetTransition;
  25721. var NotSetTransition = Transitions.NotSetTransition;
  25722. var RuleTransition = Transitions.RuleTransition;
  25723. var RangeTransition = Transitions.RangeTransition;
  25724. var ActionTransition = Transitions.ActionTransition;
  25725. var EpsilonTransition = Transitions.EpsilonTransition;
  25726. var WildcardTransition = Transitions.WildcardTransition;
  25727. var PredicateTransition = Transitions.PredicateTransition;
  25728. var PrecedencePredicateTransition = Transitions.PrecedencePredicateTransition;
  25729. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  25730. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  25731. var ATNDeserializationOptions = __webpack_require__(/*! ./ATNDeserializationOptions */ "./node_modules/antlr4/atn/ATNDeserializationOptions.js").ATNDeserializationOptions;
  25732. var LexerActions = __webpack_require__(/*! ./LexerAction */ "./node_modules/antlr4/atn/LexerAction.js");
  25733. var LexerActionType = LexerActions.LexerActionType;
  25734. var LexerSkipAction = LexerActions.LexerSkipAction;
  25735. var LexerChannelAction = LexerActions.LexerChannelAction;
  25736. var LexerCustomAction = LexerActions.LexerCustomAction;
  25737. var LexerMoreAction = LexerActions.LexerMoreAction;
  25738. var LexerTypeAction = LexerActions.LexerTypeAction;
  25739. var LexerPushModeAction = LexerActions.LexerPushModeAction;
  25740. var LexerPopModeAction = LexerActions.LexerPopModeAction;
  25741. var LexerModeAction = LexerActions.LexerModeAction;
  25742. // This is the earliest supported serialized UUID.
  25743. // stick to serialized version for now, we don't need a UUID instance
  25744. var BASE_SERIALIZED_UUID = "AADB8D7E-AEEF-4415-AD2B-8204D6CF042E";
  25745. //
  25746. // This UUID indicates the serialized ATN contains two sets of
  25747. // IntervalSets, where the second set's values are encoded as
  25748. // 32-bit integers to support the full Unicode SMP range up to U+10FFFF.
  25749. //
  25750. var ADDED_UNICODE_SMP = "59627784-3BE5-417A-B9EB-8131A7286089";
  25751. // This list contains all of the currently supported UUIDs, ordered by when
  25752. // the feature first appeared in this branch.
  25753. var SUPPORTED_UUIDS = [BASE_SERIALIZED_UUID, ADDED_UNICODE_SMP];
  25754. var SERIALIZED_VERSION = 3;
  25755. // This is the current serialized UUID.
  25756. var SERIALIZED_UUID = ADDED_UNICODE_SMP;
  25757. function initArray(length, value) {
  25758. var tmp = [];
  25759. tmp[length - 1] = value;
  25760. return tmp.map(function (i) {
  25761. return value;
  25762. });
  25763. }
  25764. function ATNDeserializer(options) {
  25765. if (options === undefined || options === null) {
  25766. options = ATNDeserializationOptions.defaultOptions;
  25767. }
  25768. this.deserializationOptions = options;
  25769. this.stateFactories = null;
  25770. this.actionFactories = null;
  25771. return this;
  25772. }
  25773. // Determines if a particular serialized representation of an ATN supports
  25774. // a particular feature, identified by the {@link UUID} used for serializing
  25775. // the ATN at the time the feature was first introduced.
  25776. //
  25777. // @param feature The {@link UUID} marking the first time the feature was
  25778. // supported in the serialized ATN.
  25779. // @param actualUuid The {@link UUID} of the actual serialized ATN which is
  25780. // currently being deserialized.
  25781. // @return {@code true} if the {@code actualUuid} value represents a
  25782. // serialized ATN at or after the feature identified by {@code feature} was
  25783. // introduced; otherwise, {@code false}.
  25784. ATNDeserializer.prototype.isFeatureSupported = function (feature, actualUuid) {
  25785. var idx1 = SUPPORTED_UUIDS.indexOf(feature);
  25786. if (idx1 < 0) {
  25787. return false;
  25788. }
  25789. var idx2 = SUPPORTED_UUIDS.indexOf(actualUuid);
  25790. return idx2 >= idx1;
  25791. };
  25792. ATNDeserializer.prototype.deserialize = function (data) {
  25793. this.reset(data);
  25794. this.checkVersion();
  25795. this.checkUUID();
  25796. var atn = this.readATN();
  25797. this.readStates(atn);
  25798. this.readRules(atn);
  25799. this.readModes(atn);
  25800. var sets = [];
  25801. // First, deserialize sets with 16-bit arguments <= U+FFFF.
  25802. this.readSets(atn, sets, this.readInt.bind(this));
  25803. // Next, if the ATN was serialized with the Unicode SMP feature,
  25804. // deserialize sets with 32-bit arguments <= U+10FFFF.
  25805. if (this.isFeatureSupported(ADDED_UNICODE_SMP, this.uuid)) {
  25806. this.readSets(atn, sets, this.readInt32.bind(this));
  25807. }
  25808. this.readEdges(atn, sets);
  25809. this.readDecisions(atn);
  25810. this.readLexerActions(atn);
  25811. this.markPrecedenceDecisions(atn);
  25812. this.verifyATN(atn);
  25813. if (this.deserializationOptions.generateRuleBypassTransitions && atn.grammarType === ATNType.PARSER) {
  25814. this.generateRuleBypassTransitions(atn);
  25815. // re-verify after modification
  25816. this.verifyATN(atn);
  25817. }
  25818. return atn;
  25819. };
  25820. ATNDeserializer.prototype.reset = function (data) {
  25821. var adjust = function adjust(c) {
  25822. var v = c.charCodeAt(0);
  25823. return v > 1 ? v - 2 : v + 65533;
  25824. };
  25825. var temp = data.split("").map(adjust);
  25826. // don't adjust the first value since that's the version number
  25827. temp[0] = data.charCodeAt(0);
  25828. this.data = temp;
  25829. this.pos = 0;
  25830. };
  25831. ATNDeserializer.prototype.checkVersion = function () {
  25832. var version = this.readInt();
  25833. if (version !== SERIALIZED_VERSION) {
  25834. throw "Could not deserialize ATN with version " + version + " (expected " + SERIALIZED_VERSION + ").";
  25835. }
  25836. };
  25837. ATNDeserializer.prototype.checkUUID = function () {
  25838. var uuid = this.readUUID();
  25839. if (SUPPORTED_UUIDS.indexOf(uuid) < 0) {
  25840. throw "Could not deserialize ATN with UUID: " + uuid + " (expected " + SERIALIZED_UUID + " or a legacy UUID).", uuid, SERIALIZED_UUID;
  25841. }
  25842. this.uuid = uuid;
  25843. };
  25844. ATNDeserializer.prototype.readATN = function () {
  25845. var grammarType = this.readInt();
  25846. var maxTokenType = this.readInt();
  25847. return new ATN(grammarType, maxTokenType);
  25848. };
  25849. ATNDeserializer.prototype.readStates = function (atn) {
  25850. var j, pair, stateNumber;
  25851. var loopBackStateNumbers = [];
  25852. var endStateNumbers = [];
  25853. var nstates = this.readInt();
  25854. for (var i = 0; i < nstates; i++) {
  25855. var stype = this.readInt();
  25856. // ignore bad type of states
  25857. if (stype === ATNState.INVALID_TYPE) {
  25858. atn.addState(null);
  25859. continue;
  25860. }
  25861. var ruleIndex = this.readInt();
  25862. if (ruleIndex === 0xFFFF) {
  25863. ruleIndex = -1;
  25864. }
  25865. var s = this.stateFactory(stype, ruleIndex);
  25866. if (stype === ATNState.LOOP_END) {
  25867. // special case
  25868. var loopBackStateNumber = this.readInt();
  25869. loopBackStateNumbers.push([s, loopBackStateNumber]);
  25870. } else if (s instanceof BlockStartState) {
  25871. var endStateNumber = this.readInt();
  25872. endStateNumbers.push([s, endStateNumber]);
  25873. }
  25874. atn.addState(s);
  25875. }
  25876. // delay the assignment of loop back and end states until we know all the
  25877. // state instances have been initialized
  25878. for (j = 0; j < loopBackStateNumbers.length; j++) {
  25879. pair = loopBackStateNumbers[j];
  25880. pair[0].loopBackState = atn.states[pair[1]];
  25881. }
  25882. for (j = 0; j < endStateNumbers.length; j++) {
  25883. pair = endStateNumbers[j];
  25884. pair[0].endState = atn.states[pair[1]];
  25885. }
  25886. var numNonGreedyStates = this.readInt();
  25887. for (j = 0; j < numNonGreedyStates; j++) {
  25888. stateNumber = this.readInt();
  25889. atn.states[stateNumber].nonGreedy = true;
  25890. }
  25891. var numPrecedenceStates = this.readInt();
  25892. for (j = 0; j < numPrecedenceStates; j++) {
  25893. stateNumber = this.readInt();
  25894. atn.states[stateNumber].isPrecedenceRule = true;
  25895. }
  25896. };
  25897. ATNDeserializer.prototype.readRules = function (atn) {
  25898. var i;
  25899. var nrules = this.readInt();
  25900. if (atn.grammarType === ATNType.LEXER) {
  25901. atn.ruleToTokenType = initArray(nrules, 0);
  25902. }
  25903. atn.ruleToStartState = initArray(nrules, 0);
  25904. for (i = 0; i < nrules; i++) {
  25905. var s = this.readInt();
  25906. var startState = atn.states[s];
  25907. atn.ruleToStartState[i] = startState;
  25908. if (atn.grammarType === ATNType.LEXER) {
  25909. var tokenType = this.readInt();
  25910. if (tokenType === 0xFFFF) {
  25911. tokenType = Token.EOF;
  25912. }
  25913. atn.ruleToTokenType[i] = tokenType;
  25914. }
  25915. }
  25916. atn.ruleToStopState = initArray(nrules, 0);
  25917. for (i = 0; i < atn.states.length; i++) {
  25918. var state = atn.states[i];
  25919. if (!(state instanceof RuleStopState)) {
  25920. continue;
  25921. }
  25922. atn.ruleToStopState[state.ruleIndex] = state;
  25923. atn.ruleToStartState[state.ruleIndex].stopState = state;
  25924. }
  25925. };
  25926. ATNDeserializer.prototype.readModes = function (atn) {
  25927. var nmodes = this.readInt();
  25928. for (var i = 0; i < nmodes; i++) {
  25929. var s = this.readInt();
  25930. atn.modeToStartState.push(atn.states[s]);
  25931. }
  25932. };
  25933. ATNDeserializer.prototype.readSets = function (atn, sets, readUnicode) {
  25934. var m = this.readInt();
  25935. for (var i = 0; i < m; i++) {
  25936. var iset = new IntervalSet();
  25937. sets.push(iset);
  25938. var n = this.readInt();
  25939. var containsEof = this.readInt();
  25940. if (containsEof !== 0) {
  25941. iset.addOne(-1);
  25942. }
  25943. for (var j = 0; j < n; j++) {
  25944. var i1 = readUnicode();
  25945. var i2 = readUnicode();
  25946. iset.addRange(i1, i2);
  25947. }
  25948. }
  25949. };
  25950. ATNDeserializer.prototype.readEdges = function (atn, sets) {
  25951. var i, j, state, trans, target;
  25952. var nedges = this.readInt();
  25953. for (i = 0; i < nedges; i++) {
  25954. var src = this.readInt();
  25955. var trg = this.readInt();
  25956. var ttype = this.readInt();
  25957. var arg1 = this.readInt();
  25958. var arg2 = this.readInt();
  25959. var arg3 = this.readInt();
  25960. trans = this.edgeFactory(atn, ttype, src, trg, arg1, arg2, arg3, sets);
  25961. var srcState = atn.states[src];
  25962. srcState.addTransition(trans);
  25963. }
  25964. // edges for rule stop states can be derived, so they aren't serialized
  25965. for (i = 0; i < atn.states.length; i++) {
  25966. state = atn.states[i];
  25967. for (j = 0; j < state.transitions.length; j++) {
  25968. var t = state.transitions[j];
  25969. if (!(t instanceof RuleTransition)) {
  25970. continue;
  25971. }
  25972. var outermostPrecedenceReturn = -1;
  25973. if (atn.ruleToStartState[t.target.ruleIndex].isPrecedenceRule) {
  25974. if (t.precedence === 0) {
  25975. outermostPrecedenceReturn = t.target.ruleIndex;
  25976. }
  25977. }
  25978. trans = new EpsilonTransition(t.followState, outermostPrecedenceReturn);
  25979. atn.ruleToStopState[t.target.ruleIndex].addTransition(trans);
  25980. }
  25981. }
  25982. for (i = 0; i < atn.states.length; i++) {
  25983. state = atn.states[i];
  25984. if (state instanceof BlockStartState) {
  25985. // we need to know the end state to set its start state
  25986. if (state.endState === null) {
  25987. throw "IllegalState";
  25988. }
  25989. // block end states can only be associated to a single block start
  25990. // state
  25991. if (state.endState.startState !== null) {
  25992. throw "IllegalState";
  25993. }
  25994. state.endState.startState = state;
  25995. }
  25996. if (state instanceof PlusLoopbackState) {
  25997. for (j = 0; j < state.transitions.length; j++) {
  25998. target = state.transitions[j].target;
  25999. if (target instanceof PlusBlockStartState) {
  26000. target.loopBackState = state;
  26001. }
  26002. }
  26003. } else if (state instanceof StarLoopbackState) {
  26004. for (j = 0; j < state.transitions.length; j++) {
  26005. target = state.transitions[j].target;
  26006. if (target instanceof StarLoopEntryState) {
  26007. target.loopBackState = state;
  26008. }
  26009. }
  26010. }
  26011. }
  26012. };
  26013. ATNDeserializer.prototype.readDecisions = function (atn) {
  26014. var ndecisions = this.readInt();
  26015. for (var i = 0; i < ndecisions; i++) {
  26016. var s = this.readInt();
  26017. var decState = atn.states[s];
  26018. atn.decisionToState.push(decState);
  26019. decState.decision = i;
  26020. }
  26021. };
  26022. ATNDeserializer.prototype.readLexerActions = function (atn) {
  26023. if (atn.grammarType === ATNType.LEXER) {
  26024. var count = this.readInt();
  26025. atn.lexerActions = initArray(count, null);
  26026. for (var i = 0; i < count; i++) {
  26027. var actionType = this.readInt();
  26028. var data1 = this.readInt();
  26029. if (data1 === 0xFFFF) {
  26030. data1 = -1;
  26031. }
  26032. var data2 = this.readInt();
  26033. if (data2 === 0xFFFF) {
  26034. data2 = -1;
  26035. }
  26036. var lexerAction = this.lexerActionFactory(actionType, data1, data2);
  26037. atn.lexerActions[i] = lexerAction;
  26038. }
  26039. }
  26040. };
  26041. ATNDeserializer.prototype.generateRuleBypassTransitions = function (atn) {
  26042. var i;
  26043. var count = atn.ruleToStartState.length;
  26044. for (i = 0; i < count; i++) {
  26045. atn.ruleToTokenType[i] = atn.maxTokenType + i + 1;
  26046. }
  26047. for (i = 0; i < count; i++) {
  26048. this.generateRuleBypassTransition(atn, i);
  26049. }
  26050. };
  26051. ATNDeserializer.prototype.generateRuleBypassTransition = function (atn, idx) {
  26052. var i, state;
  26053. var bypassStart = new BasicBlockStartState();
  26054. bypassStart.ruleIndex = idx;
  26055. atn.addState(bypassStart);
  26056. var bypassStop = new BlockEndState();
  26057. bypassStop.ruleIndex = idx;
  26058. atn.addState(bypassStop);
  26059. bypassStart.endState = bypassStop;
  26060. atn.defineDecisionState(bypassStart);
  26061. bypassStop.startState = bypassStart;
  26062. var excludeTransition = null;
  26063. var endState = null;
  26064. if (atn.ruleToStartState[idx].isPrecedenceRule) {
  26065. // wrap from the beginning of the rule to the StarLoopEntryState
  26066. endState = null;
  26067. for (i = 0; i < atn.states.length; i++) {
  26068. state = atn.states[i];
  26069. if (this.stateIsEndStateFor(state, idx)) {
  26070. endState = state;
  26071. excludeTransition = state.loopBackState.transitions[0];
  26072. break;
  26073. }
  26074. }
  26075. if (excludeTransition === null) {
  26076. throw "Couldn't identify final state of the precedence rule prefix section.";
  26077. }
  26078. } else {
  26079. endState = atn.ruleToStopState[idx];
  26080. }
  26081. // all non-excluded transitions that currently target end state need to
  26082. // target blockEnd instead
  26083. for (i = 0; i < atn.states.length; i++) {
  26084. state = atn.states[i];
  26085. for (var j = 0; j < state.transitions.length; j++) {
  26086. var transition = state.transitions[j];
  26087. if (transition === excludeTransition) {
  26088. continue;
  26089. }
  26090. if (transition.target === endState) {
  26091. transition.target = bypassStop;
  26092. }
  26093. }
  26094. }
  26095. // all transitions leaving the rule start state need to leave blockStart
  26096. // instead
  26097. var ruleToStartState = atn.ruleToStartState[idx];
  26098. var count = ruleToStartState.transitions.length;
  26099. while (count > 0) {
  26100. bypassStart.addTransition(ruleToStartState.transitions[count - 1]);
  26101. ruleToStartState.transitions = ruleToStartState.transitions.slice(-1);
  26102. }
  26103. // link the new states
  26104. atn.ruleToStartState[idx].addTransition(new EpsilonTransition(bypassStart));
  26105. bypassStop.addTransition(new EpsilonTransition(endState));
  26106. var matchState = new BasicState();
  26107. atn.addState(matchState);
  26108. matchState.addTransition(new AtomTransition(bypassStop, atn.ruleToTokenType[idx]));
  26109. bypassStart.addTransition(new EpsilonTransition(matchState));
  26110. };
  26111. ATNDeserializer.prototype.stateIsEndStateFor = function (state, idx) {
  26112. if (state.ruleIndex !== idx) {
  26113. return null;
  26114. }
  26115. if (!(state instanceof StarLoopEntryState)) {
  26116. return null;
  26117. }
  26118. var maybeLoopEndState = state.transitions[state.transitions.length - 1].target;
  26119. if (!(maybeLoopEndState instanceof LoopEndState)) {
  26120. return null;
  26121. }
  26122. if (maybeLoopEndState.epsilonOnlyTransitions && maybeLoopEndState.transitions[0].target instanceof RuleStopState) {
  26123. return state;
  26124. } else {
  26125. return null;
  26126. }
  26127. };
  26128. //
  26129. // Analyze the {@link StarLoopEntryState} states in the specified ATN to set
  26130. // the {@link StarLoopEntryState//isPrecedenceDecision} field to the
  26131. // correct value.
  26132. //
  26133. // @param atn The ATN.
  26134. //
  26135. ATNDeserializer.prototype.markPrecedenceDecisions = function (atn) {
  26136. for (var i = 0; i < atn.states.length; i++) {
  26137. var state = atn.states[i];
  26138. if (!(state instanceof StarLoopEntryState)) {
  26139. continue;
  26140. }
  26141. // We analyze the ATN to determine if this ATN decision state is the
  26142. // decision for the closure block that determines whether a
  26143. // precedence rule should continue or complete.
  26144. //
  26145. if (atn.ruleToStartState[state.ruleIndex].isPrecedenceRule) {
  26146. var maybeLoopEndState = state.transitions[state.transitions.length - 1].target;
  26147. if (maybeLoopEndState instanceof LoopEndState) {
  26148. if (maybeLoopEndState.epsilonOnlyTransitions && maybeLoopEndState.transitions[0].target instanceof RuleStopState) {
  26149. state.isPrecedenceDecision = true;
  26150. }
  26151. }
  26152. }
  26153. }
  26154. };
  26155. ATNDeserializer.prototype.verifyATN = function (atn) {
  26156. if (!this.deserializationOptions.verifyATN) {
  26157. return;
  26158. }
  26159. // verify assumptions
  26160. for (var i = 0; i < atn.states.length; i++) {
  26161. var state = atn.states[i];
  26162. if (state === null) {
  26163. continue;
  26164. }
  26165. this.checkCondition(state.epsilonOnlyTransitions || state.transitions.length <= 1);
  26166. if (state instanceof PlusBlockStartState) {
  26167. this.checkCondition(state.loopBackState !== null);
  26168. } else if (state instanceof StarLoopEntryState) {
  26169. this.checkCondition(state.loopBackState !== null);
  26170. this.checkCondition(state.transitions.length === 2);
  26171. if (state.transitions[0].target instanceof StarBlockStartState) {
  26172. this.checkCondition(state.transitions[1].target instanceof LoopEndState);
  26173. this.checkCondition(!state.nonGreedy);
  26174. } else if (state.transitions[0].target instanceof LoopEndState) {
  26175. this.checkCondition(state.transitions[1].target instanceof StarBlockStartState);
  26176. this.checkCondition(state.nonGreedy);
  26177. } else {
  26178. throw "IllegalState";
  26179. }
  26180. } else if (state instanceof StarLoopbackState) {
  26181. this.checkCondition(state.transitions.length === 1);
  26182. this.checkCondition(state.transitions[0].target instanceof StarLoopEntryState);
  26183. } else if (state instanceof LoopEndState) {
  26184. this.checkCondition(state.loopBackState !== null);
  26185. } else if (state instanceof RuleStartState) {
  26186. this.checkCondition(state.stopState !== null);
  26187. } else if (state instanceof BlockStartState) {
  26188. this.checkCondition(state.endState !== null);
  26189. } else if (state instanceof BlockEndState) {
  26190. this.checkCondition(state.startState !== null);
  26191. } else if (state instanceof DecisionState) {
  26192. this.checkCondition(state.transitions.length <= 1 || state.decision >= 0);
  26193. } else {
  26194. this.checkCondition(state.transitions.length <= 1 || state instanceof RuleStopState);
  26195. }
  26196. }
  26197. };
  26198. ATNDeserializer.prototype.checkCondition = function (condition, message) {
  26199. if (!condition) {
  26200. if (message === undefined || message === null) {
  26201. message = "IllegalState";
  26202. }
  26203. throw message;
  26204. }
  26205. };
  26206. ATNDeserializer.prototype.readInt = function () {
  26207. return this.data[this.pos++];
  26208. };
  26209. ATNDeserializer.prototype.readInt32 = function () {
  26210. var low = this.readInt();
  26211. var high = this.readInt();
  26212. return low | high << 16;
  26213. };
  26214. ATNDeserializer.prototype.readLong = function () {
  26215. var low = this.readInt32();
  26216. var high = this.readInt32();
  26217. return low & 0x00000000FFFFFFFF | high << 32;
  26218. };
  26219. function createByteToHex() {
  26220. var bth = [];
  26221. for (var i = 0; i < 256; i++) {
  26222. bth[i] = (i + 0x100).toString(16).substr(1).toUpperCase();
  26223. }
  26224. return bth;
  26225. }
  26226. var byteToHex = createByteToHex();
  26227. ATNDeserializer.prototype.readUUID = function () {
  26228. var bb = [];
  26229. for (var i = 7; i >= 0; i--) {
  26230. var int = this.readInt();
  26231. /* jshint bitwise: false */
  26232. bb[2 * i + 1] = int & 0xFF;
  26233. bb[2 * i] = int >> 8 & 0xFF;
  26234. }
  26235. return byteToHex[bb[0]] + byteToHex[bb[1]] + byteToHex[bb[2]] + byteToHex[bb[3]] + '-' + byteToHex[bb[4]] + byteToHex[bb[5]] + '-' + byteToHex[bb[6]] + byteToHex[bb[7]] + '-' + byteToHex[bb[8]] + byteToHex[bb[9]] + '-' + byteToHex[bb[10]] + byteToHex[bb[11]] + byteToHex[bb[12]] + byteToHex[bb[13]] + byteToHex[bb[14]] + byteToHex[bb[15]];
  26236. };
  26237. ATNDeserializer.prototype.edgeFactory = function (atn, type, src, trg, arg1, arg2, arg3, sets) {
  26238. var target = atn.states[trg];
  26239. switch (type) {
  26240. case Transition.EPSILON:
  26241. return new EpsilonTransition(target);
  26242. case Transition.RANGE:
  26243. return arg3 !== 0 ? new RangeTransition(target, Token.EOF, arg2) : new RangeTransition(target, arg1, arg2);
  26244. case Transition.RULE:
  26245. return new RuleTransition(atn.states[arg1], arg2, arg3, target);
  26246. case Transition.PREDICATE:
  26247. return new PredicateTransition(target, arg1, arg2, arg3 !== 0);
  26248. case Transition.PRECEDENCE:
  26249. return new PrecedencePredicateTransition(target, arg1);
  26250. case Transition.ATOM:
  26251. return arg3 !== 0 ? new AtomTransition(target, Token.EOF) : new AtomTransition(target, arg1);
  26252. case Transition.ACTION:
  26253. return new ActionTransition(target, arg1, arg2, arg3 !== 0);
  26254. case Transition.SET:
  26255. return new SetTransition(target, sets[arg1]);
  26256. case Transition.NOT_SET:
  26257. return new NotSetTransition(target, sets[arg1]);
  26258. case Transition.WILDCARD:
  26259. return new WildcardTransition(target);
  26260. default:
  26261. throw "The specified transition type: " + type + " is not valid.";
  26262. }
  26263. };
  26264. ATNDeserializer.prototype.stateFactory = function (type, ruleIndex) {
  26265. if (this.stateFactories === null) {
  26266. var sf = [];
  26267. sf[ATNState.INVALID_TYPE] = null;
  26268. sf[ATNState.BASIC] = function () {
  26269. return new BasicState();
  26270. };
  26271. sf[ATNState.RULE_START] = function () {
  26272. return new RuleStartState();
  26273. };
  26274. sf[ATNState.BLOCK_START] = function () {
  26275. return new BasicBlockStartState();
  26276. };
  26277. sf[ATNState.PLUS_BLOCK_START] = function () {
  26278. return new PlusBlockStartState();
  26279. };
  26280. sf[ATNState.STAR_BLOCK_START] = function () {
  26281. return new StarBlockStartState();
  26282. };
  26283. sf[ATNState.TOKEN_START] = function () {
  26284. return new TokensStartState();
  26285. };
  26286. sf[ATNState.RULE_STOP] = function () {
  26287. return new RuleStopState();
  26288. };
  26289. sf[ATNState.BLOCK_END] = function () {
  26290. return new BlockEndState();
  26291. };
  26292. sf[ATNState.STAR_LOOP_BACK] = function () {
  26293. return new StarLoopbackState();
  26294. };
  26295. sf[ATNState.STAR_LOOP_ENTRY] = function () {
  26296. return new StarLoopEntryState();
  26297. };
  26298. sf[ATNState.PLUS_LOOP_BACK] = function () {
  26299. return new PlusLoopbackState();
  26300. };
  26301. sf[ATNState.LOOP_END] = function () {
  26302. return new LoopEndState();
  26303. };
  26304. this.stateFactories = sf;
  26305. }
  26306. if (type > this.stateFactories.length || this.stateFactories[type] === null) {
  26307. throw "The specified state type " + type + " is not valid.";
  26308. } else {
  26309. var s = this.stateFactories[type]();
  26310. if (s !== null) {
  26311. s.ruleIndex = ruleIndex;
  26312. return s;
  26313. }
  26314. }
  26315. };
  26316. ATNDeserializer.prototype.lexerActionFactory = function (type, data1, data2) {
  26317. if (this.actionFactories === null) {
  26318. var af = [];
  26319. af[LexerActionType.CHANNEL] = function (data1, data2) {
  26320. return new LexerChannelAction(data1);
  26321. };
  26322. af[LexerActionType.CUSTOM] = function (data1, data2) {
  26323. return new LexerCustomAction(data1, data2);
  26324. };
  26325. af[LexerActionType.MODE] = function (data1, data2) {
  26326. return new LexerModeAction(data1);
  26327. };
  26328. af[LexerActionType.MORE] = function (data1, data2) {
  26329. return LexerMoreAction.INSTANCE;
  26330. };
  26331. af[LexerActionType.POP_MODE] = function (data1, data2) {
  26332. return LexerPopModeAction.INSTANCE;
  26333. };
  26334. af[LexerActionType.PUSH_MODE] = function (data1, data2) {
  26335. return new LexerPushModeAction(data1);
  26336. };
  26337. af[LexerActionType.SKIP] = function (data1, data2) {
  26338. return LexerSkipAction.INSTANCE;
  26339. };
  26340. af[LexerActionType.TYPE] = function (data1, data2) {
  26341. return new LexerTypeAction(data1);
  26342. };
  26343. this.actionFactories = af;
  26344. }
  26345. if (type > this.actionFactories.length || this.actionFactories[type] === null) {
  26346. throw "The specified lexer action type " + type + " is not valid.";
  26347. } else {
  26348. return this.actionFactories[type](data1, data2);
  26349. }
  26350. };
  26351. exports.ATNDeserializer = ATNDeserializer;
  26352. /***/ }),
  26353. /***/ "./node_modules/antlr4/atn/ATNSimulator.js":
  26354. /*!*************************************************!*\
  26355. !*** ./node_modules/antlr4/atn/ATNSimulator.js ***!
  26356. \*************************************************/
  26357. /*! no static exports found */
  26358. /***/ (function(module, exports, __webpack_require__) {
  26359. "use strict";
  26360. //
  26361. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  26362. * Use of this file is governed by the BSD 3-clause license that
  26363. * can be found in the LICENSE.txt file in the project root.
  26364. */
  26365. ///
  26366. var DFAState = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  26367. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  26368. var getCachedPredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").getCachedPredictionContext;
  26369. function ATNSimulator(atn, sharedContextCache) {
  26370. // The context cache maps all PredictionContext objects that are ==
  26371. // to a single cached copy. This cache is shared across all contexts
  26372. // in all ATNConfigs in all DFA states. We rebuild each ATNConfigSet
  26373. // to use only cached nodes/graphs in addDFAState(). We don't want to
  26374. // fill this during closure() since there are lots of contexts that
  26375. // pop up but are not used ever again. It also greatly slows down closure().
  26376. //
  26377. // <p>This cache makes a huge difference in memory and a little bit in speed.
  26378. // For the Java grammar on java.*, it dropped the memory requirements
  26379. // at the end from 25M to 16M. We don't store any of the full context
  26380. // graphs in the DFA because they are limited to local context only,
  26381. // but apparently there's a lot of repetition there as well. We optimize
  26382. // the config contexts before storing the config set in the DFA states
  26383. // by literally rebuilding them with cached subgraphs only.</p>
  26384. //
  26385. // <p>I tried a cache for use during closure operations, that was
  26386. // whacked after each adaptivePredict(). It cost a little bit
  26387. // more time I think and doesn't save on the overall footprint
  26388. // so it's not worth the complexity.</p>
  26389. ///
  26390. this.atn = atn;
  26391. this.sharedContextCache = sharedContextCache;
  26392. return this;
  26393. }
  26394. // Must distinguish between missing edge and edge we know leads nowhere///
  26395. ATNSimulator.ERROR = new DFAState(0x7FFFFFFF, new ATNConfigSet());
  26396. ATNSimulator.prototype.getCachedContext = function (context) {
  26397. if (this.sharedContextCache === null) {
  26398. return context;
  26399. }
  26400. var visited = {};
  26401. return getCachedPredictionContext(context, this.sharedContextCache, visited);
  26402. };
  26403. exports.ATNSimulator = ATNSimulator;
  26404. /***/ }),
  26405. /***/ "./node_modules/antlr4/atn/ATNState.js":
  26406. /*!*********************************************!*\
  26407. !*** ./node_modules/antlr4/atn/ATNState.js ***!
  26408. \*********************************************/
  26409. /*! no static exports found */
  26410. /***/ (function(module, exports, __webpack_require__) {
  26411. "use strict";
  26412. //
  26413. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  26414. * Use of this file is governed by the BSD 3-clause license that
  26415. * can be found in the LICENSE.txt file in the project root.
  26416. */
  26417. //
  26418. // The following images show the relation of states and
  26419. // {@link ATNState//transitions} for various grammar constructs.
  26420. //
  26421. // <ul>
  26422. //
  26423. // <li>Solid edges marked with an &//0949; indicate a required
  26424. // {@link EpsilonTransition}.</li>
  26425. //
  26426. // <li>Dashed edges indicate locations where any transition derived from
  26427. // {@link Transition} might appear.</li>
  26428. //
  26429. // <li>Dashed nodes are place holders for either a sequence of linked
  26430. // {@link BasicState} states or the inclusion of a block representing a nested
  26431. // construct in one of the forms below.</li>
  26432. //
  26433. // <li>Nodes showing multiple outgoing alternatives with a {@code ...} support
  26434. // any number of alternatives (one or more). Nodes without the {@code ...} only
  26435. // support the exact number of alternatives shown in the diagram.</li>
  26436. //
  26437. // </ul>
  26438. //
  26439. // <h2>Basic Blocks</h2>
  26440. //
  26441. // <h3>Rule</h3>
  26442. //
  26443. // <embed src="images/Rule.svg" type="image/svg+xml"/>
  26444. //
  26445. // <h3>Block of 1 or more alternatives</h3>
  26446. //
  26447. // <embed src="images/Block.svg" type="image/svg+xml"/>
  26448. //
  26449. // <h2>Greedy Loops</h2>
  26450. //
  26451. // <h3>Greedy Closure: {@code (...)*}</h3>
  26452. //
  26453. // <embed src="images/ClosureGreedy.svg" type="image/svg+xml"/>
  26454. //
  26455. // <h3>Greedy Positive Closure: {@code (...)+}</h3>
  26456. //
  26457. // <embed src="images/PositiveClosureGreedy.svg" type="image/svg+xml"/>
  26458. //
  26459. // <h3>Greedy Optional: {@code (...)?}</h3>
  26460. //
  26461. // <embed src="images/OptionalGreedy.svg" type="image/svg+xml"/>
  26462. //
  26463. // <h2>Non-Greedy Loops</h2>
  26464. //
  26465. // <h3>Non-Greedy Closure: {@code (...)*?}</h3>
  26466. //
  26467. // <embed src="images/ClosureNonGreedy.svg" type="image/svg+xml"/>
  26468. //
  26469. // <h3>Non-Greedy Positive Closure: {@code (...)+?}</h3>
  26470. //
  26471. // <embed src="images/PositiveClosureNonGreedy.svg" type="image/svg+xml"/>
  26472. //
  26473. // <h3>Non-Greedy Optional: {@code (...)??}</h3>
  26474. //
  26475. // <embed src="images/OptionalNonGreedy.svg" type="image/svg+xml"/>
  26476. //
  26477. var INITIAL_NUM_TRANSITIONS = 4;
  26478. function ATNState() {
  26479. // Which ATN are we in?
  26480. this.atn = null;
  26481. this.stateNumber = ATNState.INVALID_STATE_NUMBER;
  26482. this.stateType = null;
  26483. this.ruleIndex = 0; // at runtime, we don't have Rule objects
  26484. this.epsilonOnlyTransitions = false;
  26485. // Track the transitions emanating from this ATN state.
  26486. this.transitions = [];
  26487. // Used to cache lookahead during parsing, not used during construction
  26488. this.nextTokenWithinRule = null;
  26489. return this;
  26490. }
  26491. // constants for serialization
  26492. ATNState.INVALID_TYPE = 0;
  26493. ATNState.BASIC = 1;
  26494. ATNState.RULE_START = 2;
  26495. ATNState.BLOCK_START = 3;
  26496. ATNState.PLUS_BLOCK_START = 4;
  26497. ATNState.STAR_BLOCK_START = 5;
  26498. ATNState.TOKEN_START = 6;
  26499. ATNState.RULE_STOP = 7;
  26500. ATNState.BLOCK_END = 8;
  26501. ATNState.STAR_LOOP_BACK = 9;
  26502. ATNState.STAR_LOOP_ENTRY = 10;
  26503. ATNState.PLUS_LOOP_BACK = 11;
  26504. ATNState.LOOP_END = 12;
  26505. ATNState.serializationNames = ["INVALID", "BASIC", "RULE_START", "BLOCK_START", "PLUS_BLOCK_START", "STAR_BLOCK_START", "TOKEN_START", "RULE_STOP", "BLOCK_END", "STAR_LOOP_BACK", "STAR_LOOP_ENTRY", "PLUS_LOOP_BACK", "LOOP_END"];
  26506. ATNState.INVALID_STATE_NUMBER = -1;
  26507. ATNState.prototype.toString = function () {
  26508. return this.stateNumber;
  26509. };
  26510. ATNState.prototype.equals = function (other) {
  26511. if (other instanceof ATNState) {
  26512. return this.stateNumber === other.stateNumber;
  26513. } else {
  26514. return false;
  26515. }
  26516. };
  26517. ATNState.prototype.isNonGreedyExitState = function () {
  26518. return false;
  26519. };
  26520. ATNState.prototype.addTransition = function (trans, index) {
  26521. if (index === undefined) {
  26522. index = -1;
  26523. }
  26524. if (this.transitions.length === 0) {
  26525. this.epsilonOnlyTransitions = trans.isEpsilon;
  26526. } else if (this.epsilonOnlyTransitions !== trans.isEpsilon) {
  26527. this.epsilonOnlyTransitions = false;
  26528. }
  26529. if (index === -1) {
  26530. this.transitions.push(trans);
  26531. } else {
  26532. this.transitions.splice(index, 1, trans);
  26533. }
  26534. };
  26535. function BasicState() {
  26536. ATNState.call(this);
  26537. this.stateType = ATNState.BASIC;
  26538. return this;
  26539. }
  26540. BasicState.prototype = Object.create(ATNState.prototype);
  26541. BasicState.prototype.constructor = BasicState;
  26542. function DecisionState() {
  26543. ATNState.call(this);
  26544. this.decision = -1;
  26545. this.nonGreedy = false;
  26546. return this;
  26547. }
  26548. DecisionState.prototype = Object.create(ATNState.prototype);
  26549. DecisionState.prototype.constructor = DecisionState;
  26550. // The start of a regular {@code (...)} block.
  26551. function BlockStartState() {
  26552. DecisionState.call(this);
  26553. this.endState = null;
  26554. return this;
  26555. }
  26556. BlockStartState.prototype = Object.create(DecisionState.prototype);
  26557. BlockStartState.prototype.constructor = BlockStartState;
  26558. function BasicBlockStartState() {
  26559. BlockStartState.call(this);
  26560. this.stateType = ATNState.BLOCK_START;
  26561. return this;
  26562. }
  26563. BasicBlockStartState.prototype = Object.create(BlockStartState.prototype);
  26564. BasicBlockStartState.prototype.constructor = BasicBlockStartState;
  26565. // Terminal node of a simple {@code (a|b|c)} block.
  26566. function BlockEndState() {
  26567. ATNState.call(this);
  26568. this.stateType = ATNState.BLOCK_END;
  26569. this.startState = null;
  26570. return this;
  26571. }
  26572. BlockEndState.prototype = Object.create(ATNState.prototype);
  26573. BlockEndState.prototype.constructor = BlockEndState;
  26574. // The last node in the ATN for a rule, unless that rule is the start symbol.
  26575. // In that case, there is one transition to EOF. Later, we might encode
  26576. // references to all calls to this rule to compute FOLLOW sets for
  26577. // error handling.
  26578. //
  26579. function RuleStopState() {
  26580. ATNState.call(this);
  26581. this.stateType = ATNState.RULE_STOP;
  26582. return this;
  26583. }
  26584. RuleStopState.prototype = Object.create(ATNState.prototype);
  26585. RuleStopState.prototype.constructor = RuleStopState;
  26586. function RuleStartState() {
  26587. ATNState.call(this);
  26588. this.stateType = ATNState.RULE_START;
  26589. this.stopState = null;
  26590. this.isPrecedenceRule = false;
  26591. return this;
  26592. }
  26593. RuleStartState.prototype = Object.create(ATNState.prototype);
  26594. RuleStartState.prototype.constructor = RuleStartState;
  26595. // Decision state for {@code A+} and {@code (A|B)+}. It has two transitions:
  26596. // one to the loop back to start of the block and one to exit.
  26597. //
  26598. function PlusLoopbackState() {
  26599. DecisionState.call(this);
  26600. this.stateType = ATNState.PLUS_LOOP_BACK;
  26601. return this;
  26602. }
  26603. PlusLoopbackState.prototype = Object.create(DecisionState.prototype);
  26604. PlusLoopbackState.prototype.constructor = PlusLoopbackState;
  26605. // Start of {@code (A|B|...)+} loop. Technically a decision state, but
  26606. // we don't use for code generation; somebody might need it, so I'm defining
  26607. // it for completeness. In reality, the {@link PlusLoopbackState} node is the
  26608. // real decision-making note for {@code A+}.
  26609. //
  26610. function PlusBlockStartState() {
  26611. BlockStartState.call(this);
  26612. this.stateType = ATNState.PLUS_BLOCK_START;
  26613. this.loopBackState = null;
  26614. return this;
  26615. }
  26616. PlusBlockStartState.prototype = Object.create(BlockStartState.prototype);
  26617. PlusBlockStartState.prototype.constructor = PlusBlockStartState;
  26618. // The block that begins a closure loop.
  26619. function StarBlockStartState() {
  26620. BlockStartState.call(this);
  26621. this.stateType = ATNState.STAR_BLOCK_START;
  26622. return this;
  26623. }
  26624. StarBlockStartState.prototype = Object.create(BlockStartState.prototype);
  26625. StarBlockStartState.prototype.constructor = StarBlockStartState;
  26626. function StarLoopbackState() {
  26627. ATNState.call(this);
  26628. this.stateType = ATNState.STAR_LOOP_BACK;
  26629. return this;
  26630. }
  26631. StarLoopbackState.prototype = Object.create(ATNState.prototype);
  26632. StarLoopbackState.prototype.constructor = StarLoopbackState;
  26633. function StarLoopEntryState() {
  26634. DecisionState.call(this);
  26635. this.stateType = ATNState.STAR_LOOP_ENTRY;
  26636. this.loopBackState = null;
  26637. // Indicates whether this state can benefit from a precedence DFA during SLL decision making.
  26638. this.isPrecedenceDecision = null;
  26639. return this;
  26640. }
  26641. StarLoopEntryState.prototype = Object.create(DecisionState.prototype);
  26642. StarLoopEntryState.prototype.constructor = StarLoopEntryState;
  26643. // Mark the end of a * or + loop.
  26644. function LoopEndState() {
  26645. ATNState.call(this);
  26646. this.stateType = ATNState.LOOP_END;
  26647. this.loopBackState = null;
  26648. return this;
  26649. }
  26650. LoopEndState.prototype = Object.create(ATNState.prototype);
  26651. LoopEndState.prototype.constructor = LoopEndState;
  26652. // The Tokens rule start state linking to each lexer rule start state */
  26653. function TokensStartState() {
  26654. DecisionState.call(this);
  26655. this.stateType = ATNState.TOKEN_START;
  26656. return this;
  26657. }
  26658. TokensStartState.prototype = Object.create(DecisionState.prototype);
  26659. TokensStartState.prototype.constructor = TokensStartState;
  26660. exports.ATNState = ATNState;
  26661. exports.BasicState = BasicState;
  26662. exports.DecisionState = DecisionState;
  26663. exports.BlockStartState = BlockStartState;
  26664. exports.BlockEndState = BlockEndState;
  26665. exports.LoopEndState = LoopEndState;
  26666. exports.RuleStartState = RuleStartState;
  26667. exports.RuleStopState = RuleStopState;
  26668. exports.TokensStartState = TokensStartState;
  26669. exports.PlusLoopbackState = PlusLoopbackState;
  26670. exports.StarLoopbackState = StarLoopbackState;
  26671. exports.StarLoopEntryState = StarLoopEntryState;
  26672. exports.PlusBlockStartState = PlusBlockStartState;
  26673. exports.StarBlockStartState = StarBlockStartState;
  26674. exports.BasicBlockStartState = BasicBlockStartState;
  26675. /***/ }),
  26676. /***/ "./node_modules/antlr4/atn/ATNType.js":
  26677. /*!********************************************!*\
  26678. !*** ./node_modules/antlr4/atn/ATNType.js ***!
  26679. \********************************************/
  26680. /*! no static exports found */
  26681. /***/ (function(module, exports, __webpack_require__) {
  26682. "use strict";
  26683. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  26684. * Use of this file is governed by the BSD 3-clause license that
  26685. * can be found in the LICENSE.txt file in the project root.
  26686. */
  26687. ///
  26688. // Represents the type of recognizer an ATN applies to.
  26689. function ATNType() {}
  26690. ATNType.LEXER = 0;
  26691. ATNType.PARSER = 1;
  26692. exports.ATNType = ATNType;
  26693. /***/ }),
  26694. /***/ "./node_modules/antlr4/atn/LexerATNSimulator.js":
  26695. /*!******************************************************!*\
  26696. !*** ./node_modules/antlr4/atn/LexerATNSimulator.js ***!
  26697. \******************************************************/
  26698. /*! no static exports found */
  26699. /***/ (function(module, exports, __webpack_require__) {
  26700. "use strict";
  26701. //
  26702. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  26703. * Use of this file is governed by the BSD 3-clause license that
  26704. * can be found in the LICENSE.txt file in the project root.
  26705. */
  26706. ///
  26707. // When we hit an accept state in either the DFA or the ATN, we
  26708. // have to notify the character stream to start buffering characters
  26709. // via {@link IntStream//mark} and record the current state. The current sim state
  26710. // includes the current index into the input, the current line,
  26711. // and current character position in that line. Note that the Lexer is
  26712. // tracking the starting line and characterization of the token. These
  26713. // variables track the "state" of the simulator when it hits an accept state.
  26714. //
  26715. // <p>We track these variables separately for the DFA and ATN simulation
  26716. // because the DFA simulation often has to fail over to the ATN
  26717. // simulation. If the ATN simulation fails, we need the DFA to fall
  26718. // back to its previously accepted state, if any. If the ATN succeeds,
  26719. // then the ATN does the accept and the DFA simulator that invoked it
  26720. // can simply return the predicted token type.</p>
  26721. ///
  26722. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  26723. var Lexer = __webpack_require__(/*! ./../Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  26724. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  26725. var ATNSimulator = __webpack_require__(/*! ./ATNSimulator */ "./node_modules/antlr4/atn/ATNSimulator.js").ATNSimulator;
  26726. var DFAState = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  26727. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  26728. var OrderedATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").OrderedATNConfigSet;
  26729. var PredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").PredictionContext;
  26730. var SingletonPredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").SingletonPredictionContext;
  26731. var RuleStopState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  26732. var LexerATNConfig = __webpack_require__(/*! ./ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").LexerATNConfig;
  26733. var Transition = __webpack_require__(/*! ./Transition */ "./node_modules/antlr4/atn/Transition.js").Transition;
  26734. var LexerActionExecutor = __webpack_require__(/*! ./LexerActionExecutor */ "./node_modules/antlr4/atn/LexerActionExecutor.js").LexerActionExecutor;
  26735. var LexerNoViableAltException = __webpack_require__(/*! ./../error/Errors */ "./node_modules/antlr4/error/Errors.js").LexerNoViableAltException;
  26736. function resetSimState(sim) {
  26737. sim.index = -1;
  26738. sim.line = 0;
  26739. sim.column = -1;
  26740. sim.dfaState = null;
  26741. }
  26742. function SimState() {
  26743. resetSimState(this);
  26744. return this;
  26745. }
  26746. SimState.prototype.reset = function () {
  26747. resetSimState(this);
  26748. };
  26749. function LexerATNSimulator(recog, atn, decisionToDFA, sharedContextCache) {
  26750. ATNSimulator.call(this, atn, sharedContextCache);
  26751. this.decisionToDFA = decisionToDFA;
  26752. this.recog = recog;
  26753. // The current token's starting index into the character stream.
  26754. // Shared across DFA to ATN simulation in case the ATN fails and the
  26755. // DFA did not have a previous accept state. In this case, we use the
  26756. // ATN-generated exception object.
  26757. this.startIndex = -1;
  26758. // line number 1..n within the input///
  26759. this.line = 1;
  26760. // The index of the character relative to the beginning of the line
  26761. // 0..n-1///
  26762. this.column = 0;
  26763. this.mode = Lexer.DEFAULT_MODE;
  26764. // Used during DFA/ATN exec to record the most recent accept configuration
  26765. // info
  26766. this.prevAccept = new SimState();
  26767. // done
  26768. return this;
  26769. }
  26770. LexerATNSimulator.prototype = Object.create(ATNSimulator.prototype);
  26771. LexerATNSimulator.prototype.constructor = LexerATNSimulator;
  26772. LexerATNSimulator.debug = false;
  26773. LexerATNSimulator.dfa_debug = false;
  26774. LexerATNSimulator.MIN_DFA_EDGE = 0;
  26775. LexerATNSimulator.MAX_DFA_EDGE = 127; // forces unicode to stay in ATN
  26776. LexerATNSimulator.match_calls = 0;
  26777. LexerATNSimulator.prototype.copyState = function (simulator) {
  26778. this.column = simulator.column;
  26779. this.line = simulator.line;
  26780. this.mode = simulator.mode;
  26781. this.startIndex = simulator.startIndex;
  26782. };
  26783. LexerATNSimulator.prototype.match = function (input, mode) {
  26784. this.match_calls += 1;
  26785. this.mode = mode;
  26786. var mark = input.mark();
  26787. try {
  26788. this.startIndex = input.index;
  26789. this.prevAccept.reset();
  26790. var dfa = this.decisionToDFA[mode];
  26791. if (dfa.s0 === null) {
  26792. return this.matchATN(input);
  26793. } else {
  26794. return this.execATN(input, dfa.s0);
  26795. }
  26796. } finally {
  26797. input.release(mark);
  26798. }
  26799. };
  26800. LexerATNSimulator.prototype.reset = function () {
  26801. this.prevAccept.reset();
  26802. this.startIndex = -1;
  26803. this.line = 1;
  26804. this.column = 0;
  26805. this.mode = Lexer.DEFAULT_MODE;
  26806. };
  26807. LexerATNSimulator.prototype.matchATN = function (input) {
  26808. var startState = this.atn.modeToStartState[this.mode];
  26809. if (LexerATNSimulator.debug) {
  26810. console.log("matchATN mode " + this.mode + " start: " + startState);
  26811. }
  26812. var old_mode = this.mode;
  26813. var s0_closure = this.computeStartState(input, startState);
  26814. var suppressEdge = s0_closure.hasSemanticContext;
  26815. s0_closure.hasSemanticContext = false;
  26816. var next = this.addDFAState(s0_closure);
  26817. if (!suppressEdge) {
  26818. this.decisionToDFA[this.mode].s0 = next;
  26819. }
  26820. var predict = this.execATN(input, next);
  26821. if (LexerATNSimulator.debug) {
  26822. console.log("DFA after matchATN: " + this.decisionToDFA[old_mode].toLexerString());
  26823. }
  26824. return predict;
  26825. };
  26826. LexerATNSimulator.prototype.execATN = function (input, ds0) {
  26827. if (LexerATNSimulator.debug) {
  26828. console.log("start state closure=" + ds0.configs);
  26829. }
  26830. if (ds0.isAcceptState) {
  26831. // allow zero-length tokens
  26832. this.captureSimState(this.prevAccept, input, ds0);
  26833. }
  26834. var t = input.LA(1);
  26835. var s = ds0; // s is current/from DFA state
  26836. while (true) {
  26837. // while more work
  26838. if (LexerATNSimulator.debug) {
  26839. console.log("execATN loop starting closure: " + s.configs);
  26840. }
  26841. // As we move src->trg, src->trg, we keep track of the previous trg to
  26842. // avoid looking up the DFA state again, which is expensive.
  26843. // If the previous target was already part of the DFA, we might
  26844. // be able to avoid doing a reach operation upon t. If s!=null,
  26845. // it means that semantic predicates didn't prevent us from
  26846. // creating a DFA state. Once we know s!=null, we check to see if
  26847. // the DFA state has an edge already for t. If so, we can just reuse
  26848. // it's configuration set; there's no point in re-computing it.
  26849. // This is kind of like doing DFA simulation within the ATN
  26850. // simulation because DFA simulation is really just a way to avoid
  26851. // computing reach/closure sets. Technically, once we know that
  26852. // we have a previously added DFA state, we could jump over to
  26853. // the DFA simulator. But, that would mean popping back and forth
  26854. // a lot and making things more complicated algorithmically.
  26855. // This optimization makes a lot of sense for loops within DFA.
  26856. // A character will take us back to an existing DFA state
  26857. // that already has lots of edges out of it. e.g., .* in comments.
  26858. // print("Target for:" + str(s) + " and:" + str(t))
  26859. var target = this.getExistingTargetState(s, t);
  26860. // print("Existing:" + str(target))
  26861. if (target === null) {
  26862. target = this.computeTargetState(input, s, t);
  26863. // print("Computed:" + str(target))
  26864. }
  26865. if (target === ATNSimulator.ERROR) {
  26866. break;
  26867. }
  26868. // If this is a consumable input element, make sure to consume before
  26869. // capturing the accept state so the input index, line, and char
  26870. // position accurately reflect the state of the interpreter at the
  26871. // end of the token.
  26872. if (t !== Token.EOF) {
  26873. this.consume(input);
  26874. }
  26875. if (target.isAcceptState) {
  26876. this.captureSimState(this.prevAccept, input, target);
  26877. if (t === Token.EOF) {
  26878. break;
  26879. }
  26880. }
  26881. t = input.LA(1);
  26882. s = target; // flip; current DFA target becomes new src/from state
  26883. }
  26884. return this.failOrAccept(this.prevAccept, input, s.configs, t);
  26885. };
  26886. // Get an existing target state for an edge in the DFA. If the target state
  26887. // for the edge has not yet been computed or is otherwise not available,
  26888. // this method returns {@code null}.
  26889. //
  26890. // @param s The current DFA state
  26891. // @param t The next input symbol
  26892. // @return The existing target DFA state for the given input symbol
  26893. // {@code t}, or {@code null} if the target state for this edge is not
  26894. // already cached
  26895. LexerATNSimulator.prototype.getExistingTargetState = function (s, t) {
  26896. if (s.edges === null || t < LexerATNSimulator.MIN_DFA_EDGE || t > LexerATNSimulator.MAX_DFA_EDGE) {
  26897. return null;
  26898. }
  26899. var target = s.edges[t - LexerATNSimulator.MIN_DFA_EDGE];
  26900. if (target === undefined) {
  26901. target = null;
  26902. }
  26903. if (LexerATNSimulator.debug && target !== null) {
  26904. console.log("reuse state " + s.stateNumber + " edge to " + target.stateNumber);
  26905. }
  26906. return target;
  26907. };
  26908. // Compute a target state for an edge in the DFA, and attempt to add the
  26909. // computed state and corresponding edge to the DFA.
  26910. //
  26911. // @param input The input stream
  26912. // @param s The current DFA state
  26913. // @param t The next input symbol
  26914. //
  26915. // @return The computed target DFA state for the given input symbol
  26916. // {@code t}. If {@code t} does not lead to a valid DFA state, this method
  26917. // returns {@link //ERROR}.
  26918. LexerATNSimulator.prototype.computeTargetState = function (input, s, t) {
  26919. var reach = new OrderedATNConfigSet();
  26920. // if we don't find an existing DFA state
  26921. // Fill reach starting from closure, following t transitions
  26922. this.getReachableConfigSet(input, s.configs, reach, t);
  26923. if (reach.items.length === 0) {
  26924. // we got nowhere on t from s
  26925. if (!reach.hasSemanticContext) {
  26926. // we got nowhere on t, don't throw out this knowledge; it'd
  26927. // cause a failover from DFA later.
  26928. this.addDFAEdge(s, t, ATNSimulator.ERROR);
  26929. }
  26930. // stop when we can't match any more char
  26931. return ATNSimulator.ERROR;
  26932. }
  26933. // Add an edge from s to target DFA found/created for reach
  26934. return this.addDFAEdge(s, t, null, reach);
  26935. };
  26936. LexerATNSimulator.prototype.failOrAccept = function (prevAccept, input, reach, t) {
  26937. if (this.prevAccept.dfaState !== null) {
  26938. var lexerActionExecutor = prevAccept.dfaState.lexerActionExecutor;
  26939. this.accept(input, lexerActionExecutor, this.startIndex, prevAccept.index, prevAccept.line, prevAccept.column);
  26940. return prevAccept.dfaState.prediction;
  26941. } else {
  26942. // if no accept and EOF is first char, return EOF
  26943. if (t === Token.EOF && input.index === this.startIndex) {
  26944. return Token.EOF;
  26945. }
  26946. throw new LexerNoViableAltException(this.recog, input, this.startIndex, reach);
  26947. }
  26948. };
  26949. // Given a starting configuration set, figure out all ATN configurations
  26950. // we can reach upon input {@code t}. Parameter {@code reach} is a return
  26951. // parameter.
  26952. LexerATNSimulator.prototype.getReachableConfigSet = function (input, closure, reach, t) {
  26953. // this is used to skip processing for configs which have a lower priority
  26954. // than a config that already reached an accept state for the same rule
  26955. var skipAlt = ATN.INVALID_ALT_NUMBER;
  26956. for (var i = 0; i < closure.items.length; i++) {
  26957. var cfg = closure.items[i];
  26958. var currentAltReachedAcceptState = cfg.alt === skipAlt;
  26959. if (currentAltReachedAcceptState && cfg.passedThroughNonGreedyDecision) {
  26960. continue;
  26961. }
  26962. if (LexerATNSimulator.debug) {
  26963. console.log("testing %s at %s\n", this.getTokenName(t), cfg.toString(this.recog, true));
  26964. }
  26965. for (var j = 0; j < cfg.state.transitions.length; j++) {
  26966. var trans = cfg.state.transitions[j]; // for each transition
  26967. var target = this.getReachableTarget(trans, t);
  26968. if (target !== null) {
  26969. var lexerActionExecutor = cfg.lexerActionExecutor;
  26970. if (lexerActionExecutor !== null) {
  26971. lexerActionExecutor = lexerActionExecutor.fixOffsetBeforeMatch(input.index - this.startIndex);
  26972. }
  26973. var treatEofAsEpsilon = t === Token.EOF;
  26974. var config = new LexerATNConfig({ state: target, lexerActionExecutor: lexerActionExecutor }, cfg);
  26975. if (this.closure(input, config, reach, currentAltReachedAcceptState, true, treatEofAsEpsilon)) {
  26976. // any remaining configs for this alt have a lower priority
  26977. // than the one that just reached an accept state.
  26978. skipAlt = cfg.alt;
  26979. }
  26980. }
  26981. }
  26982. }
  26983. };
  26984. LexerATNSimulator.prototype.accept = function (input, lexerActionExecutor, startIndex, index, line, charPos) {
  26985. if (LexerATNSimulator.debug) {
  26986. console.log("ACTION %s\n", lexerActionExecutor);
  26987. }
  26988. // seek to after last char in token
  26989. input.seek(index);
  26990. this.line = line;
  26991. this.column = charPos;
  26992. if (lexerActionExecutor !== null && this.recog !== null) {
  26993. lexerActionExecutor.execute(this.recog, input, startIndex);
  26994. }
  26995. };
  26996. LexerATNSimulator.prototype.getReachableTarget = function (trans, t) {
  26997. if (trans.matches(t, 0, Lexer.MAX_CHAR_VALUE)) {
  26998. return trans.target;
  26999. } else {
  27000. return null;
  27001. }
  27002. };
  27003. LexerATNSimulator.prototype.computeStartState = function (input, p) {
  27004. var initialContext = PredictionContext.EMPTY;
  27005. var configs = new OrderedATNConfigSet();
  27006. for (var i = 0; i < p.transitions.length; i++) {
  27007. var target = p.transitions[i].target;
  27008. var cfg = new LexerATNConfig({ state: target, alt: i + 1, context: initialContext }, null);
  27009. this.closure(input, cfg, configs, false, false, false);
  27010. }
  27011. return configs;
  27012. };
  27013. // Since the alternatives within any lexer decision are ordered by
  27014. // preference, this method stops pursuing the closure as soon as an accept
  27015. // state is reached. After the first accept state is reached by depth-first
  27016. // search from {@code config}, all other (potentially reachable) states for
  27017. // this rule would have a lower priority.
  27018. //
  27019. // @return {@code true} if an accept state is reached, otherwise
  27020. // {@code false}.
  27021. LexerATNSimulator.prototype.closure = function (input, config, configs, currentAltReachedAcceptState, speculative, treatEofAsEpsilon) {
  27022. var cfg = null;
  27023. if (LexerATNSimulator.debug) {
  27024. console.log("closure(" + config.toString(this.recog, true) + ")");
  27025. }
  27026. if (config.state instanceof RuleStopState) {
  27027. if (LexerATNSimulator.debug) {
  27028. if (this.recog !== null) {
  27029. console.log("closure at %s rule stop %s\n", this.recog.ruleNames[config.state.ruleIndex], config);
  27030. } else {
  27031. console.log("closure at rule stop %s\n", config);
  27032. }
  27033. }
  27034. if (config.context === null || config.context.hasEmptyPath()) {
  27035. if (config.context === null || config.context.isEmpty()) {
  27036. configs.add(config);
  27037. return true;
  27038. } else {
  27039. configs.add(new LexerATNConfig({ state: config.state, context: PredictionContext.EMPTY }, config));
  27040. currentAltReachedAcceptState = true;
  27041. }
  27042. }
  27043. if (config.context !== null && !config.context.isEmpty()) {
  27044. for (var i = 0; i < config.context.length; i++) {
  27045. if (config.context.getReturnState(i) !== PredictionContext.EMPTY_RETURN_STATE) {
  27046. var newContext = config.context.getParent(i); // "pop" return state
  27047. var returnState = this.atn.states[config.context.getReturnState(i)];
  27048. cfg = new LexerATNConfig({ state: returnState, context: newContext }, config);
  27049. currentAltReachedAcceptState = this.closure(input, cfg, configs, currentAltReachedAcceptState, speculative, treatEofAsEpsilon);
  27050. }
  27051. }
  27052. }
  27053. return currentAltReachedAcceptState;
  27054. }
  27055. // optimization
  27056. if (!config.state.epsilonOnlyTransitions) {
  27057. if (!currentAltReachedAcceptState || !config.passedThroughNonGreedyDecision) {
  27058. configs.add(config);
  27059. }
  27060. }
  27061. for (var j = 0; j < config.state.transitions.length; j++) {
  27062. var trans = config.state.transitions[j];
  27063. cfg = this.getEpsilonTarget(input, config, trans, configs, speculative, treatEofAsEpsilon);
  27064. if (cfg !== null) {
  27065. currentAltReachedAcceptState = this.closure(input, cfg, configs, currentAltReachedAcceptState, speculative, treatEofAsEpsilon);
  27066. }
  27067. }
  27068. return currentAltReachedAcceptState;
  27069. };
  27070. // side-effect: can alter configs.hasSemanticContext
  27071. LexerATNSimulator.prototype.getEpsilonTarget = function (input, config, trans, configs, speculative, treatEofAsEpsilon) {
  27072. var cfg = null;
  27073. if (trans.serializationType === Transition.RULE) {
  27074. var newContext = SingletonPredictionContext.create(config.context, trans.followState.stateNumber);
  27075. cfg = new LexerATNConfig({ state: trans.target, context: newContext }, config);
  27076. } else if (trans.serializationType === Transition.PRECEDENCE) {
  27077. throw "Precedence predicates are not supported in lexers.";
  27078. } else if (trans.serializationType === Transition.PREDICATE) {
  27079. // Track traversing semantic predicates. If we traverse,
  27080. // we cannot add a DFA state for this "reach" computation
  27081. // because the DFA would not test the predicate again in the
  27082. // future. Rather than creating collections of semantic predicates
  27083. // like v3 and testing them on prediction, v4 will test them on the
  27084. // fly all the time using the ATN not the DFA. This is slower but
  27085. // semantically it's not used that often. One of the key elements to
  27086. // this predicate mechanism is not adding DFA states that see
  27087. // predicates immediately afterwards in the ATN. For example,
  27088. // a : ID {p1}? | ID {p2}? ;
  27089. // should create the start state for rule 'a' (to save start state
  27090. // competition), but should not create target of ID state. The
  27091. // collection of ATN states the following ID references includes
  27092. // states reached by traversing predicates. Since this is when we
  27093. // test them, we cannot cash the DFA state target of ID.
  27094. if (LexerATNSimulator.debug) {
  27095. console.log("EVAL rule " + trans.ruleIndex + ":" + trans.predIndex);
  27096. }
  27097. configs.hasSemanticContext = true;
  27098. if (this.evaluatePredicate(input, trans.ruleIndex, trans.predIndex, speculative)) {
  27099. cfg = new LexerATNConfig({ state: trans.target }, config);
  27100. }
  27101. } else if (trans.serializationType === Transition.ACTION) {
  27102. if (config.context === null || config.context.hasEmptyPath()) {
  27103. // execute actions anywhere in the start rule for a token.
  27104. //
  27105. // TODO: if the entry rule is invoked recursively, some
  27106. // actions may be executed during the recursive call. The
  27107. // problem can appear when hasEmptyPath() is true but
  27108. // isEmpty() is false. In this case, the config needs to be
  27109. // split into two contexts - one with just the empty path
  27110. // and another with everything but the empty path.
  27111. // Unfortunately, the current algorithm does not allow
  27112. // getEpsilonTarget to return two configurations, so
  27113. // additional modifications are needed before we can support
  27114. // the split operation.
  27115. var lexerActionExecutor = LexerActionExecutor.append(config.lexerActionExecutor, this.atn.lexerActions[trans.actionIndex]);
  27116. cfg = new LexerATNConfig({ state: trans.target, lexerActionExecutor: lexerActionExecutor }, config);
  27117. } else {
  27118. // ignore actions in referenced rules
  27119. cfg = new LexerATNConfig({ state: trans.target }, config);
  27120. }
  27121. } else if (trans.serializationType === Transition.EPSILON) {
  27122. cfg = new LexerATNConfig({ state: trans.target }, config);
  27123. } else if (trans.serializationType === Transition.ATOM || trans.serializationType === Transition.RANGE || trans.serializationType === Transition.SET) {
  27124. if (treatEofAsEpsilon) {
  27125. if (trans.matches(Token.EOF, 0, Lexer.MAX_CHAR_VALUE)) {
  27126. cfg = new LexerATNConfig({ state: trans.target }, config);
  27127. }
  27128. }
  27129. }
  27130. return cfg;
  27131. };
  27132. // Evaluate a predicate specified in the lexer.
  27133. //
  27134. // <p>If {@code speculative} is {@code true}, this method was called before
  27135. // {@link //consume} for the matched character. This method should call
  27136. // {@link //consume} before evaluating the predicate to ensure position
  27137. // sensitive values, including {@link Lexer//getText}, {@link Lexer//getLine},
  27138. // and {@link Lexer//getcolumn}, properly reflect the current
  27139. // lexer state. This method should restore {@code input} and the simulator
  27140. // to the original state before returning (i.e. undo the actions made by the
  27141. // call to {@link //consume}.</p>
  27142. //
  27143. // @param input The input stream.
  27144. // @param ruleIndex The rule containing the predicate.
  27145. // @param predIndex The index of the predicate within the rule.
  27146. // @param speculative {@code true} if the current index in {@code input} is
  27147. // one character before the predicate's location.
  27148. //
  27149. // @return {@code true} if the specified predicate evaluates to
  27150. // {@code true}.
  27151. // /
  27152. LexerATNSimulator.prototype.evaluatePredicate = function (input, ruleIndex, predIndex, speculative) {
  27153. // assume true if no recognizer was provided
  27154. if (this.recog === null) {
  27155. return true;
  27156. }
  27157. if (!speculative) {
  27158. return this.recog.sempred(null, ruleIndex, predIndex);
  27159. }
  27160. var savedcolumn = this.column;
  27161. var savedLine = this.line;
  27162. var index = input.index;
  27163. var marker = input.mark();
  27164. try {
  27165. this.consume(input);
  27166. return this.recog.sempred(null, ruleIndex, predIndex);
  27167. } finally {
  27168. this.column = savedcolumn;
  27169. this.line = savedLine;
  27170. input.seek(index);
  27171. input.release(marker);
  27172. }
  27173. };
  27174. LexerATNSimulator.prototype.captureSimState = function (settings, input, dfaState) {
  27175. settings.index = input.index;
  27176. settings.line = this.line;
  27177. settings.column = this.column;
  27178. settings.dfaState = dfaState;
  27179. };
  27180. LexerATNSimulator.prototype.addDFAEdge = function (from_, tk, to, cfgs) {
  27181. if (to === undefined) {
  27182. to = null;
  27183. }
  27184. if (cfgs === undefined) {
  27185. cfgs = null;
  27186. }
  27187. if (to === null && cfgs !== null) {
  27188. // leading to this call, ATNConfigSet.hasSemanticContext is used as a
  27189. // marker indicating dynamic predicate evaluation makes this edge
  27190. // dependent on the specific input sequence, so the static edge in the
  27191. // DFA should be omitted. The target DFAState is still created since
  27192. // execATN has the ability to resynchronize with the DFA state cache
  27193. // following the predicate evaluation step.
  27194. //
  27195. // TJP notes: next time through the DFA, we see a pred again and eval.
  27196. // If that gets us to a previously created (but dangling) DFA
  27197. // state, we can continue in pure DFA mode from there.
  27198. // /
  27199. var suppressEdge = cfgs.hasSemanticContext;
  27200. cfgs.hasSemanticContext = false;
  27201. to = this.addDFAState(cfgs);
  27202. if (suppressEdge) {
  27203. return to;
  27204. }
  27205. }
  27206. // add the edge
  27207. if (tk < LexerATNSimulator.MIN_DFA_EDGE || tk > LexerATNSimulator.MAX_DFA_EDGE) {
  27208. // Only track edges within the DFA bounds
  27209. return to;
  27210. }
  27211. if (LexerATNSimulator.debug) {
  27212. console.log("EDGE " + from_ + " -> " + to + " upon " + tk);
  27213. }
  27214. if (from_.edges === null) {
  27215. // make room for tokens 1..n and -1 masquerading as index 0
  27216. from_.edges = [];
  27217. }
  27218. from_.edges[tk - LexerATNSimulator.MIN_DFA_EDGE] = to; // connect
  27219. return to;
  27220. };
  27221. // Add a new DFA state if there isn't one with this set of
  27222. // configurations already. This method also detects the first
  27223. // configuration containing an ATN rule stop state. Later, when
  27224. // traversing the DFA, we will know which rule to accept.
  27225. LexerATNSimulator.prototype.addDFAState = function (configs) {
  27226. var proposed = new DFAState(null, configs);
  27227. var firstConfigWithRuleStopState = null;
  27228. for (var i = 0; i < configs.items.length; i++) {
  27229. var cfg = configs.items[i];
  27230. if (cfg.state instanceof RuleStopState) {
  27231. firstConfigWithRuleStopState = cfg;
  27232. break;
  27233. }
  27234. }
  27235. if (firstConfigWithRuleStopState !== null) {
  27236. proposed.isAcceptState = true;
  27237. proposed.lexerActionExecutor = firstConfigWithRuleStopState.lexerActionExecutor;
  27238. proposed.prediction = this.atn.ruleToTokenType[firstConfigWithRuleStopState.state.ruleIndex];
  27239. }
  27240. var dfa = this.decisionToDFA[this.mode];
  27241. var existing = dfa.states.get(proposed);
  27242. if (existing !== null) {
  27243. return existing;
  27244. }
  27245. var newState = proposed;
  27246. newState.stateNumber = dfa.states.length;
  27247. configs.setReadonly(true);
  27248. newState.configs = configs;
  27249. dfa.states.add(newState);
  27250. return newState;
  27251. };
  27252. LexerATNSimulator.prototype.getDFA = function (mode) {
  27253. return this.decisionToDFA[mode];
  27254. };
  27255. // Get the text matched so far for the current token.
  27256. LexerATNSimulator.prototype.getText = function (input) {
  27257. // index is first lookahead char, don't include.
  27258. return input.getText(this.startIndex, input.index - 1);
  27259. };
  27260. LexerATNSimulator.prototype.consume = function (input) {
  27261. var curChar = input.LA(1);
  27262. if (curChar === "\n".charCodeAt(0)) {
  27263. this.line += 1;
  27264. this.column = 0;
  27265. } else {
  27266. this.column += 1;
  27267. }
  27268. input.consume();
  27269. };
  27270. LexerATNSimulator.prototype.getTokenName = function (tt) {
  27271. if (tt === -1) {
  27272. return "EOF";
  27273. } else {
  27274. return "'" + String.fromCharCode(tt) + "'";
  27275. }
  27276. };
  27277. exports.LexerATNSimulator = LexerATNSimulator;
  27278. /***/ }),
  27279. /***/ "./node_modules/antlr4/atn/LexerAction.js":
  27280. /*!************************************************!*\
  27281. !*** ./node_modules/antlr4/atn/LexerAction.js ***!
  27282. \************************************************/
  27283. /*! no static exports found */
  27284. /***/ (function(module, exports, __webpack_require__) {
  27285. "use strict";
  27286. //
  27287. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27288. * Use of this file is governed by the BSD 3-clause license that
  27289. * can be found in the LICENSE.txt file in the project root.
  27290. */
  27291. //
  27292. function LexerActionType() {}
  27293. LexerActionType.CHANNEL = 0; //The type of a {@link LexerChannelAction} action.
  27294. LexerActionType.CUSTOM = 1; //The type of a {@link LexerCustomAction} action.
  27295. LexerActionType.MODE = 2; //The type of a {@link LexerModeAction} action.
  27296. LexerActionType.MORE = 3; //The type of a {@link LexerMoreAction} action.
  27297. LexerActionType.POP_MODE = 4; //The type of a {@link LexerPopModeAction} action.
  27298. LexerActionType.PUSH_MODE = 5; //The type of a {@link LexerPushModeAction} action.
  27299. LexerActionType.SKIP = 6; //The type of a {@link LexerSkipAction} action.
  27300. LexerActionType.TYPE = 7; //The type of a {@link LexerTypeAction} action.
  27301. function LexerAction(action) {
  27302. this.actionType = action;
  27303. this.isPositionDependent = false;
  27304. return this;
  27305. }
  27306. LexerAction.prototype.hashCode = function () {
  27307. var hash = new Hash();
  27308. this.updateHashCode(hash);
  27309. return hash.finish();
  27310. };
  27311. LexerAction.prototype.updateHashCode = function (hash) {
  27312. hash.update(this.actionType);
  27313. };
  27314. LexerAction.prototype.equals = function (other) {
  27315. return this === other;
  27316. };
  27317. //
  27318. // Implements the {@code skip} lexer action by calling {@link Lexer//skip}.
  27319. //
  27320. // <p>The {@code skip} command does not have any parameters, so this action is
  27321. // implemented as a singleton instance exposed by {@link //INSTANCE}.</p>
  27322. function LexerSkipAction() {
  27323. LexerAction.call(this, LexerActionType.SKIP);
  27324. return this;
  27325. }
  27326. LexerSkipAction.prototype = Object.create(LexerAction.prototype);
  27327. LexerSkipAction.prototype.constructor = LexerSkipAction;
  27328. // Provides a singleton instance of this parameterless lexer action.
  27329. LexerSkipAction.INSTANCE = new LexerSkipAction();
  27330. LexerSkipAction.prototype.execute = function (lexer) {
  27331. lexer.skip();
  27332. };
  27333. LexerSkipAction.prototype.toString = function () {
  27334. return "skip";
  27335. };
  27336. // Implements the {@code type} lexer action by calling {@link Lexer//setType}
  27337. // with the assigned type.
  27338. function LexerTypeAction(type) {
  27339. LexerAction.call(this, LexerActionType.TYPE);
  27340. this.type = type;
  27341. return this;
  27342. }
  27343. LexerTypeAction.prototype = Object.create(LexerAction.prototype);
  27344. LexerTypeAction.prototype.constructor = LexerTypeAction;
  27345. LexerTypeAction.prototype.execute = function (lexer) {
  27346. lexer.type = this.type;
  27347. };
  27348. LexerTypeAction.prototype.updateHashCode = function (hash) {
  27349. hash.update(this.actionType, this.type);
  27350. };
  27351. LexerTypeAction.prototype.equals = function (other) {
  27352. if (this === other) {
  27353. return true;
  27354. } else if (!(other instanceof LexerTypeAction)) {
  27355. return false;
  27356. } else {
  27357. return this.type === other.type;
  27358. }
  27359. };
  27360. LexerTypeAction.prototype.toString = function () {
  27361. return "type(" + this.type + ")";
  27362. };
  27363. // Implements the {@code pushMode} lexer action by calling
  27364. // {@link Lexer//pushMode} with the assigned mode.
  27365. function LexerPushModeAction(mode) {
  27366. LexerAction.call(this, LexerActionType.PUSH_MODE);
  27367. this.mode = mode;
  27368. return this;
  27369. }
  27370. LexerPushModeAction.prototype = Object.create(LexerAction.prototype);
  27371. LexerPushModeAction.prototype.constructor = LexerPushModeAction;
  27372. // <p>This action is implemented by calling {@link Lexer//pushMode} with the
  27373. // value provided by {@link //getMode}.</p>
  27374. LexerPushModeAction.prototype.execute = function (lexer) {
  27375. lexer.pushMode(this.mode);
  27376. };
  27377. LexerPushModeAction.prototype.updateHashCode = function (hash) {
  27378. hash.update(this.actionType, this.mode);
  27379. };
  27380. LexerPushModeAction.prototype.equals = function (other) {
  27381. if (this === other) {
  27382. return true;
  27383. } else if (!(other instanceof LexerPushModeAction)) {
  27384. return false;
  27385. } else {
  27386. return this.mode === other.mode;
  27387. }
  27388. };
  27389. LexerPushModeAction.prototype.toString = function () {
  27390. return "pushMode(" + this.mode + ")";
  27391. };
  27392. // Implements the {@code popMode} lexer action by calling {@link Lexer//popMode}.
  27393. //
  27394. // <p>The {@code popMode} command does not have any parameters, so this action is
  27395. // implemented as a singleton instance exposed by {@link //INSTANCE}.</p>
  27396. function LexerPopModeAction() {
  27397. LexerAction.call(this, LexerActionType.POP_MODE);
  27398. return this;
  27399. }
  27400. LexerPopModeAction.prototype = Object.create(LexerAction.prototype);
  27401. LexerPopModeAction.prototype.constructor = LexerPopModeAction;
  27402. LexerPopModeAction.INSTANCE = new LexerPopModeAction();
  27403. // <p>This action is implemented by calling {@link Lexer//popMode}.</p>
  27404. LexerPopModeAction.prototype.execute = function (lexer) {
  27405. lexer.popMode();
  27406. };
  27407. LexerPopModeAction.prototype.toString = function () {
  27408. return "popMode";
  27409. };
  27410. // Implements the {@code more} lexer action by calling {@link Lexer//more}.
  27411. //
  27412. // <p>The {@code more} command does not have any parameters, so this action is
  27413. // implemented as a singleton instance exposed by {@link //INSTANCE}.</p>
  27414. function LexerMoreAction() {
  27415. LexerAction.call(this, LexerActionType.MORE);
  27416. return this;
  27417. }
  27418. LexerMoreAction.prototype = Object.create(LexerAction.prototype);
  27419. LexerMoreAction.prototype.constructor = LexerMoreAction;
  27420. LexerMoreAction.INSTANCE = new LexerMoreAction();
  27421. // <p>This action is implemented by calling {@link Lexer//popMode}.</p>
  27422. LexerMoreAction.prototype.execute = function (lexer) {
  27423. lexer.more();
  27424. };
  27425. LexerMoreAction.prototype.toString = function () {
  27426. return "more";
  27427. };
  27428. // Implements the {@code mode} lexer action by calling {@link Lexer//mode} with
  27429. // the assigned mode.
  27430. function LexerModeAction(mode) {
  27431. LexerAction.call(this, LexerActionType.MODE);
  27432. this.mode = mode;
  27433. return this;
  27434. }
  27435. LexerModeAction.prototype = Object.create(LexerAction.prototype);
  27436. LexerModeAction.prototype.constructor = LexerModeAction;
  27437. // <p>This action is implemented by calling {@link Lexer//mode} with the
  27438. // value provided by {@link //getMode}.</p>
  27439. LexerModeAction.prototype.execute = function (lexer) {
  27440. lexer.mode(this.mode);
  27441. };
  27442. LexerModeAction.prototype.updateHashCode = function (hash) {
  27443. hash.update(this.actionType, this.mode);
  27444. };
  27445. LexerModeAction.prototype.equals = function (other) {
  27446. if (this === other) {
  27447. return true;
  27448. } else if (!(other instanceof LexerModeAction)) {
  27449. return false;
  27450. } else {
  27451. return this.mode === other.mode;
  27452. }
  27453. };
  27454. LexerModeAction.prototype.toString = function () {
  27455. return "mode(" + this.mode + ")";
  27456. };
  27457. // Executes a custom lexer action by calling {@link Recognizer//action} with the
  27458. // rule and action indexes assigned to the custom action. The implementation of
  27459. // a custom action is added to the generated code for the lexer in an override
  27460. // of {@link Recognizer//action} when the grammar is compiled.
  27461. //
  27462. // <p>This class may represent embedded actions created with the <code>{...}</code>
  27463. // syntax in ANTLR 4, as well as actions created for lexer commands where the
  27464. // command argument could not be evaluated when the grammar was compiled.</p>
  27465. // Constructs a custom lexer action with the specified rule and action
  27466. // indexes.
  27467. //
  27468. // @param ruleIndex The rule index to use for calls to
  27469. // {@link Recognizer//action}.
  27470. // @param actionIndex The action index to use for calls to
  27471. // {@link Recognizer//action}.
  27472. function LexerCustomAction(ruleIndex, actionIndex) {
  27473. LexerAction.call(this, LexerActionType.CUSTOM);
  27474. this.ruleIndex = ruleIndex;
  27475. this.actionIndex = actionIndex;
  27476. this.isPositionDependent = true;
  27477. return this;
  27478. }
  27479. LexerCustomAction.prototype = Object.create(LexerAction.prototype);
  27480. LexerCustomAction.prototype.constructor = LexerCustomAction;
  27481. // <p>Custom actions are implemented by calling {@link Lexer//action} with the
  27482. // appropriate rule and action indexes.</p>
  27483. LexerCustomAction.prototype.execute = function (lexer) {
  27484. lexer.action(null, this.ruleIndex, this.actionIndex);
  27485. };
  27486. LexerCustomAction.prototype.updateHashCode = function (hash) {
  27487. hash.update(this.actionType, this.ruleIndex, this.actionIndex);
  27488. };
  27489. LexerCustomAction.prototype.equals = function (other) {
  27490. if (this === other) {
  27491. return true;
  27492. } else if (!(other instanceof LexerCustomAction)) {
  27493. return false;
  27494. } else {
  27495. return this.ruleIndex === other.ruleIndex && this.actionIndex === other.actionIndex;
  27496. }
  27497. };
  27498. // Implements the {@code channel} lexer action by calling
  27499. // {@link Lexer//setChannel} with the assigned channel.
  27500. // Constructs a new {@code channel} action with the specified channel value.
  27501. // @param channel The channel value to pass to {@link Lexer//setChannel}.
  27502. function LexerChannelAction(channel) {
  27503. LexerAction.call(this, LexerActionType.CHANNEL);
  27504. this.channel = channel;
  27505. return this;
  27506. }
  27507. LexerChannelAction.prototype = Object.create(LexerAction.prototype);
  27508. LexerChannelAction.prototype.constructor = LexerChannelAction;
  27509. // <p>This action is implemented by calling {@link Lexer//setChannel} with the
  27510. // value provided by {@link //getChannel}.</p>
  27511. LexerChannelAction.prototype.execute = function (lexer) {
  27512. lexer._channel = this.channel;
  27513. };
  27514. LexerChannelAction.prototype.updateHashCode = function (hash) {
  27515. hash.update(this.actionType, this.channel);
  27516. };
  27517. LexerChannelAction.prototype.equals = function (other) {
  27518. if (this === other) {
  27519. return true;
  27520. } else if (!(other instanceof LexerChannelAction)) {
  27521. return false;
  27522. } else {
  27523. return this.channel === other.channel;
  27524. }
  27525. };
  27526. LexerChannelAction.prototype.toString = function () {
  27527. return "channel(" + this.channel + ")";
  27528. };
  27529. // This implementation of {@link LexerAction} is used for tracking input offsets
  27530. // for position-dependent actions within a {@link LexerActionExecutor}.
  27531. //
  27532. // <p>This action is not serialized as part of the ATN, and is only required for
  27533. // position-dependent lexer actions which appear at a location other than the
  27534. // end of a rule. For more information about DFA optimizations employed for
  27535. // lexer actions, see {@link LexerActionExecutor//append} and
  27536. // {@link LexerActionExecutor//fixOffsetBeforeMatch}.</p>
  27537. // Constructs a new indexed custom action by associating a character offset
  27538. // with a {@link LexerAction}.
  27539. //
  27540. // <p>Note: This class is only required for lexer actions for which
  27541. // {@link LexerAction//isPositionDependent} returns {@code true}.</p>
  27542. //
  27543. // @param offset The offset into the input {@link CharStream}, relative to
  27544. // the token start index, at which the specified lexer action should be
  27545. // executed.
  27546. // @param action The lexer action to execute at a particular offset in the
  27547. // input {@link CharStream}.
  27548. function LexerIndexedCustomAction(offset, action) {
  27549. LexerAction.call(this, action.actionType);
  27550. this.offset = offset;
  27551. this.action = action;
  27552. this.isPositionDependent = true;
  27553. return this;
  27554. }
  27555. LexerIndexedCustomAction.prototype = Object.create(LexerAction.prototype);
  27556. LexerIndexedCustomAction.prototype.constructor = LexerIndexedCustomAction;
  27557. // <p>This method calls {@link //execute} on the result of {@link //getAction}
  27558. // using the provided {@code lexer}.</p>
  27559. LexerIndexedCustomAction.prototype.execute = function (lexer) {
  27560. // assume the input stream position was properly set by the calling code
  27561. this.action.execute(lexer);
  27562. };
  27563. LexerIndexedCustomAction.prototype.updateHashCode = function (hash) {
  27564. hash.update(this.actionType, this.offset, this.action);
  27565. };
  27566. LexerIndexedCustomAction.prototype.equals = function (other) {
  27567. if (this === other) {
  27568. return true;
  27569. } else if (!(other instanceof LexerIndexedCustomAction)) {
  27570. return false;
  27571. } else {
  27572. return this.offset === other.offset && this.action === other.action;
  27573. }
  27574. };
  27575. exports.LexerActionType = LexerActionType;
  27576. exports.LexerSkipAction = LexerSkipAction;
  27577. exports.LexerChannelAction = LexerChannelAction;
  27578. exports.LexerCustomAction = LexerCustomAction;
  27579. exports.LexerIndexedCustomAction = LexerIndexedCustomAction;
  27580. exports.LexerMoreAction = LexerMoreAction;
  27581. exports.LexerTypeAction = LexerTypeAction;
  27582. exports.LexerPushModeAction = LexerPushModeAction;
  27583. exports.LexerPopModeAction = LexerPopModeAction;
  27584. exports.LexerModeAction = LexerModeAction;
  27585. /***/ }),
  27586. /***/ "./node_modules/antlr4/atn/LexerActionExecutor.js":
  27587. /*!********************************************************!*\
  27588. !*** ./node_modules/antlr4/atn/LexerActionExecutor.js ***!
  27589. \********************************************************/
  27590. /*! no static exports found */
  27591. /***/ (function(module, exports, __webpack_require__) {
  27592. "use strict";
  27593. //
  27594. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27595. * Use of this file is governed by the BSD 3-clause license that
  27596. * can be found in the LICENSE.txt file in the project root.
  27597. */
  27598. ///
  27599. // Represents an executor for a sequence of lexer actions which traversed during
  27600. // the matching operation of a lexer rule (token).
  27601. //
  27602. // <p>The executor tracks position information for position-dependent lexer actions
  27603. // efficiently, ensuring that actions appearing only at the end of the rule do
  27604. // not cause bloating of the {@link DFA} created for the lexer.</p>
  27605. var hashStuff = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").hashStuff;
  27606. var LexerIndexedCustomAction = __webpack_require__(/*! ./LexerAction */ "./node_modules/antlr4/atn/LexerAction.js").LexerIndexedCustomAction;
  27607. function LexerActionExecutor(lexerActions) {
  27608. this.lexerActions = lexerActions === null ? [] : lexerActions;
  27609. // Caches the result of {@link //hashCode} since the hash code is an element
  27610. // of the performance-critical {@link LexerATNConfig//hashCode} operation.
  27611. this.cachedHashCode = hashStuff(lexerActions); // "".join([str(la) for la in
  27612. // lexerActions]))
  27613. return this;
  27614. }
  27615. // Creates a {@link LexerActionExecutor} which executes the actions for
  27616. // the input {@code lexerActionExecutor} followed by a specified
  27617. // {@code lexerAction}.
  27618. //
  27619. // @param lexerActionExecutor The executor for actions already traversed by
  27620. // the lexer while matching a token within a particular
  27621. // {@link LexerATNConfig}. If this is {@code null}, the method behaves as
  27622. // though it were an empty executor.
  27623. // @param lexerAction The lexer action to execute after the actions
  27624. // specified in {@code lexerActionExecutor}.
  27625. //
  27626. // @return A {@link LexerActionExecutor} for executing the combine actions
  27627. // of {@code lexerActionExecutor} and {@code lexerAction}.
  27628. LexerActionExecutor.append = function (lexerActionExecutor, lexerAction) {
  27629. if (lexerActionExecutor === null) {
  27630. return new LexerActionExecutor([lexerAction]);
  27631. }
  27632. var lexerActions = lexerActionExecutor.lexerActions.concat([lexerAction]);
  27633. return new LexerActionExecutor(lexerActions);
  27634. };
  27635. // Creates a {@link LexerActionExecutor} which encodes the current offset
  27636. // for position-dependent lexer actions.
  27637. //
  27638. // <p>Normally, when the executor encounters lexer actions where
  27639. // {@link LexerAction//isPositionDependent} returns {@code true}, it calls
  27640. // {@link IntStream//seek} on the input {@link CharStream} to set the input
  27641. // position to the <em>end</em> of the current token. This behavior provides
  27642. // for efficient DFA representation of lexer actions which appear at the end
  27643. // of a lexer rule, even when the lexer rule matches a variable number of
  27644. // characters.</p>
  27645. //
  27646. // <p>Prior to traversing a match transition in the ATN, the current offset
  27647. // from the token start index is assigned to all position-dependent lexer
  27648. // actions which have not already been assigned a fixed offset. By storing
  27649. // the offsets relative to the token start index, the DFA representation of
  27650. // lexer actions which appear in the middle of tokens remains efficient due
  27651. // to sharing among tokens of the same length, regardless of their absolute
  27652. // position in the input stream.</p>
  27653. //
  27654. // <p>If the current executor already has offsets assigned to all
  27655. // position-dependent lexer actions, the method returns {@code this}.</p>
  27656. //
  27657. // @param offset The current offset to assign to all position-dependent
  27658. // lexer actions which do not already have offsets assigned.
  27659. //
  27660. // @return A {@link LexerActionExecutor} which stores input stream offsets
  27661. // for all position-dependent lexer actions.
  27662. // /
  27663. LexerActionExecutor.prototype.fixOffsetBeforeMatch = function (offset) {
  27664. var updatedLexerActions = null;
  27665. for (var i = 0; i < this.lexerActions.length; i++) {
  27666. if (this.lexerActions[i].isPositionDependent && !(this.lexerActions[i] instanceof LexerIndexedCustomAction)) {
  27667. if (updatedLexerActions === null) {
  27668. updatedLexerActions = this.lexerActions.concat([]);
  27669. }
  27670. updatedLexerActions[i] = new LexerIndexedCustomAction(offset, this.lexerActions[i]);
  27671. }
  27672. }
  27673. if (updatedLexerActions === null) {
  27674. return this;
  27675. } else {
  27676. return new LexerActionExecutor(updatedLexerActions);
  27677. }
  27678. };
  27679. // Execute the actions encapsulated by this executor within the context of a
  27680. // particular {@link Lexer}.
  27681. //
  27682. // <p>This method calls {@link IntStream//seek} to set the position of the
  27683. // {@code input} {@link CharStream} prior to calling
  27684. // {@link LexerAction//execute} on a position-dependent action. Before the
  27685. // method returns, the input position will be restored to the same position
  27686. // it was in when the method was invoked.</p>
  27687. //
  27688. // @param lexer The lexer instance.
  27689. // @param input The input stream which is the source for the current token.
  27690. // When this method is called, the current {@link IntStream//index} for
  27691. // {@code input} should be the start of the following token, i.e. 1
  27692. // character past the end of the current token.
  27693. // @param startIndex The token start index. This value may be passed to
  27694. // {@link IntStream//seek} to set the {@code input} position to the beginning
  27695. // of the token.
  27696. // /
  27697. LexerActionExecutor.prototype.execute = function (lexer, input, startIndex) {
  27698. var requiresSeek = false;
  27699. var stopIndex = input.index;
  27700. try {
  27701. for (var i = 0; i < this.lexerActions.length; i++) {
  27702. var lexerAction = this.lexerActions[i];
  27703. if (lexerAction instanceof LexerIndexedCustomAction) {
  27704. var offset = lexerAction.offset;
  27705. input.seek(startIndex + offset);
  27706. lexerAction = lexerAction.action;
  27707. requiresSeek = startIndex + offset !== stopIndex;
  27708. } else if (lexerAction.isPositionDependent) {
  27709. input.seek(stopIndex);
  27710. requiresSeek = false;
  27711. }
  27712. lexerAction.execute(lexer);
  27713. }
  27714. } finally {
  27715. if (requiresSeek) {
  27716. input.seek(stopIndex);
  27717. }
  27718. }
  27719. };
  27720. LexerActionExecutor.prototype.hashCode = function () {
  27721. return this.cachedHashCode;
  27722. };
  27723. LexerActionExecutor.prototype.updateHashCode = function (hash) {
  27724. hash.update(this.cachedHashCode);
  27725. };
  27726. LexerActionExecutor.prototype.equals = function (other) {
  27727. if (this === other) {
  27728. return true;
  27729. } else if (!(other instanceof LexerActionExecutor)) {
  27730. return false;
  27731. } else if (this.cachedHashCode != other.cachedHashCode) {
  27732. return false;
  27733. } else if (this.lexerActions.length != other.lexerActions.length) {
  27734. return false;
  27735. } else {
  27736. var numActions = this.lexerActions.length;
  27737. for (var idx = 0; idx < numActions; ++idx) {
  27738. if (!this.lexerActions[idx].equals(other.lexerActions[idx])) {
  27739. return false;
  27740. }
  27741. }
  27742. return true;
  27743. }
  27744. };
  27745. exports.LexerActionExecutor = LexerActionExecutor;
  27746. /***/ }),
  27747. /***/ "./node_modules/antlr4/atn/ParserATNSimulator.js":
  27748. /*!*******************************************************!*\
  27749. !*** ./node_modules/antlr4/atn/ParserATNSimulator.js ***!
  27750. \*******************************************************/
  27751. /*! no static exports found */
  27752. /***/ (function(module, exports, __webpack_require__) {
  27753. "use strict";
  27754. //
  27755. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27756. * Use of this file is governed by the BSD 3-clause license that
  27757. * can be found in the LICENSE.txt file in the project root.
  27758. */
  27759. //
  27760. //
  27761. // The embodiment of the adaptive LL(*), ALL(*), parsing strategy.
  27762. //
  27763. // <p>
  27764. // The basic complexity of the adaptive strategy makes it harder to understand.
  27765. // We begin with ATN simulation to build paths in a DFA. Subsequent prediction
  27766. // requests go through the DFA first. If they reach a state without an edge for
  27767. // the current symbol, the algorithm fails over to the ATN simulation to
  27768. // complete the DFA path for the current input (until it finds a conflict state
  27769. // or uniquely predicting state).</p>
  27770. //
  27771. // <p>
  27772. // All of that is done without using the outer context because we want to create
  27773. // a DFA that is not dependent upon the rule invocation stack when we do a
  27774. // prediction. One DFA works in all contexts. We avoid using context not
  27775. // necessarily because it's slower, although it can be, but because of the DFA
  27776. // caching problem. The closure routine only considers the rule invocation stack
  27777. // created during prediction beginning in the decision rule. For example, if
  27778. // prediction occurs without invoking another rule's ATN, there are no context
  27779. // stacks in the configurations. When lack of context leads to a conflict, we
  27780. // don't know if it's an ambiguity or a weakness in the strong LL(*) parsing
  27781. // strategy (versus full LL(*)).</p>
  27782. //
  27783. // <p>
  27784. // When SLL yields a configuration set with conflict, we rewind the input and
  27785. // retry the ATN simulation, this time using full outer context without adding
  27786. // to the DFA. Configuration context stacks will be the full invocation stacks
  27787. // from the start rule. If we get a conflict using full context, then we can
  27788. // definitively say we have a true ambiguity for that input sequence. If we
  27789. // don't get a conflict, it implies that the decision is sensitive to the outer
  27790. // context. (It is not context-sensitive in the sense of context-sensitive
  27791. // grammars.)</p>
  27792. //
  27793. // <p>
  27794. // The next time we reach this DFA state with an SLL conflict, through DFA
  27795. // simulation, we will again retry the ATN simulation using full context mode.
  27796. // This is slow because we can't save the results and have to "interpret" the
  27797. // ATN each time we get that input.</p>
  27798. //
  27799. // <p>
  27800. // <strong>CACHING FULL CONTEXT PREDICTIONS</strong></p>
  27801. //
  27802. // <p>
  27803. // We could cache results from full context to predicted alternative easily and
  27804. // that saves a lot of time but doesn't work in presence of predicates. The set
  27805. // of visible predicates from the ATN start state changes depending on the
  27806. // context, because closure can fall off the end of a rule. I tried to cache
  27807. // tuples (stack context, semantic context, predicted alt) but it was slower
  27808. // than interpreting and much more complicated. Also required a huge amount of
  27809. // memory. The goal is not to create the world's fastest parser anyway. I'd like
  27810. // to keep this algorithm simple. By launching multiple threads, we can improve
  27811. // the speed of parsing across a large number of files.</p>
  27812. //
  27813. // <p>
  27814. // There is no strict ordering between the amount of input used by SLL vs LL,
  27815. // which makes it really hard to build a cache for full context. Let's say that
  27816. // we have input A B C that leads to an SLL conflict with full context X. That
  27817. // implies that using X we might only use A B but we could also use A B C D to
  27818. // resolve conflict. Input A B C D could predict alternative 1 in one position
  27819. // in the input and A B C E could predict alternative 2 in another position in
  27820. // input. The conflicting SLL configurations could still be non-unique in the
  27821. // full context prediction, which would lead us to requiring more input than the
  27822. // original A B C. To make a prediction cache work, we have to track the exact
  27823. // input used during the previous prediction. That amounts to a cache that maps
  27824. // X to a specific DFA for that context.</p>
  27825. //
  27826. // <p>
  27827. // Something should be done for left-recursive expression predictions. They are
  27828. // likely LL(1) + pred eval. Easier to do the whole SLL unless error and retry
  27829. // with full LL thing Sam does.</p>
  27830. //
  27831. // <p>
  27832. // <strong>AVOIDING FULL CONTEXT PREDICTION</strong></p>
  27833. //
  27834. // <p>
  27835. // We avoid doing full context retry when the outer context is empty, we did not
  27836. // dip into the outer context by falling off the end of the decision state rule,
  27837. // or when we force SLL mode.</p>
  27838. //
  27839. // <p>
  27840. // As an example of the not dip into outer context case, consider as super
  27841. // constructor calls versus function calls. One grammar might look like
  27842. // this:</p>
  27843. //
  27844. // <pre>
  27845. // ctorBody
  27846. // : '{' superCall? stat* '}'
  27847. // ;
  27848. // </pre>
  27849. //
  27850. // <p>
  27851. // Or, you might see something like</p>
  27852. //
  27853. // <pre>
  27854. // stat
  27855. // : superCall ';'
  27856. // | expression ';'
  27857. // | ...
  27858. // ;
  27859. // </pre>
  27860. //
  27861. // <p>
  27862. // In both cases I believe that no closure operations will dip into the outer
  27863. // context. In the first case ctorBody in the worst case will stop at the '}'.
  27864. // In the 2nd case it should stop at the ';'. Both cases should stay within the
  27865. // entry rule and not dip into the outer context.</p>
  27866. //
  27867. // <p>
  27868. // <strong>PREDICATES</strong></p>
  27869. //
  27870. // <p>
  27871. // Predicates are always evaluated if present in either SLL or LL both. SLL and
  27872. // LL simulation deals with predicates differently. SLL collects predicates as
  27873. // it performs closure operations like ANTLR v3 did. It delays predicate
  27874. // evaluation until it reaches and accept state. This allows us to cache the SLL
  27875. // ATN simulation whereas, if we had evaluated predicates on-the-fly during
  27876. // closure, the DFA state configuration sets would be different and we couldn't
  27877. // build up a suitable DFA.</p>
  27878. //
  27879. // <p>
  27880. // When building a DFA accept state during ATN simulation, we evaluate any
  27881. // predicates and return the sole semantically valid alternative. If there is
  27882. // more than 1 alternative, we report an ambiguity. If there are 0 alternatives,
  27883. // we throw an exception. Alternatives without predicates act like they have
  27884. // true predicates. The simple way to think about it is to strip away all
  27885. // alternatives with false predicates and choose the minimum alternative that
  27886. // remains.</p>
  27887. //
  27888. // <p>
  27889. // When we start in the DFA and reach an accept state that's predicated, we test
  27890. // those and return the minimum semantically viable alternative. If no
  27891. // alternatives are viable, we throw an exception.</p>
  27892. //
  27893. // <p>
  27894. // During full LL ATN simulation, closure always evaluates predicates and
  27895. // on-the-fly. This is crucial to reducing the configuration set size during
  27896. // closure. It hits a landmine when parsing with the Java grammar, for example,
  27897. // without this on-the-fly evaluation.</p>
  27898. //
  27899. // <p>
  27900. // <strong>SHARING DFA</strong></p>
  27901. //
  27902. // <p>
  27903. // All instances of the same parser share the same decision DFAs through a
  27904. // static field. Each instance gets its own ATN simulator but they share the
  27905. // same {@link //decisionToDFA} field. They also share a
  27906. // {@link PredictionContextCache} object that makes sure that all
  27907. // {@link PredictionContext} objects are shared among the DFA states. This makes
  27908. // a big size difference.</p>
  27909. //
  27910. // <p>
  27911. // <strong>THREAD SAFETY</strong></p>
  27912. //
  27913. // <p>
  27914. // The {@link ParserATNSimulator} locks on the {@link //decisionToDFA} field when
  27915. // it adds a new DFA object to that array. {@link //addDFAEdge}
  27916. // locks on the DFA for the current decision when setting the
  27917. // {@link DFAState//edges} field. {@link //addDFAState} locks on
  27918. // the DFA for the current decision when looking up a DFA state to see if it
  27919. // already exists. We must make sure that all requests to add DFA states that
  27920. // are equivalent result in the same shared DFA object. This is because lots of
  27921. // threads will be trying to update the DFA at once. The
  27922. // {@link //addDFAState} method also locks inside the DFA lock
  27923. // but this time on the shared context cache when it rebuilds the
  27924. // configurations' {@link PredictionContext} objects using cached
  27925. // subgraphs/nodes. No other locking occurs, even during DFA simulation. This is
  27926. // safe as long as we can guarantee that all threads referencing
  27927. // {@code s.edge[t]} get the same physical target {@link DFAState}, or
  27928. // {@code null}. Once into the DFA, the DFA simulation does not reference the
  27929. // {@link DFA//states} map. It follows the {@link DFAState//edges} field to new
  27930. // targets. The DFA simulator will either find {@link DFAState//edges} to be
  27931. // {@code null}, to be non-{@code null} and {@code dfa.edges[t]} null, or
  27932. // {@code dfa.edges[t]} to be non-null. The
  27933. // {@link //addDFAEdge} method could be racing to set the field
  27934. // but in either case the DFA simulator works; if {@code null}, and requests ATN
  27935. // simulation. It could also race trying to get {@code dfa.edges[t]}, but either
  27936. // way it will work because it's not doing a test and set operation.</p>
  27937. //
  27938. // <p>
  27939. // <strong>Starting with SLL then failing to combined SLL/LL (Two-Stage
  27940. // Parsing)</strong></p>
  27941. //
  27942. // <p>
  27943. // Sam pointed out that if SLL does not give a syntax error, then there is no
  27944. // point in doing full LL, which is slower. We only have to try LL if we get a
  27945. // syntax error. For maximum speed, Sam starts the parser set to pure SLL
  27946. // mode with the {@link BailErrorStrategy}:</p>
  27947. //
  27948. // <pre>
  27949. // parser.{@link Parser//getInterpreter() getInterpreter()}.{@link //setPredictionMode setPredictionMode}{@code (}{@link PredictionMode//SLL}{@code )};
  27950. // parser.{@link Parser//setErrorHandler setErrorHandler}(new {@link BailErrorStrategy}());
  27951. // </pre>
  27952. //
  27953. // <p>
  27954. // If it does not get a syntax error, then we're done. If it does get a syntax
  27955. // error, we need to retry with the combined SLL/LL strategy.</p>
  27956. //
  27957. // <p>
  27958. // The reason this works is as follows. If there are no SLL conflicts, then the
  27959. // grammar is SLL (at least for that input set). If there is an SLL conflict,
  27960. // the full LL analysis must yield a set of viable alternatives which is a
  27961. // subset of the alternatives reported by SLL. If the LL set is a singleton,
  27962. // then the grammar is LL but not SLL. If the LL set is the same size as the SLL
  27963. // set, the decision is SLL. If the LL set has size &gt; 1, then that decision
  27964. // is truly ambiguous on the current input. If the LL set is smaller, then the
  27965. // SLL conflict resolution might choose an alternative that the full LL would
  27966. // rule out as a possibility based upon better context information. If that's
  27967. // the case, then the SLL parse will definitely get an error because the full LL
  27968. // analysis says it's not viable. If SLL conflict resolution chooses an
  27969. // alternative within the LL set, them both SLL and LL would choose the same
  27970. // alternative because they both choose the minimum of multiple conflicting
  27971. // alternatives.</p>
  27972. //
  27973. // <p>
  27974. // Let's say we have a set of SLL conflicting alternatives {@code {1, 2, 3}} and
  27975. // a smaller LL set called <em>s</em>. If <em>s</em> is {@code {2, 3}}, then SLL
  27976. // parsing will get an error because SLL will pursue alternative 1. If
  27977. // <em>s</em> is {@code {1, 2}} or {@code {1, 3}} then both SLL and LL will
  27978. // choose the same alternative because alternative one is the minimum of either
  27979. // set. If <em>s</em> is {@code {2}} or {@code {3}} then SLL will get a syntax
  27980. // error. If <em>s</em> is {@code {1}} then SLL will succeed.</p>
  27981. //
  27982. // <p>
  27983. // Of course, if the input is invalid, then we will get an error for sure in
  27984. // both SLL and LL parsing. Erroneous input will therefore require 2 passes over
  27985. // the input.</p>
  27986. //
  27987. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  27988. var Set = Utils.Set;
  27989. var BitSet = Utils.BitSet;
  27990. var DoubleDict = Utils.DoubleDict;
  27991. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  27992. var ATNState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").ATNState;
  27993. var ATNConfig = __webpack_require__(/*! ./ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").ATNConfig;
  27994. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  27995. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  27996. var DFAState = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  27997. var PredPrediction = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").PredPrediction;
  27998. var ATNSimulator = __webpack_require__(/*! ./ATNSimulator */ "./node_modules/antlr4/atn/ATNSimulator.js").ATNSimulator;
  27999. var PredictionMode = __webpack_require__(/*! ./PredictionMode */ "./node_modules/antlr4/atn/PredictionMode.js").PredictionMode;
  28000. var RuleContext = __webpack_require__(/*! ./../RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  28001. var ParserRuleContext = __webpack_require__(/*! ./../ParserRuleContext */ "./node_modules/antlr4/ParserRuleContext.js").ParserRuleContext;
  28002. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  28003. var StarLoopEntryState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").StarLoopEntryState;
  28004. var RuleStopState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  28005. var PredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").PredictionContext;
  28006. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  28007. var Transitions = __webpack_require__(/*! ./Transition */ "./node_modules/antlr4/atn/Transition.js");
  28008. var Transition = Transitions.Transition;
  28009. var SetTransition = Transitions.SetTransition;
  28010. var NotSetTransition = Transitions.NotSetTransition;
  28011. var RuleTransition = Transitions.RuleTransition;
  28012. var ActionTransition = Transitions.ActionTransition;
  28013. var NoViableAltException = __webpack_require__(/*! ./../error/Errors */ "./node_modules/antlr4/error/Errors.js").NoViableAltException;
  28014. var SingletonPredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").SingletonPredictionContext;
  28015. var predictionContextFromRuleContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").predictionContextFromRuleContext;
  28016. function ParserATNSimulator(parser, atn, decisionToDFA, sharedContextCache) {
  28017. ATNSimulator.call(this, atn, sharedContextCache);
  28018. this.parser = parser;
  28019. this.decisionToDFA = decisionToDFA;
  28020. // SLL, LL, or LL + exact ambig detection?//
  28021. this.predictionMode = PredictionMode.LL;
  28022. // LAME globals to avoid parameters!!!!! I need these down deep in predTransition
  28023. this._input = null;
  28024. this._startIndex = 0;
  28025. this._outerContext = null;
  28026. this._dfa = null;
  28027. // Each prediction operation uses a cache for merge of prediction contexts.
  28028. // Don't keep around as it wastes huge amounts of memory. DoubleKeyMap
  28029. // isn't synchronized but we're ok since two threads shouldn't reuse same
  28030. // parser/atnsim object because it can only handle one input at a time.
  28031. // This maps graphs a and b to merged result c. (a,b)&rarr;c. We can avoid
  28032. // the merge if we ever see a and b again. Note that (b,a)&rarr;c should
  28033. // also be examined during cache lookup.
  28034. //
  28035. this.mergeCache = null;
  28036. return this;
  28037. }
  28038. ParserATNSimulator.prototype = Object.create(ATNSimulator.prototype);
  28039. ParserATNSimulator.prototype.constructor = ParserATNSimulator;
  28040. ParserATNSimulator.prototype.debug = false;
  28041. ParserATNSimulator.prototype.debug_closure = false;
  28042. ParserATNSimulator.prototype.debug_add = false;
  28043. ParserATNSimulator.prototype.debug_list_atn_decisions = false;
  28044. ParserATNSimulator.prototype.dfa_debug = false;
  28045. ParserATNSimulator.prototype.retry_debug = false;
  28046. ParserATNSimulator.prototype.reset = function () {};
  28047. ParserATNSimulator.prototype.adaptivePredict = function (input, decision, outerContext) {
  28048. if (this.debug || this.debug_list_atn_decisions) {
  28049. console.log("adaptivePredict decision " + decision + " exec LA(1)==" + this.getLookaheadName(input) + " line " + input.LT(1).line + ":" + input.LT(1).column);
  28050. }
  28051. this._input = input;
  28052. this._startIndex = input.index;
  28053. this._outerContext = outerContext;
  28054. var dfa = this.decisionToDFA[decision];
  28055. this._dfa = dfa;
  28056. var m = input.mark();
  28057. var index = input.index;
  28058. // Now we are certain to have a specific decision's DFA
  28059. // But, do we still need an initial state?
  28060. try {
  28061. var s0;
  28062. if (dfa.precedenceDfa) {
  28063. // the start state for a precedence DFA depends on the current
  28064. // parser precedence, and is provided by a DFA method.
  28065. s0 = dfa.getPrecedenceStartState(this.parser.getPrecedence());
  28066. } else {
  28067. // the start state for a "regular" DFA is just s0
  28068. s0 = dfa.s0;
  28069. }
  28070. if (s0 === null) {
  28071. if (outerContext === null) {
  28072. outerContext = RuleContext.EMPTY;
  28073. }
  28074. if (this.debug || this.debug_list_atn_decisions) {
  28075. console.log("predictATN decision " + dfa.decision + " exec LA(1)==" + this.getLookaheadName(input) + ", outerContext=" + outerContext.toString(this.parser.ruleNames));
  28076. }
  28077. var fullCtx = false;
  28078. var s0_closure = this.computeStartState(dfa.atnStartState, RuleContext.EMPTY, fullCtx);
  28079. if (dfa.precedenceDfa) {
  28080. // If this is a precedence DFA, we use applyPrecedenceFilter
  28081. // to convert the computed start state to a precedence start
  28082. // state. We then use DFA.setPrecedenceStartState to set the
  28083. // appropriate start state for the precedence level rather
  28084. // than simply setting DFA.s0.
  28085. //
  28086. dfa.s0.configs = s0_closure; // not used for prediction but useful to know start configs anyway
  28087. s0_closure = this.applyPrecedenceFilter(s0_closure);
  28088. s0 = this.addDFAState(dfa, new DFAState(null, s0_closure));
  28089. dfa.setPrecedenceStartState(this.parser.getPrecedence(), s0);
  28090. } else {
  28091. s0 = this.addDFAState(dfa, new DFAState(null, s0_closure));
  28092. dfa.s0 = s0;
  28093. }
  28094. }
  28095. var alt = this.execATN(dfa, s0, input, index, outerContext);
  28096. if (this.debug) {
  28097. console.log("DFA after predictATN: " + dfa.toString(this.parser.literalNames));
  28098. }
  28099. return alt;
  28100. } finally {
  28101. this._dfa = null;
  28102. this.mergeCache = null; // wack cache after each prediction
  28103. input.seek(index);
  28104. input.release(m);
  28105. }
  28106. };
  28107. // Performs ATN simulation to compute a predicted alternative based
  28108. // upon the remaining input, but also updates the DFA cache to avoid
  28109. // having to traverse the ATN again for the same input sequence.
  28110. // There are some key conditions we're looking for after computing a new
  28111. // set of ATN configs (proposed DFA state):
  28112. // if the set is empty, there is no viable alternative for current symbol
  28113. // does the state uniquely predict an alternative?
  28114. // does the state have a conflict that would prevent us from
  28115. // putting it on the work list?
  28116. // We also have some key operations to do:
  28117. // add an edge from previous DFA state to potentially new DFA state, D,
  28118. // upon current symbol but only if adding to work list, which means in all
  28119. // cases except no viable alternative (and possibly non-greedy decisions?)
  28120. // collecting predicates and adding semantic context to DFA accept states
  28121. // adding rule context to context-sensitive DFA accept states
  28122. // consuming an input symbol
  28123. // reporting a conflict
  28124. // reporting an ambiguity
  28125. // reporting a context sensitivity
  28126. // reporting insufficient predicates
  28127. // cover these cases:
  28128. // dead end
  28129. // single alt
  28130. // single alt + preds
  28131. // conflict
  28132. // conflict + preds
  28133. //
  28134. ParserATNSimulator.prototype.execATN = function (dfa, s0, input, startIndex, outerContext) {
  28135. if (this.debug || this.debug_list_atn_decisions) {
  28136. console.log("execATN decision " + dfa.decision + " exec LA(1)==" + this.getLookaheadName(input) + " line " + input.LT(1).line + ":" + input.LT(1).column);
  28137. }
  28138. var alt;
  28139. var previousD = s0;
  28140. if (this.debug) {
  28141. console.log("s0 = " + s0);
  28142. }
  28143. var t = input.LA(1);
  28144. while (true) {
  28145. // while more work
  28146. var D = this.getExistingTargetState(previousD, t);
  28147. if (D === null) {
  28148. D = this.computeTargetState(dfa, previousD, t);
  28149. }
  28150. if (D === ATNSimulator.ERROR) {
  28151. // if any configs in previous dipped into outer context, that
  28152. // means that input up to t actually finished entry rule
  28153. // at least for SLL decision. Full LL doesn't dip into outer
  28154. // so don't need special case.
  28155. // We will get an error no matter what so delay until after
  28156. // decision; better error message. Also, no reachable target
  28157. // ATN states in SLL implies LL will also get nowhere.
  28158. // If conflict in states that dip out, choose min since we
  28159. // will get error no matter what.
  28160. var e = this.noViableAlt(input, outerContext, previousD.configs, startIndex);
  28161. input.seek(startIndex);
  28162. alt = this.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule(previousD.configs, outerContext);
  28163. if (alt !== ATN.INVALID_ALT_NUMBER) {
  28164. return alt;
  28165. } else {
  28166. throw e;
  28167. }
  28168. }
  28169. if (D.requiresFullContext && this.predictionMode !== PredictionMode.SLL) {
  28170. // IF PREDS, MIGHT RESOLVE TO SINGLE ALT => SLL (or syntax error)
  28171. var conflictingAlts = null;
  28172. if (D.predicates !== null) {
  28173. if (this.debug) {
  28174. console.log("DFA state has preds in DFA sim LL failover");
  28175. }
  28176. var conflictIndex = input.index;
  28177. if (conflictIndex !== startIndex) {
  28178. input.seek(startIndex);
  28179. }
  28180. conflictingAlts = this.evalSemanticContext(D.predicates, outerContext, true);
  28181. if (conflictingAlts.length === 1) {
  28182. if (this.debug) {
  28183. console.log("Full LL avoided");
  28184. }
  28185. return conflictingAlts.minValue();
  28186. }
  28187. if (conflictIndex !== startIndex) {
  28188. // restore the index so reporting the fallback to full
  28189. // context occurs with the index at the correct spot
  28190. input.seek(conflictIndex);
  28191. }
  28192. }
  28193. if (this.dfa_debug) {
  28194. console.log("ctx sensitive state " + outerContext + " in " + D);
  28195. }
  28196. var fullCtx = true;
  28197. var s0_closure = this.computeStartState(dfa.atnStartState, outerContext, fullCtx);
  28198. this.reportAttemptingFullContext(dfa, conflictingAlts, D.configs, startIndex, input.index);
  28199. alt = this.execATNWithFullContext(dfa, D, s0_closure, input, startIndex, outerContext);
  28200. return alt;
  28201. }
  28202. if (D.isAcceptState) {
  28203. if (D.predicates === null) {
  28204. return D.prediction;
  28205. }
  28206. var stopIndex = input.index;
  28207. input.seek(startIndex);
  28208. var alts = this.evalSemanticContext(D.predicates, outerContext, true);
  28209. if (alts.length === 0) {
  28210. throw this.noViableAlt(input, outerContext, D.configs, startIndex);
  28211. } else if (alts.length === 1) {
  28212. return alts.minValue();
  28213. } else {
  28214. // report ambiguity after predicate evaluation to make sure the correct set of ambig alts is reported.
  28215. this.reportAmbiguity(dfa, D, startIndex, stopIndex, false, alts, D.configs);
  28216. return alts.minValue();
  28217. }
  28218. }
  28219. previousD = D;
  28220. if (t !== Token.EOF) {
  28221. input.consume();
  28222. t = input.LA(1);
  28223. }
  28224. }
  28225. };
  28226. //
  28227. // Get an existing target state for an edge in the DFA. If the target state
  28228. // for the edge has not yet been computed or is otherwise not available,
  28229. // this method returns {@code null}.
  28230. //
  28231. // @param previousD The current DFA state
  28232. // @param t The next input symbol
  28233. // @return The existing target DFA state for the given input symbol
  28234. // {@code t}, or {@code null} if the target state for this edge is not
  28235. // already cached
  28236. //
  28237. ParserATNSimulator.prototype.getExistingTargetState = function (previousD, t) {
  28238. var edges = previousD.edges;
  28239. if (edges === null) {
  28240. return null;
  28241. } else {
  28242. return edges[t + 1] || null;
  28243. }
  28244. };
  28245. //
  28246. // Compute a target state for an edge in the DFA, and attempt to add the
  28247. // computed state and corresponding edge to the DFA.
  28248. //
  28249. // @param dfa The DFA
  28250. // @param previousD The current DFA state
  28251. // @param t The next input symbol
  28252. //
  28253. // @return The computed target DFA state for the given input symbol
  28254. // {@code t}. If {@code t} does not lead to a valid DFA state, this method
  28255. // returns {@link //ERROR}.
  28256. //
  28257. ParserATNSimulator.prototype.computeTargetState = function (dfa, previousD, t) {
  28258. var reach = this.computeReachSet(previousD.configs, t, false);
  28259. if (reach === null) {
  28260. this.addDFAEdge(dfa, previousD, t, ATNSimulator.ERROR);
  28261. return ATNSimulator.ERROR;
  28262. }
  28263. // create new target state; we'll add to DFA after it's complete
  28264. var D = new DFAState(null, reach);
  28265. var predictedAlt = this.getUniqueAlt(reach);
  28266. if (this.debug) {
  28267. var altSubSets = PredictionMode.getConflictingAltSubsets(reach);
  28268. console.log("SLL altSubSets=" + Utils.arrayToString(altSubSets) + ", previous=" + previousD.configs + ", configs=" + reach + ", predict=" + predictedAlt + ", allSubsetsConflict=" + PredictionMode.allSubsetsConflict(altSubSets) + ", conflictingAlts=" + this.getConflictingAlts(reach));
  28269. }
  28270. if (predictedAlt !== ATN.INVALID_ALT_NUMBER) {
  28271. // NO CONFLICT, UNIQUELY PREDICTED ALT
  28272. D.isAcceptState = true;
  28273. D.configs.uniqueAlt = predictedAlt;
  28274. D.prediction = predictedAlt;
  28275. } else if (PredictionMode.hasSLLConflictTerminatingPrediction(this.predictionMode, reach)) {
  28276. // MORE THAN ONE VIABLE ALTERNATIVE
  28277. D.configs.conflictingAlts = this.getConflictingAlts(reach);
  28278. D.requiresFullContext = true;
  28279. // in SLL-only mode, we will stop at this state and return the minimum alt
  28280. D.isAcceptState = true;
  28281. D.prediction = D.configs.conflictingAlts.minValue();
  28282. }
  28283. if (D.isAcceptState && D.configs.hasSemanticContext) {
  28284. this.predicateDFAState(D, this.atn.getDecisionState(dfa.decision));
  28285. if (D.predicates !== null) {
  28286. D.prediction = ATN.INVALID_ALT_NUMBER;
  28287. }
  28288. }
  28289. // all adds to dfa are done after we've created full D state
  28290. D = this.addDFAEdge(dfa, previousD, t, D);
  28291. return D;
  28292. };
  28293. ParserATNSimulator.prototype.predicateDFAState = function (dfaState, decisionState) {
  28294. // We need to test all predicates, even in DFA states that
  28295. // uniquely predict alternative.
  28296. var nalts = decisionState.transitions.length;
  28297. // Update DFA so reach becomes accept state with (predicate,alt)
  28298. // pairs if preds found for conflicting alts
  28299. var altsToCollectPredsFrom = this.getConflictingAltsOrUniqueAlt(dfaState.configs);
  28300. var altToPred = this.getPredsForAmbigAlts(altsToCollectPredsFrom, dfaState.configs, nalts);
  28301. if (altToPred !== null) {
  28302. dfaState.predicates = this.getPredicatePredictions(altsToCollectPredsFrom, altToPred);
  28303. dfaState.prediction = ATN.INVALID_ALT_NUMBER; // make sure we use preds
  28304. } else {
  28305. // There are preds in configs but they might go away
  28306. // when OR'd together like {p}? || NONE == NONE. If neither
  28307. // alt has preds, resolve to min alt
  28308. dfaState.prediction = altsToCollectPredsFrom.minValue();
  28309. }
  28310. };
  28311. // comes back with reach.uniqueAlt set to a valid alt
  28312. ParserATNSimulator.prototype.execATNWithFullContext = function (dfa, D, // how far we got before failing over
  28313. s0, input, startIndex, outerContext) {
  28314. if (this.debug || this.debug_list_atn_decisions) {
  28315. console.log("execATNWithFullContext " + s0);
  28316. }
  28317. var fullCtx = true;
  28318. var foundExactAmbig = false;
  28319. var reach = null;
  28320. var previous = s0;
  28321. input.seek(startIndex);
  28322. var t = input.LA(1);
  28323. var predictedAlt = -1;
  28324. while (true) {
  28325. // while more work
  28326. reach = this.computeReachSet(previous, t, fullCtx);
  28327. if (reach === null) {
  28328. // if any configs in previous dipped into outer context, that
  28329. // means that input up to t actually finished entry rule
  28330. // at least for LL decision. Full LL doesn't dip into outer
  28331. // so don't need special case.
  28332. // We will get an error no matter what so delay until after
  28333. // decision; better error message. Also, no reachable target
  28334. // ATN states in SLL implies LL will also get nowhere.
  28335. // If conflict in states that dip out, choose min since we
  28336. // will get error no matter what.
  28337. var e = this.noViableAlt(input, outerContext, previous, startIndex);
  28338. input.seek(startIndex);
  28339. var alt = this.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule(previous, outerContext);
  28340. if (alt !== ATN.INVALID_ALT_NUMBER) {
  28341. return alt;
  28342. } else {
  28343. throw e;
  28344. }
  28345. }
  28346. var altSubSets = PredictionMode.getConflictingAltSubsets(reach);
  28347. if (this.debug) {
  28348. console.log("LL altSubSets=" + altSubSets + ", predict=" + PredictionMode.getUniqueAlt(altSubSets) + ", resolvesToJustOneViableAlt=" + PredictionMode.resolvesToJustOneViableAlt(altSubSets));
  28349. }
  28350. reach.uniqueAlt = this.getUniqueAlt(reach);
  28351. // unique prediction?
  28352. if (reach.uniqueAlt !== ATN.INVALID_ALT_NUMBER) {
  28353. predictedAlt = reach.uniqueAlt;
  28354. break;
  28355. } else if (this.predictionMode !== PredictionMode.LL_EXACT_AMBIG_DETECTION) {
  28356. predictedAlt = PredictionMode.resolvesToJustOneViableAlt(altSubSets);
  28357. if (predictedAlt !== ATN.INVALID_ALT_NUMBER) {
  28358. break;
  28359. }
  28360. } else {
  28361. // In exact ambiguity mode, we never try to terminate early.
  28362. // Just keeps scarfing until we know what the conflict is
  28363. if (PredictionMode.allSubsetsConflict(altSubSets) && PredictionMode.allSubsetsEqual(altSubSets)) {
  28364. foundExactAmbig = true;
  28365. predictedAlt = PredictionMode.getSingleViableAlt(altSubSets);
  28366. break;
  28367. }
  28368. // else there are multiple non-conflicting subsets or
  28369. // we're not sure what the ambiguity is yet.
  28370. // So, keep going.
  28371. }
  28372. previous = reach;
  28373. if (t !== Token.EOF) {
  28374. input.consume();
  28375. t = input.LA(1);
  28376. }
  28377. }
  28378. // If the configuration set uniquely predicts an alternative,
  28379. // without conflict, then we know that it's a full LL decision
  28380. // not SLL.
  28381. if (reach.uniqueAlt !== ATN.INVALID_ALT_NUMBER) {
  28382. this.reportContextSensitivity(dfa, predictedAlt, reach, startIndex, input.index);
  28383. return predictedAlt;
  28384. }
  28385. // We do not check predicates here because we have checked them
  28386. // on-the-fly when doing full context prediction.
  28387. //
  28388. // In non-exact ambiguity detection mode, we might actually be able to
  28389. // detect an exact ambiguity, but I'm not going to spend the cycles
  28390. // needed to check. We only emit ambiguity warnings in exact ambiguity
  28391. // mode.
  28392. //
  28393. // For example, we might know that we have conflicting configurations.
  28394. // But, that does not mean that there is no way forward without a
  28395. // conflict. It's possible to have nonconflicting alt subsets as in:
  28396. // altSubSets=[{1, 2}, {1, 2}, {1}, {1, 2}]
  28397. // from
  28398. //
  28399. // [(17,1,[5 $]), (13,1,[5 10 $]), (21,1,[5 10 $]), (11,1,[$]),
  28400. // (13,2,[5 10 $]), (21,2,[5 10 $]), (11,2,[$])]
  28401. //
  28402. // In this case, (17,1,[5 $]) indicates there is some next sequence that
  28403. // would resolve this without conflict to alternative 1. Any other viable
  28404. // next sequence, however, is associated with a conflict. We stop
  28405. // looking for input because no amount of further lookahead will alter
  28406. // the fact that we should predict alternative 1. We just can't say for
  28407. // sure that there is an ambiguity without looking further.
  28408. this.reportAmbiguity(dfa, D, startIndex, input.index, foundExactAmbig, null, reach);
  28409. return predictedAlt;
  28410. };
  28411. ParserATNSimulator.prototype.computeReachSet = function (closure, t, fullCtx) {
  28412. if (this.debug) {
  28413. console.log("in computeReachSet, starting closure: " + closure);
  28414. }
  28415. if (this.mergeCache === null) {
  28416. this.mergeCache = new DoubleDict();
  28417. }
  28418. var intermediate = new ATNConfigSet(fullCtx);
  28419. // Configurations already in a rule stop state indicate reaching the end
  28420. // of the decision rule (local context) or end of the start rule (full
  28421. // context). Once reached, these configurations are never updated by a
  28422. // closure operation, so they are handled separately for the performance
  28423. // advantage of having a smaller intermediate set when calling closure.
  28424. //
  28425. // For full-context reach operations, separate handling is required to
  28426. // ensure that the alternative matching the longest overall sequence is
  28427. // chosen when multiple such configurations can match the input.
  28428. var skippedStopStates = null;
  28429. // First figure out where we can reach on input t
  28430. for (var i = 0; i < closure.items.length; i++) {
  28431. var c = closure.items[i];
  28432. if (this.debug_add) {
  28433. console.log("testing " + this.getTokenName(t) + " at " + c);
  28434. }
  28435. if (c.state instanceof RuleStopState) {
  28436. if (fullCtx || t === Token.EOF) {
  28437. if (skippedStopStates === null) {
  28438. skippedStopStates = [];
  28439. }
  28440. skippedStopStates.push(c);
  28441. if (this.debug_add) {
  28442. console.log("added " + c + " to skippedStopStates");
  28443. }
  28444. }
  28445. continue;
  28446. }
  28447. for (var j = 0; j < c.state.transitions.length; j++) {
  28448. var trans = c.state.transitions[j];
  28449. var target = this.getReachableTarget(trans, t);
  28450. if (target !== null) {
  28451. var cfg = new ATNConfig({ state: target }, c);
  28452. intermediate.add(cfg, this.mergeCache);
  28453. if (this.debug_add) {
  28454. console.log("added " + cfg + " to intermediate");
  28455. }
  28456. }
  28457. }
  28458. }
  28459. // Now figure out where the reach operation can take us...
  28460. var reach = null;
  28461. // This block optimizes the reach operation for intermediate sets which
  28462. // trivially indicate a termination state for the overall
  28463. // adaptivePredict operation.
  28464. //
  28465. // The conditions assume that intermediate
  28466. // contains all configurations relevant to the reach set, but this
  28467. // condition is not true when one or more configurations have been
  28468. // withheld in skippedStopStates, or when the current symbol is EOF.
  28469. //
  28470. if (skippedStopStates === null && t !== Token.EOF) {
  28471. if (intermediate.items.length === 1) {
  28472. // Don't pursue the closure if there is just one state.
  28473. // It can only have one alternative; just add to result
  28474. // Also don't pursue the closure if there is unique alternative
  28475. // among the configurations.
  28476. reach = intermediate;
  28477. } else if (this.getUniqueAlt(intermediate) !== ATN.INVALID_ALT_NUMBER) {
  28478. // Also don't pursue the closure if there is unique alternative
  28479. // among the configurations.
  28480. reach = intermediate;
  28481. }
  28482. }
  28483. // If the reach set could not be trivially determined, perform a closure
  28484. // operation on the intermediate set to compute its initial value.
  28485. //
  28486. if (reach === null) {
  28487. reach = new ATNConfigSet(fullCtx);
  28488. var closureBusy = new Set();
  28489. var treatEofAsEpsilon = t === Token.EOF;
  28490. for (var k = 0; k < intermediate.items.length; k++) {
  28491. this.closure(intermediate.items[k], reach, closureBusy, false, fullCtx, treatEofAsEpsilon);
  28492. }
  28493. }
  28494. if (t === Token.EOF) {
  28495. // After consuming EOF no additional input is possible, so we are
  28496. // only interested in configurations which reached the end of the
  28497. // decision rule (local context) or end of the start rule (full
  28498. // context). Update reach to contain only these configurations. This
  28499. // handles both explicit EOF transitions in the grammar and implicit
  28500. // EOF transitions following the end of the decision or start rule.
  28501. //
  28502. // When reach==intermediate, no closure operation was performed. In
  28503. // this case, removeAllConfigsNotInRuleStopState needs to check for
  28504. // reachable rule stop states as well as configurations already in
  28505. // a rule stop state.
  28506. //
  28507. // This is handled before the configurations in skippedStopStates,
  28508. // because any configurations potentially added from that list are
  28509. // already guaranteed to meet this condition whether or not it's
  28510. // required.
  28511. //
  28512. reach = this.removeAllConfigsNotInRuleStopState(reach, reach === intermediate);
  28513. }
  28514. // If skippedStopStates!==null, then it contains at least one
  28515. // configuration. For full-context reach operations, these
  28516. // configurations reached the end of the start rule, in which case we
  28517. // only add them back to reach if no configuration during the current
  28518. // closure operation reached such a state. This ensures adaptivePredict
  28519. // chooses an alternative matching the longest overall sequence when
  28520. // multiple alternatives are viable.
  28521. //
  28522. if (skippedStopStates !== null && (!fullCtx || !PredictionMode.hasConfigInRuleStopState(reach))) {
  28523. for (var l = 0; l < skippedStopStates.length; l++) {
  28524. reach.add(skippedStopStates[l], this.mergeCache);
  28525. }
  28526. }
  28527. if (reach.items.length === 0) {
  28528. return null;
  28529. } else {
  28530. return reach;
  28531. }
  28532. };
  28533. //
  28534. // Return a configuration set containing only the configurations from
  28535. // {@code configs} which are in a {@link RuleStopState}. If all
  28536. // configurations in {@code configs} are already in a rule stop state, this
  28537. // method simply returns {@code configs}.
  28538. //
  28539. // <p>When {@code lookToEndOfRule} is true, this method uses
  28540. // {@link ATN//nextTokens} for each configuration in {@code configs} which is
  28541. // not already in a rule stop state to see if a rule stop state is reachable
  28542. // from the configuration via epsilon-only transitions.</p>
  28543. //
  28544. // @param configs the configuration set to update
  28545. // @param lookToEndOfRule when true, this method checks for rule stop states
  28546. // reachable by epsilon-only transitions from each configuration in
  28547. // {@code configs}.
  28548. //
  28549. // @return {@code configs} if all configurations in {@code configs} are in a
  28550. // rule stop state, otherwise return a new configuration set containing only
  28551. // the configurations from {@code configs} which are in a rule stop state
  28552. //
  28553. ParserATNSimulator.prototype.removeAllConfigsNotInRuleStopState = function (configs, lookToEndOfRule) {
  28554. if (PredictionMode.allConfigsInRuleStopStates(configs)) {
  28555. return configs;
  28556. }
  28557. var result = new ATNConfigSet(configs.fullCtx);
  28558. for (var i = 0; i < configs.items.length; i++) {
  28559. var config = configs.items[i];
  28560. if (config.state instanceof RuleStopState) {
  28561. result.add(config, this.mergeCache);
  28562. continue;
  28563. }
  28564. if (lookToEndOfRule && config.state.epsilonOnlyTransitions) {
  28565. var nextTokens = this.atn.nextTokens(config.state);
  28566. if (nextTokens.contains(Token.EPSILON)) {
  28567. var endOfRuleState = this.atn.ruleToStopState[config.state.ruleIndex];
  28568. result.add(new ATNConfig({ state: endOfRuleState }, config), this.mergeCache);
  28569. }
  28570. }
  28571. }
  28572. return result;
  28573. };
  28574. ParserATNSimulator.prototype.computeStartState = function (p, ctx, fullCtx) {
  28575. // always at least the implicit call to start rule
  28576. var initialContext = predictionContextFromRuleContext(this.atn, ctx);
  28577. var configs = new ATNConfigSet(fullCtx);
  28578. for (var i = 0; i < p.transitions.length; i++) {
  28579. var target = p.transitions[i].target;
  28580. var c = new ATNConfig({ state: target, alt: i + 1, context: initialContext }, null);
  28581. var closureBusy = new Set();
  28582. this.closure(c, configs, closureBusy, true, fullCtx, false);
  28583. }
  28584. return configs;
  28585. };
  28586. //
  28587. // This method transforms the start state computed by
  28588. // {@link //computeStartState} to the special start state used by a
  28589. // precedence DFA for a particular precedence value. The transformation
  28590. // process applies the following changes to the start state's configuration
  28591. // set.
  28592. //
  28593. // <ol>
  28594. // <li>Evaluate the precedence predicates for each configuration using
  28595. // {@link SemanticContext//evalPrecedence}.</li>
  28596. // <li>Remove all configurations which predict an alternative greater than
  28597. // 1, for which another configuration that predicts alternative 1 is in the
  28598. // same ATN state with the same prediction context. This transformation is
  28599. // valid for the following reasons:
  28600. // <ul>
  28601. // <li>The closure block cannot contain any epsilon transitions which bypass
  28602. // the body of the closure, so all states reachable via alternative 1 are
  28603. // part of the precedence alternatives of the transformed left-recursive
  28604. // rule.</li>
  28605. // <li>The "primary" portion of a left recursive rule cannot contain an
  28606. // epsilon transition, so the only way an alternative other than 1 can exist
  28607. // in a state that is also reachable via alternative 1 is by nesting calls
  28608. // to the left-recursive rule, with the outer calls not being at the
  28609. // preferred precedence level.</li>
  28610. // </ul>
  28611. // </li>
  28612. // </ol>
  28613. //
  28614. // <p>
  28615. // The prediction context must be considered by this filter to address
  28616. // situations like the following.
  28617. // </p>
  28618. // <code>
  28619. // <pre>
  28620. // grammar TA;
  28621. // prog: statement* EOF;
  28622. // statement: letterA | statement letterA 'b' ;
  28623. // letterA: 'a';
  28624. // </pre>
  28625. // </code>
  28626. // <p>
  28627. // If the above grammar, the ATN state immediately before the token
  28628. // reference {@code 'a'} in {@code letterA} is reachable from the left edge
  28629. // of both the primary and closure blocks of the left-recursive rule
  28630. // {@code statement}. The prediction context associated with each of these
  28631. // configurations distinguishes between them, and prevents the alternative
  28632. // which stepped out to {@code prog} (and then back in to {@code statement}
  28633. // from being eliminated by the filter.
  28634. // </p>
  28635. //
  28636. // @param configs The configuration set computed by
  28637. // {@link //computeStartState} as the start state for the DFA.
  28638. // @return The transformed configuration set representing the start state
  28639. // for a precedence DFA at a particular precedence level (determined by
  28640. // calling {@link Parser//getPrecedence}).
  28641. //
  28642. ParserATNSimulator.prototype.applyPrecedenceFilter = function (configs) {
  28643. var config;
  28644. var statesFromAlt1 = [];
  28645. var configSet = new ATNConfigSet(configs.fullCtx);
  28646. for (var i = 0; i < configs.items.length; i++) {
  28647. config = configs.items[i];
  28648. // handle alt 1 first
  28649. if (config.alt !== 1) {
  28650. continue;
  28651. }
  28652. var updatedContext = config.semanticContext.evalPrecedence(this.parser, this._outerContext);
  28653. if (updatedContext === null) {
  28654. // the configuration was eliminated
  28655. continue;
  28656. }
  28657. statesFromAlt1[config.state.stateNumber] = config.context;
  28658. if (updatedContext !== config.semanticContext) {
  28659. configSet.add(new ATNConfig({ semanticContext: updatedContext }, config), this.mergeCache);
  28660. } else {
  28661. configSet.add(config, this.mergeCache);
  28662. }
  28663. }
  28664. for (i = 0; i < configs.items.length; i++) {
  28665. config = configs.items[i];
  28666. if (config.alt === 1) {
  28667. // already handled
  28668. continue;
  28669. }
  28670. // In the future, this elimination step could be updated to also
  28671. // filter the prediction context for alternatives predicting alt>1
  28672. // (basically a graph subtraction algorithm).
  28673. if (!config.precedenceFilterSuppressed) {
  28674. var context = statesFromAlt1[config.state.stateNumber] || null;
  28675. if (context !== null && context.equals(config.context)) {
  28676. // eliminated
  28677. continue;
  28678. }
  28679. }
  28680. configSet.add(config, this.mergeCache);
  28681. }
  28682. return configSet;
  28683. };
  28684. ParserATNSimulator.prototype.getReachableTarget = function (trans, ttype) {
  28685. if (trans.matches(ttype, 0, this.atn.maxTokenType)) {
  28686. return trans.target;
  28687. } else {
  28688. return null;
  28689. }
  28690. };
  28691. ParserATNSimulator.prototype.getPredsForAmbigAlts = function (ambigAlts, configs, nalts) {
  28692. // REACH=[1|1|[]|0:0, 1|2|[]|0:1]
  28693. // altToPred starts as an array of all null contexts. The entry at index i
  28694. // corresponds to alternative i. altToPred[i] may have one of three values:
  28695. // 1. null: no ATNConfig c is found such that c.alt==i
  28696. // 2. SemanticContext.NONE: At least one ATNConfig c exists such that
  28697. // c.alt==i and c.semanticContext==SemanticContext.NONE. In other words,
  28698. // alt i has at least one unpredicated config.
  28699. // 3. Non-NONE Semantic Context: There exists at least one, and for all
  28700. // ATNConfig c such that c.alt==i, c.semanticContext!=SemanticContext.NONE.
  28701. //
  28702. // From this, it is clear that NONE||anything==NONE.
  28703. //
  28704. var altToPred = [];
  28705. for (var i = 0; i < configs.items.length; i++) {
  28706. var c = configs.items[i];
  28707. if (ambigAlts.contains(c.alt)) {
  28708. altToPred[c.alt] = SemanticContext.orContext(altToPred[c.alt] || null, c.semanticContext);
  28709. }
  28710. }
  28711. var nPredAlts = 0;
  28712. for (i = 1; i < nalts + 1; i++) {
  28713. var pred = altToPred[i] || null;
  28714. if (pred === null) {
  28715. altToPred[i] = SemanticContext.NONE;
  28716. } else if (pred !== SemanticContext.NONE) {
  28717. nPredAlts += 1;
  28718. }
  28719. }
  28720. // nonambig alts are null in altToPred
  28721. if (nPredAlts === 0) {
  28722. altToPred = null;
  28723. }
  28724. if (this.debug) {
  28725. console.log("getPredsForAmbigAlts result " + Utils.arrayToString(altToPred));
  28726. }
  28727. return altToPred;
  28728. };
  28729. ParserATNSimulator.prototype.getPredicatePredictions = function (ambigAlts, altToPred) {
  28730. var pairs = [];
  28731. var containsPredicate = false;
  28732. for (var i = 1; i < altToPred.length; i++) {
  28733. var pred = altToPred[i];
  28734. // unpredicated is indicated by SemanticContext.NONE
  28735. if (ambigAlts !== null && ambigAlts.contains(i)) {
  28736. pairs.push(new PredPrediction(pred, i));
  28737. }
  28738. if (pred !== SemanticContext.NONE) {
  28739. containsPredicate = true;
  28740. }
  28741. }
  28742. if (!containsPredicate) {
  28743. return null;
  28744. }
  28745. return pairs;
  28746. };
  28747. //
  28748. // This method is used to improve the localization of error messages by
  28749. // choosing an alternative rather than throwing a
  28750. // {@link NoViableAltException} in particular prediction scenarios where the
  28751. // {@link //ERROR} state was reached during ATN simulation.
  28752. //
  28753. // <p>
  28754. // The default implementation of this method uses the following
  28755. // algorithm to identify an ATN configuration which successfully parsed the
  28756. // decision entry rule. Choosing such an alternative ensures that the
  28757. // {@link ParserRuleContext} returned by the calling rule will be complete
  28758. // and valid, and the syntax error will be reported later at a more
  28759. // localized location.</p>
  28760. //
  28761. // <ul>
  28762. // <li>If a syntactically valid path or paths reach the end of the decision rule and
  28763. // they are semantically valid if predicated, return the min associated alt.</li>
  28764. // <li>Else, if a semantically invalid but syntactically valid path exist
  28765. // or paths exist, return the minimum associated alt.
  28766. // </li>
  28767. // <li>Otherwise, return {@link ATN//INVALID_ALT_NUMBER}.</li>
  28768. // </ul>
  28769. //
  28770. // <p>
  28771. // In some scenarios, the algorithm described above could predict an
  28772. // alternative which will result in a {@link FailedPredicateException} in
  28773. // the parser. Specifically, this could occur if the <em>only</em> configuration
  28774. // capable of successfully parsing to the end of the decision rule is
  28775. // blocked by a semantic predicate. By choosing this alternative within
  28776. // {@link //adaptivePredict} instead of throwing a
  28777. // {@link NoViableAltException}, the resulting
  28778. // {@link FailedPredicateException} in the parser will identify the specific
  28779. // predicate which is preventing the parser from successfully parsing the
  28780. // decision rule, which helps developers identify and correct logic errors
  28781. // in semantic predicates.
  28782. // </p>
  28783. //
  28784. // @param configs The ATN configurations which were valid immediately before
  28785. // the {@link //ERROR} state was reached
  28786. // @param outerContext The is the \gamma_0 initial parser context from the paper
  28787. // or the parser stack at the instant before prediction commences.
  28788. //
  28789. // @return The value to return from {@link //adaptivePredict}, or
  28790. // {@link ATN//INVALID_ALT_NUMBER} if a suitable alternative was not
  28791. // identified and {@link //adaptivePredict} should report an error instead.
  28792. //
  28793. ParserATNSimulator.prototype.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule = function (configs, outerContext) {
  28794. var cfgs = this.splitAccordingToSemanticValidity(configs, outerContext);
  28795. var semValidConfigs = cfgs[0];
  28796. var semInvalidConfigs = cfgs[1];
  28797. var alt = this.getAltThatFinishedDecisionEntryRule(semValidConfigs);
  28798. if (alt !== ATN.INVALID_ALT_NUMBER) {
  28799. // semantically/syntactically viable path exists
  28800. return alt;
  28801. }
  28802. // Is there a syntactically valid path with a failed pred?
  28803. if (semInvalidConfigs.items.length > 0) {
  28804. alt = this.getAltThatFinishedDecisionEntryRule(semInvalidConfigs);
  28805. if (alt !== ATN.INVALID_ALT_NUMBER) {
  28806. // syntactically viable path exists
  28807. return alt;
  28808. }
  28809. }
  28810. return ATN.INVALID_ALT_NUMBER;
  28811. };
  28812. ParserATNSimulator.prototype.getAltThatFinishedDecisionEntryRule = function (configs) {
  28813. var alts = [];
  28814. for (var i = 0; i < configs.items.length; i++) {
  28815. var c = configs.items[i];
  28816. if (c.reachesIntoOuterContext > 0 || c.state instanceof RuleStopState && c.context.hasEmptyPath()) {
  28817. if (alts.indexOf(c.alt) < 0) {
  28818. alts.push(c.alt);
  28819. }
  28820. }
  28821. }
  28822. if (alts.length === 0) {
  28823. return ATN.INVALID_ALT_NUMBER;
  28824. } else {
  28825. return Math.min.apply(null, alts);
  28826. }
  28827. };
  28828. // Walk the list of configurations and split them according to
  28829. // those that have preds evaluating to true/false. If no pred, assume
  28830. // true pred and include in succeeded set. Returns Pair of sets.
  28831. //
  28832. // Create a new set so as not to alter the incoming parameter.
  28833. //
  28834. // Assumption: the input stream has been restored to the starting point
  28835. // prediction, which is where predicates need to evaluate.
  28836. //
  28837. ParserATNSimulator.prototype.splitAccordingToSemanticValidity = function (configs, outerContext) {
  28838. var succeeded = new ATNConfigSet(configs.fullCtx);
  28839. var failed = new ATNConfigSet(configs.fullCtx);
  28840. for (var i = 0; i < configs.items.length; i++) {
  28841. var c = configs.items[i];
  28842. if (c.semanticContext !== SemanticContext.NONE) {
  28843. var predicateEvaluationResult = c.semanticContext.evaluate(this.parser, outerContext);
  28844. if (predicateEvaluationResult) {
  28845. succeeded.add(c);
  28846. } else {
  28847. failed.add(c);
  28848. }
  28849. } else {
  28850. succeeded.add(c);
  28851. }
  28852. }
  28853. return [succeeded, failed];
  28854. };
  28855. // Look through a list of predicate/alt pairs, returning alts for the
  28856. // pairs that win. A {@code NONE} predicate indicates an alt containing an
  28857. // unpredicated config which behaves as "always true." If !complete
  28858. // then we stop at the first predicate that evaluates to true. This
  28859. // includes pairs with null predicates.
  28860. //
  28861. ParserATNSimulator.prototype.evalSemanticContext = function (predPredictions, outerContext, complete) {
  28862. var predictions = new BitSet();
  28863. for (var i = 0; i < predPredictions.length; i++) {
  28864. var pair = predPredictions[i];
  28865. if (pair.pred === SemanticContext.NONE) {
  28866. predictions.add(pair.alt);
  28867. if (!complete) {
  28868. break;
  28869. }
  28870. continue;
  28871. }
  28872. var predicateEvaluationResult = pair.pred.evaluate(this.parser, outerContext);
  28873. if (this.debug || this.dfa_debug) {
  28874. console.log("eval pred " + pair + "=" + predicateEvaluationResult);
  28875. }
  28876. if (predicateEvaluationResult) {
  28877. if (this.debug || this.dfa_debug) {
  28878. console.log("PREDICT " + pair.alt);
  28879. }
  28880. predictions.add(pair.alt);
  28881. if (!complete) {
  28882. break;
  28883. }
  28884. }
  28885. }
  28886. return predictions;
  28887. };
  28888. // TODO: If we are doing predicates, there is no point in pursuing
  28889. // closure operations if we reach a DFA state that uniquely predicts
  28890. // alternative. We will not be caching that DFA state and it is a
  28891. // waste to pursue the closure. Might have to advance when we do
  28892. // ambig detection thought :(
  28893. //
  28894. ParserATNSimulator.prototype.closure = function (config, configs, closureBusy, collectPredicates, fullCtx, treatEofAsEpsilon) {
  28895. var initialDepth = 0;
  28896. this.closureCheckingStopState(config, configs, closureBusy, collectPredicates, fullCtx, initialDepth, treatEofAsEpsilon);
  28897. };
  28898. ParserATNSimulator.prototype.closureCheckingStopState = function (config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon) {
  28899. if (this.debug || this.debug_closure) {
  28900. console.log("closure(" + config.toString(this.parser, true) + ")");
  28901. // console.log("configs(" + configs.toString() + ")");
  28902. if (config.reachesIntoOuterContext > 50) {
  28903. throw "problem";
  28904. }
  28905. }
  28906. if (config.state instanceof RuleStopState) {
  28907. // We hit rule end. If we have context info, use it
  28908. // run thru all possible stack tops in ctx
  28909. if (!config.context.isEmpty()) {
  28910. for (var i = 0; i < config.context.length; i++) {
  28911. if (config.context.getReturnState(i) === PredictionContext.EMPTY_RETURN_STATE) {
  28912. if (fullCtx) {
  28913. configs.add(new ATNConfig({ state: config.state, context: PredictionContext.EMPTY }, config), this.mergeCache);
  28914. continue;
  28915. } else {
  28916. // we have no context info, just chase follow links (if greedy)
  28917. if (this.debug) {
  28918. console.log("FALLING off rule " + this.getRuleName(config.state.ruleIndex));
  28919. }
  28920. this.closure_(config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon);
  28921. }
  28922. continue;
  28923. }
  28924. var returnState = this.atn.states[config.context.getReturnState(i)];
  28925. var newContext = config.context.getParent(i); // "pop" return state
  28926. var parms = { state: returnState, alt: config.alt, context: newContext, semanticContext: config.semanticContext };
  28927. var c = new ATNConfig(parms, null);
  28928. // While we have context to pop back from, we may have
  28929. // gotten that context AFTER having falling off a rule.
  28930. // Make sure we track that we are now out of context.
  28931. c.reachesIntoOuterContext = config.reachesIntoOuterContext;
  28932. this.closureCheckingStopState(c, configs, closureBusy, collectPredicates, fullCtx, depth - 1, treatEofAsEpsilon);
  28933. }
  28934. return;
  28935. } else if (fullCtx) {
  28936. // reached end of start rule
  28937. configs.add(config, this.mergeCache);
  28938. return;
  28939. } else {
  28940. // else if we have no context info, just chase follow links (if greedy)
  28941. if (this.debug) {
  28942. console.log("FALLING off rule " + this.getRuleName(config.state.ruleIndex));
  28943. }
  28944. }
  28945. }
  28946. this.closure_(config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon);
  28947. };
  28948. // Do the actual work of walking epsilon edges//
  28949. ParserATNSimulator.prototype.closure_ = function (config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon) {
  28950. var p = config.state;
  28951. // optimization
  28952. if (!p.epsilonOnlyTransitions) {
  28953. configs.add(config, this.mergeCache);
  28954. // make sure to not return here, because EOF transitions can act as
  28955. // both epsilon transitions and non-epsilon transitions.
  28956. }
  28957. for (var i = 0; i < p.transitions.length; i++) {
  28958. if (i == 0 && this.canDropLoopEntryEdgeInLeftRecursiveRule(config)) continue;
  28959. var t = p.transitions[i];
  28960. var continueCollecting = collectPredicates && !(t instanceof ActionTransition);
  28961. var c = this.getEpsilonTarget(config, t, continueCollecting, depth === 0, fullCtx, treatEofAsEpsilon);
  28962. if (c !== null) {
  28963. if (!t.isEpsilon && closureBusy.add(c) !== c) {
  28964. // avoid infinite recursion for EOF* and EOF+
  28965. continue;
  28966. }
  28967. var newDepth = depth;
  28968. if (config.state instanceof RuleStopState) {
  28969. // target fell off end of rule; mark resulting c as having dipped into outer context
  28970. // We can't get here if incoming config was rule stop and we had context
  28971. // track how far we dip into outer context. Might
  28972. // come in handy and we avoid evaluating context dependent
  28973. // preds if this is > 0.
  28974. if (closureBusy.add(c) !== c) {
  28975. // avoid infinite recursion for right-recursive rules
  28976. continue;
  28977. }
  28978. if (this._dfa !== null && this._dfa.precedenceDfa) {
  28979. if (t.outermostPrecedenceReturn === this._dfa.atnStartState.ruleIndex) {
  28980. c.precedenceFilterSuppressed = true;
  28981. }
  28982. }
  28983. c.reachesIntoOuterContext += 1;
  28984. configs.dipsIntoOuterContext = true; // TODO: can remove? only care when we add to set per middle of this method
  28985. newDepth -= 1;
  28986. if (this.debug) {
  28987. console.log("dips into outer ctx: " + c);
  28988. }
  28989. } else if (t instanceof RuleTransition) {
  28990. // latch when newDepth goes negative - once we step out of the entry context we can't return
  28991. if (newDepth >= 0) {
  28992. newDepth += 1;
  28993. }
  28994. }
  28995. this.closureCheckingStopState(c, configs, closureBusy, continueCollecting, fullCtx, newDepth, treatEofAsEpsilon);
  28996. }
  28997. }
  28998. };
  28999. ParserATNSimulator.prototype.canDropLoopEntryEdgeInLeftRecursiveRule = function (config) {
  29000. // return False
  29001. var p = config.state;
  29002. // First check to see if we are in StarLoopEntryState generated during
  29003. // left-recursion elimination. For efficiency, also check if
  29004. // the context has an empty stack case. If so, it would mean
  29005. // global FOLLOW so we can't perform optimization
  29006. // Are we the special loop entry/exit state? or SLL wildcard
  29007. if (p.stateType != ATNState.STAR_LOOP_ENTRY) return false;
  29008. if (p.stateType != ATNState.STAR_LOOP_ENTRY || !p.isPrecedenceDecision || config.context.isEmpty() || config.context.hasEmptyPath()) return false;
  29009. // Require all return states to return back to the same rule that p is in.
  29010. var numCtxs = config.context.length;
  29011. for (var i = 0; i < numCtxs; i++) {
  29012. // for each stack context
  29013. var returnState = this.atn.states[config.context.getReturnState(i)];
  29014. if (returnState.ruleIndex != p.ruleIndex) return false;
  29015. }
  29016. var decisionStartState = p.transitions[0].target;
  29017. var blockEndStateNum = decisionStartState.endState.stateNumber;
  29018. var blockEndState = this.atn.states[blockEndStateNum];
  29019. // Verify that the top of each stack context leads to loop entry/exit
  29020. // state through epsilon edges and w/o leaving rule.
  29021. for (var i = 0; i < numCtxs; i++) {
  29022. // for each stack context
  29023. var returnStateNumber = config.context.getReturnState(i);
  29024. var returnState = this.atn.states[returnStateNumber];
  29025. // all states must have single outgoing epsilon edge
  29026. if (returnState.transitions.length != 1 || !returnState.transitions[0].isEpsilon) return false;
  29027. // Look for prefix op case like 'not expr', (' type ')' expr
  29028. var returnStateTarget = returnState.transitions[0].target;
  29029. if (returnState.stateType == ATNState.BLOCK_END && returnStateTarget == p) continue;
  29030. // Look for 'expr op expr' or case where expr's return state is block end
  29031. // of (...)* internal block; the block end points to loop back
  29032. // which points to p but we don't need to check that
  29033. if (returnState == blockEndState) continue;
  29034. // Look for ternary expr ? expr : expr. The return state points at block end,
  29035. // which points at loop entry state
  29036. if (returnStateTarget == blockEndState) continue;
  29037. // Look for complex prefix 'between expr and expr' case where 2nd expr's
  29038. // return state points at block end state of (...)* internal block
  29039. if (returnStateTarget.stateType == ATNState.BLOCK_END && returnStateTarget.transitions.length == 1 && returnStateTarget.transitions[0].isEpsilon && returnStateTarget.transitions[0].target == p) continue;
  29040. // anything else ain't conforming
  29041. return false;
  29042. }
  29043. return true;
  29044. };
  29045. ParserATNSimulator.prototype.getRuleName = function (index) {
  29046. if (this.parser !== null && index >= 0) {
  29047. return this.parser.ruleNames[index];
  29048. } else {
  29049. return "<rule " + index + ">";
  29050. }
  29051. };
  29052. ParserATNSimulator.prototype.getEpsilonTarget = function (config, t, collectPredicates, inContext, fullCtx, treatEofAsEpsilon) {
  29053. switch (t.serializationType) {
  29054. case Transition.RULE:
  29055. return this.ruleTransition(config, t);
  29056. case Transition.PRECEDENCE:
  29057. return this.precedenceTransition(config, t, collectPredicates, inContext, fullCtx);
  29058. case Transition.PREDICATE:
  29059. return this.predTransition(config, t, collectPredicates, inContext, fullCtx);
  29060. case Transition.ACTION:
  29061. return this.actionTransition(config, t);
  29062. case Transition.EPSILON:
  29063. return new ATNConfig({ state: t.target }, config);
  29064. case Transition.ATOM:
  29065. case Transition.RANGE:
  29066. case Transition.SET:
  29067. // EOF transitions act like epsilon transitions after the first EOF
  29068. // transition is traversed
  29069. if (treatEofAsEpsilon) {
  29070. if (t.matches(Token.EOF, 0, 1)) {
  29071. return new ATNConfig({ state: t.target }, config);
  29072. }
  29073. }
  29074. return null;
  29075. default:
  29076. return null;
  29077. }
  29078. };
  29079. ParserATNSimulator.prototype.actionTransition = function (config, t) {
  29080. if (this.debug) {
  29081. var index = t.actionIndex == -1 ? 65535 : t.actionIndex;
  29082. console.log("ACTION edge " + t.ruleIndex + ":" + index);
  29083. }
  29084. return new ATNConfig({ state: t.target }, config);
  29085. };
  29086. ParserATNSimulator.prototype.precedenceTransition = function (config, pt, collectPredicates, inContext, fullCtx) {
  29087. if (this.debug) {
  29088. console.log("PRED (collectPredicates=" + collectPredicates + ") " + pt.precedence + ">=_p, ctx dependent=true");
  29089. if (this.parser !== null) {
  29090. console.log("context surrounding pred is " + Utils.arrayToString(this.parser.getRuleInvocationStack()));
  29091. }
  29092. }
  29093. var c = null;
  29094. if (collectPredicates && inContext) {
  29095. if (fullCtx) {
  29096. // In full context mode, we can evaluate predicates on-the-fly
  29097. // during closure, which dramatically reduces the size of
  29098. // the config sets. It also obviates the need to test predicates
  29099. // later during conflict resolution.
  29100. var currentPosition = this._input.index;
  29101. this._input.seek(this._startIndex);
  29102. var predSucceeds = pt.getPredicate().evaluate(this.parser, this._outerContext);
  29103. this._input.seek(currentPosition);
  29104. if (predSucceeds) {
  29105. c = new ATNConfig({ state: pt.target }, config); // no pred context
  29106. }
  29107. } else {
  29108. var newSemCtx = SemanticContext.andContext(config.semanticContext, pt.getPredicate());
  29109. c = new ATNConfig({ state: pt.target, semanticContext: newSemCtx }, config);
  29110. }
  29111. } else {
  29112. c = new ATNConfig({ state: pt.target }, config);
  29113. }
  29114. if (this.debug) {
  29115. console.log("config from pred transition=" + c);
  29116. }
  29117. return c;
  29118. };
  29119. ParserATNSimulator.prototype.predTransition = function (config, pt, collectPredicates, inContext, fullCtx) {
  29120. if (this.debug) {
  29121. console.log("PRED (collectPredicates=" + collectPredicates + ") " + pt.ruleIndex + ":" + pt.predIndex + ", ctx dependent=" + pt.isCtxDependent);
  29122. if (this.parser !== null) {
  29123. console.log("context surrounding pred is " + Utils.arrayToString(this.parser.getRuleInvocationStack()));
  29124. }
  29125. }
  29126. var c = null;
  29127. if (collectPredicates && (pt.isCtxDependent && inContext || !pt.isCtxDependent)) {
  29128. if (fullCtx) {
  29129. // In full context mode, we can evaluate predicates on-the-fly
  29130. // during closure, which dramatically reduces the size of
  29131. // the config sets. It also obviates the need to test predicates
  29132. // later during conflict resolution.
  29133. var currentPosition = this._input.index;
  29134. this._input.seek(this._startIndex);
  29135. var predSucceeds = pt.getPredicate().evaluate(this.parser, this._outerContext);
  29136. this._input.seek(currentPosition);
  29137. if (predSucceeds) {
  29138. c = new ATNConfig({ state: pt.target }, config); // no pred context
  29139. }
  29140. } else {
  29141. var newSemCtx = SemanticContext.andContext(config.semanticContext, pt.getPredicate());
  29142. c = new ATNConfig({ state: pt.target, semanticContext: newSemCtx }, config);
  29143. }
  29144. } else {
  29145. c = new ATNConfig({ state: pt.target }, config);
  29146. }
  29147. if (this.debug) {
  29148. console.log("config from pred transition=" + c);
  29149. }
  29150. return c;
  29151. };
  29152. ParserATNSimulator.prototype.ruleTransition = function (config, t) {
  29153. if (this.debug) {
  29154. console.log("CALL rule " + this.getRuleName(t.target.ruleIndex) + ", ctx=" + config.context);
  29155. }
  29156. var returnState = t.followState;
  29157. var newContext = SingletonPredictionContext.create(config.context, returnState.stateNumber);
  29158. return new ATNConfig({ state: t.target, context: newContext }, config);
  29159. };
  29160. ParserATNSimulator.prototype.getConflictingAlts = function (configs) {
  29161. var altsets = PredictionMode.getConflictingAltSubsets(configs);
  29162. return PredictionMode.getAlts(altsets);
  29163. };
  29164. // Sam pointed out a problem with the previous definition, v3, of
  29165. // ambiguous states. If we have another state associated with conflicting
  29166. // alternatives, we should keep going. For example, the following grammar
  29167. //
  29168. // s : (ID | ID ID?) ';' ;
  29169. //
  29170. // When the ATN simulation reaches the state before ';', it has a DFA
  29171. // state that looks like: [12|1|[], 6|2|[], 12|2|[]]. Naturally
  29172. // 12|1|[] and 12|2|[] conflict, but we cannot stop processing this node
  29173. // because alternative to has another way to continue, via [6|2|[]].
  29174. // The key is that we have a single state that has config's only associated
  29175. // with a single alternative, 2, and crucially the state transitions
  29176. // among the configurations are all non-epsilon transitions. That means
  29177. // we don't consider any conflicts that include alternative 2. So, we
  29178. // ignore the conflict between alts 1 and 2. We ignore a set of
  29179. // conflicting alts when there is an intersection with an alternative
  29180. // associated with a single alt state in the state&rarr;config-list map.
  29181. //
  29182. // It's also the case that we might have two conflicting configurations but
  29183. // also a 3rd nonconflicting configuration for a different alternative:
  29184. // [1|1|[], 1|2|[], 8|3|[]]. This can come about from grammar:
  29185. //
  29186. // a : A | A | A B ;
  29187. //
  29188. // After matching input A, we reach the stop state for rule A, state 1.
  29189. // State 8 is the state right before B. Clearly alternatives 1 and 2
  29190. // conflict and no amount of further lookahead will separate the two.
  29191. // However, alternative 3 will be able to continue and so we do not
  29192. // stop working on this state. In the previous example, we're concerned
  29193. // with states associated with the conflicting alternatives. Here alt
  29194. // 3 is not associated with the conflicting configs, but since we can continue
  29195. // looking for input reasonably, I don't declare the state done. We
  29196. // ignore a set of conflicting alts when we have an alternative
  29197. // that we still need to pursue.
  29198. //
  29199. ParserATNSimulator.prototype.getConflictingAltsOrUniqueAlt = function (configs) {
  29200. var conflictingAlts = null;
  29201. if (configs.uniqueAlt !== ATN.INVALID_ALT_NUMBER) {
  29202. conflictingAlts = new BitSet();
  29203. conflictingAlts.add(configs.uniqueAlt);
  29204. } else {
  29205. conflictingAlts = configs.conflictingAlts;
  29206. }
  29207. return conflictingAlts;
  29208. };
  29209. ParserATNSimulator.prototype.getTokenName = function (t) {
  29210. if (t === Token.EOF) {
  29211. return "EOF";
  29212. }
  29213. if (this.parser !== null && this.parser.literalNames !== null) {
  29214. if (t >= this.parser.literalNames.length && t >= this.parser.symbolicNames.length) {
  29215. console.log("" + t + " ttype out of range: " + this.parser.literalNames);
  29216. console.log("" + this.parser.getInputStream().getTokens());
  29217. } else {
  29218. var name = this.parser.literalNames[t] || this.parser.symbolicNames[t];
  29219. return name + "<" + t + ">";
  29220. }
  29221. }
  29222. return "" + t;
  29223. };
  29224. ParserATNSimulator.prototype.getLookaheadName = function (input) {
  29225. return this.getTokenName(input.LA(1));
  29226. };
  29227. // Used for debugging in adaptivePredict around execATN but I cut
  29228. // it out for clarity now that alg. works well. We can leave this
  29229. // "dead" code for a bit.
  29230. //
  29231. ParserATNSimulator.prototype.dumpDeadEndConfigs = function (nvae) {
  29232. console.log("dead end configs: ");
  29233. var decs = nvae.getDeadEndConfigs();
  29234. for (var i = 0; i < decs.length; i++) {
  29235. var c = decs[i];
  29236. var trans = "no edges";
  29237. if (c.state.transitions.length > 0) {
  29238. var t = c.state.transitions[0];
  29239. if (t instanceof AtomTransition) {
  29240. trans = "Atom " + this.getTokenName(t.label);
  29241. } else if (t instanceof SetTransition) {
  29242. var neg = t instanceof NotSetTransition;
  29243. trans = (neg ? "~" : "") + "Set " + t.set;
  29244. }
  29245. }
  29246. console.error(c.toString(this.parser, true) + ":" + trans);
  29247. }
  29248. };
  29249. ParserATNSimulator.prototype.noViableAlt = function (input, outerContext, configs, startIndex) {
  29250. return new NoViableAltException(this.parser, input, input.get(startIndex), input.LT(1), configs, outerContext);
  29251. };
  29252. ParserATNSimulator.prototype.getUniqueAlt = function (configs) {
  29253. var alt = ATN.INVALID_ALT_NUMBER;
  29254. for (var i = 0; i < configs.items.length; i++) {
  29255. var c = configs.items[i];
  29256. if (alt === ATN.INVALID_ALT_NUMBER) {
  29257. alt = c.alt; // found first alt
  29258. } else if (c.alt !== alt) {
  29259. return ATN.INVALID_ALT_NUMBER;
  29260. }
  29261. }
  29262. return alt;
  29263. };
  29264. //
  29265. // Add an edge to the DFA, if possible. This method calls
  29266. // {@link //addDFAState} to ensure the {@code to} state is present in the
  29267. // DFA. If {@code from} is {@code null}, or if {@code t} is outside the
  29268. // range of edges that can be represented in the DFA tables, this method
  29269. // returns without adding the edge to the DFA.
  29270. //
  29271. // <p>If {@code to} is {@code null}, this method returns {@code null}.
  29272. // Otherwise, this method returns the {@link DFAState} returned by calling
  29273. // {@link //addDFAState} for the {@code to} state.</p>
  29274. //
  29275. // @param dfa The DFA
  29276. // @param from The source state for the edge
  29277. // @param t The input symbol
  29278. // @param to The target state for the edge
  29279. //
  29280. // @return If {@code to} is {@code null}, this method returns {@code null};
  29281. // otherwise this method returns the result of calling {@link //addDFAState}
  29282. // on {@code to}
  29283. //
  29284. ParserATNSimulator.prototype.addDFAEdge = function (dfa, from_, t, to) {
  29285. if (this.debug) {
  29286. console.log("EDGE " + from_ + " -> " + to + " upon " + this.getTokenName(t));
  29287. }
  29288. if (to === null) {
  29289. return null;
  29290. }
  29291. to = this.addDFAState(dfa, to); // used existing if possible not incoming
  29292. if (from_ === null || t < -1 || t > this.atn.maxTokenType) {
  29293. return to;
  29294. }
  29295. if (from_.edges === null) {
  29296. from_.edges = [];
  29297. }
  29298. from_.edges[t + 1] = to; // connect
  29299. if (this.debug) {
  29300. var literalNames = this.parser === null ? null : this.parser.literalNames;
  29301. var symbolicNames = this.parser === null ? null : this.parser.symbolicNames;
  29302. console.log("DFA=\n" + dfa.toString(literalNames, symbolicNames));
  29303. }
  29304. return to;
  29305. };
  29306. //
  29307. // Add state {@code D} to the DFA if it is not already present, and return
  29308. // the actual instance stored in the DFA. If a state equivalent to {@code D}
  29309. // is already in the DFA, the existing state is returned. Otherwise this
  29310. // method returns {@code D} after adding it to the DFA.
  29311. //
  29312. // <p>If {@code D} is {@link //ERROR}, this method returns {@link //ERROR} and
  29313. // does not change the DFA.</p>
  29314. //
  29315. // @param dfa The dfa
  29316. // @param D The DFA state to add
  29317. // @return The state stored in the DFA. This will be either the existing
  29318. // state if {@code D} is already in the DFA, or {@code D} itself if the
  29319. // state was not already present.
  29320. //
  29321. ParserATNSimulator.prototype.addDFAState = function (dfa, D) {
  29322. if (D == ATNSimulator.ERROR) {
  29323. return D;
  29324. }
  29325. var existing = dfa.states.get(D);
  29326. if (existing !== null) {
  29327. return existing;
  29328. }
  29329. D.stateNumber = dfa.states.length;
  29330. if (!D.configs.readOnly) {
  29331. D.configs.optimizeConfigs(this);
  29332. D.configs.setReadonly(true);
  29333. }
  29334. dfa.states.add(D);
  29335. if (this.debug) {
  29336. console.log("adding new DFA state: " + D);
  29337. }
  29338. return D;
  29339. };
  29340. ParserATNSimulator.prototype.reportAttemptingFullContext = function (dfa, conflictingAlts, configs, startIndex, stopIndex) {
  29341. if (this.debug || this.retry_debug) {
  29342. var interval = new Interval(startIndex, stopIndex + 1);
  29343. console.log("reportAttemptingFullContext decision=" + dfa.decision + ":" + configs + ", input=" + this.parser.getTokenStream().getText(interval));
  29344. }
  29345. if (this.parser !== null) {
  29346. this.parser.getErrorListenerDispatch().reportAttemptingFullContext(this.parser, dfa, startIndex, stopIndex, conflictingAlts, configs);
  29347. }
  29348. };
  29349. ParserATNSimulator.prototype.reportContextSensitivity = function (dfa, prediction, configs, startIndex, stopIndex) {
  29350. if (this.debug || this.retry_debug) {
  29351. var interval = new Interval(startIndex, stopIndex + 1);
  29352. console.log("reportContextSensitivity decision=" + dfa.decision + ":" + configs + ", input=" + this.parser.getTokenStream().getText(interval));
  29353. }
  29354. if (this.parser !== null) {
  29355. this.parser.getErrorListenerDispatch().reportContextSensitivity(this.parser, dfa, startIndex, stopIndex, prediction, configs);
  29356. }
  29357. };
  29358. // If context sensitive parsing, we know it's ambiguity not conflict//
  29359. ParserATNSimulator.prototype.reportAmbiguity = function (dfa, D, startIndex, stopIndex, exact, ambigAlts, configs) {
  29360. if (this.debug || this.retry_debug) {
  29361. var interval = new Interval(startIndex, stopIndex + 1);
  29362. console.log("reportAmbiguity " + ambigAlts + ":" + configs + ", input=" + this.parser.getTokenStream().getText(interval));
  29363. }
  29364. if (this.parser !== null) {
  29365. this.parser.getErrorListenerDispatch().reportAmbiguity(this.parser, dfa, startIndex, stopIndex, exact, ambigAlts, configs);
  29366. }
  29367. };
  29368. exports.ParserATNSimulator = ParserATNSimulator;
  29369. /***/ }),
  29370. /***/ "./node_modules/antlr4/atn/PredictionMode.js":
  29371. /*!***************************************************!*\
  29372. !*** ./node_modules/antlr4/atn/PredictionMode.js ***!
  29373. \***************************************************/
  29374. /*! no static exports found */
  29375. /***/ (function(module, exports, __webpack_require__) {
  29376. "use strict";
  29377. //
  29378. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  29379. * Use of this file is governed by the BSD 3-clause license that
  29380. * can be found in the LICENSE.txt file in the project root.
  29381. */
  29382. //
  29383. //
  29384. // This enumeration defines the prediction modes available in ANTLR 4 along with
  29385. // utility methods for analyzing configuration sets for conflicts and/or
  29386. // ambiguities.
  29387. var Set = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Set;
  29388. var Map = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Map;
  29389. var BitSet = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").BitSet;
  29390. var AltDict = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").AltDict;
  29391. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  29392. var RuleStopState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  29393. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  29394. var ATNConfig = __webpack_require__(/*! ./ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").ATNConfig;
  29395. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  29396. var Hash = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").Hash;
  29397. var hashStuff = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").hashStuff;
  29398. var equalArrays = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").equalArrays;
  29399. function PredictionMode() {
  29400. return this;
  29401. }
  29402. //
  29403. // The SLL(*) prediction mode. This prediction mode ignores the current
  29404. // parser context when making predictions. This is the fastest prediction
  29405. // mode, and provides correct results for many grammars. This prediction
  29406. // mode is more powerful than the prediction mode provided by ANTLR 3, but
  29407. // may result in syntax errors for grammar and input combinations which are
  29408. // not SLL.
  29409. //
  29410. // <p>
  29411. // When using this prediction mode, the parser will either return a correct
  29412. // parse tree (i.e. the same parse tree that would be returned with the
  29413. // {@link //LL} prediction mode), or it will report a syntax error. If a
  29414. // syntax error is encountered when using the {@link //SLL} prediction mode,
  29415. // it may be due to either an actual syntax error in the input or indicate
  29416. // that the particular combination of grammar and input requires the more
  29417. // powerful {@link //LL} prediction abilities to complete successfully.</p>
  29418. //
  29419. // <p>
  29420. // This prediction mode does not provide any guarantees for prediction
  29421. // behavior for syntactically-incorrect inputs.</p>
  29422. //
  29423. PredictionMode.SLL = 0;
  29424. //
  29425. // The LL(*) prediction mode. This prediction mode allows the current parser
  29426. // context to be used for resolving SLL conflicts that occur during
  29427. // prediction. This is the fastest prediction mode that guarantees correct
  29428. // parse results for all combinations of grammars with syntactically correct
  29429. // inputs.
  29430. //
  29431. // <p>
  29432. // When using this prediction mode, the parser will make correct decisions
  29433. // for all syntactically-correct grammar and input combinations. However, in
  29434. // cases where the grammar is truly ambiguous this prediction mode might not
  29435. // report a precise answer for <em>exactly which</em> alternatives are
  29436. // ambiguous.</p>
  29437. //
  29438. // <p>
  29439. // This prediction mode does not provide any guarantees for prediction
  29440. // behavior for syntactically-incorrect inputs.</p>
  29441. //
  29442. PredictionMode.LL = 1;
  29443. //
  29444. // The LL(*) prediction mode with exact ambiguity detection. In addition to
  29445. // the correctness guarantees provided by the {@link //LL} prediction mode,
  29446. // this prediction mode instructs the prediction algorithm to determine the
  29447. // complete and exact set of ambiguous alternatives for every ambiguous
  29448. // decision encountered while parsing.
  29449. //
  29450. // <p>
  29451. // This prediction mode may be used for diagnosing ambiguities during
  29452. // grammar development. Due to the performance overhead of calculating sets
  29453. // of ambiguous alternatives, this prediction mode should be avoided when
  29454. // the exact results are not necessary.</p>
  29455. //
  29456. // <p>
  29457. // This prediction mode does not provide any guarantees for prediction
  29458. // behavior for syntactically-incorrect inputs.</p>
  29459. //
  29460. PredictionMode.LL_EXACT_AMBIG_DETECTION = 2;
  29461. //
  29462. // Computes the SLL prediction termination condition.
  29463. //
  29464. // <p>
  29465. // This method computes the SLL prediction termination condition for both of
  29466. // the following cases.</p>
  29467. //
  29468. // <ul>
  29469. // <li>The usual SLL+LL fallback upon SLL conflict</li>
  29470. // <li>Pure SLL without LL fallback</li>
  29471. // </ul>
  29472. //
  29473. // <p><strong>COMBINED SLL+LL PARSING</strong></p>
  29474. //
  29475. // <p>When LL-fallback is enabled upon SLL conflict, correct predictions are
  29476. // ensured regardless of how the termination condition is computed by this
  29477. // method. Due to the substantially higher cost of LL prediction, the
  29478. // prediction should only fall back to LL when the additional lookahead
  29479. // cannot lead to a unique SLL prediction.</p>
  29480. //
  29481. // <p>Assuming combined SLL+LL parsing, an SLL configuration set with only
  29482. // conflicting subsets should fall back to full LL, even if the
  29483. // configuration sets don't resolve to the same alternative (e.g.
  29484. // {@code {1,2}} and {@code {3,4}}. If there is at least one non-conflicting
  29485. // configuration, SLL could continue with the hopes that more lookahead will
  29486. // resolve via one of those non-conflicting configurations.</p>
  29487. //
  29488. // <p>Here's the prediction termination rule them: SLL (for SLL+LL parsing)
  29489. // stops when it sees only conflicting configuration subsets. In contrast,
  29490. // full LL keeps going when there is uncertainty.</p>
  29491. //
  29492. // <p><strong>HEURISTIC</strong></p>
  29493. //
  29494. // <p>As a heuristic, we stop prediction when we see any conflicting subset
  29495. // unless we see a state that only has one alternative associated with it.
  29496. // The single-alt-state thing lets prediction continue upon rules like
  29497. // (otherwise, it would admit defeat too soon):</p>
  29498. //
  29499. // <p>{@code [12|1|[], 6|2|[], 12|2|[]]. s : (ID | ID ID?) ';' ;}</p>
  29500. //
  29501. // <p>When the ATN simulation reaches the state before {@code ';'}, it has a
  29502. // DFA state that looks like: {@code [12|1|[], 6|2|[], 12|2|[]]}. Naturally
  29503. // {@code 12|1|[]} and {@code 12|2|[]} conflict, but we cannot stop
  29504. // processing this node because alternative to has another way to continue,
  29505. // via {@code [6|2|[]]}.</p>
  29506. //
  29507. // <p>It also let's us continue for this rule:</p>
  29508. //
  29509. // <p>{@code [1|1|[], 1|2|[], 8|3|[]] a : A | A | A B ;}</p>
  29510. //
  29511. // <p>After matching input A, we reach the stop state for rule A, state 1.
  29512. // State 8 is the state right before B. Clearly alternatives 1 and 2
  29513. // conflict and no amount of further lookahead will separate the two.
  29514. // However, alternative 3 will be able to continue and so we do not stop
  29515. // working on this state. In the previous example, we're concerned with
  29516. // states associated with the conflicting alternatives. Here alt 3 is not
  29517. // associated with the conflicting configs, but since we can continue
  29518. // looking for input reasonably, don't declare the state done.</p>
  29519. //
  29520. // <p><strong>PURE SLL PARSING</strong></p>
  29521. //
  29522. // <p>To handle pure SLL parsing, all we have to do is make sure that we
  29523. // combine stack contexts for configurations that differ only by semantic
  29524. // predicate. From there, we can do the usual SLL termination heuristic.</p>
  29525. //
  29526. // <p><strong>PREDICATES IN SLL+LL PARSING</strong></p>
  29527. //
  29528. // <p>SLL decisions don't evaluate predicates until after they reach DFA stop
  29529. // states because they need to create the DFA cache that works in all
  29530. // semantic situations. In contrast, full LL evaluates predicates collected
  29531. // during start state computation so it can ignore predicates thereafter.
  29532. // This means that SLL termination detection can totally ignore semantic
  29533. // predicates.</p>
  29534. //
  29535. // <p>Implementation-wise, {@link ATNConfigSet} combines stack contexts but not
  29536. // semantic predicate contexts so we might see two configurations like the
  29537. // following.</p>
  29538. //
  29539. // <p>{@code (s, 1, x, {}), (s, 1, x', {p})}</p>
  29540. //
  29541. // <p>Before testing these configurations against others, we have to merge
  29542. // {@code x} and {@code x'} (without modifying the existing configurations).
  29543. // For example, we test {@code (x+x')==x''} when looking for conflicts in
  29544. // the following configurations.</p>
  29545. //
  29546. // <p>{@code (s, 1, x, {}), (s, 1, x', {p}), (s, 2, x'', {})}</p>
  29547. //
  29548. // <p>If the configuration set has predicates (as indicated by
  29549. // {@link ATNConfigSet//hasSemanticContext}), this algorithm makes a copy of
  29550. // the configurations to strip out all of the predicates so that a standard
  29551. // {@link ATNConfigSet} will merge everything ignoring predicates.</p>
  29552. //
  29553. PredictionMode.hasSLLConflictTerminatingPrediction = function (mode, configs) {
  29554. // Configs in rule stop states indicate reaching the end of the decision
  29555. // rule (local context) or end of start rule (full context). If all
  29556. // configs meet this condition, then none of the configurations is able
  29557. // to match additional input so we terminate prediction.
  29558. //
  29559. if (PredictionMode.allConfigsInRuleStopStates(configs)) {
  29560. return true;
  29561. }
  29562. // pure SLL mode parsing
  29563. if (mode === PredictionMode.SLL) {
  29564. // Don't bother with combining configs from different semantic
  29565. // contexts if we can fail over to full LL; costs more time
  29566. // since we'll often fail over anyway.
  29567. if (configs.hasSemanticContext) {
  29568. // dup configs, tossing out semantic predicates
  29569. var dup = new ATNConfigSet();
  29570. for (var i = 0; i < configs.items.length; i++) {
  29571. var c = configs.items[i];
  29572. c = new ATNConfig({ semanticContext: SemanticContext.NONE }, c);
  29573. dup.add(c);
  29574. }
  29575. configs = dup;
  29576. }
  29577. // now we have combined contexts for configs with dissimilar preds
  29578. }
  29579. // pure SLL or combined SLL+LL mode parsing
  29580. var altsets = PredictionMode.getConflictingAltSubsets(configs);
  29581. return PredictionMode.hasConflictingAltSet(altsets) && !PredictionMode.hasStateAssociatedWithOneAlt(configs);
  29582. };
  29583. // Checks if any configuration in {@code configs} is in a
  29584. // {@link RuleStopState}. Configurations meeting this condition have reached
  29585. // the end of the decision rule (local context) or end of start rule (full
  29586. // context).
  29587. //
  29588. // @param configs the configuration set to test
  29589. // @return {@code true} if any configuration in {@code configs} is in a
  29590. // {@link RuleStopState}, otherwise {@code false}
  29591. PredictionMode.hasConfigInRuleStopState = function (configs) {
  29592. for (var i = 0; i < configs.items.length; i++) {
  29593. var c = configs.items[i];
  29594. if (c.state instanceof RuleStopState) {
  29595. return true;
  29596. }
  29597. }
  29598. return false;
  29599. };
  29600. // Checks if all configurations in {@code configs} are in a
  29601. // {@link RuleStopState}. Configurations meeting this condition have reached
  29602. // the end of the decision rule (local context) or end of start rule (full
  29603. // context).
  29604. //
  29605. // @param configs the configuration set to test
  29606. // @return {@code true} if all configurations in {@code configs} are in a
  29607. // {@link RuleStopState}, otherwise {@code false}
  29608. PredictionMode.allConfigsInRuleStopStates = function (configs) {
  29609. for (var i = 0; i < configs.items.length; i++) {
  29610. var c = configs.items[i];
  29611. if (!(c.state instanceof RuleStopState)) {
  29612. return false;
  29613. }
  29614. }
  29615. return true;
  29616. };
  29617. //
  29618. // Full LL prediction termination.
  29619. //
  29620. // <p>Can we stop looking ahead during ATN simulation or is there some
  29621. // uncertainty as to which alternative we will ultimately pick, after
  29622. // consuming more input? Even if there are partial conflicts, we might know
  29623. // that everything is going to resolve to the same minimum alternative. That
  29624. // means we can stop since no more lookahead will change that fact. On the
  29625. // other hand, there might be multiple conflicts that resolve to different
  29626. // minimums. That means we need more look ahead to decide which of those
  29627. // alternatives we should predict.</p>
  29628. //
  29629. // <p>The basic idea is to split the set of configurations {@code C}, into
  29630. // conflicting subsets {@code (s, _, ctx, _)} and singleton subsets with
  29631. // non-conflicting configurations. Two configurations conflict if they have
  29632. // identical {@link ATNConfig//state} and {@link ATNConfig//context} values
  29633. // but different {@link ATNConfig//alt} value, e.g. {@code (s, i, ctx, _)}
  29634. // and {@code (s, j, ctx, _)} for {@code i!=j}.</p>
  29635. //
  29636. // <p>Reduce these configuration subsets to the set of possible alternatives.
  29637. // You can compute the alternative subsets in one pass as follows:</p>
  29638. //
  29639. // <p>{@code A_s,ctx = {i | (s, i, ctx, _)}} for each configuration in
  29640. // {@code C} holding {@code s} and {@code ctx} fixed.</p>
  29641. //
  29642. // <p>Or in pseudo-code, for each configuration {@code c} in {@code C}:</p>
  29643. //
  29644. // <pre>
  29645. // map[c] U= c.{@link ATNConfig//alt alt} // map hash/equals uses s and x, not
  29646. // alt and not pred
  29647. // </pre>
  29648. //
  29649. // <p>The values in {@code map} are the set of {@code A_s,ctx} sets.</p>
  29650. //
  29651. // <p>If {@code |A_s,ctx|=1} then there is no conflict associated with
  29652. // {@code s} and {@code ctx}.</p>
  29653. //
  29654. // <p>Reduce the subsets to singletons by choosing a minimum of each subset. If
  29655. // the union of these alternative subsets is a singleton, then no amount of
  29656. // more lookahead will help us. We will always pick that alternative. If,
  29657. // however, there is more than one alternative, then we are uncertain which
  29658. // alternative to predict and must continue looking for resolution. We may
  29659. // or may not discover an ambiguity in the future, even if there are no
  29660. // conflicting subsets this round.</p>
  29661. //
  29662. // <p>The biggest sin is to terminate early because it means we've made a
  29663. // decision but were uncertain as to the eventual outcome. We haven't used
  29664. // enough lookahead. On the other hand, announcing a conflict too late is no
  29665. // big deal; you will still have the conflict. It's just inefficient. It
  29666. // might even look until the end of file.</p>
  29667. //
  29668. // <p>No special consideration for semantic predicates is required because
  29669. // predicates are evaluated on-the-fly for full LL prediction, ensuring that
  29670. // no configuration contains a semantic context during the termination
  29671. // check.</p>
  29672. //
  29673. // <p><strong>CONFLICTING CONFIGS</strong></p>
  29674. //
  29675. // <p>Two configurations {@code (s, i, x)} and {@code (s, j, x')}, conflict
  29676. // when {@code i!=j} but {@code x=x'}. Because we merge all
  29677. // {@code (s, i, _)} configurations together, that means that there are at
  29678. // most {@code n} configurations associated with state {@code s} for
  29679. // {@code n} possible alternatives in the decision. The merged stacks
  29680. // complicate the comparison of configuration contexts {@code x} and
  29681. // {@code x'}. Sam checks to see if one is a subset of the other by calling
  29682. // merge and checking to see if the merged result is either {@code x} or
  29683. // {@code x'}. If the {@code x} associated with lowest alternative {@code i}
  29684. // is the superset, then {@code i} is the only possible prediction since the
  29685. // others resolve to {@code min(i)} as well. However, if {@code x} is
  29686. // associated with {@code j>i} then at least one stack configuration for
  29687. // {@code j} is not in conflict with alternative {@code i}. The algorithm
  29688. // should keep going, looking for more lookahead due to the uncertainty.</p>
  29689. //
  29690. // <p>For simplicity, I'm doing a equality check between {@code x} and
  29691. // {@code x'} that lets the algorithm continue to consume lookahead longer
  29692. // than necessary. The reason I like the equality is of course the
  29693. // simplicity but also because that is the test you need to detect the
  29694. // alternatives that are actually in conflict.</p>
  29695. //
  29696. // <p><strong>CONTINUE/STOP RULE</strong></p>
  29697. //
  29698. // <p>Continue if union of resolved alternative sets from non-conflicting and
  29699. // conflicting alternative subsets has more than one alternative. We are
  29700. // uncertain about which alternative to predict.</p>
  29701. //
  29702. // <p>The complete set of alternatives, {@code [i for (_,i,_)]}, tells us which
  29703. // alternatives are still in the running for the amount of input we've
  29704. // consumed at this point. The conflicting sets let us to strip away
  29705. // configurations that won't lead to more states because we resolve
  29706. // conflicts to the configuration with a minimum alternate for the
  29707. // conflicting set.</p>
  29708. //
  29709. // <p><strong>CASES</strong></p>
  29710. //
  29711. // <ul>
  29712. //
  29713. // <li>no conflicts and more than 1 alternative in set =&gt; continue</li>
  29714. //
  29715. // <li> {@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s, 3, z)},
  29716. // {@code (s', 1, y)}, {@code (s', 2, y)} yields non-conflicting set
  29717. // {@code {3}} U conflicting sets {@code min({1,2})} U {@code min({1,2})} =
  29718. // {@code {1,3}} =&gt; continue
  29719. // </li>
  29720. //
  29721. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 1, y)},
  29722. // {@code (s', 2, y)}, {@code (s'', 1, z)} yields non-conflicting set
  29723. // {@code {1}} U conflicting sets {@code min({1,2})} U {@code min({1,2})} =
  29724. // {@code {1}} =&gt; stop and predict 1</li>
  29725. //
  29726. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 1, y)},
  29727. // {@code (s', 2, y)} yields conflicting, reduced sets {@code {1}} U
  29728. // {@code {1}} = {@code {1}} =&gt; stop and predict 1, can announce
  29729. // ambiguity {@code {1,2}}</li>
  29730. //
  29731. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 2, y)},
  29732. // {@code (s', 3, y)} yields conflicting, reduced sets {@code {1}} U
  29733. // {@code {2}} = {@code {1,2}} =&gt; continue</li>
  29734. //
  29735. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 3, y)},
  29736. // {@code (s', 4, y)} yields conflicting, reduced sets {@code {1}} U
  29737. // {@code {3}} = {@code {1,3}} =&gt; continue</li>
  29738. //
  29739. // </ul>
  29740. //
  29741. // <p><strong>EXACT AMBIGUITY DETECTION</strong></p>
  29742. //
  29743. // <p>If all states report the same conflicting set of alternatives, then we
  29744. // know we have the exact ambiguity set.</p>
  29745. //
  29746. // <p><code>|A_<em>i</em>|&gt;1</code> and
  29747. // <code>A_<em>i</em> = A_<em>j</em></code> for all <em>i</em>, <em>j</em>.</p>
  29748. //
  29749. // <p>In other words, we continue examining lookahead until all {@code A_i}
  29750. // have more than one alternative and all {@code A_i} are the same. If
  29751. // {@code A={{1,2}, {1,3}}}, then regular LL prediction would terminate
  29752. // because the resolved set is {@code {1}}. To determine what the real
  29753. // ambiguity is, we have to know whether the ambiguity is between one and
  29754. // two or one and three so we keep going. We can only stop prediction when
  29755. // we need exact ambiguity detection when the sets look like
  29756. // {@code A={{1,2}}} or {@code {{1,2},{1,2}}}, etc...</p>
  29757. //
  29758. PredictionMode.resolvesToJustOneViableAlt = function (altsets) {
  29759. return PredictionMode.getSingleViableAlt(altsets);
  29760. };
  29761. //
  29762. // Determines if every alternative subset in {@code altsets} contains more
  29763. // than one alternative.
  29764. //
  29765. // @param altsets a collection of alternative subsets
  29766. // @return {@code true} if every {@link BitSet} in {@code altsets} has
  29767. // {@link BitSet//cardinality cardinality} &gt; 1, otherwise {@code false}
  29768. //
  29769. PredictionMode.allSubsetsConflict = function (altsets) {
  29770. return !PredictionMode.hasNonConflictingAltSet(altsets);
  29771. };
  29772. //
  29773. // Determines if any single alternative subset in {@code altsets} contains
  29774. // exactly one alternative.
  29775. //
  29776. // @param altsets a collection of alternative subsets
  29777. // @return {@code true} if {@code altsets} contains a {@link BitSet} with
  29778. // {@link BitSet//cardinality cardinality} 1, otherwise {@code false}
  29779. //
  29780. PredictionMode.hasNonConflictingAltSet = function (altsets) {
  29781. for (var i = 0; i < altsets.length; i++) {
  29782. var alts = altsets[i];
  29783. if (alts.length === 1) {
  29784. return true;
  29785. }
  29786. }
  29787. return false;
  29788. };
  29789. //
  29790. // Determines if any single alternative subset in {@code altsets} contains
  29791. // more than one alternative.
  29792. //
  29793. // @param altsets a collection of alternative subsets
  29794. // @return {@code true} if {@code altsets} contains a {@link BitSet} with
  29795. // {@link BitSet//cardinality cardinality} &gt; 1, otherwise {@code false}
  29796. //
  29797. PredictionMode.hasConflictingAltSet = function (altsets) {
  29798. for (var i = 0; i < altsets.length; i++) {
  29799. var alts = altsets[i];
  29800. if (alts.length > 1) {
  29801. return true;
  29802. }
  29803. }
  29804. return false;
  29805. };
  29806. //
  29807. // Determines if every alternative subset in {@code altsets} is equivalent.
  29808. //
  29809. // @param altsets a collection of alternative subsets
  29810. // @return {@code true} if every member of {@code altsets} is equal to the
  29811. // others, otherwise {@code false}
  29812. //
  29813. PredictionMode.allSubsetsEqual = function (altsets) {
  29814. var first = null;
  29815. for (var i = 0; i < altsets.length; i++) {
  29816. var alts = altsets[i];
  29817. if (first === null) {
  29818. first = alts;
  29819. } else if (alts !== first) {
  29820. return false;
  29821. }
  29822. }
  29823. return true;
  29824. };
  29825. //
  29826. // Returns the unique alternative predicted by all alternative subsets in
  29827. // {@code altsets}. If no such alternative exists, this method returns
  29828. // {@link ATN//INVALID_ALT_NUMBER}.
  29829. //
  29830. // @param altsets a collection of alternative subsets
  29831. //
  29832. PredictionMode.getUniqueAlt = function (altsets) {
  29833. var all = PredictionMode.getAlts(altsets);
  29834. if (all.length === 1) {
  29835. return all.minValue();
  29836. } else {
  29837. return ATN.INVALID_ALT_NUMBER;
  29838. }
  29839. };
  29840. // Gets the complete set of represented alternatives for a collection of
  29841. // alternative subsets. This method returns the union of each {@link BitSet}
  29842. // in {@code altsets}.
  29843. //
  29844. // @param altsets a collection of alternative subsets
  29845. // @return the set of represented alternatives in {@code altsets}
  29846. //
  29847. PredictionMode.getAlts = function (altsets) {
  29848. var all = new BitSet();
  29849. altsets.map(function (alts) {
  29850. all.or(alts);
  29851. });
  29852. return all;
  29853. };
  29854. //
  29855. // This function gets the conflicting alt subsets from a configuration set.
  29856. // For each configuration {@code c} in {@code configs}:
  29857. //
  29858. // <pre>
  29859. // map[c] U= c.{@link ATNConfig//alt alt} // map hash/equals uses s and x, not
  29860. // alt and not pred
  29861. // </pre>
  29862. PredictionMode.getConflictingAltSubsets = function (configs) {
  29863. var configToAlts = new Map();
  29864. configToAlts.hashFunction = function (cfg) {
  29865. hashStuff(cfg.state.stateNumber, cfg.context);
  29866. };
  29867. configToAlts.equalsFunction = function (c1, c2) {
  29868. return c1.state.stateNumber == c2.state.stateNumber && c1.context.equals(c2.context);
  29869. };
  29870. configs.items.map(function (cfg) {
  29871. var alts = configToAlts.get(cfg);
  29872. if (alts === null) {
  29873. alts = new BitSet();
  29874. configToAlts.put(cfg, alts);
  29875. }
  29876. alts.add(cfg.alt);
  29877. });
  29878. return configToAlts.getValues();
  29879. };
  29880. //
  29881. // Get a map from state to alt subset from a configuration set. For each
  29882. // configuration {@code c} in {@code configs}:
  29883. //
  29884. // <pre>
  29885. // map[c.{@link ATNConfig//state state}] U= c.{@link ATNConfig//alt alt}
  29886. // </pre>
  29887. //
  29888. PredictionMode.getStateToAltMap = function (configs) {
  29889. var m = new AltDict();
  29890. configs.items.map(function (c) {
  29891. var alts = m.get(c.state);
  29892. if (alts === null) {
  29893. alts = new BitSet();
  29894. m.put(c.state, alts);
  29895. }
  29896. alts.add(c.alt);
  29897. });
  29898. return m;
  29899. };
  29900. PredictionMode.hasStateAssociatedWithOneAlt = function (configs) {
  29901. var values = PredictionMode.getStateToAltMap(configs).values();
  29902. for (var i = 0; i < values.length; i++) {
  29903. if (values[i].length === 1) {
  29904. return true;
  29905. }
  29906. }
  29907. return false;
  29908. };
  29909. PredictionMode.getSingleViableAlt = function (altsets) {
  29910. var result = null;
  29911. for (var i = 0; i < altsets.length; i++) {
  29912. var alts = altsets[i];
  29913. var minAlt = alts.minValue();
  29914. if (result === null) {
  29915. result = minAlt;
  29916. } else if (result !== minAlt) {
  29917. // more than 1 viable alt
  29918. return ATN.INVALID_ALT_NUMBER;
  29919. }
  29920. }
  29921. return result;
  29922. };
  29923. exports.PredictionMode = PredictionMode;
  29924. /***/ }),
  29925. /***/ "./node_modules/antlr4/atn/SemanticContext.js":
  29926. /*!****************************************************!*\
  29927. !*** ./node_modules/antlr4/atn/SemanticContext.js ***!
  29928. \****************************************************/
  29929. /*! no static exports found */
  29930. /***/ (function(module, exports, __webpack_require__) {
  29931. "use strict";
  29932. //
  29933. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  29934. * Use of this file is governed by the BSD 3-clause license that
  29935. * can be found in the LICENSE.txt file in the project root.
  29936. */
  29937. //
  29938. // A tree structure used to record the semantic context in which
  29939. // an ATN configuration is valid. It's either a single predicate,
  29940. // a conjunction {@code p1&&p2}, or a sum of products {@code p1||p2}.
  29941. //
  29942. // <p>I have scoped the {@link AND}, {@link OR}, and {@link Predicate} subclasses of
  29943. // {@link SemanticContext} within the scope of this outer class.</p>
  29944. //
  29945. var Set = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Set;
  29946. var Hash = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Hash;
  29947. function SemanticContext() {
  29948. return this;
  29949. }
  29950. SemanticContext.prototype.hashCode = function () {
  29951. var hash = new Hash();
  29952. this.updateHashCode(hash);
  29953. return hash.finish();
  29954. };
  29955. // For context independent predicates, we evaluate them without a local
  29956. // context (i.e., null context). That way, we can evaluate them without
  29957. // having to create proper rule-specific context during prediction (as
  29958. // opposed to the parser, which creates them naturally). In a practical
  29959. // sense, this avoids a cast exception from RuleContext to myruleContext.
  29960. //
  29961. // <p>For context dependent predicates, we must pass in a local context so that
  29962. // references such as $arg evaluate properly as _localctx.arg. We only
  29963. // capture context dependent predicates in the context in which we begin
  29964. // prediction, so we passed in the outer context here in case of context
  29965. // dependent predicate evaluation.</p>
  29966. //
  29967. SemanticContext.prototype.evaluate = function (parser, outerContext) {};
  29968. //
  29969. // Evaluate the precedence predicates for the context and reduce the result.
  29970. //
  29971. // @param parser The parser instance.
  29972. // @param outerContext The current parser context object.
  29973. // @return The simplified semantic context after precedence predicates are
  29974. // evaluated, which will be one of the following values.
  29975. // <ul>
  29976. // <li>{@link //NONE}: if the predicate simplifies to {@code true} after
  29977. // precedence predicates are evaluated.</li>
  29978. // <li>{@code null}: if the predicate simplifies to {@code false} after
  29979. // precedence predicates are evaluated.</li>
  29980. // <li>{@code this}: if the semantic context is not changed as a result of
  29981. // precedence predicate evaluation.</li>
  29982. // <li>A non-{@code null} {@link SemanticContext}: the new simplified
  29983. // semantic context after precedence predicates are evaluated.</li>
  29984. // </ul>
  29985. //
  29986. SemanticContext.prototype.evalPrecedence = function (parser, outerContext) {
  29987. return this;
  29988. };
  29989. SemanticContext.andContext = function (a, b) {
  29990. if (a === null || a === SemanticContext.NONE) {
  29991. return b;
  29992. }
  29993. if (b === null || b === SemanticContext.NONE) {
  29994. return a;
  29995. }
  29996. var result = new AND(a, b);
  29997. if (result.opnds.length === 1) {
  29998. return result.opnds[0];
  29999. } else {
  30000. return result;
  30001. }
  30002. };
  30003. SemanticContext.orContext = function (a, b) {
  30004. if (a === null) {
  30005. return b;
  30006. }
  30007. if (b === null) {
  30008. return a;
  30009. }
  30010. if (a === SemanticContext.NONE || b === SemanticContext.NONE) {
  30011. return SemanticContext.NONE;
  30012. }
  30013. var result = new OR(a, b);
  30014. if (result.opnds.length === 1) {
  30015. return result.opnds[0];
  30016. } else {
  30017. return result;
  30018. }
  30019. };
  30020. function Predicate(ruleIndex, predIndex, isCtxDependent) {
  30021. SemanticContext.call(this);
  30022. this.ruleIndex = ruleIndex === undefined ? -1 : ruleIndex;
  30023. this.predIndex = predIndex === undefined ? -1 : predIndex;
  30024. this.isCtxDependent = isCtxDependent === undefined ? false : isCtxDependent; // e.g., $i ref in pred
  30025. return this;
  30026. }
  30027. Predicate.prototype = Object.create(SemanticContext.prototype);
  30028. Predicate.prototype.constructor = Predicate;
  30029. //The default {@link SemanticContext}, which is semantically equivalent to
  30030. //a predicate of the form {@code {true}?}.
  30031. //
  30032. SemanticContext.NONE = new Predicate();
  30033. Predicate.prototype.evaluate = function (parser, outerContext) {
  30034. var localctx = this.isCtxDependent ? outerContext : null;
  30035. return parser.sempred(localctx, this.ruleIndex, this.predIndex);
  30036. };
  30037. Predicate.prototype.updateHashCode = function (hash) {
  30038. hash.update(this.ruleIndex, this.predIndex, this.isCtxDependent);
  30039. };
  30040. Predicate.prototype.equals = function (other) {
  30041. if (this === other) {
  30042. return true;
  30043. } else if (!(other instanceof Predicate)) {
  30044. return false;
  30045. } else {
  30046. return this.ruleIndex === other.ruleIndex && this.predIndex === other.predIndex && this.isCtxDependent === other.isCtxDependent;
  30047. }
  30048. };
  30049. Predicate.prototype.toString = function () {
  30050. return "{" + this.ruleIndex + ":" + this.predIndex + "}?";
  30051. };
  30052. function PrecedencePredicate(precedence) {
  30053. SemanticContext.call(this);
  30054. this.precedence = precedence === undefined ? 0 : precedence;
  30055. }
  30056. PrecedencePredicate.prototype = Object.create(SemanticContext.prototype);
  30057. PrecedencePredicate.prototype.constructor = PrecedencePredicate;
  30058. PrecedencePredicate.prototype.evaluate = function (parser, outerContext) {
  30059. return parser.precpred(outerContext, this.precedence);
  30060. };
  30061. PrecedencePredicate.prototype.evalPrecedence = function (parser, outerContext) {
  30062. if (parser.precpred(outerContext, this.precedence)) {
  30063. return SemanticContext.NONE;
  30064. } else {
  30065. return null;
  30066. }
  30067. };
  30068. PrecedencePredicate.prototype.compareTo = function (other) {
  30069. return this.precedence - other.precedence;
  30070. };
  30071. PrecedencePredicate.prototype.updateHashCode = function (hash) {
  30072. hash.update(31);
  30073. };
  30074. PrecedencePredicate.prototype.equals = function (other) {
  30075. if (this === other) {
  30076. return true;
  30077. } else if (!(other instanceof PrecedencePredicate)) {
  30078. return false;
  30079. } else {
  30080. return this.precedence === other.precedence;
  30081. }
  30082. };
  30083. PrecedencePredicate.prototype.toString = function () {
  30084. return "{" + this.precedence + ">=prec}?";
  30085. };
  30086. PrecedencePredicate.filterPrecedencePredicates = function (set) {
  30087. var result = [];
  30088. set.values().map(function (context) {
  30089. if (context instanceof PrecedencePredicate) {
  30090. result.push(context);
  30091. }
  30092. });
  30093. return result;
  30094. };
  30095. // A semantic context which is true whenever none of the contained contexts
  30096. // is false.
  30097. //
  30098. function AND(a, b) {
  30099. SemanticContext.call(this);
  30100. var operands = new Set();
  30101. if (a instanceof AND) {
  30102. a.opnds.map(function (o) {
  30103. operands.add(o);
  30104. });
  30105. } else {
  30106. operands.add(a);
  30107. }
  30108. if (b instanceof AND) {
  30109. b.opnds.map(function (o) {
  30110. operands.add(o);
  30111. });
  30112. } else {
  30113. operands.add(b);
  30114. }
  30115. var precedencePredicates = PrecedencePredicate.filterPrecedencePredicates(operands);
  30116. if (precedencePredicates.length > 0) {
  30117. // interested in the transition with the lowest precedence
  30118. var reduced = null;
  30119. precedencePredicates.map(function (p) {
  30120. if (reduced === null || p.precedence < reduced.precedence) {
  30121. reduced = p;
  30122. }
  30123. });
  30124. operands.add(reduced);
  30125. }
  30126. this.opnds = operands.values();
  30127. return this;
  30128. }
  30129. AND.prototype = Object.create(SemanticContext.prototype);
  30130. AND.prototype.constructor = AND;
  30131. AND.prototype.equals = function (other) {
  30132. if (this === other) {
  30133. return true;
  30134. } else if (!(other instanceof AND)) {
  30135. return false;
  30136. } else {
  30137. return this.opnds === other.opnds;
  30138. }
  30139. };
  30140. AND.prototype.updateHashCode = function (hash) {
  30141. hash.update(this.opnds, "AND");
  30142. };
  30143. //
  30144. // {@inheritDoc}
  30145. //
  30146. // <p>
  30147. // The evaluation of predicates by this context is short-circuiting, but
  30148. // unordered.</p>
  30149. //
  30150. AND.prototype.evaluate = function (parser, outerContext) {
  30151. for (var i = 0; i < this.opnds.length; i++) {
  30152. if (!this.opnds[i].evaluate(parser, outerContext)) {
  30153. return false;
  30154. }
  30155. }
  30156. return true;
  30157. };
  30158. AND.prototype.evalPrecedence = function (parser, outerContext) {
  30159. var differs = false;
  30160. var operands = [];
  30161. for (var i = 0; i < this.opnds.length; i++) {
  30162. var context = this.opnds[i];
  30163. var evaluated = context.evalPrecedence(parser, outerContext);
  30164. differs |= evaluated !== context;
  30165. if (evaluated === null) {
  30166. // The AND context is false if any element is false
  30167. return null;
  30168. } else if (evaluated !== SemanticContext.NONE) {
  30169. // Reduce the result by skipping true elements
  30170. operands.push(evaluated);
  30171. }
  30172. }
  30173. if (!differs) {
  30174. return this;
  30175. }
  30176. if (operands.length === 0) {
  30177. // all elements were true, so the AND context is true
  30178. return SemanticContext.NONE;
  30179. }
  30180. var result = null;
  30181. operands.map(function (o) {
  30182. result = result === null ? o : SemanticContext.andContext(result, o);
  30183. });
  30184. return result;
  30185. };
  30186. AND.prototype.toString = function () {
  30187. var s = "";
  30188. this.opnds.map(function (o) {
  30189. s += "&& " + o.toString();
  30190. });
  30191. return s.length > 3 ? s.slice(3) : s;
  30192. };
  30193. //
  30194. // A semantic context which is true whenever at least one of the contained
  30195. // contexts is true.
  30196. //
  30197. function OR(a, b) {
  30198. SemanticContext.call(this);
  30199. var operands = new Set();
  30200. if (a instanceof OR) {
  30201. a.opnds.map(function (o) {
  30202. operands.add(o);
  30203. });
  30204. } else {
  30205. operands.add(a);
  30206. }
  30207. if (b instanceof OR) {
  30208. b.opnds.map(function (o) {
  30209. operands.add(o);
  30210. });
  30211. } else {
  30212. operands.add(b);
  30213. }
  30214. var precedencePredicates = PrecedencePredicate.filterPrecedencePredicates(operands);
  30215. if (precedencePredicates.length > 0) {
  30216. // interested in the transition with the highest precedence
  30217. var s = precedencePredicates.sort(function (a, b) {
  30218. return a.compareTo(b);
  30219. });
  30220. var reduced = s[s.length - 1];
  30221. operands.add(reduced);
  30222. }
  30223. this.opnds = operands.values();
  30224. return this;
  30225. }
  30226. OR.prototype = Object.create(SemanticContext.prototype);
  30227. OR.prototype.constructor = OR;
  30228. OR.prototype.constructor = function (other) {
  30229. if (this === other) {
  30230. return true;
  30231. } else if (!(other instanceof OR)) {
  30232. return false;
  30233. } else {
  30234. return this.opnds === other.opnds;
  30235. }
  30236. };
  30237. OR.prototype.updateHashCode = function (hash) {
  30238. hash.update(this.opnds, "OR");
  30239. };
  30240. // <p>
  30241. // The evaluation of predicates by this context is short-circuiting, but
  30242. // unordered.</p>
  30243. //
  30244. OR.prototype.evaluate = function (parser, outerContext) {
  30245. for (var i = 0; i < this.opnds.length; i++) {
  30246. if (this.opnds[i].evaluate(parser, outerContext)) {
  30247. return true;
  30248. }
  30249. }
  30250. return false;
  30251. };
  30252. OR.prototype.evalPrecedence = function (parser, outerContext) {
  30253. var differs = false;
  30254. var operands = [];
  30255. for (var i = 0; i < this.opnds.length; i++) {
  30256. var context = this.opnds[i];
  30257. var evaluated = context.evalPrecedence(parser, outerContext);
  30258. differs |= evaluated !== context;
  30259. if (evaluated === SemanticContext.NONE) {
  30260. // The OR context is true if any element is true
  30261. return SemanticContext.NONE;
  30262. } else if (evaluated !== null) {
  30263. // Reduce the result by skipping false elements
  30264. operands.push(evaluated);
  30265. }
  30266. }
  30267. if (!differs) {
  30268. return this;
  30269. }
  30270. if (operands.length === 0) {
  30271. // all elements were false, so the OR context is false
  30272. return null;
  30273. }
  30274. var result = null;
  30275. operands.map(function (o) {
  30276. return result === null ? o : SemanticContext.orContext(result, o);
  30277. });
  30278. return result;
  30279. };
  30280. OR.prototype.toString = function () {
  30281. var s = "";
  30282. this.opnds.map(function (o) {
  30283. s += "|| " + o.toString();
  30284. });
  30285. return s.length > 3 ? s.slice(3) : s;
  30286. };
  30287. exports.SemanticContext = SemanticContext;
  30288. exports.PrecedencePredicate = PrecedencePredicate;
  30289. exports.Predicate = Predicate;
  30290. /***/ }),
  30291. /***/ "./node_modules/antlr4/atn/Transition.js":
  30292. /*!***********************************************!*\
  30293. !*** ./node_modules/antlr4/atn/Transition.js ***!
  30294. \***********************************************/
  30295. /*! no static exports found */
  30296. /***/ (function(module, exports, __webpack_require__) {
  30297. "use strict";
  30298. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30299. * Use of this file is governed by the BSD 3-clause license that
  30300. * can be found in the LICENSE.txt file in the project root.
  30301. */
  30302. //
  30303. // An ATN transition between any two ATN states. Subclasses define
  30304. // atom, set, epsilon, action, predicate, rule transitions.
  30305. //
  30306. // <p>This is a one way link. It emanates from a state (usually via a list of
  30307. // transitions) and has a target state.</p>
  30308. //
  30309. // <p>Since we never have to change the ATN transitions once we construct it,
  30310. // we can fix these transitions as specific classes. The DFA transitions
  30311. // on the other hand need to update the labels as it adds transitions to
  30312. // the states. We'll use the term Edge for the DFA to distinguish them from
  30313. // ATN transitions.</p>
  30314. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  30315. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  30316. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  30317. var Predicate = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").Predicate;
  30318. var PrecedencePredicate = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").PrecedencePredicate;
  30319. function Transition(target) {
  30320. // The target of this transition.
  30321. if (target === undefined || target === null) {
  30322. throw "target cannot be null.";
  30323. }
  30324. this.target = target;
  30325. // Are we epsilon, action, sempred?
  30326. this.isEpsilon = false;
  30327. this.label = null;
  30328. return this;
  30329. }
  30330. // constants for serialization
  30331. Transition.EPSILON = 1;
  30332. Transition.RANGE = 2;
  30333. Transition.RULE = 3;
  30334. Transition.PREDICATE = 4; // e.g., {isType(input.LT(1))}?
  30335. Transition.ATOM = 5;
  30336. Transition.ACTION = 6;
  30337. Transition.SET = 7; // ~(A|B) or ~atom, wildcard, which convert to next 2
  30338. Transition.NOT_SET = 8;
  30339. Transition.WILDCARD = 9;
  30340. Transition.PRECEDENCE = 10;
  30341. Transition.serializationNames = ["INVALID", "EPSILON", "RANGE", "RULE", "PREDICATE", "ATOM", "ACTION", "SET", "NOT_SET", "WILDCARD", "PRECEDENCE"];
  30342. Transition.serializationTypes = {
  30343. EpsilonTransition: Transition.EPSILON,
  30344. RangeTransition: Transition.RANGE,
  30345. RuleTransition: Transition.RULE,
  30346. PredicateTransition: Transition.PREDICATE,
  30347. AtomTransition: Transition.ATOM,
  30348. ActionTransition: Transition.ACTION,
  30349. SetTransition: Transition.SET,
  30350. NotSetTransition: Transition.NOT_SET,
  30351. WildcardTransition: Transition.WILDCARD,
  30352. PrecedencePredicateTransition: Transition.PRECEDENCE
  30353. };
  30354. // TODO: make all transitions sets? no, should remove set edges
  30355. function AtomTransition(target, label) {
  30356. Transition.call(this, target);
  30357. this.label_ = label; // The token type or character value; or, signifies special label.
  30358. this.label = this.makeLabel();
  30359. this.serializationType = Transition.ATOM;
  30360. return this;
  30361. }
  30362. AtomTransition.prototype = Object.create(Transition.prototype);
  30363. AtomTransition.prototype.constructor = AtomTransition;
  30364. AtomTransition.prototype.makeLabel = function () {
  30365. var s = new IntervalSet();
  30366. s.addOne(this.label_);
  30367. return s;
  30368. };
  30369. AtomTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  30370. return this.label_ === symbol;
  30371. };
  30372. AtomTransition.prototype.toString = function () {
  30373. return this.label_;
  30374. };
  30375. function RuleTransition(ruleStart, ruleIndex, precedence, followState) {
  30376. Transition.call(this, ruleStart);
  30377. this.ruleIndex = ruleIndex; // ptr to the rule definition object for this rule ref
  30378. this.precedence = precedence;
  30379. this.followState = followState; // what node to begin computations following ref to rule
  30380. this.serializationType = Transition.RULE;
  30381. this.isEpsilon = true;
  30382. return this;
  30383. }
  30384. RuleTransition.prototype = Object.create(Transition.prototype);
  30385. RuleTransition.prototype.constructor = RuleTransition;
  30386. RuleTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  30387. return false;
  30388. };
  30389. function EpsilonTransition(target, outermostPrecedenceReturn) {
  30390. Transition.call(this, target);
  30391. this.serializationType = Transition.EPSILON;
  30392. this.isEpsilon = true;
  30393. this.outermostPrecedenceReturn = outermostPrecedenceReturn;
  30394. return this;
  30395. }
  30396. EpsilonTransition.prototype = Object.create(Transition.prototype);
  30397. EpsilonTransition.prototype.constructor = EpsilonTransition;
  30398. EpsilonTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  30399. return false;
  30400. };
  30401. EpsilonTransition.prototype.toString = function () {
  30402. return "epsilon";
  30403. };
  30404. function RangeTransition(target, start, stop) {
  30405. Transition.call(this, target);
  30406. this.serializationType = Transition.RANGE;
  30407. this.start = start;
  30408. this.stop = stop;
  30409. this.label = this.makeLabel();
  30410. return this;
  30411. }
  30412. RangeTransition.prototype = Object.create(Transition.prototype);
  30413. RangeTransition.prototype.constructor = RangeTransition;
  30414. RangeTransition.prototype.makeLabel = function () {
  30415. var s = new IntervalSet();
  30416. s.addRange(this.start, this.stop);
  30417. return s;
  30418. };
  30419. RangeTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  30420. return symbol >= this.start && symbol <= this.stop;
  30421. };
  30422. RangeTransition.prototype.toString = function () {
  30423. return "'" + String.fromCharCode(this.start) + "'..'" + String.fromCharCode(this.stop) + "'";
  30424. };
  30425. function AbstractPredicateTransition(target) {
  30426. Transition.call(this, target);
  30427. return this;
  30428. }
  30429. AbstractPredicateTransition.prototype = Object.create(Transition.prototype);
  30430. AbstractPredicateTransition.prototype.constructor = AbstractPredicateTransition;
  30431. function PredicateTransition(target, ruleIndex, predIndex, isCtxDependent) {
  30432. AbstractPredicateTransition.call(this, target);
  30433. this.serializationType = Transition.PREDICATE;
  30434. this.ruleIndex = ruleIndex;
  30435. this.predIndex = predIndex;
  30436. this.isCtxDependent = isCtxDependent; // e.g., $i ref in pred
  30437. this.isEpsilon = true;
  30438. return this;
  30439. }
  30440. PredicateTransition.prototype = Object.create(AbstractPredicateTransition.prototype);
  30441. PredicateTransition.prototype.constructor = PredicateTransition;
  30442. PredicateTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  30443. return false;
  30444. };
  30445. PredicateTransition.prototype.getPredicate = function () {
  30446. return new Predicate(this.ruleIndex, this.predIndex, this.isCtxDependent);
  30447. };
  30448. PredicateTransition.prototype.toString = function () {
  30449. return "pred_" + this.ruleIndex + ":" + this.predIndex;
  30450. };
  30451. function ActionTransition(target, ruleIndex, actionIndex, isCtxDependent) {
  30452. Transition.call(this, target);
  30453. this.serializationType = Transition.ACTION;
  30454. this.ruleIndex = ruleIndex;
  30455. this.actionIndex = actionIndex === undefined ? -1 : actionIndex;
  30456. this.isCtxDependent = isCtxDependent === undefined ? false : isCtxDependent; // e.g., $i ref in pred
  30457. this.isEpsilon = true;
  30458. return this;
  30459. }
  30460. ActionTransition.prototype = Object.create(Transition.prototype);
  30461. ActionTransition.prototype.constructor = ActionTransition;
  30462. ActionTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  30463. return false;
  30464. };
  30465. ActionTransition.prototype.toString = function () {
  30466. return "action_" + this.ruleIndex + ":" + this.actionIndex;
  30467. };
  30468. // A transition containing a set of values.
  30469. function SetTransition(target, set) {
  30470. Transition.call(this, target);
  30471. this.serializationType = Transition.SET;
  30472. if (set !== undefined && set !== null) {
  30473. this.label = set;
  30474. } else {
  30475. this.label = new IntervalSet();
  30476. this.label.addOne(Token.INVALID_TYPE);
  30477. }
  30478. return this;
  30479. }
  30480. SetTransition.prototype = Object.create(Transition.prototype);
  30481. SetTransition.prototype.constructor = SetTransition;
  30482. SetTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  30483. return this.label.contains(symbol);
  30484. };
  30485. SetTransition.prototype.toString = function () {
  30486. return this.label.toString();
  30487. };
  30488. function NotSetTransition(target, set) {
  30489. SetTransition.call(this, target, set);
  30490. this.serializationType = Transition.NOT_SET;
  30491. return this;
  30492. }
  30493. NotSetTransition.prototype = Object.create(SetTransition.prototype);
  30494. NotSetTransition.prototype.constructor = NotSetTransition;
  30495. NotSetTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  30496. return symbol >= minVocabSymbol && symbol <= maxVocabSymbol && !SetTransition.prototype.matches.call(this, symbol, minVocabSymbol, maxVocabSymbol);
  30497. };
  30498. NotSetTransition.prototype.toString = function () {
  30499. return '~' + SetTransition.prototype.toString.call(this);
  30500. };
  30501. function WildcardTransition(target) {
  30502. Transition.call(this, target);
  30503. this.serializationType = Transition.WILDCARD;
  30504. return this;
  30505. }
  30506. WildcardTransition.prototype = Object.create(Transition.prototype);
  30507. WildcardTransition.prototype.constructor = WildcardTransition;
  30508. WildcardTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  30509. return symbol >= minVocabSymbol && symbol <= maxVocabSymbol;
  30510. };
  30511. WildcardTransition.prototype.toString = function () {
  30512. return ".";
  30513. };
  30514. function PrecedencePredicateTransition(target, precedence) {
  30515. AbstractPredicateTransition.call(this, target);
  30516. this.serializationType = Transition.PRECEDENCE;
  30517. this.precedence = precedence;
  30518. this.isEpsilon = true;
  30519. return this;
  30520. }
  30521. PrecedencePredicateTransition.prototype = Object.create(AbstractPredicateTransition.prototype);
  30522. PrecedencePredicateTransition.prototype.constructor = PrecedencePredicateTransition;
  30523. PrecedencePredicateTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  30524. return false;
  30525. };
  30526. PrecedencePredicateTransition.prototype.getPredicate = function () {
  30527. return new PrecedencePredicate(this.precedence);
  30528. };
  30529. PrecedencePredicateTransition.prototype.toString = function () {
  30530. return this.precedence + " >= _p";
  30531. };
  30532. exports.Transition = Transition;
  30533. exports.AtomTransition = AtomTransition;
  30534. exports.SetTransition = SetTransition;
  30535. exports.NotSetTransition = NotSetTransition;
  30536. exports.RuleTransition = RuleTransition;
  30537. exports.ActionTransition = ActionTransition;
  30538. exports.EpsilonTransition = EpsilonTransition;
  30539. exports.RangeTransition = RangeTransition;
  30540. exports.WildcardTransition = WildcardTransition;
  30541. exports.PredicateTransition = PredicateTransition;
  30542. exports.PrecedencePredicateTransition = PrecedencePredicateTransition;
  30543. exports.AbstractPredicateTransition = AbstractPredicateTransition;
  30544. /***/ }),
  30545. /***/ "./node_modules/antlr4/atn/index.js":
  30546. /*!******************************************!*\
  30547. !*** ./node_modules/antlr4/atn/index.js ***!
  30548. \******************************************/
  30549. /*! no static exports found */
  30550. /***/ (function(module, exports, __webpack_require__) {
  30551. "use strict";
  30552. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30553. * Use of this file is governed by the BSD 3-clause license that
  30554. * can be found in the LICENSE.txt file in the project root.
  30555. */
  30556. exports.ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  30557. exports.ATNDeserializer = __webpack_require__(/*! ./ATNDeserializer */ "./node_modules/antlr4/atn/ATNDeserializer.js").ATNDeserializer;
  30558. exports.LexerATNSimulator = __webpack_require__(/*! ./LexerATNSimulator */ "./node_modules/antlr4/atn/LexerATNSimulator.js").LexerATNSimulator;
  30559. exports.ParserATNSimulator = __webpack_require__(/*! ./ParserATNSimulator */ "./node_modules/antlr4/atn/ParserATNSimulator.js").ParserATNSimulator;
  30560. exports.PredictionMode = __webpack_require__(/*! ./PredictionMode */ "./node_modules/antlr4/atn/PredictionMode.js").PredictionMode;
  30561. /***/ }),
  30562. /***/ "./node_modules/antlr4/dfa/DFA.js":
  30563. /*!****************************************!*\
  30564. !*** ./node_modules/antlr4/dfa/DFA.js ***!
  30565. \****************************************/
  30566. /*! no static exports found */
  30567. /***/ (function(module, exports, __webpack_require__) {
  30568. "use strict";
  30569. //
  30570. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30571. * Use of this file is governed by the BSD 3-clause license that
  30572. * can be found in the LICENSE.txt file in the project root.
  30573. */
  30574. var Set = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").Set;
  30575. var DFAState = __webpack_require__(/*! ./DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  30576. var StarLoopEntryState = __webpack_require__(/*! ../atn/ATNState */ "./node_modules/antlr4/atn/ATNState.js").StarLoopEntryState;
  30577. var ATNConfigSet = __webpack_require__(/*! ./../atn/ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  30578. var DFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").DFASerializer;
  30579. var LexerDFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").LexerDFASerializer;
  30580. function DFA(atnStartState, decision) {
  30581. if (decision === undefined) {
  30582. decision = 0;
  30583. }
  30584. // From which ATN state did we create this DFA?
  30585. this.atnStartState = atnStartState;
  30586. this.decision = decision;
  30587. // A set of all DFA states. Use {@link Map} so we can get old state back
  30588. // ({@link Set} only allows you to see if it's there).
  30589. this._states = new Set();
  30590. this.s0 = null;
  30591. // {@code true} if this DFA is for a precedence decision; otherwise,
  30592. // {@code false}. This is the backing field for {@link //isPrecedenceDfa},
  30593. // {@link //setPrecedenceDfa}.
  30594. this.precedenceDfa = false;
  30595. if (atnStartState instanceof StarLoopEntryState) {
  30596. if (atnStartState.isPrecedenceDecision) {
  30597. this.precedenceDfa = true;
  30598. var precedenceState = new DFAState(null, new ATNConfigSet());
  30599. precedenceState.edges = [];
  30600. precedenceState.isAcceptState = false;
  30601. precedenceState.requiresFullContext = false;
  30602. this.s0 = precedenceState;
  30603. }
  30604. }
  30605. return this;
  30606. }
  30607. // Get the start state for a specific precedence value.
  30608. //
  30609. // @param precedence The current precedence.
  30610. // @return The start state corresponding to the specified precedence, or
  30611. // {@code null} if no start state exists for the specified precedence.
  30612. //
  30613. // @throws IllegalStateException if this is not a precedence DFA.
  30614. // @see //isPrecedenceDfa()
  30615. DFA.prototype.getPrecedenceStartState = function (precedence) {
  30616. if (!this.precedenceDfa) {
  30617. throw "Only precedence DFAs may contain a precedence start state.";
  30618. }
  30619. // s0.edges is never null for a precedence DFA
  30620. if (precedence < 0 || precedence >= this.s0.edges.length) {
  30621. return null;
  30622. }
  30623. return this.s0.edges[precedence] || null;
  30624. };
  30625. // Set the start state for a specific precedence value.
  30626. //
  30627. // @param precedence The current precedence.
  30628. // @param startState The start state corresponding to the specified
  30629. // precedence.
  30630. //
  30631. // @throws IllegalStateException if this is not a precedence DFA.
  30632. // @see //isPrecedenceDfa()
  30633. //
  30634. DFA.prototype.setPrecedenceStartState = function (precedence, startState) {
  30635. if (!this.precedenceDfa) {
  30636. throw "Only precedence DFAs may contain a precedence start state.";
  30637. }
  30638. if (precedence < 0) {
  30639. return;
  30640. }
  30641. // synchronization on s0 here is ok. when the DFA is turned into a
  30642. // precedence DFA, s0 will be initialized once and not updated again
  30643. // s0.edges is never null for a precedence DFA
  30644. this.s0.edges[precedence] = startState;
  30645. };
  30646. //
  30647. // Sets whether this is a precedence DFA. If the specified value differs
  30648. // from the current DFA configuration, the following actions are taken;
  30649. // otherwise no changes are made to the current DFA.
  30650. //
  30651. // <ul>
  30652. // <li>The {@link //states} map is cleared</li>
  30653. // <li>If {@code precedenceDfa} is {@code false}, the initial state
  30654. // {@link //s0} is set to {@code null}; otherwise, it is initialized to a new
  30655. // {@link DFAState} with an empty outgoing {@link DFAState//edges} array to
  30656. // store the start states for individual precedence values.</li>
  30657. // <li>The {@link //precedenceDfa} field is updated</li>
  30658. // </ul>
  30659. //
  30660. // @param precedenceDfa {@code true} if this is a precedence DFA; otherwise,
  30661. // {@code false}
  30662. DFA.prototype.setPrecedenceDfa = function (precedenceDfa) {
  30663. if (this.precedenceDfa !== precedenceDfa) {
  30664. this._states = new DFAStatesSet();
  30665. if (precedenceDfa) {
  30666. var precedenceState = new DFAState(null, new ATNConfigSet());
  30667. precedenceState.edges = [];
  30668. precedenceState.isAcceptState = false;
  30669. precedenceState.requiresFullContext = false;
  30670. this.s0 = precedenceState;
  30671. } else {
  30672. this.s0 = null;
  30673. }
  30674. this.precedenceDfa = precedenceDfa;
  30675. }
  30676. };
  30677. Object.defineProperty(DFA.prototype, "states", {
  30678. get: function get() {
  30679. return this._states;
  30680. }
  30681. });
  30682. // Return a list of all states in this DFA, ordered by state number.
  30683. DFA.prototype.sortedStates = function () {
  30684. var list = this._states.values();
  30685. return list.sort(function (a, b) {
  30686. return a.stateNumber - b.stateNumber;
  30687. });
  30688. };
  30689. DFA.prototype.toString = function (literalNames, symbolicNames) {
  30690. literalNames = literalNames || null;
  30691. symbolicNames = symbolicNames || null;
  30692. if (this.s0 === null) {
  30693. return "";
  30694. }
  30695. var serializer = new DFASerializer(this, literalNames, symbolicNames);
  30696. return serializer.toString();
  30697. };
  30698. DFA.prototype.toLexerString = function () {
  30699. if (this.s0 === null) {
  30700. return "";
  30701. }
  30702. var serializer = new LexerDFASerializer(this);
  30703. return serializer.toString();
  30704. };
  30705. exports.DFA = DFA;
  30706. /***/ }),
  30707. /***/ "./node_modules/antlr4/dfa/DFASerializer.js":
  30708. /*!**************************************************!*\
  30709. !*** ./node_modules/antlr4/dfa/DFASerializer.js ***!
  30710. \**************************************************/
  30711. /*! no static exports found */
  30712. /***/ (function(module, exports, __webpack_require__) {
  30713. "use strict";
  30714. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30715. * Use of this file is governed by the BSD 3-clause license that
  30716. * can be found in the LICENSE.txt file in the project root.
  30717. */
  30718. // A DFA walker that knows how to dump them to serialized strings.#/
  30719. function DFASerializer(dfa, literalNames, symbolicNames) {
  30720. this.dfa = dfa;
  30721. this.literalNames = literalNames || [];
  30722. this.symbolicNames = symbolicNames || [];
  30723. return this;
  30724. }
  30725. DFASerializer.prototype.toString = function () {
  30726. if (this.dfa.s0 === null) {
  30727. return null;
  30728. }
  30729. var buf = "";
  30730. var states = this.dfa.sortedStates();
  30731. for (var i = 0; i < states.length; i++) {
  30732. var s = states[i];
  30733. if (s.edges !== null) {
  30734. var n = s.edges.length;
  30735. for (var j = 0; j < n; j++) {
  30736. var t = s.edges[j] || null;
  30737. if (t !== null && t.stateNumber !== 0x7FFFFFFF) {
  30738. buf = buf.concat(this.getStateString(s));
  30739. buf = buf.concat("-");
  30740. buf = buf.concat(this.getEdgeLabel(j));
  30741. buf = buf.concat("->");
  30742. buf = buf.concat(this.getStateString(t));
  30743. buf = buf.concat('\n');
  30744. }
  30745. }
  30746. }
  30747. }
  30748. return buf.length === 0 ? null : buf;
  30749. };
  30750. DFASerializer.prototype.getEdgeLabel = function (i) {
  30751. if (i === 0) {
  30752. return "EOF";
  30753. } else if (this.literalNames !== null || this.symbolicNames !== null) {
  30754. return this.literalNames[i - 1] || this.symbolicNames[i - 1];
  30755. } else {
  30756. return String.fromCharCode(i - 1);
  30757. }
  30758. };
  30759. DFASerializer.prototype.getStateString = function (s) {
  30760. var baseStateStr = (s.isAcceptState ? ":" : "") + "s" + s.stateNumber + (s.requiresFullContext ? "^" : "");
  30761. if (s.isAcceptState) {
  30762. if (s.predicates !== null) {
  30763. return baseStateStr + "=>" + s.predicates.toString();
  30764. } else {
  30765. return baseStateStr + "=>" + s.prediction.toString();
  30766. }
  30767. } else {
  30768. return baseStateStr;
  30769. }
  30770. };
  30771. function LexerDFASerializer(dfa) {
  30772. DFASerializer.call(this, dfa, null);
  30773. return this;
  30774. }
  30775. LexerDFASerializer.prototype = Object.create(DFASerializer.prototype);
  30776. LexerDFASerializer.prototype.constructor = LexerDFASerializer;
  30777. LexerDFASerializer.prototype.getEdgeLabel = function (i) {
  30778. return "'" + String.fromCharCode(i) + "'";
  30779. };
  30780. exports.DFASerializer = DFASerializer;
  30781. exports.LexerDFASerializer = LexerDFASerializer;
  30782. /***/ }),
  30783. /***/ "./node_modules/antlr4/dfa/DFAState.js":
  30784. /*!*********************************************!*\
  30785. !*** ./node_modules/antlr4/dfa/DFAState.js ***!
  30786. \*********************************************/
  30787. /*! no static exports found */
  30788. /***/ (function(module, exports, __webpack_require__) {
  30789. "use strict";
  30790. //
  30791. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30792. * Use of this file is governed by the BSD 3-clause license that
  30793. * can be found in the LICENSE.txt file in the project root.
  30794. */
  30795. ///
  30796. var ATNConfigSet = __webpack_require__(/*! ./../atn/ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  30797. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  30798. var Hash = Utils.Hash;
  30799. var Set = Utils.Set;
  30800. // Map a predicate to a predicted alternative.///
  30801. function PredPrediction(pred, alt) {
  30802. this.alt = alt;
  30803. this.pred = pred;
  30804. return this;
  30805. }
  30806. PredPrediction.prototype.toString = function () {
  30807. return "(" + this.pred + ", " + this.alt + ")";
  30808. };
  30809. // A DFA state represents a set of possible ATN configurations.
  30810. // As Aho, Sethi, Ullman p. 117 says "The DFA uses its state
  30811. // to keep track of all possible states the ATN can be in after
  30812. // reading each input symbol. That is to say, after reading
  30813. // input a1a2..an, the DFA is in a state that represents the
  30814. // subset T of the states of the ATN that are reachable from the
  30815. // ATN's start state along some path labeled a1a2..an."
  30816. // In conventional NFA&rarr;DFA conversion, therefore, the subset T
  30817. // would be a bitset representing the set of states the
  30818. // ATN could be in. We need to track the alt predicted by each
  30819. // state as well, however. More importantly, we need to maintain
  30820. // a stack of states, tracking the closure operations as they
  30821. // jump from rule to rule, emulating rule invocations (method calls).
  30822. // I have to add a stack to simulate the proper lookahead sequences for
  30823. // the underlying LL grammar from which the ATN was derived.
  30824. //
  30825. // <p>I use a set of ATNConfig objects not simple states. An ATNConfig
  30826. // is both a state (ala normal conversion) and a RuleContext describing
  30827. // the chain of rules (if any) followed to arrive at that state.</p>
  30828. //
  30829. // <p>A DFA state may have multiple references to a particular state,
  30830. // but with different ATN contexts (with same or different alts)
  30831. // meaning that state was reached via a different set of rule invocations.</p>
  30832. // /
  30833. function DFAState(stateNumber, configs) {
  30834. if (stateNumber === null) {
  30835. stateNumber = -1;
  30836. }
  30837. if (configs === null) {
  30838. configs = new ATNConfigSet();
  30839. }
  30840. this.stateNumber = stateNumber;
  30841. this.configs = configs;
  30842. // {@code edges[symbol]} points to target of symbol. Shift up by 1 so (-1)
  30843. // {@link Token//EOF} maps to {@code edges[0]}.
  30844. this.edges = null;
  30845. this.isAcceptState = false;
  30846. // if accept state, what ttype do we match or alt do we predict?
  30847. // This is set to {@link ATN//INVALID_ALT_NUMBER} when {@link
  30848. // //predicates}{@code !=null} or
  30849. // {@link //requiresFullContext}.
  30850. this.prediction = 0;
  30851. this.lexerActionExecutor = null;
  30852. // Indicates that this state was created during SLL prediction that
  30853. // discovered a conflict between the configurations in the state. Future
  30854. // {@link ParserATNSimulator//execATN} invocations immediately jumped doing
  30855. // full context prediction if this field is true.
  30856. this.requiresFullContext = false;
  30857. // During SLL parsing, this is a list of predicates associated with the
  30858. // ATN configurations of the DFA state. When we have predicates,
  30859. // {@link //requiresFullContext} is {@code false} since full context
  30860. // prediction evaluates predicates
  30861. // on-the-fly. If this is not null, then {@link //prediction} is
  30862. // {@link ATN//INVALID_ALT_NUMBER}.
  30863. //
  30864. // <p>We only use these for non-{@link //requiresFullContext} but
  30865. // conflicting states. That
  30866. // means we know from the context (it's $ or we don't dip into outer
  30867. // context) that it's an ambiguity not a conflict.</p>
  30868. //
  30869. // <p>This list is computed by {@link
  30870. // ParserATNSimulator//predicateDFAState}.</p>
  30871. this.predicates = null;
  30872. return this;
  30873. }
  30874. // Get the set of all alts mentioned by all ATN configurations in this
  30875. // DFA state.
  30876. DFAState.prototype.getAltSet = function () {
  30877. var alts = new Set();
  30878. if (this.configs !== null) {
  30879. for (var i = 0; i < this.configs.length; i++) {
  30880. var c = this.configs[i];
  30881. alts.add(c.alt);
  30882. }
  30883. }
  30884. if (alts.length === 0) {
  30885. return null;
  30886. } else {
  30887. return alts;
  30888. }
  30889. };
  30890. // Two {@link DFAState} instances are equal if their ATN configuration sets
  30891. // are the same. This method is used to see if a state already exists.
  30892. //
  30893. // <p>Because the number of alternatives and number of ATN configurations are
  30894. // finite, there is a finite number of DFA states that can be processed.
  30895. // This is necessary to show that the algorithm terminates.</p>
  30896. //
  30897. // <p>Cannot test the DFA state numbers here because in
  30898. // {@link ParserATNSimulator//addDFAState} we need to know if any other state
  30899. // exists that has this exact set of ATN configurations. The
  30900. // {@link //stateNumber} is irrelevant.</p>
  30901. DFAState.prototype.equals = function (other) {
  30902. // compare set of ATN configurations in this set with other
  30903. return this === other || other instanceof DFAState && this.configs.equals(other.configs);
  30904. };
  30905. DFAState.prototype.toString = function () {
  30906. var s = "" + this.stateNumber + ":" + this.configs;
  30907. if (this.isAcceptState) {
  30908. s = s + "=>";
  30909. if (this.predicates !== null) s = s + this.predicates;else s = s + this.prediction;
  30910. }
  30911. return s;
  30912. };
  30913. DFAState.prototype.hashCode = function () {
  30914. var hash = new Hash();
  30915. hash.update(this.configs);
  30916. if (this.isAcceptState) {
  30917. if (this.predicates !== null) hash.update(this.predicates);else hash.update(this.prediction);
  30918. }
  30919. return hash.finish();
  30920. };
  30921. exports.DFAState = DFAState;
  30922. exports.PredPrediction = PredPrediction;
  30923. /***/ }),
  30924. /***/ "./node_modules/antlr4/dfa/index.js":
  30925. /*!******************************************!*\
  30926. !*** ./node_modules/antlr4/dfa/index.js ***!
  30927. \******************************************/
  30928. /*! no static exports found */
  30929. /***/ (function(module, exports, __webpack_require__) {
  30930. "use strict";
  30931. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30932. * Use of this file is governed by the BSD 3-clause license that
  30933. * can be found in the LICENSE.txt file in the project root.
  30934. */
  30935. exports.DFA = __webpack_require__(/*! ./DFA */ "./node_modules/antlr4/dfa/DFA.js").DFA;
  30936. exports.DFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").DFASerializer;
  30937. exports.LexerDFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").LexerDFASerializer;
  30938. exports.PredPrediction = __webpack_require__(/*! ./DFAState */ "./node_modules/antlr4/dfa/DFAState.js").PredPrediction;
  30939. /***/ }),
  30940. /***/ "./node_modules/antlr4/error/DiagnosticErrorListener.js":
  30941. /*!**************************************************************!*\
  30942. !*** ./node_modules/antlr4/error/DiagnosticErrorListener.js ***!
  30943. \**************************************************************/
  30944. /*! no static exports found */
  30945. /***/ (function(module, exports, __webpack_require__) {
  30946. "use strict";
  30947. //
  30948. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30949. * Use of this file is governed by the BSD 3-clause license that
  30950. * can be found in the LICENSE.txt file in the project root.
  30951. */
  30952. //
  30953. //
  30954. // This implementation of {@link ANTLRErrorListener} can be used to identify
  30955. // certain potential correctness and performance problems in grammars. "Reports"
  30956. // are made by calling {@link Parser//notifyErrorListeners} with the appropriate
  30957. // message.
  30958. //
  30959. // <ul>
  30960. // <li><b>Ambiguities</b>: These are cases where more than one path through the
  30961. // grammar can match the input.</li>
  30962. // <li><b>Weak context sensitivity</b>: These are cases where full-context
  30963. // prediction resolved an SLL conflict to a unique alternative which equaled the
  30964. // minimum alternative of the SLL conflict.</li>
  30965. // <li><b>Strong (forced) context sensitivity</b>: These are cases where the
  30966. // full-context prediction resolved an SLL conflict to a unique alternative,
  30967. // <em>and</em> the minimum alternative of the SLL conflict was found to not be
  30968. // a truly viable alternative. Two-stage parsing cannot be used for inputs where
  30969. // this situation occurs.</li>
  30970. // </ul>
  30971. var BitSet = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").BitSet;
  30972. var ErrorListener = __webpack_require__(/*! ./ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ErrorListener;
  30973. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  30974. function DiagnosticErrorListener(exactOnly) {
  30975. ErrorListener.call(this);
  30976. exactOnly = exactOnly || true;
  30977. // whether all ambiguities or only exact ambiguities are reported.
  30978. this.exactOnly = exactOnly;
  30979. return this;
  30980. }
  30981. DiagnosticErrorListener.prototype = Object.create(ErrorListener.prototype);
  30982. DiagnosticErrorListener.prototype.constructor = DiagnosticErrorListener;
  30983. DiagnosticErrorListener.prototype.reportAmbiguity = function (recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs) {
  30984. if (this.exactOnly && !exact) {
  30985. return;
  30986. }
  30987. var msg = "reportAmbiguity d=" + this.getDecisionDescription(recognizer, dfa) + ": ambigAlts=" + this.getConflictingAlts(ambigAlts, configs) + ", input='" + recognizer.getTokenStream().getText(new Interval(startIndex, stopIndex)) + "'";
  30988. recognizer.notifyErrorListeners(msg);
  30989. };
  30990. DiagnosticErrorListener.prototype.reportAttemptingFullContext = function (recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs) {
  30991. var msg = "reportAttemptingFullContext d=" + this.getDecisionDescription(recognizer, dfa) + ", input='" + recognizer.getTokenStream().getText(new Interval(startIndex, stopIndex)) + "'";
  30992. recognizer.notifyErrorListeners(msg);
  30993. };
  30994. DiagnosticErrorListener.prototype.reportContextSensitivity = function (recognizer, dfa, startIndex, stopIndex, prediction, configs) {
  30995. var msg = "reportContextSensitivity d=" + this.getDecisionDescription(recognizer, dfa) + ", input='" + recognizer.getTokenStream().getText(new Interval(startIndex, stopIndex)) + "'";
  30996. recognizer.notifyErrorListeners(msg);
  30997. };
  30998. DiagnosticErrorListener.prototype.getDecisionDescription = function (recognizer, dfa) {
  30999. var decision = dfa.decision;
  31000. var ruleIndex = dfa.atnStartState.ruleIndex;
  31001. var ruleNames = recognizer.ruleNames;
  31002. if (ruleIndex < 0 || ruleIndex >= ruleNames.length) {
  31003. return "" + decision;
  31004. }
  31005. var ruleName = ruleNames[ruleIndex] || null;
  31006. if (ruleName === null || ruleName.length === 0) {
  31007. return "" + decision;
  31008. }
  31009. return "" + decision + " (" + ruleName + ")";
  31010. };
  31011. //
  31012. // Computes the set of conflicting or ambiguous alternatives from a
  31013. // configuration set, if that information was not already provided by the
  31014. // parser.
  31015. //
  31016. // @param reportedAlts The set of conflicting or ambiguous alternatives, as
  31017. // reported by the parser.
  31018. // @param configs The conflicting or ambiguous configuration set.
  31019. // @return Returns {@code reportedAlts} if it is not {@code null}, otherwise
  31020. // returns the set of alternatives represented in {@code configs}.
  31021. //
  31022. DiagnosticErrorListener.prototype.getConflictingAlts = function (reportedAlts, configs) {
  31023. if (reportedAlts !== null) {
  31024. return reportedAlts;
  31025. }
  31026. var result = new BitSet();
  31027. for (var i = 0; i < configs.items.length; i++) {
  31028. result.add(configs.items[i].alt);
  31029. }
  31030. return "{" + result.values().join(", ") + "}";
  31031. };
  31032. exports.DiagnosticErrorListener = DiagnosticErrorListener;
  31033. /***/ }),
  31034. /***/ "./node_modules/antlr4/error/ErrorListener.js":
  31035. /*!****************************************************!*\
  31036. !*** ./node_modules/antlr4/error/ErrorListener.js ***!
  31037. \****************************************************/
  31038. /*! no static exports found */
  31039. /***/ (function(module, exports, __webpack_require__) {
  31040. "use strict";
  31041. //
  31042. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31043. * Use of this file is governed by the BSD 3-clause license that
  31044. * can be found in the LICENSE.txt file in the project root.
  31045. */
  31046. // Provides an empty default implementation of {@link ANTLRErrorListener}. The
  31047. // default implementation of each method does nothing, but can be overridden as
  31048. // necessary.
  31049. function ErrorListener() {
  31050. return this;
  31051. }
  31052. ErrorListener.prototype.syntaxError = function (recognizer, offendingSymbol, line, column, msg, e) {};
  31053. ErrorListener.prototype.reportAmbiguity = function (recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs) {};
  31054. ErrorListener.prototype.reportAttemptingFullContext = function (recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs) {};
  31055. ErrorListener.prototype.reportContextSensitivity = function (recognizer, dfa, startIndex, stopIndex, prediction, configs) {};
  31056. function ConsoleErrorListener() {
  31057. ErrorListener.call(this);
  31058. return this;
  31059. }
  31060. ConsoleErrorListener.prototype = Object.create(ErrorListener.prototype);
  31061. ConsoleErrorListener.prototype.constructor = ConsoleErrorListener;
  31062. //
  31063. // Provides a default instance of {@link ConsoleErrorListener}.
  31064. //
  31065. ConsoleErrorListener.INSTANCE = new ConsoleErrorListener();
  31066. //
  31067. // {@inheritDoc}
  31068. //
  31069. // <p>
  31070. // This implementation prints messages to {@link System//err} containing the
  31071. // values of {@code line}, {@code charPositionInLine}, and {@code msg} using
  31072. // the following format.</p>
  31073. //
  31074. // <pre>
  31075. // line <em>line</em>:<em>charPositionInLine</em> <em>msg</em>
  31076. // </pre>
  31077. //
  31078. ConsoleErrorListener.prototype.syntaxError = function (recognizer, offendingSymbol, line, column, msg, e) {
  31079. console.error("line " + line + ":" + column + " " + msg);
  31080. };
  31081. function ProxyErrorListener(delegates) {
  31082. ErrorListener.call(this);
  31083. if (delegates === null) {
  31084. throw "delegates";
  31085. }
  31086. this.delegates = delegates;
  31087. return this;
  31088. }
  31089. ProxyErrorListener.prototype = Object.create(ErrorListener.prototype);
  31090. ProxyErrorListener.prototype.constructor = ProxyErrorListener;
  31091. ProxyErrorListener.prototype.syntaxError = function (recognizer, offendingSymbol, line, column, msg, e) {
  31092. this.delegates.map(function (d) {
  31093. d.syntaxError(recognizer, offendingSymbol, line, column, msg, e);
  31094. });
  31095. };
  31096. ProxyErrorListener.prototype.reportAmbiguity = function (recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs) {
  31097. this.delegates.map(function (d) {
  31098. d.reportAmbiguity(recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs);
  31099. });
  31100. };
  31101. ProxyErrorListener.prototype.reportAttemptingFullContext = function (recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs) {
  31102. this.delegates.map(function (d) {
  31103. d.reportAttemptingFullContext(recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs);
  31104. });
  31105. };
  31106. ProxyErrorListener.prototype.reportContextSensitivity = function (recognizer, dfa, startIndex, stopIndex, prediction, configs) {
  31107. this.delegates.map(function (d) {
  31108. d.reportContextSensitivity(recognizer, dfa, startIndex, stopIndex, prediction, configs);
  31109. });
  31110. };
  31111. exports.ErrorListener = ErrorListener;
  31112. exports.ConsoleErrorListener = ConsoleErrorListener;
  31113. exports.ProxyErrorListener = ProxyErrorListener;
  31114. /***/ }),
  31115. /***/ "./node_modules/antlr4/error/ErrorStrategy.js":
  31116. /*!****************************************************!*\
  31117. !*** ./node_modules/antlr4/error/ErrorStrategy.js ***!
  31118. \****************************************************/
  31119. /*! no static exports found */
  31120. /***/ (function(module, exports, __webpack_require__) {
  31121. "use strict";
  31122. //
  31123. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31124. * Use of this file is governed by the BSD 3-clause license that
  31125. * can be found in the LICENSE.txt file in the project root.
  31126. */
  31127. //
  31128. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  31129. var Errors = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js");
  31130. var NoViableAltException = Errors.NoViableAltException;
  31131. var InputMismatchException = Errors.InputMismatchException;
  31132. var FailedPredicateException = Errors.FailedPredicateException;
  31133. var ParseCancellationException = Errors.ParseCancellationException;
  31134. var ATNState = __webpack_require__(/*! ./../atn/ATNState */ "./node_modules/antlr4/atn/ATNState.js").ATNState;
  31135. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  31136. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  31137. function ErrorStrategy() {}
  31138. ErrorStrategy.prototype.reset = function (recognizer) {};
  31139. ErrorStrategy.prototype.recoverInline = function (recognizer) {};
  31140. ErrorStrategy.prototype.recover = function (recognizer, e) {};
  31141. ErrorStrategy.prototype.sync = function (recognizer) {};
  31142. ErrorStrategy.prototype.inErrorRecoveryMode = function (recognizer) {};
  31143. ErrorStrategy.prototype.reportError = function (recognizer) {};
  31144. // This is the default implementation of {@link ANTLRErrorStrategy} used for
  31145. // error reporting and recovery in ANTLR parsers.
  31146. //
  31147. function DefaultErrorStrategy() {
  31148. ErrorStrategy.call(this);
  31149. // Indicates whether the error strategy is currently "recovering from an
  31150. // error". This is used to suppress reporting multiple error messages while
  31151. // attempting to recover from a detected syntax error.
  31152. //
  31153. // @see //inErrorRecoveryMode
  31154. //
  31155. this.errorRecoveryMode = false;
  31156. // The index into the input stream where the last error occurred.
  31157. // This is used to prevent infinite loops where an error is found
  31158. // but no token is consumed during recovery...another error is found,
  31159. // ad nauseum. This is a failsafe mechanism to guarantee that at least
  31160. // one token/tree node is consumed for two errors.
  31161. //
  31162. this.lastErrorIndex = -1;
  31163. this.lastErrorStates = null;
  31164. return this;
  31165. }
  31166. DefaultErrorStrategy.prototype = Object.create(ErrorStrategy.prototype);
  31167. DefaultErrorStrategy.prototype.constructor = DefaultErrorStrategy;
  31168. // <p>The default implementation simply calls {@link //endErrorCondition} to
  31169. // ensure that the handler is not in error recovery mode.</p>
  31170. DefaultErrorStrategy.prototype.reset = function (recognizer) {
  31171. this.endErrorCondition(recognizer);
  31172. };
  31173. //
  31174. // This method is called to enter error recovery mode when a recognition
  31175. // exception is reported.
  31176. //
  31177. // @param recognizer the parser instance
  31178. //
  31179. DefaultErrorStrategy.prototype.beginErrorCondition = function (recognizer) {
  31180. this.errorRecoveryMode = true;
  31181. };
  31182. DefaultErrorStrategy.prototype.inErrorRecoveryMode = function (recognizer) {
  31183. return this.errorRecoveryMode;
  31184. };
  31185. //
  31186. // This method is called to leave error recovery mode after recovering from
  31187. // a recognition exception.
  31188. //
  31189. // @param recognizer
  31190. //
  31191. DefaultErrorStrategy.prototype.endErrorCondition = function (recognizer) {
  31192. this.errorRecoveryMode = false;
  31193. this.lastErrorStates = null;
  31194. this.lastErrorIndex = -1;
  31195. };
  31196. //
  31197. // {@inheritDoc}
  31198. //
  31199. // <p>The default implementation simply calls {@link //endErrorCondition}.</p>
  31200. //
  31201. DefaultErrorStrategy.prototype.reportMatch = function (recognizer) {
  31202. this.endErrorCondition(recognizer);
  31203. };
  31204. //
  31205. // {@inheritDoc}
  31206. //
  31207. // <p>The default implementation returns immediately if the handler is already
  31208. // in error recovery mode. Otherwise, it calls {@link //beginErrorCondition}
  31209. // and dispatches the reporting task based on the runtime type of {@code e}
  31210. // according to the following table.</p>
  31211. //
  31212. // <ul>
  31213. // <li>{@link NoViableAltException}: Dispatches the call to
  31214. // {@link //reportNoViableAlternative}</li>
  31215. // <li>{@link InputMismatchException}: Dispatches the call to
  31216. // {@link //reportInputMismatch}</li>
  31217. // <li>{@link FailedPredicateException}: Dispatches the call to
  31218. // {@link //reportFailedPredicate}</li>
  31219. // <li>All other types: calls {@link Parser//notifyErrorListeners} to report
  31220. // the exception</li>
  31221. // </ul>
  31222. //
  31223. DefaultErrorStrategy.prototype.reportError = function (recognizer, e) {
  31224. // if we've already reported an error and have not matched a token
  31225. // yet successfully, don't report any errors.
  31226. if (this.inErrorRecoveryMode(recognizer)) {
  31227. return; // don't report spurious errors
  31228. }
  31229. this.beginErrorCondition(recognizer);
  31230. if (e instanceof NoViableAltException) {
  31231. this.reportNoViableAlternative(recognizer, e);
  31232. } else if (e instanceof InputMismatchException) {
  31233. this.reportInputMismatch(recognizer, e);
  31234. } else if (e instanceof FailedPredicateException) {
  31235. this.reportFailedPredicate(recognizer, e);
  31236. } else {
  31237. console.log("unknown recognition error type: " + e.constructor.name);
  31238. console.log(e.stack);
  31239. recognizer.notifyErrorListeners(e.getOffendingToken(), e.getMessage(), e);
  31240. }
  31241. };
  31242. //
  31243. // {@inheritDoc}
  31244. //
  31245. // <p>The default implementation resynchronizes the parser by consuming tokens
  31246. // until we find one in the resynchronization set--loosely the set of tokens
  31247. // that can follow the current rule.</p>
  31248. //
  31249. DefaultErrorStrategy.prototype.recover = function (recognizer, e) {
  31250. if (this.lastErrorIndex === recognizer.getInputStream().index && this.lastErrorStates !== null && this.lastErrorStates.indexOf(recognizer.state) >= 0) {
  31251. // uh oh, another error at same token index and previously-visited
  31252. // state in ATN; must be a case where LT(1) is in the recovery
  31253. // token set so nothing got consumed. Consume a single token
  31254. // at least to prevent an infinite loop; this is a failsafe.
  31255. recognizer.consume();
  31256. }
  31257. this.lastErrorIndex = recognizer._input.index;
  31258. if (this.lastErrorStates === null) {
  31259. this.lastErrorStates = [];
  31260. }
  31261. this.lastErrorStates.push(recognizer.state);
  31262. var followSet = this.getErrorRecoverySet(recognizer);
  31263. this.consumeUntil(recognizer, followSet);
  31264. };
  31265. // The default implementation of {@link ANTLRErrorStrategy//sync} makes sure
  31266. // that the current lookahead symbol is consistent with what were expecting
  31267. // at this point in the ATN. You can call this anytime but ANTLR only
  31268. // generates code to check before subrules/loops and each iteration.
  31269. //
  31270. // <p>Implements Jim Idle's magic sync mechanism in closures and optional
  31271. // subrules. E.g.,</p>
  31272. //
  31273. // <pre>
  31274. // a : sync ( stuff sync )* ;
  31275. // sync : {consume to what can follow sync} ;
  31276. // </pre>
  31277. //
  31278. // At the start of a sub rule upon error, {@link //sync} performs single
  31279. // token deletion, if possible. If it can't do that, it bails on the current
  31280. // rule and uses the default error recovery, which consumes until the
  31281. // resynchronization set of the current rule.
  31282. //
  31283. // <p>If the sub rule is optional ({@code (...)?}, {@code (...)*}, or block
  31284. // with an empty alternative), then the expected set includes what follows
  31285. // the subrule.</p>
  31286. //
  31287. // <p>During loop iteration, it consumes until it sees a token that can start a
  31288. // sub rule or what follows loop. Yes, that is pretty aggressive. We opt to
  31289. // stay in the loop as long as possible.</p>
  31290. //
  31291. // <p><strong>ORIGINS</strong></p>
  31292. //
  31293. // <p>Previous versions of ANTLR did a poor job of their recovery within loops.
  31294. // A single mismatch token or missing token would force the parser to bail
  31295. // out of the entire rules surrounding the loop. So, for rule</p>
  31296. //
  31297. // <pre>
  31298. // classDef : 'class' ID '{' member* '}'
  31299. // </pre>
  31300. //
  31301. // input with an extra token between members would force the parser to
  31302. // consume until it found the next class definition rather than the next
  31303. // member definition of the current class.
  31304. //
  31305. // <p>This functionality cost a little bit of effort because the parser has to
  31306. // compare token set at the start of the loop and at each iteration. If for
  31307. // some reason speed is suffering for you, you can turn off this
  31308. // functionality by simply overriding this method as a blank { }.</p>
  31309. //
  31310. DefaultErrorStrategy.prototype.sync = function (recognizer) {
  31311. // If already recovering, don't try to sync
  31312. if (this.inErrorRecoveryMode(recognizer)) {
  31313. return;
  31314. }
  31315. var s = recognizer._interp.atn.states[recognizer.state];
  31316. var la = recognizer.getTokenStream().LA(1);
  31317. // try cheaper subset first; might get lucky. seems to shave a wee bit off
  31318. var nextTokens = recognizer.atn.nextTokens(s);
  31319. if (nextTokens.contains(Token.EPSILON) || nextTokens.contains(la)) {
  31320. return;
  31321. }
  31322. switch (s.stateType) {
  31323. case ATNState.BLOCK_START:
  31324. case ATNState.STAR_BLOCK_START:
  31325. case ATNState.PLUS_BLOCK_START:
  31326. case ATNState.STAR_LOOP_ENTRY:
  31327. // report error and recover if possible
  31328. if (this.singleTokenDeletion(recognizer) !== null) {
  31329. return;
  31330. } else {
  31331. throw new InputMismatchException(recognizer);
  31332. }
  31333. break;
  31334. case ATNState.PLUS_LOOP_BACK:
  31335. case ATNState.STAR_LOOP_BACK:
  31336. this.reportUnwantedToken(recognizer);
  31337. var expecting = new IntervalSet();
  31338. expecting.addSet(recognizer.getExpectedTokens());
  31339. var whatFollowsLoopIterationOrRule = expecting.addSet(this.getErrorRecoverySet(recognizer));
  31340. this.consumeUntil(recognizer, whatFollowsLoopIterationOrRule);
  31341. break;
  31342. default:
  31343. // do nothing if we can't identify the exact kind of ATN state
  31344. }
  31345. };
  31346. // This is called by {@link //reportError} when the exception is a
  31347. // {@link NoViableAltException}.
  31348. //
  31349. // @see //reportError
  31350. //
  31351. // @param recognizer the parser instance
  31352. // @param e the recognition exception
  31353. //
  31354. DefaultErrorStrategy.prototype.reportNoViableAlternative = function (recognizer, e) {
  31355. var tokens = recognizer.getTokenStream();
  31356. var input;
  31357. if (tokens !== null) {
  31358. if (e.startToken.type === Token.EOF) {
  31359. input = "<EOF>";
  31360. } else {
  31361. input = tokens.getText(new Interval(e.startToken.tokenIndex, e.offendingToken.tokenIndex));
  31362. }
  31363. } else {
  31364. input = "<unknown input>";
  31365. }
  31366. var msg = "no viable alternative at input " + this.escapeWSAndQuote(input);
  31367. recognizer.notifyErrorListeners(msg, e.offendingToken, e);
  31368. };
  31369. //
  31370. // This is called by {@link //reportError} when the exception is an
  31371. // {@link InputMismatchException}.
  31372. //
  31373. // @see //reportError
  31374. //
  31375. // @param recognizer the parser instance
  31376. // @param e the recognition exception
  31377. //
  31378. DefaultErrorStrategy.prototype.reportInputMismatch = function (recognizer, e) {
  31379. var msg = "mismatched input " + this.getTokenErrorDisplay(e.offendingToken) + " expecting " + e.getExpectedTokens().toString(recognizer.literalNames, recognizer.symbolicNames);
  31380. recognizer.notifyErrorListeners(msg, e.offendingToken, e);
  31381. };
  31382. //
  31383. // This is called by {@link //reportError} when the exception is a
  31384. // {@link FailedPredicateException}.
  31385. //
  31386. // @see //reportError
  31387. //
  31388. // @param recognizer the parser instance
  31389. // @param e the recognition exception
  31390. //
  31391. DefaultErrorStrategy.prototype.reportFailedPredicate = function (recognizer, e) {
  31392. var ruleName = recognizer.ruleNames[recognizer._ctx.ruleIndex];
  31393. var msg = "rule " + ruleName + " " + e.message;
  31394. recognizer.notifyErrorListeners(msg, e.offendingToken, e);
  31395. };
  31396. // This method is called to report a syntax error which requires the removal
  31397. // of a token from the input stream. At the time this method is called, the
  31398. // erroneous symbol is current {@code LT(1)} symbol and has not yet been
  31399. // removed from the input stream. When this method returns,
  31400. // {@code recognizer} is in error recovery mode.
  31401. //
  31402. // <p>This method is called when {@link //singleTokenDeletion} identifies
  31403. // single-token deletion as a viable recovery strategy for a mismatched
  31404. // input error.</p>
  31405. //
  31406. // <p>The default implementation simply returns if the handler is already in
  31407. // error recovery mode. Otherwise, it calls {@link //beginErrorCondition} to
  31408. // enter error recovery mode, followed by calling
  31409. // {@link Parser//notifyErrorListeners}.</p>
  31410. //
  31411. // @param recognizer the parser instance
  31412. //
  31413. DefaultErrorStrategy.prototype.reportUnwantedToken = function (recognizer) {
  31414. if (this.inErrorRecoveryMode(recognizer)) {
  31415. return;
  31416. }
  31417. this.beginErrorCondition(recognizer);
  31418. var t = recognizer.getCurrentToken();
  31419. var tokenName = this.getTokenErrorDisplay(t);
  31420. var expecting = this.getExpectedTokens(recognizer);
  31421. var msg = "extraneous input " + tokenName + " expecting " + expecting.toString(recognizer.literalNames, recognizer.symbolicNames);
  31422. recognizer.notifyErrorListeners(msg, t, null);
  31423. };
  31424. // This method is called to report a syntax error which requires the
  31425. // insertion of a missing token into the input stream. At the time this
  31426. // method is called, the missing token has not yet been inserted. When this
  31427. // method returns, {@code recognizer} is in error recovery mode.
  31428. //
  31429. // <p>This method is called when {@link //singleTokenInsertion} identifies
  31430. // single-token insertion as a viable recovery strategy for a mismatched
  31431. // input error.</p>
  31432. //
  31433. // <p>The default implementation simply returns if the handler is already in
  31434. // error recovery mode. Otherwise, it calls {@link //beginErrorCondition} to
  31435. // enter error recovery mode, followed by calling
  31436. // {@link Parser//notifyErrorListeners}.</p>
  31437. //
  31438. // @param recognizer the parser instance
  31439. //
  31440. DefaultErrorStrategy.prototype.reportMissingToken = function (recognizer) {
  31441. if (this.inErrorRecoveryMode(recognizer)) {
  31442. return;
  31443. }
  31444. this.beginErrorCondition(recognizer);
  31445. var t = recognizer.getCurrentToken();
  31446. var expecting = this.getExpectedTokens(recognizer);
  31447. var msg = "missing " + expecting.toString(recognizer.literalNames, recognizer.symbolicNames) + " at " + this.getTokenErrorDisplay(t);
  31448. recognizer.notifyErrorListeners(msg, t, null);
  31449. };
  31450. // <p>The default implementation attempts to recover from the mismatched input
  31451. // by using single token insertion and deletion as described below. If the
  31452. // recovery attempt fails, this method throws an
  31453. // {@link InputMismatchException}.</p>
  31454. //
  31455. // <p><strong>EXTRA TOKEN</strong> (single token deletion)</p>
  31456. //
  31457. // <p>{@code LA(1)} is not what we are looking for. If {@code LA(2)} has the
  31458. // right token, however, then assume {@code LA(1)} is some extra spurious
  31459. // token and delete it. Then consume and return the next token (which was
  31460. // the {@code LA(2)} token) as the successful result of the match operation.</p>
  31461. //
  31462. // <p>This recovery strategy is implemented by {@link
  31463. // //singleTokenDeletion}.</p>
  31464. //
  31465. // <p><strong>MISSING TOKEN</strong> (single token insertion)</p>
  31466. //
  31467. // <p>If current token (at {@code LA(1)}) is consistent with what could come
  31468. // after the expected {@code LA(1)} token, then assume the token is missing
  31469. // and use the parser's {@link TokenFactory} to create it on the fly. The
  31470. // "insertion" is performed by returning the created token as the successful
  31471. // result of the match operation.</p>
  31472. //
  31473. // <p>This recovery strategy is implemented by {@link
  31474. // //singleTokenInsertion}.</p>
  31475. //
  31476. // <p><strong>EXAMPLE</strong></p>
  31477. //
  31478. // <p>For example, Input {@code i=(3;} is clearly missing the {@code ')'}. When
  31479. // the parser returns from the nested call to {@code expr}, it will have
  31480. // call chain:</p>
  31481. //
  31482. // <pre>
  31483. // stat &rarr; expr &rarr; atom
  31484. // </pre>
  31485. //
  31486. // and it will be trying to match the {@code ')'} at this point in the
  31487. // derivation:
  31488. //
  31489. // <pre>
  31490. // =&gt; ID '=' '(' INT ')' ('+' atom)* ';'
  31491. // ^
  31492. // </pre>
  31493. //
  31494. // The attempt to match {@code ')'} will fail when it sees {@code ';'} and
  31495. // call {@link //recoverInline}. To recover, it sees that {@code LA(1)==';'}
  31496. // is in the set of tokens that can follow the {@code ')'} token reference
  31497. // in rule {@code atom}. It can assume that you forgot the {@code ')'}.
  31498. //
  31499. DefaultErrorStrategy.prototype.recoverInline = function (recognizer) {
  31500. // SINGLE TOKEN DELETION
  31501. var matchedSymbol = this.singleTokenDeletion(recognizer);
  31502. if (matchedSymbol !== null) {
  31503. // we have deleted the extra token.
  31504. // now, move past ttype token as if all were ok
  31505. recognizer.consume();
  31506. return matchedSymbol;
  31507. }
  31508. // SINGLE TOKEN INSERTION
  31509. if (this.singleTokenInsertion(recognizer)) {
  31510. return this.getMissingSymbol(recognizer);
  31511. }
  31512. // even that didn't work; must throw the exception
  31513. throw new InputMismatchException(recognizer);
  31514. };
  31515. //
  31516. // This method implements the single-token insertion inline error recovery
  31517. // strategy. It is called by {@link //recoverInline} if the single-token
  31518. // deletion strategy fails to recover from the mismatched input. If this
  31519. // method returns {@code true}, {@code recognizer} will be in error recovery
  31520. // mode.
  31521. //
  31522. // <p>This method determines whether or not single-token insertion is viable by
  31523. // checking if the {@code LA(1)} input symbol could be successfully matched
  31524. // if it were instead the {@code LA(2)} symbol. If this method returns
  31525. // {@code true}, the caller is responsible for creating and inserting a
  31526. // token with the correct type to produce this behavior.</p>
  31527. //
  31528. // @param recognizer the parser instance
  31529. // @return {@code true} if single-token insertion is a viable recovery
  31530. // strategy for the current mismatched input, otherwise {@code false}
  31531. //
  31532. DefaultErrorStrategy.prototype.singleTokenInsertion = function (recognizer) {
  31533. var currentSymbolType = recognizer.getTokenStream().LA(1);
  31534. // if current token is consistent with what could come after current
  31535. // ATN state, then we know we're missing a token; error recovery
  31536. // is free to conjure up and insert the missing token
  31537. var atn = recognizer._interp.atn;
  31538. var currentState = atn.states[recognizer.state];
  31539. var next = currentState.transitions[0].target;
  31540. var expectingAtLL2 = atn.nextTokens(next, recognizer._ctx);
  31541. if (expectingAtLL2.contains(currentSymbolType)) {
  31542. this.reportMissingToken(recognizer);
  31543. return true;
  31544. } else {
  31545. return false;
  31546. }
  31547. };
  31548. // This method implements the single-token deletion inline error recovery
  31549. // strategy. It is called by {@link //recoverInline} to attempt to recover
  31550. // from mismatched input. If this method returns null, the parser and error
  31551. // handler state will not have changed. If this method returns non-null,
  31552. // {@code recognizer} will <em>not</em> be in error recovery mode since the
  31553. // returned token was a successful match.
  31554. //
  31555. // <p>If the single-token deletion is successful, this method calls
  31556. // {@link //reportUnwantedToken} to report the error, followed by
  31557. // {@link Parser//consume} to actually "delete" the extraneous token. Then,
  31558. // before returning {@link //reportMatch} is called to signal a successful
  31559. // match.</p>
  31560. //
  31561. // @param recognizer the parser instance
  31562. // @return the successfully matched {@link Token} instance if single-token
  31563. // deletion successfully recovers from the mismatched input, otherwise
  31564. // {@code null}
  31565. //
  31566. DefaultErrorStrategy.prototype.singleTokenDeletion = function (recognizer) {
  31567. var nextTokenType = recognizer.getTokenStream().LA(2);
  31568. var expecting = this.getExpectedTokens(recognizer);
  31569. if (expecting.contains(nextTokenType)) {
  31570. this.reportUnwantedToken(recognizer);
  31571. // print("recoverFromMismatchedToken deleting " \
  31572. // + str(recognizer.getTokenStream().LT(1)) \
  31573. // + " since " + str(recognizer.getTokenStream().LT(2)) \
  31574. // + " is what we want", file=sys.stderr)
  31575. recognizer.consume(); // simply delete extra token
  31576. // we want to return the token we're actually matching
  31577. var matchedSymbol = recognizer.getCurrentToken();
  31578. this.reportMatch(recognizer); // we know current token is correct
  31579. return matchedSymbol;
  31580. } else {
  31581. return null;
  31582. }
  31583. };
  31584. // Conjure up a missing token during error recovery.
  31585. //
  31586. // The recognizer attempts to recover from single missing
  31587. // symbols. But, actions might refer to that missing symbol.
  31588. // For example, x=ID {f($x);}. The action clearly assumes
  31589. // that there has been an identifier matched previously and that
  31590. // $x points at that token. If that token is missing, but
  31591. // the next token in the stream is what we want we assume that
  31592. // this token is missing and we keep going. Because we
  31593. // have to return some token to replace the missing token,
  31594. // we have to conjure one up. This method gives the user control
  31595. // over the tokens returned for missing tokens. Mostly,
  31596. // you will want to create something special for identifier
  31597. // tokens. For literals such as '{' and ',', the default
  31598. // action in the parser or tree parser works. It simply creates
  31599. // a CommonToken of the appropriate type. The text will be the token.
  31600. // If you change what tokens must be created by the lexer,
  31601. // override this method to create the appropriate tokens.
  31602. //
  31603. DefaultErrorStrategy.prototype.getMissingSymbol = function (recognizer) {
  31604. var currentSymbol = recognizer.getCurrentToken();
  31605. var expecting = this.getExpectedTokens(recognizer);
  31606. var expectedTokenType = expecting.first(); // get any element
  31607. var tokenText;
  31608. if (expectedTokenType === Token.EOF) {
  31609. tokenText = "<missing EOF>";
  31610. } else {
  31611. tokenText = "<missing " + recognizer.literalNames[expectedTokenType] + ">";
  31612. }
  31613. var current = currentSymbol;
  31614. var lookback = recognizer.getTokenStream().LT(-1);
  31615. if (current.type === Token.EOF && lookback !== null) {
  31616. current = lookback;
  31617. }
  31618. return recognizer.getTokenFactory().create(current.source, expectedTokenType, tokenText, Token.DEFAULT_CHANNEL, -1, -1, current.line, current.column);
  31619. };
  31620. DefaultErrorStrategy.prototype.getExpectedTokens = function (recognizer) {
  31621. return recognizer.getExpectedTokens();
  31622. };
  31623. // How should a token be displayed in an error message? The default
  31624. // is to display just the text, but during development you might
  31625. // want to have a lot of information spit out. Override in that case
  31626. // to use t.toString() (which, for CommonToken, dumps everything about
  31627. // the token). This is better than forcing you to override a method in
  31628. // your token objects because you don't have to go modify your lexer
  31629. // so that it creates a new Java type.
  31630. //
  31631. DefaultErrorStrategy.prototype.getTokenErrorDisplay = function (t) {
  31632. if (t === null) {
  31633. return "<no token>";
  31634. }
  31635. var s = t.text;
  31636. if (s === null) {
  31637. if (t.type === Token.EOF) {
  31638. s = "<EOF>";
  31639. } else {
  31640. s = "<" + t.type + ">";
  31641. }
  31642. }
  31643. return this.escapeWSAndQuote(s);
  31644. };
  31645. DefaultErrorStrategy.prototype.escapeWSAndQuote = function (s) {
  31646. s = s.replace(/\n/g, "\\n");
  31647. s = s.replace(/\r/g, "\\r");
  31648. s = s.replace(/\t/g, "\\t");
  31649. return "'" + s + "'";
  31650. };
  31651. // Compute the error recovery set for the current rule. During
  31652. // rule invocation, the parser pushes the set of tokens that can
  31653. // follow that rule reference on the stack; this amounts to
  31654. // computing FIRST of what follows the rule reference in the
  31655. // enclosing rule. See LinearApproximator.FIRST().
  31656. // This local follow set only includes tokens
  31657. // from within the rule; i.e., the FIRST computation done by
  31658. // ANTLR stops at the end of a rule.
  31659. //
  31660. // EXAMPLE
  31661. //
  31662. // When you find a "no viable alt exception", the input is not
  31663. // consistent with any of the alternatives for rule r. The best
  31664. // thing to do is to consume tokens until you see something that
  31665. // can legally follow a call to r//or* any rule that called r.
  31666. // You don't want the exact set of viable next tokens because the
  31667. // input might just be missing a token--you might consume the
  31668. // rest of the input looking for one of the missing tokens.
  31669. //
  31670. // Consider grammar:
  31671. //
  31672. // a : '[' b ']'
  31673. // | '(' b ')'
  31674. // ;
  31675. // b : c '^' INT ;
  31676. // c : ID
  31677. // | INT
  31678. // ;
  31679. //
  31680. // At each rule invocation, the set of tokens that could follow
  31681. // that rule is pushed on a stack. Here are the various
  31682. // context-sensitive follow sets:
  31683. //
  31684. // FOLLOW(b1_in_a) = FIRST(']') = ']'
  31685. // FOLLOW(b2_in_a) = FIRST(')') = ')'
  31686. // FOLLOW(c_in_b) = FIRST('^') = '^'
  31687. //
  31688. // Upon erroneous input "[]", the call chain is
  31689. //
  31690. // a -> b -> c
  31691. //
  31692. // and, hence, the follow context stack is:
  31693. //
  31694. // depth follow set start of rule execution
  31695. // 0 <EOF> a (from main())
  31696. // 1 ']' b
  31697. // 2 '^' c
  31698. //
  31699. // Notice that ')' is not included, because b would have to have
  31700. // been called from a different context in rule a for ')' to be
  31701. // included.
  31702. //
  31703. // For error recovery, we cannot consider FOLLOW(c)
  31704. // (context-sensitive or otherwise). We need the combined set of
  31705. // all context-sensitive FOLLOW sets--the set of all tokens that
  31706. // could follow any reference in the call chain. We need to
  31707. // resync to one of those tokens. Note that FOLLOW(c)='^' and if
  31708. // we resync'd to that token, we'd consume until EOF. We need to
  31709. // sync to context-sensitive FOLLOWs for a, b, and c: {']','^'}.
  31710. // In this case, for input "[]", LA(1) is ']' and in the set, so we would
  31711. // not consume anything. After printing an error, rule c would
  31712. // return normally. Rule b would not find the required '^' though.
  31713. // At this point, it gets a mismatched token error and throws an
  31714. // exception (since LA(1) is not in the viable following token
  31715. // set). The rule exception handler tries to recover, but finds
  31716. // the same recovery set and doesn't consume anything. Rule b
  31717. // exits normally returning to rule a. Now it finds the ']' (and
  31718. // with the successful match exits errorRecovery mode).
  31719. //
  31720. // So, you can see that the parser walks up the call chain looking
  31721. // for the token that was a member of the recovery set.
  31722. //
  31723. // Errors are not generated in errorRecovery mode.
  31724. //
  31725. // ANTLR's error recovery mechanism is based upon original ideas:
  31726. //
  31727. // "Algorithms + Data Structures = Programs" by Niklaus Wirth
  31728. //
  31729. // and
  31730. //
  31731. // "A note on error recovery in recursive descent parsers":
  31732. // http://portal.acm.org/citation.cfm?id=947902.947905
  31733. //
  31734. // Later, Josef Grosch had some good ideas:
  31735. //
  31736. // "Efficient and Comfortable Error Recovery in Recursive Descent
  31737. // Parsers":
  31738. // ftp://www.cocolab.com/products/cocktail/doca4.ps/ell.ps.zip
  31739. //
  31740. // Like Grosch I implement context-sensitive FOLLOW sets that are combined
  31741. // at run-time upon error to avoid overhead during parsing.
  31742. //
  31743. DefaultErrorStrategy.prototype.getErrorRecoverySet = function (recognizer) {
  31744. var atn = recognizer._interp.atn;
  31745. var ctx = recognizer._ctx;
  31746. var recoverSet = new IntervalSet();
  31747. while (ctx !== null && ctx.invokingState >= 0) {
  31748. // compute what follows who invoked us
  31749. var invokingState = atn.states[ctx.invokingState];
  31750. var rt = invokingState.transitions[0];
  31751. var follow = atn.nextTokens(rt.followState);
  31752. recoverSet.addSet(follow);
  31753. ctx = ctx.parentCtx;
  31754. }
  31755. recoverSet.removeOne(Token.EPSILON);
  31756. return recoverSet;
  31757. };
  31758. // Consume tokens until one matches the given token set.//
  31759. DefaultErrorStrategy.prototype.consumeUntil = function (recognizer, set) {
  31760. var ttype = recognizer.getTokenStream().LA(1);
  31761. while (ttype !== Token.EOF && !set.contains(ttype)) {
  31762. recognizer.consume();
  31763. ttype = recognizer.getTokenStream().LA(1);
  31764. }
  31765. };
  31766. //
  31767. // This implementation of {@link ANTLRErrorStrategy} responds to syntax errors
  31768. // by immediately canceling the parse operation with a
  31769. // {@link ParseCancellationException}. The implementation ensures that the
  31770. // {@link ParserRuleContext//exception} field is set for all parse tree nodes
  31771. // that were not completed prior to encountering the error.
  31772. //
  31773. // <p>
  31774. // This error strategy is useful in the following scenarios.</p>
  31775. //
  31776. // <ul>
  31777. // <li><strong>Two-stage parsing:</strong> This error strategy allows the first
  31778. // stage of two-stage parsing to immediately terminate if an error is
  31779. // encountered, and immediately fall back to the second stage. In addition to
  31780. // avoiding wasted work by attempting to recover from errors here, the empty
  31781. // implementation of {@link BailErrorStrategy//sync} improves the performance of
  31782. // the first stage.</li>
  31783. // <li><strong>Silent validation:</strong> When syntax errors are not being
  31784. // reported or logged, and the parse result is simply ignored if errors occur,
  31785. // the {@link BailErrorStrategy} avoids wasting work on recovering from errors
  31786. // when the result will be ignored either way.</li>
  31787. // </ul>
  31788. //
  31789. // <p>
  31790. // {@code myparser.setErrorHandler(new BailErrorStrategy());}</p>
  31791. //
  31792. // @see Parser//setErrorHandler(ANTLRErrorStrategy)
  31793. //
  31794. function BailErrorStrategy() {
  31795. DefaultErrorStrategy.call(this);
  31796. return this;
  31797. }
  31798. BailErrorStrategy.prototype = Object.create(DefaultErrorStrategy.prototype);
  31799. BailErrorStrategy.prototype.constructor = BailErrorStrategy;
  31800. // Instead of recovering from exception {@code e}, re-throw it wrapped
  31801. // in a {@link ParseCancellationException} so it is not caught by the
  31802. // rule function catches. Use {@link Exception//getCause()} to get the
  31803. // original {@link RecognitionException}.
  31804. //
  31805. BailErrorStrategy.prototype.recover = function (recognizer, e) {
  31806. var context = recognizer._ctx;
  31807. while (context !== null) {
  31808. context.exception = e;
  31809. context = context.parentCtx;
  31810. }
  31811. throw new ParseCancellationException(e);
  31812. };
  31813. // Make sure we don't attempt to recover inline; if the parser
  31814. // successfully recovers, it won't throw an exception.
  31815. //
  31816. BailErrorStrategy.prototype.recoverInline = function (recognizer) {
  31817. this.recover(recognizer, new InputMismatchException(recognizer));
  31818. };
  31819. // Make sure we don't attempt to recover from problems in subrules.//
  31820. BailErrorStrategy.prototype.sync = function (recognizer) {
  31821. // pass
  31822. };
  31823. exports.BailErrorStrategy = BailErrorStrategy;
  31824. exports.DefaultErrorStrategy = DefaultErrorStrategy;
  31825. /***/ }),
  31826. /***/ "./node_modules/antlr4/error/Errors.js":
  31827. /*!*********************************************!*\
  31828. !*** ./node_modules/antlr4/error/Errors.js ***!
  31829. \*********************************************/
  31830. /*! no static exports found */
  31831. /***/ (function(module, exports, __webpack_require__) {
  31832. "use strict";
  31833. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31834. * Use of this file is governed by the BSD 3-clause license that
  31835. * can be found in the LICENSE.txt file in the project root.
  31836. */
  31837. // The root of the ANTLR exception hierarchy. In general, ANTLR tracks just
  31838. // 3 kinds of errors: prediction errors, failed predicate errors, and
  31839. // mismatched input errors. In each case, the parser knows where it is
  31840. // in the input, where it is in the ATN, the rule invocation stack,
  31841. // and what kind of problem occurred.
  31842. var PredicateTransition = __webpack_require__(/*! ./../atn/Transition */ "./node_modules/antlr4/atn/Transition.js").PredicateTransition;
  31843. function RecognitionException(params) {
  31844. Error.call(this);
  31845. if (!!Error.captureStackTrace) {
  31846. Error.captureStackTrace(this, RecognitionException);
  31847. } else {
  31848. var stack = new Error().stack;
  31849. }
  31850. this.message = params.message;
  31851. this.recognizer = params.recognizer;
  31852. this.input = params.input;
  31853. this.ctx = params.ctx;
  31854. // The current {@link Token} when an error occurred. Since not all streams
  31855. // support accessing symbols by index, we have to track the {@link Token}
  31856. // instance itself.
  31857. this.offendingToken = null;
  31858. // Get the ATN state number the parser was in at the time the error
  31859. // occurred. For {@link NoViableAltException} and
  31860. // {@link LexerNoViableAltException} exceptions, this is the
  31861. // {@link DecisionState} number. For others, it is the state whose outgoing
  31862. // edge we couldn't match.
  31863. this.offendingState = -1;
  31864. if (this.recognizer !== null) {
  31865. this.offendingState = this.recognizer.state;
  31866. }
  31867. return this;
  31868. }
  31869. RecognitionException.prototype = Object.create(Error.prototype);
  31870. RecognitionException.prototype.constructor = RecognitionException;
  31871. // <p>If the state number is not known, this method returns -1.</p>
  31872. //
  31873. // Gets the set of input symbols which could potentially follow the
  31874. // previously matched symbol at the time this exception was thrown.
  31875. //
  31876. // <p>If the set of expected tokens is not known and could not be computed,
  31877. // this method returns {@code null}.</p>
  31878. //
  31879. // @return The set of token types that could potentially follow the current
  31880. // state in the ATN, or {@code null} if the information is not available.
  31881. // /
  31882. RecognitionException.prototype.getExpectedTokens = function () {
  31883. if (this.recognizer !== null) {
  31884. return this.recognizer.atn.getExpectedTokens(this.offendingState, this.ctx);
  31885. } else {
  31886. return null;
  31887. }
  31888. };
  31889. RecognitionException.prototype.toString = function () {
  31890. return this.message;
  31891. };
  31892. function LexerNoViableAltException(lexer, input, startIndex, deadEndConfigs) {
  31893. RecognitionException.call(this, { message: "", recognizer: lexer, input: input, ctx: null });
  31894. this.startIndex = startIndex;
  31895. this.deadEndConfigs = deadEndConfigs;
  31896. return this;
  31897. }
  31898. LexerNoViableAltException.prototype = Object.create(RecognitionException.prototype);
  31899. LexerNoViableAltException.prototype.constructor = LexerNoViableAltException;
  31900. LexerNoViableAltException.prototype.toString = function () {
  31901. var symbol = "";
  31902. if (this.startIndex >= 0 && this.startIndex < this.input.size) {
  31903. symbol = this.input.getText((this.startIndex, this.startIndex));
  31904. }
  31905. return "LexerNoViableAltException" + symbol;
  31906. };
  31907. // Indicates that the parser could not decide which of two or more paths
  31908. // to take based upon the remaining input. It tracks the starting token
  31909. // of the offending input and also knows where the parser was
  31910. // in the various paths when the error. Reported by reportNoViableAlternative()
  31911. //
  31912. function NoViableAltException(recognizer, input, startToken, offendingToken, deadEndConfigs, ctx) {
  31913. ctx = ctx || recognizer._ctx;
  31914. offendingToken = offendingToken || recognizer.getCurrentToken();
  31915. startToken = startToken || recognizer.getCurrentToken();
  31916. input = input || recognizer.getInputStream();
  31917. RecognitionException.call(this, { message: "", recognizer: recognizer, input: input, ctx: ctx });
  31918. // Which configurations did we try at input.index() that couldn't match
  31919. // input.LT(1)?//
  31920. this.deadEndConfigs = deadEndConfigs;
  31921. // The token object at the start index; the input stream might
  31922. // not be buffering tokens so get a reference to it. (At the
  31923. // time the error occurred, of course the stream needs to keep a
  31924. // buffer all of the tokens but later we might not have access to those.)
  31925. this.startToken = startToken;
  31926. this.offendingToken = offendingToken;
  31927. }
  31928. NoViableAltException.prototype = Object.create(RecognitionException.prototype);
  31929. NoViableAltException.prototype.constructor = NoViableAltException;
  31930. // This signifies any kind of mismatched input exceptions such as
  31931. // when the current input does not match the expected token.
  31932. //
  31933. function InputMismatchException(recognizer) {
  31934. RecognitionException.call(this, { message: "", recognizer: recognizer, input: recognizer.getInputStream(), ctx: recognizer._ctx });
  31935. this.offendingToken = recognizer.getCurrentToken();
  31936. }
  31937. InputMismatchException.prototype = Object.create(RecognitionException.prototype);
  31938. InputMismatchException.prototype.constructor = InputMismatchException;
  31939. // A semantic predicate failed during validation. Validation of predicates
  31940. // occurs when normally parsing the alternative just like matching a token.
  31941. // Disambiguating predicate evaluation occurs when we test a predicate during
  31942. // prediction.
  31943. function FailedPredicateException(recognizer, predicate, message) {
  31944. RecognitionException.call(this, { message: this.formatMessage(predicate, message || null), recognizer: recognizer,
  31945. input: recognizer.getInputStream(), ctx: recognizer._ctx });
  31946. var s = recognizer._interp.atn.states[recognizer.state];
  31947. var trans = s.transitions[0];
  31948. if (trans instanceof PredicateTransition) {
  31949. this.ruleIndex = trans.ruleIndex;
  31950. this.predicateIndex = trans.predIndex;
  31951. } else {
  31952. this.ruleIndex = 0;
  31953. this.predicateIndex = 0;
  31954. }
  31955. this.predicate = predicate;
  31956. this.offendingToken = recognizer.getCurrentToken();
  31957. return this;
  31958. }
  31959. FailedPredicateException.prototype = Object.create(RecognitionException.prototype);
  31960. FailedPredicateException.prototype.constructor = FailedPredicateException;
  31961. FailedPredicateException.prototype.formatMessage = function (predicate, message) {
  31962. if (message !== null) {
  31963. return message;
  31964. } else {
  31965. return "failed predicate: {" + predicate + "}?";
  31966. }
  31967. };
  31968. function ParseCancellationException() {
  31969. Error.call(this);
  31970. Error.captureStackTrace(this, ParseCancellationException);
  31971. return this;
  31972. }
  31973. ParseCancellationException.prototype = Object.create(Error.prototype);
  31974. ParseCancellationException.prototype.constructor = ParseCancellationException;
  31975. exports.RecognitionException = RecognitionException;
  31976. exports.NoViableAltException = NoViableAltException;
  31977. exports.LexerNoViableAltException = LexerNoViableAltException;
  31978. exports.InputMismatchException = InputMismatchException;
  31979. exports.FailedPredicateException = FailedPredicateException;
  31980. exports.ParseCancellationException = ParseCancellationException;
  31981. /***/ }),
  31982. /***/ "./node_modules/antlr4/error/index.js":
  31983. /*!********************************************!*\
  31984. !*** ./node_modules/antlr4/error/index.js ***!
  31985. \********************************************/
  31986. /*! no static exports found */
  31987. /***/ (function(module, exports, __webpack_require__) {
  31988. "use strict";
  31989. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31990. * Use of this file is governed by the BSD 3-clause license that
  31991. * can be found in the LICENSE.txt file in the project root.
  31992. */
  31993. exports.RecognitionException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").RecognitionException;
  31994. exports.NoViableAltException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").NoViableAltException;
  31995. exports.LexerNoViableAltException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").LexerNoViableAltException;
  31996. exports.InputMismatchException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").InputMismatchException;
  31997. exports.FailedPredicateException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").FailedPredicateException;
  31998. exports.DiagnosticErrorListener = __webpack_require__(/*! ./DiagnosticErrorListener */ "./node_modules/antlr4/error/DiagnosticErrorListener.js").DiagnosticErrorListener;
  31999. exports.BailErrorStrategy = __webpack_require__(/*! ./ErrorStrategy */ "./node_modules/antlr4/error/ErrorStrategy.js").BailErrorStrategy;
  32000. exports.ErrorListener = __webpack_require__(/*! ./ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ErrorListener;
  32001. /***/ }),
  32002. /***/ "./node_modules/antlr4/index.js":
  32003. /*!**************************************!*\
  32004. !*** ./node_modules/antlr4/index.js ***!
  32005. \**************************************/
  32006. /*! no static exports found */
  32007. /***/ (function(module, exports, __webpack_require__) {
  32008. "use strict";
  32009. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  32010. * Use of this file is governed by the BSD 3-clause license that
  32011. * can be found in the LICENSE.txt file in the project root.
  32012. */
  32013. exports.atn = __webpack_require__(/*! ./atn/index */ "./node_modules/antlr4/atn/index.js");
  32014. exports.codepointat = __webpack_require__(/*! ./polyfills/codepointat */ "./node_modules/antlr4/polyfills/codepointat.js");
  32015. exports.dfa = __webpack_require__(/*! ./dfa/index */ "./node_modules/antlr4/dfa/index.js");
  32016. exports.fromcodepoint = __webpack_require__(/*! ./polyfills/fromcodepoint */ "./node_modules/antlr4/polyfills/fromcodepoint.js");
  32017. exports.tree = __webpack_require__(/*! ./tree/index */ "./node_modules/antlr4/tree/index.js");
  32018. exports.error = __webpack_require__(/*! ./error/index */ "./node_modules/antlr4/error/index.js");
  32019. exports.Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  32020. exports.CharStreams = __webpack_require__(/*! ./CharStreams */ "./node_modules/antlr4/CharStreams.js").CharStreams;
  32021. exports.CommonToken = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").CommonToken;
  32022. exports.InputStream = __webpack_require__(/*! ./InputStream */ "./node_modules/antlr4/InputStream.js").InputStream;
  32023. exports.FileStream = __webpack_require__(/*! ./FileStream */ "./node_modules/antlr4/FileStream.js").FileStream;
  32024. exports.CommonTokenStream = __webpack_require__(/*! ./CommonTokenStream */ "./node_modules/antlr4/CommonTokenStream.js").CommonTokenStream;
  32025. exports.Lexer = __webpack_require__(/*! ./Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  32026. exports.Parser = __webpack_require__(/*! ./Parser */ "./node_modules/antlr4/Parser.js").Parser;
  32027. var pc = __webpack_require__(/*! ./PredictionContext */ "./node_modules/antlr4/PredictionContext.js");
  32028. exports.PredictionContextCache = pc.PredictionContextCache;
  32029. exports.ParserRuleContext = __webpack_require__(/*! ./ParserRuleContext */ "./node_modules/antlr4/ParserRuleContext.js").ParserRuleContext;
  32030. exports.Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  32031. exports.Utils = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js");
  32032. /***/ }),
  32033. /***/ "./node_modules/antlr4/polyfills/codepointat.js":
  32034. /*!******************************************************!*\
  32035. !*** ./node_modules/antlr4/polyfills/codepointat.js ***!
  32036. \******************************************************/
  32037. /*! no static exports found */
  32038. /***/ (function(module, exports, __webpack_require__) {
  32039. "use strict";
  32040. /*! https://mths.be/codepointat v0.2.0 by @mathias */
  32041. if (!String.prototype.codePointAt) {
  32042. (function () {
  32043. 'use strict'; // needed to support `apply`/`call` with `undefined`/`null`
  32044. var defineProperty = function () {
  32045. // IE 8 only supports `Object.defineProperty` on DOM elements
  32046. try {
  32047. var object = {};
  32048. var $defineProperty = Object.defineProperty;
  32049. var result = $defineProperty(object, object, object) && $defineProperty;
  32050. } catch (error) {}
  32051. return result;
  32052. }();
  32053. var codePointAt = function codePointAt(position) {
  32054. if (this == null) {
  32055. throw TypeError();
  32056. }
  32057. var string = String(this);
  32058. var size = string.length;
  32059. // `ToInteger`
  32060. var index = position ? Number(position) : 0;
  32061. if (index != index) {
  32062. // better `isNaN`
  32063. index = 0;
  32064. }
  32065. // Account for out-of-bounds indices:
  32066. if (index < 0 || index >= size) {
  32067. return undefined;
  32068. }
  32069. // Get the first code unit
  32070. var first = string.charCodeAt(index);
  32071. var second;
  32072. if ( // check if it’s the start of a surrogate pair
  32073. first >= 0xD800 && first <= 0xDBFF && // high surrogate
  32074. size > index + 1 // there is a next code unit
  32075. ) {
  32076. second = string.charCodeAt(index + 1);
  32077. if (second >= 0xDC00 && second <= 0xDFFF) {
  32078. // low surrogate
  32079. // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
  32080. return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
  32081. }
  32082. }
  32083. return first;
  32084. };
  32085. if (defineProperty) {
  32086. defineProperty(String.prototype, 'codePointAt', {
  32087. 'value': codePointAt,
  32088. 'configurable': true,
  32089. 'writable': true
  32090. });
  32091. } else {
  32092. String.prototype.codePointAt = codePointAt;
  32093. }
  32094. })();
  32095. }
  32096. /***/ }),
  32097. /***/ "./node_modules/antlr4/polyfills/fromcodepoint.js":
  32098. /*!********************************************************!*\
  32099. !*** ./node_modules/antlr4/polyfills/fromcodepoint.js ***!
  32100. \********************************************************/
  32101. /*! no static exports found */
  32102. /***/ (function(module, exports, __webpack_require__) {
  32103. "use strict";
  32104. /*! https://mths.be/fromcodepoint v0.2.1 by @mathias */
  32105. if (!String.fromCodePoint) {
  32106. (function () {
  32107. var defineProperty = function () {
  32108. // IE 8 only supports `Object.defineProperty` on DOM elements
  32109. try {
  32110. var object = {};
  32111. var $defineProperty = Object.defineProperty;
  32112. var result = $defineProperty(object, object, object) && $defineProperty;
  32113. } catch (error) {}
  32114. return result;
  32115. }();
  32116. var stringFromCharCode = String.fromCharCode;
  32117. var floor = Math.floor;
  32118. var fromCodePoint = function fromCodePoint(_) {
  32119. var MAX_SIZE = 0x4000;
  32120. var codeUnits = [];
  32121. var highSurrogate;
  32122. var lowSurrogate;
  32123. var index = -1;
  32124. var length = arguments.length;
  32125. if (!length) {
  32126. return '';
  32127. }
  32128. var result = '';
  32129. while (++index < length) {
  32130. var codePoint = Number(arguments[index]);
  32131. if (!isFinite(codePoint) || // `NaN`, `+Infinity`, or `-Infinity`
  32132. codePoint < 0 || // not a valid Unicode code point
  32133. codePoint > 0x10FFFF || // not a valid Unicode code point
  32134. floor(codePoint) != codePoint // not an integer
  32135. ) {
  32136. throw RangeError('Invalid code point: ' + codePoint);
  32137. }
  32138. if (codePoint <= 0xFFFF) {
  32139. // BMP code point
  32140. codeUnits.push(codePoint);
  32141. } else {
  32142. // Astral code point; split in surrogate halves
  32143. // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
  32144. codePoint -= 0x10000;
  32145. highSurrogate = (codePoint >> 10) + 0xD800;
  32146. lowSurrogate = codePoint % 0x400 + 0xDC00;
  32147. codeUnits.push(highSurrogate, lowSurrogate);
  32148. }
  32149. if (index + 1 == length || codeUnits.length > MAX_SIZE) {
  32150. result += stringFromCharCode.apply(null, codeUnits);
  32151. codeUnits.length = 0;
  32152. }
  32153. }
  32154. return result;
  32155. };
  32156. if (defineProperty) {
  32157. defineProperty(String, 'fromCodePoint', {
  32158. 'value': fromCodePoint,
  32159. 'configurable': true,
  32160. 'writable': true
  32161. });
  32162. } else {
  32163. String.fromCodePoint = fromCodePoint;
  32164. }
  32165. })();
  32166. }
  32167. /***/ }),
  32168. /***/ "./node_modules/antlr4/tree/Tree.js":
  32169. /*!******************************************!*\
  32170. !*** ./node_modules/antlr4/tree/Tree.js ***!
  32171. \******************************************/
  32172. /*! no static exports found */
  32173. /***/ (function(module, exports, __webpack_require__) {
  32174. "use strict";
  32175. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  32176. * Use of this file is governed by the BSD 3-clause license that
  32177. * can be found in the LICENSE.txt file in the project root.
  32178. */
  32179. ///
  32180. // The basic notion of a tree has a parent, a payload, and a list of children.
  32181. // It is the most abstract interface for all the trees used by ANTLR.
  32182. ///
  32183. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  32184. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  32185. var INVALID_INTERVAL = new Interval(-1, -2);
  32186. var Utils = __webpack_require__(/*! ../Utils.js */ "./node_modules/antlr4/Utils.js");
  32187. function Tree() {
  32188. return this;
  32189. }
  32190. function SyntaxTree() {
  32191. Tree.call(this);
  32192. return this;
  32193. }
  32194. SyntaxTree.prototype = Object.create(Tree.prototype);
  32195. SyntaxTree.prototype.constructor = SyntaxTree;
  32196. function ParseTree() {
  32197. SyntaxTree.call(this);
  32198. return this;
  32199. }
  32200. ParseTree.prototype = Object.create(SyntaxTree.prototype);
  32201. ParseTree.prototype.constructor = ParseTree;
  32202. function RuleNode() {
  32203. ParseTree.call(this);
  32204. return this;
  32205. }
  32206. RuleNode.prototype = Object.create(ParseTree.prototype);
  32207. RuleNode.prototype.constructor = RuleNode;
  32208. function TerminalNode() {
  32209. ParseTree.call(this);
  32210. return this;
  32211. }
  32212. TerminalNode.prototype = Object.create(ParseTree.prototype);
  32213. TerminalNode.prototype.constructor = TerminalNode;
  32214. function ErrorNode() {
  32215. TerminalNode.call(this);
  32216. return this;
  32217. }
  32218. ErrorNode.prototype = Object.create(TerminalNode.prototype);
  32219. ErrorNode.prototype.constructor = ErrorNode;
  32220. function ParseTreeVisitor() {
  32221. return this;
  32222. }
  32223. ParseTreeVisitor.prototype.visit = function (ctx) {
  32224. if (Array.isArray(ctx)) {
  32225. return ctx.map(function (child) {
  32226. return child.accept(this);
  32227. }, this);
  32228. } else {
  32229. return ctx.accept(this);
  32230. }
  32231. };
  32232. ParseTreeVisitor.prototype.visitChildren = function (ctx) {
  32233. return this.visit(ctx.children);
  32234. };
  32235. ParseTreeVisitor.prototype.visitTerminal = function (node) {};
  32236. ParseTreeVisitor.prototype.visitErrorNode = function (node) {};
  32237. function ParseTreeListener() {
  32238. return this;
  32239. }
  32240. ParseTreeListener.prototype.visitTerminal = function (node) {};
  32241. ParseTreeListener.prototype.visitErrorNode = function (node) {};
  32242. ParseTreeListener.prototype.enterEveryRule = function (node) {};
  32243. ParseTreeListener.prototype.exitEveryRule = function (node) {};
  32244. function TerminalNodeImpl(symbol) {
  32245. TerminalNode.call(this);
  32246. this.parentCtx = null;
  32247. this.symbol = symbol;
  32248. return this;
  32249. }
  32250. TerminalNodeImpl.prototype = Object.create(TerminalNode.prototype);
  32251. TerminalNodeImpl.prototype.constructor = TerminalNodeImpl;
  32252. TerminalNodeImpl.prototype.getChild = function (i) {
  32253. return null;
  32254. };
  32255. TerminalNodeImpl.prototype.getSymbol = function () {
  32256. return this.symbol;
  32257. };
  32258. TerminalNodeImpl.prototype.getParent = function () {
  32259. return this.parentCtx;
  32260. };
  32261. TerminalNodeImpl.prototype.getPayload = function () {
  32262. return this.symbol;
  32263. };
  32264. TerminalNodeImpl.prototype.getSourceInterval = function () {
  32265. if (this.symbol === null) {
  32266. return INVALID_INTERVAL;
  32267. }
  32268. var tokenIndex = this.symbol.tokenIndex;
  32269. return new Interval(tokenIndex, tokenIndex);
  32270. };
  32271. TerminalNodeImpl.prototype.getChildCount = function () {
  32272. return 0;
  32273. };
  32274. TerminalNodeImpl.prototype.accept = function (visitor) {
  32275. return visitor.visitTerminal(this);
  32276. };
  32277. TerminalNodeImpl.prototype.getText = function () {
  32278. return this.symbol.text;
  32279. };
  32280. TerminalNodeImpl.prototype.toString = function () {
  32281. if (this.symbol.type === Token.EOF) {
  32282. return "<EOF>";
  32283. } else {
  32284. return this.symbol.text;
  32285. }
  32286. };
  32287. // Represents a token that was consumed during resynchronization
  32288. // rather than during a valid match operation. For example,
  32289. // we will create this kind of a node during single token insertion
  32290. // and deletion as well as during "consume until error recovery set"
  32291. // upon no viable alternative exceptions.
  32292. function ErrorNodeImpl(token) {
  32293. TerminalNodeImpl.call(this, token);
  32294. return this;
  32295. }
  32296. ErrorNodeImpl.prototype = Object.create(TerminalNodeImpl.prototype);
  32297. ErrorNodeImpl.prototype.constructor = ErrorNodeImpl;
  32298. ErrorNodeImpl.prototype.isErrorNode = function () {
  32299. return true;
  32300. };
  32301. ErrorNodeImpl.prototype.accept = function (visitor) {
  32302. return visitor.visitErrorNode(this);
  32303. };
  32304. function ParseTreeWalker() {
  32305. return this;
  32306. }
  32307. ParseTreeWalker.prototype.walk = function (listener, t) {
  32308. var errorNode = t instanceof ErrorNode || t.isErrorNode !== undefined && t.isErrorNode();
  32309. if (errorNode) {
  32310. listener.visitErrorNode(t);
  32311. } else if (t instanceof TerminalNode) {
  32312. listener.visitTerminal(t);
  32313. } else {
  32314. this.enterRule(listener, t);
  32315. for (var i = 0; i < t.getChildCount(); i++) {
  32316. var child = t.getChild(i);
  32317. this.walk(listener, child);
  32318. }
  32319. this.exitRule(listener, t);
  32320. }
  32321. };
  32322. //
  32323. // The discovery of a rule node, involves sending two events: the generic
  32324. // {@link ParseTreeListener//enterEveryRule} and a
  32325. // {@link RuleContext}-specific event. First we trigger the generic and then
  32326. // the rule specific. We to them in reverse order upon finishing the node.
  32327. //
  32328. ParseTreeWalker.prototype.enterRule = function (listener, r) {
  32329. var ctx = r.getRuleContext();
  32330. listener.enterEveryRule(ctx);
  32331. ctx.enterRule(listener);
  32332. };
  32333. ParseTreeWalker.prototype.exitRule = function (listener, r) {
  32334. var ctx = r.getRuleContext();
  32335. ctx.exitRule(listener);
  32336. listener.exitEveryRule(ctx);
  32337. };
  32338. ParseTreeWalker.DEFAULT = new ParseTreeWalker();
  32339. exports.RuleNode = RuleNode;
  32340. exports.ErrorNode = ErrorNode;
  32341. exports.TerminalNode = TerminalNode;
  32342. exports.ErrorNodeImpl = ErrorNodeImpl;
  32343. exports.TerminalNodeImpl = TerminalNodeImpl;
  32344. exports.ParseTreeListener = ParseTreeListener;
  32345. exports.ParseTreeVisitor = ParseTreeVisitor;
  32346. exports.ParseTreeWalker = ParseTreeWalker;
  32347. exports.INVALID_INTERVAL = INVALID_INTERVAL;
  32348. /***/ }),
  32349. /***/ "./node_modules/antlr4/tree/Trees.js":
  32350. /*!*******************************************!*\
  32351. !*** ./node_modules/antlr4/tree/Trees.js ***!
  32352. \*******************************************/
  32353. /*! no static exports found */
  32354. /***/ (function(module, exports, __webpack_require__) {
  32355. "use strict";
  32356. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  32357. * Use of this file is governed by the BSD 3-clause license that
  32358. * can be found in the LICENSE.txt file in the project root.
  32359. */
  32360. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  32361. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  32362. var RuleNode = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js").RuleNode;
  32363. var ErrorNode = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js").ErrorNode;
  32364. var TerminalNode = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js").TerminalNode;
  32365. var ParserRuleContext = __webpack_require__(/*! ./../ParserRuleContext */ "./node_modules/antlr4/ParserRuleContext.js").ParserRuleContext;
  32366. var RuleContext = __webpack_require__(/*! ./../RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  32367. var INVALID_ALT_NUMBER = __webpack_require__(/*! ./../atn/ATN */ "./node_modules/antlr4/atn/ATN.js").INVALID_ALT_NUMBER;
  32368. /** A set of utility routines useful for all kinds of ANTLR trees. */
  32369. function Trees() {}
  32370. // Print out a whole tree in LISP form. {@link //getNodeText} is used on the
  32371. // node payloads to get the text for the nodes. Detect
  32372. // parse trees and extract data appropriately.
  32373. Trees.toStringTree = function (tree, ruleNames, recog) {
  32374. ruleNames = ruleNames || null;
  32375. recog = recog || null;
  32376. if (recog !== null) {
  32377. ruleNames = recog.ruleNames;
  32378. }
  32379. var s = Trees.getNodeText(tree, ruleNames);
  32380. s = Utils.escapeWhitespace(s, false);
  32381. var c = tree.getChildCount();
  32382. if (c === 0) {
  32383. return s;
  32384. }
  32385. var res = "(" + s + ' ';
  32386. if (c > 0) {
  32387. s = Trees.toStringTree(tree.getChild(0), ruleNames);
  32388. res = res.concat(s);
  32389. }
  32390. for (var i = 1; i < c; i++) {
  32391. s = Trees.toStringTree(tree.getChild(i), ruleNames);
  32392. res = res.concat(' ' + s);
  32393. }
  32394. res = res.concat(")");
  32395. return res;
  32396. };
  32397. Trees.getNodeText = function (t, ruleNames, recog) {
  32398. ruleNames = ruleNames || null;
  32399. recog = recog || null;
  32400. if (recog !== null) {
  32401. ruleNames = recog.ruleNames;
  32402. }
  32403. if (ruleNames !== null) {
  32404. if (t instanceof RuleContext) {
  32405. var altNumber = t.getAltNumber();
  32406. if (altNumber != INVALID_ALT_NUMBER) {
  32407. return ruleNames[t.ruleIndex] + ":" + altNumber;
  32408. }
  32409. return ruleNames[t.ruleIndex];
  32410. } else if (t instanceof ErrorNode) {
  32411. return t.toString();
  32412. } else if (t instanceof TerminalNode) {
  32413. if (t.symbol !== null) {
  32414. return t.symbol.text;
  32415. }
  32416. }
  32417. }
  32418. // no recog for rule names
  32419. var payload = t.getPayload();
  32420. if (payload instanceof Token) {
  32421. return payload.text;
  32422. }
  32423. return t.getPayload().toString();
  32424. };
  32425. // Return ordered list of all children of this node
  32426. Trees.getChildren = function (t) {
  32427. var list = [];
  32428. for (var i = 0; i < t.getChildCount(); i++) {
  32429. list.push(t.getChild(i));
  32430. }
  32431. return list;
  32432. };
  32433. // Return a list of all ancestors of this node. The first node of
  32434. // list is the root and the last is the parent of this node.
  32435. //
  32436. Trees.getAncestors = function (t) {
  32437. var ancestors = [];
  32438. t = t.getParent();
  32439. while (t !== null) {
  32440. ancestors = [t].concat(ancestors);
  32441. t = t.getParent();
  32442. }
  32443. return ancestors;
  32444. };
  32445. Trees.findAllTokenNodes = function (t, ttype) {
  32446. return Trees.findAllNodes(t, ttype, true);
  32447. };
  32448. Trees.findAllRuleNodes = function (t, ruleIndex) {
  32449. return Trees.findAllNodes(t, ruleIndex, false);
  32450. };
  32451. Trees.findAllNodes = function (t, index, findTokens) {
  32452. var nodes = [];
  32453. Trees._findAllNodes(t, index, findTokens, nodes);
  32454. return nodes;
  32455. };
  32456. Trees._findAllNodes = function (t, index, findTokens, nodes) {
  32457. // check this node (the root) first
  32458. if (findTokens && t instanceof TerminalNode) {
  32459. if (t.symbol.type === index) {
  32460. nodes.push(t);
  32461. }
  32462. } else if (!findTokens && t instanceof ParserRuleContext) {
  32463. if (t.ruleIndex === index) {
  32464. nodes.push(t);
  32465. }
  32466. }
  32467. // check children
  32468. for (var i = 0; i < t.getChildCount(); i++) {
  32469. Trees._findAllNodes(t.getChild(i), index, findTokens, nodes);
  32470. }
  32471. };
  32472. Trees.descendants = function (t) {
  32473. var nodes = [t];
  32474. for (var i = 0; i < t.getChildCount(); i++) {
  32475. nodes = nodes.concat(Trees.descendants(t.getChild(i)));
  32476. }
  32477. return nodes;
  32478. };
  32479. exports.Trees = Trees;
  32480. /***/ }),
  32481. /***/ "./node_modules/antlr4/tree/index.js":
  32482. /*!*******************************************!*\
  32483. !*** ./node_modules/antlr4/tree/index.js ***!
  32484. \*******************************************/
  32485. /*! no static exports found */
  32486. /***/ (function(module, exports, __webpack_require__) {
  32487. "use strict";
  32488. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  32489. * Use of this file is governed by the BSD 3-clause license that
  32490. * can be found in the LICENSE.txt file in the project root.
  32491. */
  32492. var Tree = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js");
  32493. exports.Trees = __webpack_require__(/*! ./Trees */ "./node_modules/antlr4/tree/Trees.js").Trees;
  32494. exports.RuleNode = Tree.RuleNode;
  32495. exports.ParseTreeListener = Tree.ParseTreeListener;
  32496. exports.ParseTreeVisitor = Tree.ParseTreeVisitor;
  32497. exports.ParseTreeWalker = Tree.ParseTreeWalker;
  32498. /***/ }),
  32499. /***/ "./node_modules/decimal.js/decimal.js":
  32500. /*!********************************************!*\
  32501. !*** ./node_modules/decimal.js/decimal.js ***!
  32502. \********************************************/
  32503. /*! no static exports found */
  32504. /***/ (function(module, exports, __webpack_require__) {
  32505. "use strict";
  32506. var __WEBPACK_AMD_DEFINE_RESULT__;
  32507. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  32508. /*! decimal.js v10.0.1 https://github.com/MikeMcl/decimal.js/LICENCE */
  32509. ;(function (globalScope) {
  32510. 'use strict';
  32511. /*
  32512. * decimal.js v10.0.1
  32513. * An arbitrary-precision Decimal type for JavaScript.
  32514. * https://github.com/MikeMcl/decimal.js
  32515. * Copyright (c) 2017 Michael Mclaughlin <M8ch88l@gmail.com>
  32516. * MIT Licence
  32517. */
  32518. // ----------------------------------- EDITABLE DEFAULTS ------------------------------------ //
  32519. // The maximum exponent magnitude.
  32520. // The limit on the value of `toExpNeg`, `toExpPos`, `minE` and `maxE`.
  32521. var EXP_LIMIT = 9e15,
  32522. // 0 to 9e15
  32523. // The limit on the value of `precision`, and on the value of the first argument to
  32524. // `toDecimalPlaces`, `toExponential`, `toFixed`, `toPrecision` and `toSignificantDigits`.
  32525. MAX_DIGITS = 1e9,
  32526. // 0 to 1e9
  32527. // Base conversion alphabet.
  32528. NUMERALS = '0123456789abcdef',
  32529. // The natural logarithm of 10 (1025 digits).
  32530. LN10 = '2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058',
  32531. // Pi (1025 digits).
  32532. PI = '3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789',
  32533. // The initial configuration properties of the Decimal constructor.
  32534. DEFAULTS = {
  32535. // These values must be integers within the stated ranges (inclusive).
  32536. // Most of these values can be changed at run-time using the `Decimal.config` method.
  32537. // The maximum number of significant digits of the result of a calculation or base conversion.
  32538. // E.g. `Decimal.config({ precision: 20 });`
  32539. precision: 20, // 1 to MAX_DIGITS
  32540. // The rounding mode used when rounding to `precision`.
  32541. //
  32542. // ROUND_UP 0 Away from zero.
  32543. // ROUND_DOWN 1 Towards zero.
  32544. // ROUND_CEIL 2 Towards +Infinity.
  32545. // ROUND_FLOOR 3 Towards -Infinity.
  32546. // ROUND_HALF_UP 4 Towards nearest neighbour. If equidistant, up.
  32547. // ROUND_HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.
  32548. // ROUND_HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.
  32549. // ROUND_HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.
  32550. // ROUND_HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.
  32551. //
  32552. // E.g.
  32553. // `Decimal.rounding = 4;`
  32554. // `Decimal.rounding = Decimal.ROUND_HALF_UP;`
  32555. rounding: 4, // 0 to 8
  32556. // The modulo mode used when calculating the modulus: a mod n.
  32557. // The quotient (q = a / n) is calculated according to the corresponding rounding mode.
  32558. // The remainder (r) is calculated as: r = a - n * q.
  32559. //
  32560. // UP 0 The remainder is positive if the dividend is negative, else is negative.
  32561. // DOWN 1 The remainder has the same sign as the dividend (JavaScript %).
  32562. // FLOOR 3 The remainder has the same sign as the divisor (Python %).
  32563. // HALF_EVEN 6 The IEEE 754 remainder function.
  32564. // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)). Always positive.
  32565. //
  32566. // Truncated division (1), floored division (3), the IEEE 754 remainder (6), and Euclidian
  32567. // division (9) are commonly used for the modulus operation. The other rounding modes can also
  32568. // be used, but they may not give useful results.
  32569. modulo: 1, // 0 to 9
  32570. // The exponent value at and beneath which `toString` returns exponential notation.
  32571. // JavaScript numbers: -7
  32572. toExpNeg: -7, // 0 to -EXP_LIMIT
  32573. // The exponent value at and above which `toString` returns exponential notation.
  32574. // JavaScript numbers: 21
  32575. toExpPos: 21, // 0 to EXP_LIMIT
  32576. // The minimum exponent value, beneath which underflow to zero occurs.
  32577. // JavaScript numbers: -324 (5e-324)
  32578. minE: -EXP_LIMIT, // -1 to -EXP_LIMIT
  32579. // The maximum exponent value, above which overflow to Infinity occurs.
  32580. // JavaScript numbers: 308 (1.7976931348623157e+308)
  32581. maxE: EXP_LIMIT, // 1 to EXP_LIMIT
  32582. // Whether to use cryptographically-secure random number generation, if available.
  32583. crypto: false // true/false
  32584. },
  32585. // ----------------------------------- END OF EDITABLE DEFAULTS ------------------------------- //
  32586. Decimal,
  32587. inexact,
  32588. noConflict,
  32589. quadrant,
  32590. external = true,
  32591. decimalError = '[DecimalError] ',
  32592. invalidArgument = decimalError + 'Invalid argument: ',
  32593. precisionLimitExceeded = decimalError + 'Precision limit exceeded',
  32594. cryptoUnavailable = decimalError + 'crypto unavailable',
  32595. mathfloor = Math.floor,
  32596. mathpow = Math.pow,
  32597. isBinary = /^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,
  32598. isHex = /^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,
  32599. isOctal = /^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,
  32600. isDecimal = /^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,
  32601. BASE = 1e7,
  32602. LOG_BASE = 7,
  32603. MAX_SAFE_INTEGER = 9007199254740991,
  32604. LN10_PRECISION = LN10.length - 1,
  32605. PI_PRECISION = PI.length - 1,
  32606. // Decimal.prototype object
  32607. P = { name: '[object Decimal]' };
  32608. // Decimal prototype methods
  32609. /*
  32610. * absoluteValue abs
  32611. * ceil
  32612. * comparedTo cmp
  32613. * cosine cos
  32614. * cubeRoot cbrt
  32615. * decimalPlaces dp
  32616. * dividedBy div
  32617. * dividedToIntegerBy divToInt
  32618. * equals eq
  32619. * floor
  32620. * greaterThan gt
  32621. * greaterThanOrEqualTo gte
  32622. * hyperbolicCosine cosh
  32623. * hyperbolicSine sinh
  32624. * hyperbolicTangent tanh
  32625. * inverseCosine acos
  32626. * inverseHyperbolicCosine acosh
  32627. * inverseHyperbolicSine asinh
  32628. * inverseHyperbolicTangent atanh
  32629. * inverseSine asin
  32630. * inverseTangent atan
  32631. * isFinite
  32632. * isInteger isInt
  32633. * isNaN
  32634. * isNegative isNeg
  32635. * isPositive isPos
  32636. * isZero
  32637. * lessThan lt
  32638. * lessThanOrEqualTo lte
  32639. * logarithm log
  32640. * [maximum] [max]
  32641. * [minimum] [min]
  32642. * minus sub
  32643. * modulo mod
  32644. * naturalExponential exp
  32645. * naturalLogarithm ln
  32646. * negated neg
  32647. * plus add
  32648. * precision sd
  32649. * round
  32650. * sine sin
  32651. * squareRoot sqrt
  32652. * tangent tan
  32653. * times mul
  32654. * toBinary
  32655. * toDecimalPlaces toDP
  32656. * toExponential
  32657. * toFixed
  32658. * toFraction
  32659. * toHexadecimal toHex
  32660. * toNearest
  32661. * toNumber
  32662. * toOctal
  32663. * toPower pow
  32664. * toPrecision
  32665. * toSignificantDigits toSD
  32666. * toString
  32667. * truncated trunc
  32668. * valueOf toJSON
  32669. */
  32670. /*
  32671. * Return a new Decimal whose value is the absolute value of this Decimal.
  32672. *
  32673. */
  32674. P.absoluteValue = P.abs = function () {
  32675. var x = new this.constructor(this);
  32676. if (x.s < 0) x.s = 1;
  32677. return finalise(x);
  32678. };
  32679. /*
  32680. * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the
  32681. * direction of positive Infinity.
  32682. *
  32683. */
  32684. P.ceil = function () {
  32685. return finalise(new this.constructor(this), this.e + 1, 2);
  32686. };
  32687. /*
  32688. * Return
  32689. * 1 if the value of this Decimal is greater than the value of `y`,
  32690. * -1 if the value of this Decimal is less than the value of `y`,
  32691. * 0 if they have the same value,
  32692. * NaN if the value of either Decimal is NaN.
  32693. *
  32694. */
  32695. P.comparedTo = P.cmp = function (y) {
  32696. var i,
  32697. j,
  32698. xdL,
  32699. ydL,
  32700. x = this,
  32701. xd = x.d,
  32702. yd = (y = new x.constructor(y)).d,
  32703. xs = x.s,
  32704. ys = y.s;
  32705. // Either NaN or ±Infinity?
  32706. if (!xd || !yd) {
  32707. return !xs || !ys ? NaN : xs !== ys ? xs : xd === yd ? 0 : !xd ^ xs < 0 ? 1 : -1;
  32708. }
  32709. // Either zero?
  32710. if (!xd[0] || !yd[0]) return xd[0] ? xs : yd[0] ? -ys : 0;
  32711. // Signs differ?
  32712. if (xs !== ys) return xs;
  32713. // Compare exponents.
  32714. if (x.e !== y.e) return x.e > y.e ^ xs < 0 ? 1 : -1;
  32715. xdL = xd.length;
  32716. ydL = yd.length;
  32717. // Compare digit by digit.
  32718. for (i = 0, j = xdL < ydL ? xdL : ydL; i < j; ++i) {
  32719. if (xd[i] !== yd[i]) return xd[i] > yd[i] ^ xs < 0 ? 1 : -1;
  32720. }
  32721. // Compare lengths.
  32722. return xdL === ydL ? 0 : xdL > ydL ^ xs < 0 ? 1 : -1;
  32723. };
  32724. /*
  32725. * Return a new Decimal whose value is the cosine of the value in radians of this Decimal.
  32726. *
  32727. * Domain: [-Infinity, Infinity]
  32728. * Range: [-1, 1]
  32729. *
  32730. * cos(0) = 1
  32731. * cos(-0) = 1
  32732. * cos(Infinity) = NaN
  32733. * cos(-Infinity) = NaN
  32734. * cos(NaN) = NaN
  32735. *
  32736. */
  32737. P.cosine = P.cos = function () {
  32738. var pr,
  32739. rm,
  32740. x = this,
  32741. Ctor = x.constructor;
  32742. if (!x.d) return new Ctor(NaN);
  32743. // cos(0) = cos(-0) = 1
  32744. if (!x.d[0]) return new Ctor(1);
  32745. pr = Ctor.precision;
  32746. rm = Ctor.rounding;
  32747. Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE;
  32748. Ctor.rounding = 1;
  32749. x = cosine(Ctor, toLessThanHalfPi(Ctor, x));
  32750. Ctor.precision = pr;
  32751. Ctor.rounding = rm;
  32752. return finalise(quadrant == 2 || quadrant == 3 ? x.neg() : x, pr, rm, true);
  32753. };
  32754. /*
  32755. *
  32756. * Return a new Decimal whose value is the cube root of the value of this Decimal, rounded to
  32757. * `precision` significant digits using rounding mode `rounding`.
  32758. *
  32759. * cbrt(0) = 0
  32760. * cbrt(-0) = -0
  32761. * cbrt(1) = 1
  32762. * cbrt(-1) = -1
  32763. * cbrt(N) = N
  32764. * cbrt(-I) = -I
  32765. * cbrt(I) = I
  32766. *
  32767. * Math.cbrt(x) = (x < 0 ? -Math.pow(-x, 1/3) : Math.pow(x, 1/3))
  32768. *
  32769. */
  32770. P.cubeRoot = P.cbrt = function () {
  32771. var e,
  32772. m,
  32773. n,
  32774. r,
  32775. rep,
  32776. s,
  32777. sd,
  32778. t,
  32779. t3,
  32780. t3plusx,
  32781. x = this,
  32782. Ctor = x.constructor;
  32783. if (!x.isFinite() || x.isZero()) return new Ctor(x);
  32784. external = false;
  32785. // Initial estimate.
  32786. s = x.s * Math.pow(x.s * x, 1 / 3);
  32787. // Math.cbrt underflow/overflow?
  32788. // Pass x to Math.pow as integer, then adjust the exponent of the result.
  32789. if (!s || Math.abs(s) == 1 / 0) {
  32790. n = digitsToString(x.d);
  32791. e = x.e;
  32792. // Adjust n exponent so it is a multiple of 3 away from x exponent.
  32793. if (s = (e - n.length + 1) % 3) n += s == 1 || s == -2 ? '0' : '00';
  32794. s = Math.pow(n, 1 / 3);
  32795. // Rarely, e may be one less than the result exponent value.
  32796. e = mathfloor((e + 1) / 3) - (e % 3 == (e < 0 ? -1 : 2));
  32797. if (s == 1 / 0) {
  32798. n = '5e' + e;
  32799. } else {
  32800. n = s.toExponential();
  32801. n = n.slice(0, n.indexOf('e') + 1) + e;
  32802. }
  32803. r = new Ctor(n);
  32804. r.s = x.s;
  32805. } else {
  32806. r = new Ctor(s.toString());
  32807. }
  32808. sd = (e = Ctor.precision) + 3;
  32809. // Halley's method.
  32810. // TODO? Compare Newton's method.
  32811. for (;;) {
  32812. t = r;
  32813. t3 = t.times(t).times(t);
  32814. t3plusx = t3.plus(x);
  32815. r = divide(t3plusx.plus(x).times(t), t3plusx.plus(t3), sd + 2, 1);
  32816. // TODO? Replace with for-loop and checkRoundingDigits.
  32817. if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) {
  32818. n = n.slice(sd - 3, sd + 1);
  32819. // The 4th rounding digit may be in error by -1 so if the 4 rounding digits are 9999 or 4999
  32820. // , i.e. approaching a rounding boundary, continue the iteration.
  32821. if (n == '9999' || !rep && n == '4999') {
  32822. // On the first iteration only, check to see if rounding up gives the exact result as the
  32823. // nines may infinitely repeat.
  32824. if (!rep) {
  32825. finalise(t, e + 1, 0);
  32826. if (t.times(t).times(t).eq(x)) {
  32827. r = t;
  32828. break;
  32829. }
  32830. }
  32831. sd += 4;
  32832. rep = 1;
  32833. } else {
  32834. // If the rounding digits are null, 0{0,4} or 50{0,3}, check for an exact result.
  32835. // If not, then there are further digits and m will be truthy.
  32836. if (!+n || !+n.slice(1) && n.charAt(0) == '5') {
  32837. // Truncate to the first rounding digit.
  32838. finalise(r, e + 1, 1);
  32839. m = !r.times(r).times(r).eq(x);
  32840. }
  32841. break;
  32842. }
  32843. }
  32844. }
  32845. external = true;
  32846. return finalise(r, e, Ctor.rounding, m);
  32847. };
  32848. /*
  32849. * Return the number of decimal places of the value of this Decimal.
  32850. *
  32851. */
  32852. P.decimalPlaces = P.dp = function () {
  32853. var w,
  32854. d = this.d,
  32855. n = NaN;
  32856. if (d) {
  32857. w = d.length - 1;
  32858. n = (w - mathfloor(this.e / LOG_BASE)) * LOG_BASE;
  32859. // Subtract the number of trailing zeros of the last word.
  32860. w = d[w];
  32861. if (w) for (; w % 10 == 0; w /= 10) {
  32862. n--;
  32863. }if (n < 0) n = 0;
  32864. }
  32865. return n;
  32866. };
  32867. /*
  32868. * n / 0 = I
  32869. * n / N = N
  32870. * n / I = 0
  32871. * 0 / n = 0
  32872. * 0 / 0 = N
  32873. * 0 / N = N
  32874. * 0 / I = 0
  32875. * N / n = N
  32876. * N / 0 = N
  32877. * N / N = N
  32878. * N / I = N
  32879. * I / n = I
  32880. * I / 0 = I
  32881. * I / N = N
  32882. * I / I = N
  32883. *
  32884. * Return a new Decimal whose value is the value of this Decimal divided by `y`, rounded to
  32885. * `precision` significant digits using rounding mode `rounding`.
  32886. *
  32887. */
  32888. P.dividedBy = P.div = function (y) {
  32889. return divide(this, new this.constructor(y));
  32890. };
  32891. /*
  32892. * Return a new Decimal whose value is the integer part of dividing the value of this Decimal
  32893. * by the value of `y`, rounded to `precision` significant digits using rounding mode `rounding`.
  32894. *
  32895. */
  32896. P.dividedToIntegerBy = P.divToInt = function (y) {
  32897. var x = this,
  32898. Ctor = x.constructor;
  32899. return finalise(divide(x, new Ctor(y), 0, 1, 1), Ctor.precision, Ctor.rounding);
  32900. };
  32901. /*
  32902. * Return true if the value of this Decimal is equal to the value of `y`, otherwise return false.
  32903. *
  32904. */
  32905. P.equals = P.eq = function (y) {
  32906. return this.cmp(y) === 0;
  32907. };
  32908. /*
  32909. * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the
  32910. * direction of negative Infinity.
  32911. *
  32912. */
  32913. P.floor = function () {
  32914. return finalise(new this.constructor(this), this.e + 1, 3);
  32915. };
  32916. /*
  32917. * Return true if the value of this Decimal is greater than the value of `y`, otherwise return
  32918. * false.
  32919. *
  32920. */
  32921. P.greaterThan = P.gt = function (y) {
  32922. return this.cmp(y) > 0;
  32923. };
  32924. /*
  32925. * Return true if the value of this Decimal is greater than or equal to the value of `y`,
  32926. * otherwise return false.
  32927. *
  32928. */
  32929. P.greaterThanOrEqualTo = P.gte = function (y) {
  32930. var k = this.cmp(y);
  32931. return k == 1 || k === 0;
  32932. };
  32933. /*
  32934. * Return a new Decimal whose value is the hyperbolic cosine of the value in radians of this
  32935. * Decimal.
  32936. *
  32937. * Domain: [-Infinity, Infinity]
  32938. * Range: [1, Infinity]
  32939. *
  32940. * cosh(x) = 1 + x^2/2! + x^4/4! + x^6/6! + ...
  32941. *
  32942. * cosh(0) = 1
  32943. * cosh(-0) = 1
  32944. * cosh(Infinity) = Infinity
  32945. * cosh(-Infinity) = Infinity
  32946. * cosh(NaN) = NaN
  32947. *
  32948. * x time taken (ms) result
  32949. * 1000 9 9.8503555700852349694e+433
  32950. * 10000 25 4.4034091128314607936e+4342
  32951. * 100000 171 1.4033316802130615897e+43429
  32952. * 1000000 3817 1.5166076984010437725e+434294
  32953. * 10000000 abandoned after 2 minute wait
  32954. *
  32955. * TODO? Compare performance of cosh(x) = 0.5 * (exp(x) + exp(-x))
  32956. *
  32957. */
  32958. P.hyperbolicCosine = P.cosh = function () {
  32959. var k,
  32960. n,
  32961. pr,
  32962. rm,
  32963. len,
  32964. x = this,
  32965. Ctor = x.constructor,
  32966. one = new Ctor(1);
  32967. if (!x.isFinite()) return new Ctor(x.s ? 1 / 0 : NaN);
  32968. if (x.isZero()) return one;
  32969. pr = Ctor.precision;
  32970. rm = Ctor.rounding;
  32971. Ctor.precision = pr + Math.max(x.e, x.sd()) + 4;
  32972. Ctor.rounding = 1;
  32973. len = x.d.length;
  32974. // Argument reduction: cos(4x) = 1 - 8cos^2(x) + 8cos^4(x) + 1
  32975. // i.e. cos(x) = 1 - cos^2(x/4)(8 - 8cos^2(x/4))
  32976. // Estimate the optimum number of times to use the argument reduction.
  32977. // TODO? Estimation reused from cosine() and may not be optimal here.
  32978. if (len < 32) {
  32979. k = Math.ceil(len / 3);
  32980. n = Math.pow(4, -k).toString();
  32981. } else {
  32982. k = 16;
  32983. n = '2.3283064365386962890625e-10';
  32984. }
  32985. x = taylorSeries(Ctor, 1, x.times(n), new Ctor(1), true);
  32986. // Reverse argument reduction
  32987. var cosh2_x,
  32988. i = k,
  32989. d8 = new Ctor(8);
  32990. for (; i--;) {
  32991. cosh2_x = x.times(x);
  32992. x = one.minus(cosh2_x.times(d8.minus(cosh2_x.times(d8))));
  32993. }
  32994. return finalise(x, Ctor.precision = pr, Ctor.rounding = rm, true);
  32995. };
  32996. /*
  32997. * Return a new Decimal whose value is the hyperbolic sine of the value in radians of this
  32998. * Decimal.
  32999. *
  33000. * Domain: [-Infinity, Infinity]
  33001. * Range: [-Infinity, Infinity]
  33002. *
  33003. * sinh(x) = x + x^3/3! + x^5/5! + x^7/7! + ...
  33004. *
  33005. * sinh(0) = 0
  33006. * sinh(-0) = -0
  33007. * sinh(Infinity) = Infinity
  33008. * sinh(-Infinity) = -Infinity
  33009. * sinh(NaN) = NaN
  33010. *
  33011. * x time taken (ms)
  33012. * 10 2 ms
  33013. * 100 5 ms
  33014. * 1000 14 ms
  33015. * 10000 82 ms
  33016. * 100000 886 ms 1.4033316802130615897e+43429
  33017. * 200000 2613 ms
  33018. * 300000 5407 ms
  33019. * 400000 8824 ms
  33020. * 500000 13026 ms 8.7080643612718084129e+217146
  33021. * 1000000 48543 ms
  33022. *
  33023. * TODO? Compare performance of sinh(x) = 0.5 * (exp(x) - exp(-x))
  33024. *
  33025. */
  33026. P.hyperbolicSine = P.sinh = function () {
  33027. var k,
  33028. pr,
  33029. rm,
  33030. len,
  33031. x = this,
  33032. Ctor = x.constructor;
  33033. if (!x.isFinite() || x.isZero()) return new Ctor(x);
  33034. pr = Ctor.precision;
  33035. rm = Ctor.rounding;
  33036. Ctor.precision = pr + Math.max(x.e, x.sd()) + 4;
  33037. Ctor.rounding = 1;
  33038. len = x.d.length;
  33039. if (len < 3) {
  33040. x = taylorSeries(Ctor, 2, x, x, true);
  33041. } else {
  33042. // Alternative argument reduction: sinh(3x) = sinh(x)(3 + 4sinh^2(x))
  33043. // i.e. sinh(x) = sinh(x/3)(3 + 4sinh^2(x/3))
  33044. // 3 multiplications and 1 addition
  33045. // Argument reduction: sinh(5x) = sinh(x)(5 + sinh^2(x)(20 + 16sinh^2(x)))
  33046. // i.e. sinh(x) = sinh(x/5)(5 + sinh^2(x/5)(20 + 16sinh^2(x/5)))
  33047. // 4 multiplications and 2 additions
  33048. // Estimate the optimum number of times to use the argument reduction.
  33049. k = 1.4 * Math.sqrt(len);
  33050. k = k > 16 ? 16 : k | 0;
  33051. x = x.times(Math.pow(5, -k));
  33052. x = taylorSeries(Ctor, 2, x, x, true);
  33053. // Reverse argument reduction
  33054. var sinh2_x,
  33055. d5 = new Ctor(5),
  33056. d16 = new Ctor(16),
  33057. d20 = new Ctor(20);
  33058. for (; k--;) {
  33059. sinh2_x = x.times(x);
  33060. x = x.times(d5.plus(sinh2_x.times(d16.times(sinh2_x).plus(d20))));
  33061. }
  33062. }
  33063. Ctor.precision = pr;
  33064. Ctor.rounding = rm;
  33065. return finalise(x, pr, rm, true);
  33066. };
  33067. /*
  33068. * Return a new Decimal whose value is the hyperbolic tangent of the value in radians of this
  33069. * Decimal.
  33070. *
  33071. * Domain: [-Infinity, Infinity]
  33072. * Range: [-1, 1]
  33073. *
  33074. * tanh(x) = sinh(x) / cosh(x)
  33075. *
  33076. * tanh(0) = 0
  33077. * tanh(-0) = -0
  33078. * tanh(Infinity) = 1
  33079. * tanh(-Infinity) = -1
  33080. * tanh(NaN) = NaN
  33081. *
  33082. */
  33083. P.hyperbolicTangent = P.tanh = function () {
  33084. var pr,
  33085. rm,
  33086. x = this,
  33087. Ctor = x.constructor;
  33088. if (!x.isFinite()) return new Ctor(x.s);
  33089. if (x.isZero()) return new Ctor(x);
  33090. pr = Ctor.precision;
  33091. rm = Ctor.rounding;
  33092. Ctor.precision = pr + 7;
  33093. Ctor.rounding = 1;
  33094. return divide(x.sinh(), x.cosh(), Ctor.precision = pr, Ctor.rounding = rm);
  33095. };
  33096. /*
  33097. * Return a new Decimal whose value is the arccosine (inverse cosine) in radians of the value of
  33098. * this Decimal.
  33099. *
  33100. * Domain: [-1, 1]
  33101. * Range: [0, pi]
  33102. *
  33103. * acos(x) = pi/2 - asin(x)
  33104. *
  33105. * acos(0) = pi/2
  33106. * acos(-0) = pi/2
  33107. * acos(1) = 0
  33108. * acos(-1) = pi
  33109. * acos(1/2) = pi/3
  33110. * acos(-1/2) = 2*pi/3
  33111. * acos(|x| > 1) = NaN
  33112. * acos(NaN) = NaN
  33113. *
  33114. */
  33115. P.inverseCosine = P.acos = function () {
  33116. var halfPi,
  33117. x = this,
  33118. Ctor = x.constructor,
  33119. k = x.abs().cmp(1),
  33120. pr = Ctor.precision,
  33121. rm = Ctor.rounding;
  33122. if (k !== -1) {
  33123. return k === 0
  33124. // |x| is 1
  33125. ? x.isNeg() ? getPi(Ctor, pr, rm) : new Ctor(0)
  33126. // |x| > 1 or x is NaN
  33127. : new Ctor(NaN);
  33128. }
  33129. if (x.isZero()) return getPi(Ctor, pr + 4, rm).times(0.5);
  33130. // TODO? Special case acos(0.5) = pi/3 and acos(-0.5) = 2*pi/3
  33131. Ctor.precision = pr + 6;
  33132. Ctor.rounding = 1;
  33133. x = x.asin();
  33134. halfPi = getPi(Ctor, pr + 4, rm).times(0.5);
  33135. Ctor.precision = pr;
  33136. Ctor.rounding = rm;
  33137. return halfPi.minus(x);
  33138. };
  33139. /*
  33140. * Return a new Decimal whose value is the inverse of the hyperbolic cosine in radians of the
  33141. * value of this Decimal.
  33142. *
  33143. * Domain: [1, Infinity]
  33144. * Range: [0, Infinity]
  33145. *
  33146. * acosh(x) = ln(x + sqrt(x^2 - 1))
  33147. *
  33148. * acosh(x < 1) = NaN
  33149. * acosh(NaN) = NaN
  33150. * acosh(Infinity) = Infinity
  33151. * acosh(-Infinity) = NaN
  33152. * acosh(0) = NaN
  33153. * acosh(-0) = NaN
  33154. * acosh(1) = 0
  33155. * acosh(-1) = NaN
  33156. *
  33157. */
  33158. P.inverseHyperbolicCosine = P.acosh = function () {
  33159. var pr,
  33160. rm,
  33161. x = this,
  33162. Ctor = x.constructor;
  33163. if (x.lte(1)) return new Ctor(x.eq(1) ? 0 : NaN);
  33164. if (!x.isFinite()) return new Ctor(x);
  33165. pr = Ctor.precision;
  33166. rm = Ctor.rounding;
  33167. Ctor.precision = pr + Math.max(Math.abs(x.e), x.sd()) + 4;
  33168. Ctor.rounding = 1;
  33169. external = false;
  33170. x = x.times(x).minus(1).sqrt().plus(x);
  33171. external = true;
  33172. Ctor.precision = pr;
  33173. Ctor.rounding = rm;
  33174. return x.ln();
  33175. };
  33176. /*
  33177. * Return a new Decimal whose value is the inverse of the hyperbolic sine in radians of the value
  33178. * of this Decimal.
  33179. *
  33180. * Domain: [-Infinity, Infinity]
  33181. * Range: [-Infinity, Infinity]
  33182. *
  33183. * asinh(x) = ln(x + sqrt(x^2 + 1))
  33184. *
  33185. * asinh(NaN) = NaN
  33186. * asinh(Infinity) = Infinity
  33187. * asinh(-Infinity) = -Infinity
  33188. * asinh(0) = 0
  33189. * asinh(-0) = -0
  33190. *
  33191. */
  33192. P.inverseHyperbolicSine = P.asinh = function () {
  33193. var pr,
  33194. rm,
  33195. x = this,
  33196. Ctor = x.constructor;
  33197. if (!x.isFinite() || x.isZero()) return new Ctor(x);
  33198. pr = Ctor.precision;
  33199. rm = Ctor.rounding;
  33200. Ctor.precision = pr + 2 * Math.max(Math.abs(x.e), x.sd()) + 6;
  33201. Ctor.rounding = 1;
  33202. external = false;
  33203. x = x.times(x).plus(1).sqrt().plus(x);
  33204. external = true;
  33205. Ctor.precision = pr;
  33206. Ctor.rounding = rm;
  33207. return x.ln();
  33208. };
  33209. /*
  33210. * Return a new Decimal whose value is the inverse of the hyperbolic tangent in radians of the
  33211. * value of this Decimal.
  33212. *
  33213. * Domain: [-1, 1]
  33214. * Range: [-Infinity, Infinity]
  33215. *
  33216. * atanh(x) = 0.5 * ln((1 + x) / (1 - x))
  33217. *
  33218. * atanh(|x| > 1) = NaN
  33219. * atanh(NaN) = NaN
  33220. * atanh(Infinity) = NaN
  33221. * atanh(-Infinity) = NaN
  33222. * atanh(0) = 0
  33223. * atanh(-0) = -0
  33224. * atanh(1) = Infinity
  33225. * atanh(-1) = -Infinity
  33226. *
  33227. */
  33228. P.inverseHyperbolicTangent = P.atanh = function () {
  33229. var pr,
  33230. rm,
  33231. wpr,
  33232. xsd,
  33233. x = this,
  33234. Ctor = x.constructor;
  33235. if (!x.isFinite()) return new Ctor(NaN);
  33236. if (x.e >= 0) return new Ctor(x.abs().eq(1) ? x.s / 0 : x.isZero() ? x : NaN);
  33237. pr = Ctor.precision;
  33238. rm = Ctor.rounding;
  33239. xsd = x.sd();
  33240. if (Math.max(xsd, pr) < 2 * -x.e - 1) return finalise(new Ctor(x), pr, rm, true);
  33241. Ctor.precision = wpr = xsd - x.e;
  33242. x = divide(x.plus(1), new Ctor(1).minus(x), wpr + pr, 1);
  33243. Ctor.precision = pr + 4;
  33244. Ctor.rounding = 1;
  33245. x = x.ln();
  33246. Ctor.precision = pr;
  33247. Ctor.rounding = rm;
  33248. return x.times(0.5);
  33249. };
  33250. /*
  33251. * Return a new Decimal whose value is the arcsine (inverse sine) in radians of the value of this
  33252. * Decimal.
  33253. *
  33254. * Domain: [-Infinity, Infinity]
  33255. * Range: [-pi/2, pi/2]
  33256. *
  33257. * asin(x) = 2*atan(x/(1 + sqrt(1 - x^2)))
  33258. *
  33259. * asin(0) = 0
  33260. * asin(-0) = -0
  33261. * asin(1/2) = pi/6
  33262. * asin(-1/2) = -pi/6
  33263. * asin(1) = pi/2
  33264. * asin(-1) = -pi/2
  33265. * asin(|x| > 1) = NaN
  33266. * asin(NaN) = NaN
  33267. *
  33268. * TODO? Compare performance of Taylor series.
  33269. *
  33270. */
  33271. P.inverseSine = P.asin = function () {
  33272. var halfPi,
  33273. k,
  33274. pr,
  33275. rm,
  33276. x = this,
  33277. Ctor = x.constructor;
  33278. if (x.isZero()) return new Ctor(x);
  33279. k = x.abs().cmp(1);
  33280. pr = Ctor.precision;
  33281. rm = Ctor.rounding;
  33282. if (k !== -1) {
  33283. // |x| is 1
  33284. if (k === 0) {
  33285. halfPi = getPi(Ctor, pr + 4, rm).times(0.5);
  33286. halfPi.s = x.s;
  33287. return halfPi;
  33288. }
  33289. // |x| > 1 or x is NaN
  33290. return new Ctor(NaN);
  33291. }
  33292. // TODO? Special case asin(1/2) = pi/6 and asin(-1/2) = -pi/6
  33293. Ctor.precision = pr + 6;
  33294. Ctor.rounding = 1;
  33295. x = x.div(new Ctor(1).minus(x.times(x)).sqrt().plus(1)).atan();
  33296. Ctor.precision = pr;
  33297. Ctor.rounding = rm;
  33298. return x.times(2);
  33299. };
  33300. /*
  33301. * Return a new Decimal whose value is the arctangent (inverse tangent) in radians of the value
  33302. * of this Decimal.
  33303. *
  33304. * Domain: [-Infinity, Infinity]
  33305. * Range: [-pi/2, pi/2]
  33306. *
  33307. * atan(x) = x - x^3/3 + x^5/5 - x^7/7 + ...
  33308. *
  33309. * atan(0) = 0
  33310. * atan(-0) = -0
  33311. * atan(1) = pi/4
  33312. * atan(-1) = -pi/4
  33313. * atan(Infinity) = pi/2
  33314. * atan(-Infinity) = -pi/2
  33315. * atan(NaN) = NaN
  33316. *
  33317. */
  33318. P.inverseTangent = P.atan = function () {
  33319. var i,
  33320. j,
  33321. k,
  33322. n,
  33323. px,
  33324. t,
  33325. r,
  33326. wpr,
  33327. x2,
  33328. x = this,
  33329. Ctor = x.constructor,
  33330. pr = Ctor.precision,
  33331. rm = Ctor.rounding;
  33332. if (!x.isFinite()) {
  33333. if (!x.s) return new Ctor(NaN);
  33334. if (pr + 4 <= PI_PRECISION) {
  33335. r = getPi(Ctor, pr + 4, rm).times(0.5);
  33336. r.s = x.s;
  33337. return r;
  33338. }
  33339. } else if (x.isZero()) {
  33340. return new Ctor(x);
  33341. } else if (x.abs().eq(1) && pr + 4 <= PI_PRECISION) {
  33342. r = getPi(Ctor, pr + 4, rm).times(0.25);
  33343. r.s = x.s;
  33344. return r;
  33345. }
  33346. Ctor.precision = wpr = pr + 10;
  33347. Ctor.rounding = 1;
  33348. // TODO? if (x >= 1 && pr <= PI_PRECISION) atan(x) = halfPi * x.s - atan(1 / x);
  33349. // Argument reduction
  33350. // Ensure |x| < 0.42
  33351. // atan(x) = 2 * atan(x / (1 + sqrt(1 + x^2)))
  33352. k = Math.min(28, wpr / LOG_BASE + 2 | 0);
  33353. for (i = k; i; --i) {
  33354. x = x.div(x.times(x).plus(1).sqrt().plus(1));
  33355. }external = false;
  33356. j = Math.ceil(wpr / LOG_BASE);
  33357. n = 1;
  33358. x2 = x.times(x);
  33359. r = new Ctor(x);
  33360. px = x;
  33361. // atan(x) = x - x^3/3 + x^5/5 - x^7/7 + ...
  33362. for (; i !== -1;) {
  33363. px = px.times(x2);
  33364. t = r.minus(px.div(n += 2));
  33365. px = px.times(x2);
  33366. r = t.plus(px.div(n += 2));
  33367. if (r.d[j] !== void 0) for (i = j; r.d[i] === t.d[i] && i--;) {}
  33368. }
  33369. if (k) r = r.times(2 << k - 1);
  33370. external = true;
  33371. return finalise(r, Ctor.precision = pr, Ctor.rounding = rm, true);
  33372. };
  33373. /*
  33374. * Return true if the value of this Decimal is a finite number, otherwise return false.
  33375. *
  33376. */
  33377. P.isFinite = function () {
  33378. return !!this.d;
  33379. };
  33380. /*
  33381. * Return true if the value of this Decimal is an integer, otherwise return false.
  33382. *
  33383. */
  33384. P.isInteger = P.isInt = function () {
  33385. return !!this.d && mathfloor(this.e / LOG_BASE) > this.d.length - 2;
  33386. };
  33387. /*
  33388. * Return true if the value of this Decimal is NaN, otherwise return false.
  33389. *
  33390. */
  33391. P.isNaN = function () {
  33392. return !this.s;
  33393. };
  33394. /*
  33395. * Return true if the value of this Decimal is negative, otherwise return false.
  33396. *
  33397. */
  33398. P.isNegative = P.isNeg = function () {
  33399. return this.s < 0;
  33400. };
  33401. /*
  33402. * Return true if the value of this Decimal is positive, otherwise return false.
  33403. *
  33404. */
  33405. P.isPositive = P.isPos = function () {
  33406. return this.s > 0;
  33407. };
  33408. /*
  33409. * Return true if the value of this Decimal is 0 or -0, otherwise return false.
  33410. *
  33411. */
  33412. P.isZero = function () {
  33413. return !!this.d && this.d[0] === 0;
  33414. };
  33415. /*
  33416. * Return true if the value of this Decimal is less than `y`, otherwise return false.
  33417. *
  33418. */
  33419. P.lessThan = P.lt = function (y) {
  33420. return this.cmp(y) < 0;
  33421. };
  33422. /*
  33423. * Return true if the value of this Decimal is less than or equal to `y`, otherwise return false.
  33424. *
  33425. */
  33426. P.lessThanOrEqualTo = P.lte = function (y) {
  33427. return this.cmp(y) < 1;
  33428. };
  33429. /*
  33430. * Return the logarithm of the value of this Decimal to the specified base, rounded to `precision`
  33431. * significant digits using rounding mode `rounding`.
  33432. *
  33433. * If no base is specified, return log[10](arg).
  33434. *
  33435. * log[base](arg) = ln(arg) / ln(base)
  33436. *
  33437. * The result will always be correctly rounded if the base of the log is 10, and 'almost always'
  33438. * otherwise:
  33439. *
  33440. * Depending on the rounding mode, the result may be incorrectly rounded if the first fifteen
  33441. * rounding digits are [49]99999999999999 or [50]00000000000000. In that case, the maximum error
  33442. * between the result and the correctly rounded result will be one ulp (unit in the last place).
  33443. *
  33444. * log[-b](a) = NaN
  33445. * log[0](a) = NaN
  33446. * log[1](a) = NaN
  33447. * log[NaN](a) = NaN
  33448. * log[Infinity](a) = NaN
  33449. * log[b](0) = -Infinity
  33450. * log[b](-0) = -Infinity
  33451. * log[b](-a) = NaN
  33452. * log[b](1) = 0
  33453. * log[b](Infinity) = Infinity
  33454. * log[b](NaN) = NaN
  33455. *
  33456. * [base] {number|string|Decimal} The base of the logarithm.
  33457. *
  33458. */
  33459. P.logarithm = P.log = function (base) {
  33460. var isBase10,
  33461. d,
  33462. denominator,
  33463. k,
  33464. inf,
  33465. num,
  33466. sd,
  33467. r,
  33468. arg = this,
  33469. Ctor = arg.constructor,
  33470. pr = Ctor.precision,
  33471. rm = Ctor.rounding,
  33472. guard = 5;
  33473. // Default base is 10.
  33474. if (base == null) {
  33475. base = new Ctor(10);
  33476. isBase10 = true;
  33477. } else {
  33478. base = new Ctor(base);
  33479. d = base.d;
  33480. // Return NaN if base is negative, or non-finite, or is 0 or 1.
  33481. if (base.s < 0 || !d || !d[0] || base.eq(1)) return new Ctor(NaN);
  33482. isBase10 = base.eq(10);
  33483. }
  33484. d = arg.d;
  33485. // Is arg negative, non-finite, 0 or 1?
  33486. if (arg.s < 0 || !d || !d[0] || arg.eq(1)) {
  33487. return new Ctor(d && !d[0] ? -1 / 0 : arg.s != 1 ? NaN : d ? 0 : 1 / 0);
  33488. }
  33489. // The result will have a non-terminating decimal expansion if base is 10 and arg is not an
  33490. // integer power of 10.
  33491. if (isBase10) {
  33492. if (d.length > 1) {
  33493. inf = true;
  33494. } else {
  33495. for (k = d[0]; k % 10 === 0;) {
  33496. k /= 10;
  33497. }inf = k !== 1;
  33498. }
  33499. }
  33500. external = false;
  33501. sd = pr + guard;
  33502. num = naturalLogarithm(arg, sd);
  33503. denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd);
  33504. // The result will have 5 rounding digits.
  33505. r = divide(num, denominator, sd, 1);
  33506. // If at a rounding boundary, i.e. the result's rounding digits are [49]9999 or [50]0000,
  33507. // calculate 10 further digits.
  33508. //
  33509. // If the result is known to have an infinite decimal expansion, repeat this until it is clear
  33510. // that the result is above or below the boundary. Otherwise, if after calculating the 10
  33511. // further digits, the last 14 are nines, round up and assume the result is exact.
  33512. // Also assume the result is exact if the last 14 are zero.
  33513. //
  33514. // Example of a result that will be incorrectly rounded:
  33515. // log[1048576](4503599627370502) = 2.60000000000000009610279511444746...
  33516. // The above result correctly rounded using ROUND_CEIL to 1 decimal place should be 2.7, but it
  33517. // will be given as 2.6 as there are 15 zeros immediately after the requested decimal place, so
  33518. // the exact result would be assumed to be 2.6, which rounded using ROUND_CEIL to 1 decimal
  33519. // place is still 2.6.
  33520. if (checkRoundingDigits(r.d, k = pr, rm)) {
  33521. do {
  33522. sd += 10;
  33523. num = naturalLogarithm(arg, sd);
  33524. denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd);
  33525. r = divide(num, denominator, sd, 1);
  33526. if (!inf) {
  33527. // Check for 14 nines from the 2nd rounding digit, as the first may be 4.
  33528. if (+digitsToString(r.d).slice(k + 1, k + 15) + 1 == 1e14) {
  33529. r = finalise(r, pr + 1, 0);
  33530. }
  33531. break;
  33532. }
  33533. } while (checkRoundingDigits(r.d, k += 10, rm));
  33534. }
  33535. external = true;
  33536. return finalise(r, pr, rm);
  33537. };
  33538. /*
  33539. * Return a new Decimal whose value is the maximum of the arguments and the value of this Decimal.
  33540. *
  33541. * arguments {number|string|Decimal}
  33542. *
  33543. P.max = function () {
  33544. Array.prototype.push.call(arguments, this);
  33545. return maxOrMin(this.constructor, arguments, 'lt');
  33546. };
  33547. */
  33548. /*
  33549. * Return a new Decimal whose value is the minimum of the arguments and the value of this Decimal.
  33550. *
  33551. * arguments {number|string|Decimal}
  33552. *
  33553. P.min = function () {
  33554. Array.prototype.push.call(arguments, this);
  33555. return maxOrMin(this.constructor, arguments, 'gt');
  33556. };
  33557. */
  33558. /*
  33559. * n - 0 = n
  33560. * n - N = N
  33561. * n - I = -I
  33562. * 0 - n = -n
  33563. * 0 - 0 = 0
  33564. * 0 - N = N
  33565. * 0 - I = -I
  33566. * N - n = N
  33567. * N - 0 = N
  33568. * N - N = N
  33569. * N - I = N
  33570. * I - n = I
  33571. * I - 0 = I
  33572. * I - N = N
  33573. * I - I = N
  33574. *
  33575. * Return a new Decimal whose value is the value of this Decimal minus `y`, rounded to `precision`
  33576. * significant digits using rounding mode `rounding`.
  33577. *
  33578. */
  33579. P.minus = P.sub = function (y) {
  33580. var d,
  33581. e,
  33582. i,
  33583. j,
  33584. k,
  33585. len,
  33586. pr,
  33587. rm,
  33588. xd,
  33589. xe,
  33590. xLTy,
  33591. yd,
  33592. x = this,
  33593. Ctor = x.constructor;
  33594. y = new Ctor(y);
  33595. // If either is not finite...
  33596. if (!x.d || !y.d) {
  33597. // Return NaN if either is NaN.
  33598. if (!x.s || !y.s) y = new Ctor(NaN);
  33599. // Return y negated if x is finite and y is ±Infinity.
  33600. else if (x.d) y.s = -y.s;
  33601. // Return x if y is finite and x is ±Infinity.
  33602. // Return x if both are ±Infinity with different signs.
  33603. // Return NaN if both are ±Infinity with the same sign.
  33604. else y = new Ctor(y.d || x.s !== y.s ? x : NaN);
  33605. return y;
  33606. }
  33607. // If signs differ...
  33608. if (x.s != y.s) {
  33609. y.s = -y.s;
  33610. return x.plus(y);
  33611. }
  33612. xd = x.d;
  33613. yd = y.d;
  33614. pr = Ctor.precision;
  33615. rm = Ctor.rounding;
  33616. // If either is zero...
  33617. if (!xd[0] || !yd[0]) {
  33618. // Return y negated if x is zero and y is non-zero.
  33619. if (yd[0]) y.s = -y.s;
  33620. // Return x if y is zero and x is non-zero.
  33621. else if (xd[0]) y = new Ctor(x);
  33622. // Return zero if both are zero.
  33623. // From IEEE 754 (2008) 6.3: 0 - 0 = -0 - -0 = -0 when rounding to -Infinity.
  33624. else return new Ctor(rm === 3 ? -0 : 0);
  33625. return external ? finalise(y, pr, rm) : y;
  33626. }
  33627. // x and y are finite, non-zero numbers with the same sign.
  33628. // Calculate base 1e7 exponents.
  33629. e = mathfloor(y.e / LOG_BASE);
  33630. xe = mathfloor(x.e / LOG_BASE);
  33631. xd = xd.slice();
  33632. k = xe - e;
  33633. // If base 1e7 exponents differ...
  33634. if (k) {
  33635. xLTy = k < 0;
  33636. if (xLTy) {
  33637. d = xd;
  33638. k = -k;
  33639. len = yd.length;
  33640. } else {
  33641. d = yd;
  33642. e = xe;
  33643. len = xd.length;
  33644. }
  33645. // Numbers with massively different exponents would result in a very high number of
  33646. // zeros needing to be prepended, but this can be avoided while still ensuring correct
  33647. // rounding by limiting the number of zeros to `Math.ceil(pr / LOG_BASE) + 2`.
  33648. i = Math.max(Math.ceil(pr / LOG_BASE), len) + 2;
  33649. if (k > i) {
  33650. k = i;
  33651. d.length = 1;
  33652. }
  33653. // Prepend zeros to equalise exponents.
  33654. d.reverse();
  33655. for (i = k; i--;) {
  33656. d.push(0);
  33657. }d.reverse();
  33658. // Base 1e7 exponents equal.
  33659. } else {
  33660. // Check digits to determine which is the bigger number.
  33661. i = xd.length;
  33662. len = yd.length;
  33663. xLTy = i < len;
  33664. if (xLTy) len = i;
  33665. for (i = 0; i < len; i++) {
  33666. if (xd[i] != yd[i]) {
  33667. xLTy = xd[i] < yd[i];
  33668. break;
  33669. }
  33670. }
  33671. k = 0;
  33672. }
  33673. if (xLTy) {
  33674. d = xd;
  33675. xd = yd;
  33676. yd = d;
  33677. y.s = -y.s;
  33678. }
  33679. len = xd.length;
  33680. // Append zeros to `xd` if shorter.
  33681. // Don't add zeros to `yd` if shorter as subtraction only needs to start at `yd` length.
  33682. for (i = yd.length - len; i > 0; --i) {
  33683. xd[len++] = 0;
  33684. } // Subtract yd from xd.
  33685. for (i = yd.length; i > k;) {
  33686. if (xd[--i] < yd[i]) {
  33687. for (j = i; j && xd[--j] === 0;) {
  33688. xd[j] = BASE - 1;
  33689. }--xd[j];
  33690. xd[i] += BASE;
  33691. }
  33692. xd[i] -= yd[i];
  33693. }
  33694. // Remove trailing zeros.
  33695. for (; xd[--len] === 0;) {
  33696. xd.pop();
  33697. } // Remove leading zeros and adjust exponent accordingly.
  33698. for (; xd[0] === 0; xd.shift()) {
  33699. --e;
  33700. } // Zero?
  33701. if (!xd[0]) return new Ctor(rm === 3 ? -0 : 0);
  33702. y.d = xd;
  33703. y.e = getBase10Exponent(xd, e);
  33704. return external ? finalise(y, pr, rm) : y;
  33705. };
  33706. /*
  33707. * n % 0 = N
  33708. * n % N = N
  33709. * n % I = n
  33710. * 0 % n = 0
  33711. * -0 % n = -0
  33712. * 0 % 0 = N
  33713. * 0 % N = N
  33714. * 0 % I = 0
  33715. * N % n = N
  33716. * N % 0 = N
  33717. * N % N = N
  33718. * N % I = N
  33719. * I % n = N
  33720. * I % 0 = N
  33721. * I % N = N
  33722. * I % I = N
  33723. *
  33724. * Return a new Decimal whose value is the value of this Decimal modulo `y`, rounded to
  33725. * `precision` significant digits using rounding mode `rounding`.
  33726. *
  33727. * The result depends on the modulo mode.
  33728. *
  33729. */
  33730. P.modulo = P.mod = function (y) {
  33731. var q,
  33732. x = this,
  33733. Ctor = x.constructor;
  33734. y = new Ctor(y);
  33735. // Return NaN if x is ±Infinity or NaN, or y is NaN or ±0.
  33736. if (!x.d || !y.s || y.d && !y.d[0]) return new Ctor(NaN);
  33737. // Return x if y is ±Infinity or x is ±0.
  33738. if (!y.d || x.d && !x.d[0]) {
  33739. return finalise(new Ctor(x), Ctor.precision, Ctor.rounding);
  33740. }
  33741. // Prevent rounding of intermediate calculations.
  33742. external = false;
  33743. if (Ctor.modulo == 9) {
  33744. // Euclidian division: q = sign(y) * floor(x / abs(y))
  33745. // result = x - q * y where 0 <= result < abs(y)
  33746. q = divide(x, y.abs(), 0, 3, 1);
  33747. q.s *= y.s;
  33748. } else {
  33749. q = divide(x, y, 0, Ctor.modulo, 1);
  33750. }
  33751. q = q.times(y);
  33752. external = true;
  33753. return x.minus(q);
  33754. };
  33755. /*
  33756. * Return a new Decimal whose value is the natural exponential of the value of this Decimal,
  33757. * i.e. the base e raised to the power the value of this Decimal, rounded to `precision`
  33758. * significant digits using rounding mode `rounding`.
  33759. *
  33760. */
  33761. P.naturalExponential = P.exp = function () {
  33762. return naturalExponential(this);
  33763. };
  33764. /*
  33765. * Return a new Decimal whose value is the natural logarithm of the value of this Decimal,
  33766. * rounded to `precision` significant digits using rounding mode `rounding`.
  33767. *
  33768. */
  33769. P.naturalLogarithm = P.ln = function () {
  33770. return naturalLogarithm(this);
  33771. };
  33772. /*
  33773. * Return a new Decimal whose value is the value of this Decimal negated, i.e. as if multiplied by
  33774. * -1.
  33775. *
  33776. */
  33777. P.negated = P.neg = function () {
  33778. var x = new this.constructor(this);
  33779. x.s = -x.s;
  33780. return finalise(x);
  33781. };
  33782. /*
  33783. * n + 0 = n
  33784. * n + N = N
  33785. * n + I = I
  33786. * 0 + n = n
  33787. * 0 + 0 = 0
  33788. * 0 + N = N
  33789. * 0 + I = I
  33790. * N + n = N
  33791. * N + 0 = N
  33792. * N + N = N
  33793. * N + I = N
  33794. * I + n = I
  33795. * I + 0 = I
  33796. * I + N = N
  33797. * I + I = I
  33798. *
  33799. * Return a new Decimal whose value is the value of this Decimal plus `y`, rounded to `precision`
  33800. * significant digits using rounding mode `rounding`.
  33801. *
  33802. */
  33803. P.plus = P.add = function (y) {
  33804. var carry,
  33805. d,
  33806. e,
  33807. i,
  33808. k,
  33809. len,
  33810. pr,
  33811. rm,
  33812. xd,
  33813. yd,
  33814. x = this,
  33815. Ctor = x.constructor;
  33816. y = new Ctor(y);
  33817. // If either is not finite...
  33818. if (!x.d || !y.d) {
  33819. // Return NaN if either is NaN.
  33820. if (!x.s || !y.s) y = new Ctor(NaN);
  33821. // Return x if y is finite and x is ±Infinity.
  33822. // Return x if both are ±Infinity with the same sign.
  33823. // Return NaN if both are ±Infinity with different signs.
  33824. // Return y if x is finite and y is ±Infinity.
  33825. else if (!x.d) y = new Ctor(y.d || x.s === y.s ? x : NaN);
  33826. return y;
  33827. }
  33828. // If signs differ...
  33829. if (x.s != y.s) {
  33830. y.s = -y.s;
  33831. return x.minus(y);
  33832. }
  33833. xd = x.d;
  33834. yd = y.d;
  33835. pr = Ctor.precision;
  33836. rm = Ctor.rounding;
  33837. // If either is zero...
  33838. if (!xd[0] || !yd[0]) {
  33839. // Return x if y is zero.
  33840. // Return y if y is non-zero.
  33841. if (!yd[0]) y = new Ctor(x);
  33842. return external ? finalise(y, pr, rm) : y;
  33843. }
  33844. // x and y are finite, non-zero numbers with the same sign.
  33845. // Calculate base 1e7 exponents.
  33846. k = mathfloor(x.e / LOG_BASE);
  33847. e = mathfloor(y.e / LOG_BASE);
  33848. xd = xd.slice();
  33849. i = k - e;
  33850. // If base 1e7 exponents differ...
  33851. if (i) {
  33852. if (i < 0) {
  33853. d = xd;
  33854. i = -i;
  33855. len = yd.length;
  33856. } else {
  33857. d = yd;
  33858. e = k;
  33859. len = xd.length;
  33860. }
  33861. // Limit number of zeros prepended to max(ceil(pr / LOG_BASE), len) + 1.
  33862. k = Math.ceil(pr / LOG_BASE);
  33863. len = k > len ? k + 1 : len + 1;
  33864. if (i > len) {
  33865. i = len;
  33866. d.length = 1;
  33867. }
  33868. // Prepend zeros to equalise exponents. Note: Faster to use reverse then do unshifts.
  33869. d.reverse();
  33870. for (; i--;) {
  33871. d.push(0);
  33872. }d.reverse();
  33873. }
  33874. len = xd.length;
  33875. i = yd.length;
  33876. // If yd is longer than xd, swap xd and yd so xd points to the longer array.
  33877. if (len - i < 0) {
  33878. i = len;
  33879. d = yd;
  33880. yd = xd;
  33881. xd = d;
  33882. }
  33883. // Only start adding at yd.length - 1 as the further digits of xd can be left as they are.
  33884. for (carry = 0; i;) {
  33885. carry = (xd[--i] = xd[i] + yd[i] + carry) / BASE | 0;
  33886. xd[i] %= BASE;
  33887. }
  33888. if (carry) {
  33889. xd.unshift(carry);
  33890. ++e;
  33891. }
  33892. // Remove trailing zeros.
  33893. // No need to check for zero, as +x + +y != 0 && -x + -y != 0
  33894. for (len = xd.length; xd[--len] == 0;) {
  33895. xd.pop();
  33896. }y.d = xd;
  33897. y.e = getBase10Exponent(xd, e);
  33898. return external ? finalise(y, pr, rm) : y;
  33899. };
  33900. /*
  33901. * Return the number of significant digits of the value of this Decimal.
  33902. *
  33903. * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.
  33904. *
  33905. */
  33906. P.precision = P.sd = function (z) {
  33907. var k,
  33908. x = this;
  33909. if (z !== void 0 && z !== !!z && z !== 1 && z !== 0) throw Error(invalidArgument + z);
  33910. if (x.d) {
  33911. k = getPrecision(x.d);
  33912. if (z && x.e + 1 > k) k = x.e + 1;
  33913. } else {
  33914. k = NaN;
  33915. }
  33916. return k;
  33917. };
  33918. /*
  33919. * Return a new Decimal whose value is the value of this Decimal rounded to a whole number using
  33920. * rounding mode `rounding`.
  33921. *
  33922. */
  33923. P.round = function () {
  33924. var x = this,
  33925. Ctor = x.constructor;
  33926. return finalise(new Ctor(x), x.e + 1, Ctor.rounding);
  33927. };
  33928. /*
  33929. * Return a new Decimal whose value is the sine of the value in radians of this Decimal.
  33930. *
  33931. * Domain: [-Infinity, Infinity]
  33932. * Range: [-1, 1]
  33933. *
  33934. * sin(x) = x - x^3/3! + x^5/5! - ...
  33935. *
  33936. * sin(0) = 0
  33937. * sin(-0) = -0
  33938. * sin(Infinity) = NaN
  33939. * sin(-Infinity) = NaN
  33940. * sin(NaN) = NaN
  33941. *
  33942. */
  33943. P.sine = P.sin = function () {
  33944. var pr,
  33945. rm,
  33946. x = this,
  33947. Ctor = x.constructor;
  33948. if (!x.isFinite()) return new Ctor(NaN);
  33949. if (x.isZero()) return new Ctor(x);
  33950. pr = Ctor.precision;
  33951. rm = Ctor.rounding;
  33952. Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE;
  33953. Ctor.rounding = 1;
  33954. x = sine(Ctor, toLessThanHalfPi(Ctor, x));
  33955. Ctor.precision = pr;
  33956. Ctor.rounding = rm;
  33957. return finalise(quadrant > 2 ? x.neg() : x, pr, rm, true);
  33958. };
  33959. /*
  33960. * Return a new Decimal whose value is the square root of this Decimal, rounded to `precision`
  33961. * significant digits using rounding mode `rounding`.
  33962. *
  33963. * sqrt(-n) = N
  33964. * sqrt(N) = N
  33965. * sqrt(-I) = N
  33966. * sqrt(I) = I
  33967. * sqrt(0) = 0
  33968. * sqrt(-0) = -0
  33969. *
  33970. */
  33971. P.squareRoot = P.sqrt = function () {
  33972. var m,
  33973. n,
  33974. sd,
  33975. r,
  33976. rep,
  33977. t,
  33978. x = this,
  33979. d = x.d,
  33980. e = x.e,
  33981. s = x.s,
  33982. Ctor = x.constructor;
  33983. // Negative/NaN/Infinity/zero?
  33984. if (s !== 1 || !d || !d[0]) {
  33985. return new Ctor(!s || s < 0 && (!d || d[0]) ? NaN : d ? x : 1 / 0);
  33986. }
  33987. external = false;
  33988. // Initial estimate.
  33989. s = Math.sqrt(+x);
  33990. // Math.sqrt underflow/overflow?
  33991. // Pass x to Math.sqrt as integer, then adjust the exponent of the result.
  33992. if (s == 0 || s == 1 / 0) {
  33993. n = digitsToString(d);
  33994. if ((n.length + e) % 2 == 0) n += '0';
  33995. s = Math.sqrt(n);
  33996. e = mathfloor((e + 1) / 2) - (e < 0 || e % 2);
  33997. if (s == 1 / 0) {
  33998. n = '1e' + e;
  33999. } else {
  34000. n = s.toExponential();
  34001. n = n.slice(0, n.indexOf('e') + 1) + e;
  34002. }
  34003. r = new Ctor(n);
  34004. } else {
  34005. r = new Ctor(s.toString());
  34006. }
  34007. sd = (e = Ctor.precision) + 3;
  34008. // Newton-Raphson iteration.
  34009. for (;;) {
  34010. t = r;
  34011. r = t.plus(divide(x, t, sd + 2, 1)).times(0.5);
  34012. // TODO? Replace with for-loop and checkRoundingDigits.
  34013. if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) {
  34014. n = n.slice(sd - 3, sd + 1);
  34015. // The 4th rounding digit may be in error by -1 so if the 4 rounding digits are 9999 or
  34016. // 4999, i.e. approaching a rounding boundary, continue the iteration.
  34017. if (n == '9999' || !rep && n == '4999') {
  34018. // On the first iteration only, check to see if rounding up gives the exact result as the
  34019. // nines may infinitely repeat.
  34020. if (!rep) {
  34021. finalise(t, e + 1, 0);
  34022. if (t.times(t).eq(x)) {
  34023. r = t;
  34024. break;
  34025. }
  34026. }
  34027. sd += 4;
  34028. rep = 1;
  34029. } else {
  34030. // If the rounding digits are null, 0{0,4} or 50{0,3}, check for an exact result.
  34031. // If not, then there are further digits and m will be truthy.
  34032. if (!+n || !+n.slice(1) && n.charAt(0) == '5') {
  34033. // Truncate to the first rounding digit.
  34034. finalise(r, e + 1, 1);
  34035. m = !r.times(r).eq(x);
  34036. }
  34037. break;
  34038. }
  34039. }
  34040. }
  34041. external = true;
  34042. return finalise(r, e, Ctor.rounding, m);
  34043. };
  34044. /*
  34045. * Return a new Decimal whose value is the tangent of the value in radians of this Decimal.
  34046. *
  34047. * Domain: [-Infinity, Infinity]
  34048. * Range: [-Infinity, Infinity]
  34049. *
  34050. * tan(0) = 0
  34051. * tan(-0) = -0
  34052. * tan(Infinity) = NaN
  34053. * tan(-Infinity) = NaN
  34054. * tan(NaN) = NaN
  34055. *
  34056. */
  34057. P.tangent = P.tan = function () {
  34058. var pr,
  34059. rm,
  34060. x = this,
  34061. Ctor = x.constructor;
  34062. if (!x.isFinite()) return new Ctor(NaN);
  34063. if (x.isZero()) return new Ctor(x);
  34064. pr = Ctor.precision;
  34065. rm = Ctor.rounding;
  34066. Ctor.precision = pr + 10;
  34067. Ctor.rounding = 1;
  34068. x = x.sin();
  34069. x.s = 1;
  34070. x = divide(x, new Ctor(1).minus(x.times(x)).sqrt(), pr + 10, 0);
  34071. Ctor.precision = pr;
  34072. Ctor.rounding = rm;
  34073. return finalise(quadrant == 2 || quadrant == 4 ? x.neg() : x, pr, rm, true);
  34074. };
  34075. /*
  34076. * n * 0 = 0
  34077. * n * N = N
  34078. * n * I = I
  34079. * 0 * n = 0
  34080. * 0 * 0 = 0
  34081. * 0 * N = N
  34082. * 0 * I = N
  34083. * N * n = N
  34084. * N * 0 = N
  34085. * N * N = N
  34086. * N * I = N
  34087. * I * n = I
  34088. * I * 0 = N
  34089. * I * N = N
  34090. * I * I = I
  34091. *
  34092. * Return a new Decimal whose value is this Decimal times `y`, rounded to `precision` significant
  34093. * digits using rounding mode `rounding`.
  34094. *
  34095. */
  34096. P.times = P.mul = function (y) {
  34097. var carry,
  34098. e,
  34099. i,
  34100. k,
  34101. r,
  34102. rL,
  34103. t,
  34104. xdL,
  34105. ydL,
  34106. x = this,
  34107. Ctor = x.constructor,
  34108. xd = x.d,
  34109. yd = (y = new Ctor(y)).d;
  34110. y.s *= x.s;
  34111. // If either is NaN, ±Infinity or ±0...
  34112. if (!xd || !xd[0] || !yd || !yd[0]) {
  34113. return new Ctor(!y.s || xd && !xd[0] && !yd || yd && !yd[0] && !xd
  34114. // Return NaN if either is NaN.
  34115. // Return NaN if x is ±0 and y is ±Infinity, or y is ±0 and x is ±Infinity.
  34116. ? NaN
  34117. // Return ±Infinity if either is ±Infinity.
  34118. // Return ±0 if either is ±0.
  34119. : !xd || !yd ? y.s / 0 : y.s * 0);
  34120. }
  34121. e = mathfloor(x.e / LOG_BASE) + mathfloor(y.e / LOG_BASE);
  34122. xdL = xd.length;
  34123. ydL = yd.length;
  34124. // Ensure xd points to the longer array.
  34125. if (xdL < ydL) {
  34126. r = xd;
  34127. xd = yd;
  34128. yd = r;
  34129. rL = xdL;
  34130. xdL = ydL;
  34131. ydL = rL;
  34132. }
  34133. // Initialise the result array with zeros.
  34134. r = [];
  34135. rL = xdL + ydL;
  34136. for (i = rL; i--;) {
  34137. r.push(0);
  34138. } // Multiply!
  34139. for (i = ydL; --i >= 0;) {
  34140. carry = 0;
  34141. for (k = xdL + i; k > i;) {
  34142. t = r[k] + yd[i] * xd[k - i - 1] + carry;
  34143. r[k--] = t % BASE | 0;
  34144. carry = t / BASE | 0;
  34145. }
  34146. r[k] = (r[k] + carry) % BASE | 0;
  34147. }
  34148. // Remove trailing zeros.
  34149. for (; !r[--rL];) {
  34150. r.pop();
  34151. }if (carry) ++e;else r.shift();
  34152. y.d = r;
  34153. y.e = getBase10Exponent(r, e);
  34154. return external ? finalise(y, Ctor.precision, Ctor.rounding) : y;
  34155. };
  34156. /*
  34157. * Return a string representing the value of this Decimal in base 2, round to `sd` significant
  34158. * digits using rounding mode `rm`.
  34159. *
  34160. * If the optional `sd` argument is present then return binary exponential notation.
  34161. *
  34162. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  34163. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  34164. *
  34165. */
  34166. P.toBinary = function (sd, rm) {
  34167. return toStringBinary(this, 2, sd, rm);
  34168. };
  34169. /*
  34170. * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `dp`
  34171. * decimal places using rounding mode `rm` or `rounding` if `rm` is omitted.
  34172. *
  34173. * If `dp` is omitted, return a new Decimal whose value is the value of this Decimal.
  34174. *
  34175. * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
  34176. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  34177. *
  34178. */
  34179. P.toDecimalPlaces = P.toDP = function (dp, rm) {
  34180. var x = this,
  34181. Ctor = x.constructor;
  34182. x = new Ctor(x);
  34183. if (dp === void 0) return x;
  34184. checkInt32(dp, 0, MAX_DIGITS);
  34185. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  34186. return finalise(x, dp + x.e + 1, rm);
  34187. };
  34188. /*
  34189. * Return a string representing the value of this Decimal in exponential notation rounded to
  34190. * `dp` fixed decimal places using rounding mode `rounding`.
  34191. *
  34192. * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
  34193. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  34194. *
  34195. */
  34196. P.toExponential = function (dp, rm) {
  34197. var str,
  34198. x = this,
  34199. Ctor = x.constructor;
  34200. if (dp === void 0) {
  34201. str = finiteToString(x, true);
  34202. } else {
  34203. checkInt32(dp, 0, MAX_DIGITS);
  34204. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  34205. x = finalise(new Ctor(x), dp + 1, rm);
  34206. str = finiteToString(x, true, dp + 1);
  34207. }
  34208. return x.isNeg() && !x.isZero() ? '-' + str : str;
  34209. };
  34210. /*
  34211. * Return a string representing the value of this Decimal in normal (fixed-point) notation to
  34212. * `dp` fixed decimal places and rounded using rounding mode `rm` or `rounding` if `rm` is
  34213. * omitted.
  34214. *
  34215. * As with JavaScript numbers, (-0).toFixed(0) is '0', but e.g. (-0.00001).toFixed(0) is '-0'.
  34216. *
  34217. * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
  34218. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  34219. *
  34220. * (-0).toFixed(0) is '0', but (-0.1).toFixed(0) is '-0'.
  34221. * (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'.
  34222. * (-0).toFixed(3) is '0.000'.
  34223. * (-0.5).toFixed(0) is '-0'.
  34224. *
  34225. */
  34226. P.toFixed = function (dp, rm) {
  34227. var str,
  34228. y,
  34229. x = this,
  34230. Ctor = x.constructor;
  34231. if (dp === void 0) {
  34232. str = finiteToString(x);
  34233. } else {
  34234. checkInt32(dp, 0, MAX_DIGITS);
  34235. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  34236. y = finalise(new Ctor(x), dp + x.e + 1, rm);
  34237. str = finiteToString(y, false, dp + y.e + 1);
  34238. }
  34239. // To determine whether to add the minus sign look at the value before it was rounded,
  34240. // i.e. look at `x` rather than `y`.
  34241. return x.isNeg() && !x.isZero() ? '-' + str : str;
  34242. };
  34243. /*
  34244. * Return an array representing the value of this Decimal as a simple fraction with an integer
  34245. * numerator and an integer denominator.
  34246. *
  34247. * The denominator will be a positive non-zero value less than or equal to the specified maximum
  34248. * denominator. If a maximum denominator is not specified, the denominator will be the lowest
  34249. * value necessary to represent the number exactly.
  34250. *
  34251. * [maxD] {number|string|Decimal} Maximum denominator. Integer >= 1 and < Infinity.
  34252. *
  34253. */
  34254. P.toFraction = function (maxD) {
  34255. var d,
  34256. d0,
  34257. d1,
  34258. d2,
  34259. e,
  34260. k,
  34261. n,
  34262. n0,
  34263. n1,
  34264. pr,
  34265. q,
  34266. r,
  34267. x = this,
  34268. xd = x.d,
  34269. Ctor = x.constructor;
  34270. if (!xd) return new Ctor(x);
  34271. n1 = d0 = new Ctor(1);
  34272. d1 = n0 = new Ctor(0);
  34273. d = new Ctor(d1);
  34274. e = d.e = getPrecision(xd) - x.e - 1;
  34275. k = e % LOG_BASE;
  34276. d.d[0] = mathpow(10, k < 0 ? LOG_BASE + k : k);
  34277. if (maxD == null) {
  34278. // d is 10**e, the minimum max-denominator needed.
  34279. maxD = e > 0 ? d : n1;
  34280. } else {
  34281. n = new Ctor(maxD);
  34282. if (!n.isInt() || n.lt(n1)) throw Error(invalidArgument + n);
  34283. maxD = n.gt(d) ? e > 0 ? d : n1 : n;
  34284. }
  34285. external = false;
  34286. n = new Ctor(digitsToString(xd));
  34287. pr = Ctor.precision;
  34288. Ctor.precision = e = xd.length * LOG_BASE * 2;
  34289. for (;;) {
  34290. q = divide(n, d, 0, 1, 1);
  34291. d2 = d0.plus(q.times(d1));
  34292. if (d2.cmp(maxD) == 1) break;
  34293. d0 = d1;
  34294. d1 = d2;
  34295. d2 = n1;
  34296. n1 = n0.plus(q.times(d2));
  34297. n0 = d2;
  34298. d2 = d;
  34299. d = n.minus(q.times(d2));
  34300. n = d2;
  34301. }
  34302. d2 = divide(maxD.minus(d0), d1, 0, 1, 1);
  34303. n0 = n0.plus(d2.times(n1));
  34304. d0 = d0.plus(d2.times(d1));
  34305. n0.s = n1.s = x.s;
  34306. // Determine which fraction is closer to x, n0/d0 or n1/d1?
  34307. r = divide(n1, d1, e, 1).minus(x).abs().cmp(divide(n0, d0, e, 1).minus(x).abs()) < 1 ? [n1, d1] : [n0, d0];
  34308. Ctor.precision = pr;
  34309. external = true;
  34310. return r;
  34311. };
  34312. /*
  34313. * Return a string representing the value of this Decimal in base 16, round to `sd` significant
  34314. * digits using rounding mode `rm`.
  34315. *
  34316. * If the optional `sd` argument is present then return binary exponential notation.
  34317. *
  34318. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  34319. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  34320. *
  34321. */
  34322. P.toHexadecimal = P.toHex = function (sd, rm) {
  34323. return toStringBinary(this, 16, sd, rm);
  34324. };
  34325. /*
  34326. * Returns a new Decimal whose value is the nearest multiple of `y` in the direction of rounding
  34327. * mode `rm`, or `Decimal.rounding` if `rm` is omitted, to the value of this Decimal.
  34328. *
  34329. * The return value will always have the same sign as this Decimal, unless either this Decimal
  34330. * or `y` is NaN, in which case the return value will be also be NaN.
  34331. *
  34332. * The return value is not affected by the value of `precision`.
  34333. *
  34334. * y {number|string|Decimal} The magnitude to round to a multiple of.
  34335. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  34336. *
  34337. * 'toNearest() rounding mode not an integer: {rm}'
  34338. * 'toNearest() rounding mode out of range: {rm}'
  34339. *
  34340. */
  34341. P.toNearest = function (y, rm) {
  34342. var x = this,
  34343. Ctor = x.constructor;
  34344. x = new Ctor(x);
  34345. if (y == null) {
  34346. // If x is not finite, return x.
  34347. if (!x.d) return x;
  34348. y = new Ctor(1);
  34349. rm = Ctor.rounding;
  34350. } else {
  34351. y = new Ctor(y);
  34352. if (rm === void 0) {
  34353. rm = Ctor.rounding;
  34354. } else {
  34355. checkInt32(rm, 0, 8);
  34356. }
  34357. // If x is not finite, return x if y is not NaN, else NaN.
  34358. if (!x.d) return y.s ? x : y;
  34359. // If y is not finite, return Infinity with the sign of x if y is Infinity, else NaN.
  34360. if (!y.d) {
  34361. if (y.s) y.s = x.s;
  34362. return y;
  34363. }
  34364. }
  34365. // If y is not zero, calculate the nearest multiple of y to x.
  34366. if (y.d[0]) {
  34367. external = false;
  34368. x = divide(x, y, 0, rm, 1).times(y);
  34369. external = true;
  34370. finalise(x);
  34371. // If y is zero, return zero with the sign of x.
  34372. } else {
  34373. y.s = x.s;
  34374. x = y;
  34375. }
  34376. return x;
  34377. };
  34378. /*
  34379. * Return the value of this Decimal converted to a number primitive.
  34380. * Zero keeps its sign.
  34381. *
  34382. */
  34383. P.toNumber = function () {
  34384. return +this;
  34385. };
  34386. /*
  34387. * Return a string representing the value of this Decimal in base 8, round to `sd` significant
  34388. * digits using rounding mode `rm`.
  34389. *
  34390. * If the optional `sd` argument is present then return binary exponential notation.
  34391. *
  34392. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  34393. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  34394. *
  34395. */
  34396. P.toOctal = function (sd, rm) {
  34397. return toStringBinary(this, 8, sd, rm);
  34398. };
  34399. /*
  34400. * Return a new Decimal whose value is the value of this Decimal raised to the power `y`, rounded
  34401. * to `precision` significant digits using rounding mode `rounding`.
  34402. *
  34403. * ECMAScript compliant.
  34404. *
  34405. * pow(x, NaN) = NaN
  34406. * pow(x, ±0) = 1
  34407. * pow(NaN, non-zero) = NaN
  34408. * pow(abs(x) > 1, +Infinity) = +Infinity
  34409. * pow(abs(x) > 1, -Infinity) = +0
  34410. * pow(abs(x) == 1, ±Infinity) = NaN
  34411. * pow(abs(x) < 1, +Infinity) = +0
  34412. * pow(abs(x) < 1, -Infinity) = +Infinity
  34413. * pow(+Infinity, y > 0) = +Infinity
  34414. * pow(+Infinity, y < 0) = +0
  34415. * pow(-Infinity, odd integer > 0) = -Infinity
  34416. * pow(-Infinity, even integer > 0) = +Infinity
  34417. * pow(-Infinity, odd integer < 0) = -0
  34418. * pow(-Infinity, even integer < 0) = +0
  34419. * pow(+0, y > 0) = +0
  34420. * pow(+0, y < 0) = +Infinity
  34421. * pow(-0, odd integer > 0) = -0
  34422. * pow(-0, even integer > 0) = +0
  34423. * pow(-0, odd integer < 0) = -Infinity
  34424. * pow(-0, even integer < 0) = +Infinity
  34425. * pow(finite x < 0, finite non-integer) = NaN
  34426. *
  34427. * For non-integer or very large exponents pow(x, y) is calculated using
  34428. *
  34429. * x^y = exp(y*ln(x))
  34430. *
  34431. * Assuming the first 15 rounding digits are each equally likely to be any digit 0-9, the
  34432. * probability of an incorrectly rounded result
  34433. * P([49]9{14} | [50]0{14}) = 2 * 0.2 * 10^-14 = 4e-15 = 1/2.5e+14
  34434. * i.e. 1 in 250,000,000,000,000
  34435. *
  34436. * If a result is incorrectly rounded the maximum error will be 1 ulp (unit in last place).
  34437. *
  34438. * y {number|string|Decimal} The power to which to raise this Decimal.
  34439. *
  34440. */
  34441. P.toPower = P.pow = function (y) {
  34442. var e,
  34443. k,
  34444. pr,
  34445. r,
  34446. rm,
  34447. s,
  34448. x = this,
  34449. Ctor = x.constructor,
  34450. yn = +(y = new Ctor(y));
  34451. // Either ±Infinity, NaN or ±0?
  34452. if (!x.d || !y.d || !x.d[0] || !y.d[0]) return new Ctor(mathpow(+x, yn));
  34453. x = new Ctor(x);
  34454. if (x.eq(1)) return x;
  34455. pr = Ctor.precision;
  34456. rm = Ctor.rounding;
  34457. if (y.eq(1)) return finalise(x, pr, rm);
  34458. // y exponent
  34459. e = mathfloor(y.e / LOG_BASE);
  34460. // If y is a small integer use the 'exponentiation by squaring' algorithm.
  34461. if (e >= y.d.length - 1 && (k = yn < 0 ? -yn : yn) <= MAX_SAFE_INTEGER) {
  34462. r = intPow(Ctor, x, k, pr);
  34463. return y.s < 0 ? new Ctor(1).div(r) : finalise(r, pr, rm);
  34464. }
  34465. s = x.s;
  34466. // if x is negative
  34467. if (s < 0) {
  34468. // if y is not an integer
  34469. if (e < y.d.length - 1) return new Ctor(NaN);
  34470. // Result is positive if x is negative and the last digit of integer y is even.
  34471. if ((y.d[e] & 1) == 0) s = 1;
  34472. // if x.eq(-1)
  34473. if (x.e == 0 && x.d[0] == 1 && x.d.length == 1) {
  34474. x.s = s;
  34475. return x;
  34476. }
  34477. }
  34478. // Estimate result exponent.
  34479. // x^y = 10^e, where e = y * log10(x)
  34480. // log10(x) = log10(x_significand) + x_exponent
  34481. // log10(x_significand) = ln(x_significand) / ln(10)
  34482. k = mathpow(+x, yn);
  34483. e = k == 0 || !isFinite(k) ? mathfloor(yn * (Math.log('0.' + digitsToString(x.d)) / Math.LN10 + x.e + 1)) : new Ctor(k + '').e;
  34484. // Exponent estimate may be incorrect e.g. x: 0.999999999999999999, y: 2.29, e: 0, r.e: -1.
  34485. // Overflow/underflow?
  34486. if (e > Ctor.maxE + 1 || e < Ctor.minE - 1) return new Ctor(e > 0 ? s / 0 : 0);
  34487. external = false;
  34488. Ctor.rounding = x.s = 1;
  34489. // Estimate the extra guard digits needed to ensure five correct rounding digits from
  34490. // naturalLogarithm(x). Example of failure without these extra digits (precision: 10):
  34491. // new Decimal(2.32456).pow('2087987436534566.46411')
  34492. // should be 1.162377823e+764914905173815, but is 1.162355823e+764914905173815
  34493. k = Math.min(12, (e + '').length);
  34494. // r = x^y = exp(y*ln(x))
  34495. r = naturalExponential(y.times(naturalLogarithm(x, pr + k)), pr);
  34496. // r may be Infinity, e.g. (0.9999999999999999).pow(-1e+40)
  34497. if (r.d) {
  34498. // Truncate to the required precision plus five rounding digits.
  34499. r = finalise(r, pr + 5, 1);
  34500. // If the rounding digits are [49]9999 or [50]0000 increase the precision by 10 and recalculate
  34501. // the result.
  34502. if (checkRoundingDigits(r.d, pr, rm)) {
  34503. e = pr + 10;
  34504. // Truncate to the increased precision plus five rounding digits.
  34505. r = finalise(naturalExponential(y.times(naturalLogarithm(x, e + k)), e), e + 5, 1);
  34506. // Check for 14 nines from the 2nd rounding digit (the first rounding digit may be 4 or 9).
  34507. if (+digitsToString(r.d).slice(pr + 1, pr + 15) + 1 == 1e14) {
  34508. r = finalise(r, pr + 1, 0);
  34509. }
  34510. }
  34511. }
  34512. r.s = s;
  34513. external = true;
  34514. Ctor.rounding = rm;
  34515. return finalise(r, pr, rm);
  34516. };
  34517. /*
  34518. * Return a string representing the value of this Decimal rounded to `sd` significant digits
  34519. * using rounding mode `rounding`.
  34520. *
  34521. * Return exponential notation if `sd` is less than the number of digits necessary to represent
  34522. * the integer part of the value in normal notation.
  34523. *
  34524. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  34525. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  34526. *
  34527. */
  34528. P.toPrecision = function (sd, rm) {
  34529. var str,
  34530. x = this,
  34531. Ctor = x.constructor;
  34532. if (sd === void 0) {
  34533. str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);
  34534. } else {
  34535. checkInt32(sd, 1, MAX_DIGITS);
  34536. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  34537. x = finalise(new Ctor(x), sd, rm);
  34538. str = finiteToString(x, sd <= x.e || x.e <= Ctor.toExpNeg, sd);
  34539. }
  34540. return x.isNeg() && !x.isZero() ? '-' + str : str;
  34541. };
  34542. /*
  34543. * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `sd`
  34544. * significant digits using rounding mode `rm`, or to `precision` and `rounding` respectively if
  34545. * omitted.
  34546. *
  34547. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  34548. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  34549. *
  34550. * 'toSD() digits out of range: {sd}'
  34551. * 'toSD() digits not an integer: {sd}'
  34552. * 'toSD() rounding mode not an integer: {rm}'
  34553. * 'toSD() rounding mode out of range: {rm}'
  34554. *
  34555. */
  34556. P.toSignificantDigits = P.toSD = function (sd, rm) {
  34557. var x = this,
  34558. Ctor = x.constructor;
  34559. if (sd === void 0) {
  34560. sd = Ctor.precision;
  34561. rm = Ctor.rounding;
  34562. } else {
  34563. checkInt32(sd, 1, MAX_DIGITS);
  34564. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  34565. }
  34566. return finalise(new Ctor(x), sd, rm);
  34567. };
  34568. /*
  34569. * Return a string representing the value of this Decimal.
  34570. *
  34571. * Return exponential notation if this Decimal has a positive exponent equal to or greater than
  34572. * `toExpPos`, or a negative exponent equal to or less than `toExpNeg`.
  34573. *
  34574. */
  34575. P.toString = function () {
  34576. var x = this,
  34577. Ctor = x.constructor,
  34578. str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);
  34579. return x.isNeg() && !x.isZero() ? '-' + str : str;
  34580. };
  34581. /*
  34582. * Return a new Decimal whose value is the value of this Decimal truncated to a whole number.
  34583. *
  34584. */
  34585. P.truncated = P.trunc = function () {
  34586. return finalise(new this.constructor(this), this.e + 1, 1);
  34587. };
  34588. /*
  34589. * Return a string representing the value of this Decimal.
  34590. * Unlike `toString`, negative zero will include the minus sign.
  34591. *
  34592. */
  34593. P.valueOf = P.toJSON = function () {
  34594. var x = this,
  34595. Ctor = x.constructor,
  34596. str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);
  34597. return x.isNeg() ? '-' + str : str;
  34598. };
  34599. /*
  34600. // Add aliases to match BigDecimal method names.
  34601. // P.add = P.plus;
  34602. P.subtract = P.minus;
  34603. P.multiply = P.times;
  34604. P.divide = P.div;
  34605. P.remainder = P.mod;
  34606. P.compareTo = P.cmp;
  34607. P.negate = P.neg;
  34608. */
  34609. // Helper functions for Decimal.prototype (P) and/or Decimal methods, and their callers.
  34610. /*
  34611. * digitsToString P.cubeRoot, P.logarithm, P.squareRoot, P.toFraction, P.toPower,
  34612. * finiteToString, naturalExponential, naturalLogarithm
  34613. * checkInt32 P.toDecimalPlaces, P.toExponential, P.toFixed, P.toNearest,
  34614. * P.toPrecision, P.toSignificantDigits, toStringBinary, random
  34615. * checkRoundingDigits P.logarithm, P.toPower, naturalExponential, naturalLogarithm
  34616. * convertBase toStringBinary, parseOther
  34617. * cos P.cos
  34618. * divide P.atanh, P.cubeRoot, P.dividedBy, P.dividedToIntegerBy,
  34619. * P.logarithm, P.modulo, P.squareRoot, P.tan, P.tanh, P.toFraction,
  34620. * P.toNearest, toStringBinary, naturalExponential, naturalLogarithm,
  34621. * taylorSeries, atan2, parseOther
  34622. * finalise P.absoluteValue, P.atan, P.atanh, P.ceil, P.cos, P.cosh,
  34623. * P.cubeRoot, P.dividedToIntegerBy, P.floor, P.logarithm, P.minus,
  34624. * P.modulo, P.negated, P.plus, P.round, P.sin, P.sinh, P.squareRoot,
  34625. * P.tan, P.times, P.toDecimalPlaces, P.toExponential, P.toFixed,
  34626. * P.toNearest, P.toPower, P.toPrecision, P.toSignificantDigits,
  34627. * P.truncated, divide, getLn10, getPi, naturalExponential,
  34628. * naturalLogarithm, ceil, floor, round, trunc
  34629. * finiteToString P.toExponential, P.toFixed, P.toPrecision, P.toString, P.valueOf,
  34630. * toStringBinary
  34631. * getBase10Exponent P.minus, P.plus, P.times, parseOther
  34632. * getLn10 P.logarithm, naturalLogarithm
  34633. * getPi P.acos, P.asin, P.atan, toLessThanHalfPi, atan2
  34634. * getPrecision P.precision, P.toFraction
  34635. * getZeroString digitsToString, finiteToString
  34636. * intPow P.toPower, parseOther
  34637. * isOdd toLessThanHalfPi
  34638. * maxOrMin max, min
  34639. * naturalExponential P.naturalExponential, P.toPower
  34640. * naturalLogarithm P.acosh, P.asinh, P.atanh, P.logarithm, P.naturalLogarithm,
  34641. * P.toPower, naturalExponential
  34642. * nonFiniteToString finiteToString, toStringBinary
  34643. * parseDecimal Decimal
  34644. * parseOther Decimal
  34645. * sin P.sin
  34646. * taylorSeries P.cosh, P.sinh, cos, sin
  34647. * toLessThanHalfPi P.cos, P.sin
  34648. * toStringBinary P.toBinary, P.toHexadecimal, P.toOctal
  34649. * truncate intPow
  34650. *
  34651. * Throws: P.logarithm, P.precision, P.toFraction, checkInt32, getLn10, getPi,
  34652. * naturalLogarithm, config, parseOther, random, Decimal
  34653. */
  34654. function digitsToString(d) {
  34655. var i,
  34656. k,
  34657. ws,
  34658. indexOfLastWord = d.length - 1,
  34659. str = '',
  34660. w = d[0];
  34661. if (indexOfLastWord > 0) {
  34662. str += w;
  34663. for (i = 1; i < indexOfLastWord; i++) {
  34664. ws = d[i] + '';
  34665. k = LOG_BASE - ws.length;
  34666. if (k) str += getZeroString(k);
  34667. str += ws;
  34668. }
  34669. w = d[i];
  34670. ws = w + '';
  34671. k = LOG_BASE - ws.length;
  34672. if (k) str += getZeroString(k);
  34673. } else if (w === 0) {
  34674. return '0';
  34675. }
  34676. // Remove trailing zeros of last w.
  34677. for (; w % 10 === 0;) {
  34678. w /= 10;
  34679. }return str + w;
  34680. }
  34681. function checkInt32(i, min, max) {
  34682. if (i !== ~~i || i < min || i > max) {
  34683. throw Error(invalidArgument + i);
  34684. }
  34685. }
  34686. /*
  34687. * Check 5 rounding digits if `repeating` is null, 4 otherwise.
  34688. * `repeating == null` if caller is `log` or `pow`,
  34689. * `repeating != null` if caller is `naturalLogarithm` or `naturalExponential`.
  34690. */
  34691. function checkRoundingDigits(d, i, rm, repeating) {
  34692. var di, k, r, rd;
  34693. // Get the length of the first word of the array d.
  34694. for (k = d[0]; k >= 10; k /= 10) {
  34695. --i;
  34696. } // Is the rounding digit in the first word of d?
  34697. if (--i < 0) {
  34698. i += LOG_BASE;
  34699. di = 0;
  34700. } else {
  34701. di = Math.ceil((i + 1) / LOG_BASE);
  34702. i %= LOG_BASE;
  34703. }
  34704. // i is the index (0 - 6) of the rounding digit.
  34705. // E.g. if within the word 3487563 the first rounding digit is 5,
  34706. // then i = 4, k = 1000, rd = 3487563 % 1000 = 563
  34707. k = mathpow(10, LOG_BASE - i);
  34708. rd = d[di] % k | 0;
  34709. if (repeating == null) {
  34710. if (i < 3) {
  34711. if (i == 0) rd = rd / 100 | 0;else if (i == 1) rd = rd / 10 | 0;
  34712. r = rm < 4 && rd == 99999 || rm > 3 && rd == 49999 || rd == 50000 || rd == 0;
  34713. } else {
  34714. r = (rm < 4 && rd + 1 == k || rm > 3 && rd + 1 == k / 2) && (d[di + 1] / k / 100 | 0) == mathpow(10, i - 2) - 1 || (rd == k / 2 || rd == 0) && (d[di + 1] / k / 100 | 0) == 0;
  34715. }
  34716. } else {
  34717. if (i < 4) {
  34718. if (i == 0) rd = rd / 1000 | 0;else if (i == 1) rd = rd / 100 | 0;else if (i == 2) rd = rd / 10 | 0;
  34719. r = (repeating || rm < 4) && rd == 9999 || !repeating && rm > 3 && rd == 4999;
  34720. } else {
  34721. r = ((repeating || rm < 4) && rd + 1 == k || !repeating && rm > 3 && rd + 1 == k / 2) && (d[di + 1] / k / 1000 | 0) == mathpow(10, i - 3) - 1;
  34722. }
  34723. }
  34724. return r;
  34725. }
  34726. // Convert string of `baseIn` to an array of numbers of `baseOut`.
  34727. // Eg. convertBase('255', 10, 16) returns [15, 15].
  34728. // Eg. convertBase('ff', 16, 10) returns [2, 5, 5].
  34729. function convertBase(str, baseIn, baseOut) {
  34730. var j,
  34731. arr = [0],
  34732. arrL,
  34733. i = 0,
  34734. strL = str.length;
  34735. for (; i < strL;) {
  34736. for (arrL = arr.length; arrL--;) {
  34737. arr[arrL] *= baseIn;
  34738. }arr[0] += NUMERALS.indexOf(str.charAt(i++));
  34739. for (j = 0; j < arr.length; j++) {
  34740. if (arr[j] > baseOut - 1) {
  34741. if (arr[j + 1] === void 0) arr[j + 1] = 0;
  34742. arr[j + 1] += arr[j] / baseOut | 0;
  34743. arr[j] %= baseOut;
  34744. }
  34745. }
  34746. }
  34747. return arr.reverse();
  34748. }
  34749. /*
  34750. * cos(x) = 1 - x^2/2! + x^4/4! - ...
  34751. * |x| < pi/2
  34752. *
  34753. */
  34754. function cosine(Ctor, x) {
  34755. var k,
  34756. y,
  34757. len = x.d.length;
  34758. // Argument reduction: cos(4x) = 8*(cos^4(x) - cos^2(x)) + 1
  34759. // i.e. cos(x) = 8*(cos^4(x/4) - cos^2(x/4)) + 1
  34760. // Estimate the optimum number of times to use the argument reduction.
  34761. if (len < 32) {
  34762. k = Math.ceil(len / 3);
  34763. y = Math.pow(4, -k).toString();
  34764. } else {
  34765. k = 16;
  34766. y = '2.3283064365386962890625e-10';
  34767. }
  34768. Ctor.precision += k;
  34769. x = taylorSeries(Ctor, 1, x.times(y), new Ctor(1));
  34770. // Reverse argument reduction
  34771. for (var i = k; i--;) {
  34772. var cos2x = x.times(x);
  34773. x = cos2x.times(cos2x).minus(cos2x).times(8).plus(1);
  34774. }
  34775. Ctor.precision -= k;
  34776. return x;
  34777. }
  34778. /*
  34779. * Perform division in the specified base.
  34780. */
  34781. var divide = function () {
  34782. // Assumes non-zero x and k, and hence non-zero result.
  34783. function multiplyInteger(x, k, base) {
  34784. var temp,
  34785. carry = 0,
  34786. i = x.length;
  34787. for (x = x.slice(); i--;) {
  34788. temp = x[i] * k + carry;
  34789. x[i] = temp % base | 0;
  34790. carry = temp / base | 0;
  34791. }
  34792. if (carry) x.unshift(carry);
  34793. return x;
  34794. }
  34795. function compare(a, b, aL, bL) {
  34796. var i, r;
  34797. if (aL != bL) {
  34798. r = aL > bL ? 1 : -1;
  34799. } else {
  34800. for (i = r = 0; i < aL; i++) {
  34801. if (a[i] != b[i]) {
  34802. r = a[i] > b[i] ? 1 : -1;
  34803. break;
  34804. }
  34805. }
  34806. }
  34807. return r;
  34808. }
  34809. function subtract(a, b, aL, base) {
  34810. var i = 0;
  34811. // Subtract b from a.
  34812. for (; aL--;) {
  34813. a[aL] -= i;
  34814. i = a[aL] < b[aL] ? 1 : 0;
  34815. a[aL] = i * base + a[aL] - b[aL];
  34816. }
  34817. // Remove leading zeros.
  34818. for (; !a[0] && a.length > 1;) {
  34819. a.shift();
  34820. }
  34821. }
  34822. return function (x, y, pr, rm, dp, base) {
  34823. var cmp,
  34824. e,
  34825. i,
  34826. k,
  34827. logBase,
  34828. more,
  34829. prod,
  34830. prodL,
  34831. q,
  34832. qd,
  34833. rem,
  34834. remL,
  34835. rem0,
  34836. sd,
  34837. t,
  34838. xi,
  34839. xL,
  34840. yd0,
  34841. yL,
  34842. yz,
  34843. Ctor = x.constructor,
  34844. sign = x.s == y.s ? 1 : -1,
  34845. xd = x.d,
  34846. yd = y.d;
  34847. // Either NaN, Infinity or 0?
  34848. if (!xd || !xd[0] || !yd || !yd[0]) {
  34849. return new Ctor( // Return NaN if either NaN, or both Infinity or 0.
  34850. !x.s || !y.s || (xd ? yd && xd[0] == yd[0] : !yd) ? NaN :
  34851. // Return ±0 if x is 0 or y is ±Infinity, or return ±Infinity as y is 0.
  34852. xd && xd[0] == 0 || !yd ? sign * 0 : sign / 0);
  34853. }
  34854. if (base) {
  34855. logBase = 1;
  34856. e = x.e - y.e;
  34857. } else {
  34858. base = BASE;
  34859. logBase = LOG_BASE;
  34860. e = mathfloor(x.e / logBase) - mathfloor(y.e / logBase);
  34861. }
  34862. yL = yd.length;
  34863. xL = xd.length;
  34864. q = new Ctor(sign);
  34865. qd = q.d = [];
  34866. // Result exponent may be one less than e.
  34867. // The digit array of a Decimal from toStringBinary may have trailing zeros.
  34868. for (i = 0; yd[i] == (xd[i] || 0); i++) {}
  34869. if (yd[i] > (xd[i] || 0)) e--;
  34870. if (pr == null) {
  34871. sd = pr = Ctor.precision;
  34872. rm = Ctor.rounding;
  34873. } else if (dp) {
  34874. sd = pr + (x.e - y.e) + 1;
  34875. } else {
  34876. sd = pr;
  34877. }
  34878. if (sd < 0) {
  34879. qd.push(1);
  34880. more = true;
  34881. } else {
  34882. // Convert precision in number of base 10 digits to base 1e7 digits.
  34883. sd = sd / logBase + 2 | 0;
  34884. i = 0;
  34885. // divisor < 1e7
  34886. if (yL == 1) {
  34887. k = 0;
  34888. yd = yd[0];
  34889. sd++;
  34890. // k is the carry.
  34891. for (; (i < xL || k) && sd--; i++) {
  34892. t = k * base + (xd[i] || 0);
  34893. qd[i] = t / yd | 0;
  34894. k = t % yd | 0;
  34895. }
  34896. more = k || i < xL;
  34897. // divisor >= 1e7
  34898. } else {
  34899. // Normalise xd and yd so highest order digit of yd is >= base/2
  34900. k = base / (yd[0] + 1) | 0;
  34901. if (k > 1) {
  34902. yd = multiplyInteger(yd, k, base);
  34903. xd = multiplyInteger(xd, k, base);
  34904. yL = yd.length;
  34905. xL = xd.length;
  34906. }
  34907. xi = yL;
  34908. rem = xd.slice(0, yL);
  34909. remL = rem.length;
  34910. // Add zeros to make remainder as long as divisor.
  34911. for (; remL < yL;) {
  34912. rem[remL++] = 0;
  34913. }yz = yd.slice();
  34914. yz.unshift(0);
  34915. yd0 = yd[0];
  34916. if (yd[1] >= base / 2) ++yd0;
  34917. do {
  34918. k = 0;
  34919. // Compare divisor and remainder.
  34920. cmp = compare(yd, rem, yL, remL);
  34921. // If divisor < remainder.
  34922. if (cmp < 0) {
  34923. // Calculate trial digit, k.
  34924. rem0 = rem[0];
  34925. if (yL != remL) rem0 = rem0 * base + (rem[1] || 0);
  34926. // k will be how many times the divisor goes into the current remainder.
  34927. k = rem0 / yd0 | 0;
  34928. // Algorithm:
  34929. // 1. product = divisor * trial digit (k)
  34930. // 2. if product > remainder: product -= divisor, k--
  34931. // 3. remainder -= product
  34932. // 4. if product was < remainder at 2:
  34933. // 5. compare new remainder and divisor
  34934. // 6. If remainder > divisor: remainder -= divisor, k++
  34935. if (k > 1) {
  34936. if (k >= base) k = base - 1;
  34937. // product = divisor * trial digit.
  34938. prod = multiplyInteger(yd, k, base);
  34939. prodL = prod.length;
  34940. remL = rem.length;
  34941. // Compare product and remainder.
  34942. cmp = compare(prod, rem, prodL, remL);
  34943. // product > remainder.
  34944. if (cmp == 1) {
  34945. k--;
  34946. // Subtract divisor from product.
  34947. subtract(prod, yL < prodL ? yz : yd, prodL, base);
  34948. }
  34949. } else {
  34950. // cmp is -1.
  34951. // If k is 0, there is no need to compare yd and rem again below, so change cmp to 1
  34952. // to avoid it. If k is 1 there is a need to compare yd and rem again below.
  34953. if (k == 0) cmp = k = 1;
  34954. prod = yd.slice();
  34955. }
  34956. prodL = prod.length;
  34957. if (prodL < remL) prod.unshift(0);
  34958. // Subtract product from remainder.
  34959. subtract(rem, prod, remL, base);
  34960. // If product was < previous remainder.
  34961. if (cmp == -1) {
  34962. remL = rem.length;
  34963. // Compare divisor and new remainder.
  34964. cmp = compare(yd, rem, yL, remL);
  34965. // If divisor < new remainder, subtract divisor from remainder.
  34966. if (cmp < 1) {
  34967. k++;
  34968. // Subtract divisor from remainder.
  34969. subtract(rem, yL < remL ? yz : yd, remL, base);
  34970. }
  34971. }
  34972. remL = rem.length;
  34973. } else if (cmp === 0) {
  34974. k++;
  34975. rem = [0];
  34976. } // if cmp === 1, k will be 0
  34977. // Add the next digit, k, to the result array.
  34978. qd[i++] = k;
  34979. // Update the remainder.
  34980. if (cmp && rem[0]) {
  34981. rem[remL++] = xd[xi] || 0;
  34982. } else {
  34983. rem = [xd[xi]];
  34984. remL = 1;
  34985. }
  34986. } while ((xi++ < xL || rem[0] !== void 0) && sd--);
  34987. more = rem[0] !== void 0;
  34988. }
  34989. // Leading zero?
  34990. if (!qd[0]) qd.shift();
  34991. }
  34992. // logBase is 1 when divide is being used for base conversion.
  34993. if (logBase == 1) {
  34994. q.e = e;
  34995. inexact = more;
  34996. } else {
  34997. // To calculate q.e, first get the number of digits of qd[0].
  34998. for (i = 1, k = qd[0]; k >= 10; k /= 10) {
  34999. i++;
  35000. }q.e = i + e * logBase - 1;
  35001. finalise(q, dp ? pr + q.e + 1 : pr, rm, more);
  35002. }
  35003. return q;
  35004. };
  35005. }();
  35006. /*
  35007. * Round `x` to `sd` significant digits using rounding mode `rm`.
  35008. * Check for over/under-flow.
  35009. */
  35010. function finalise(x, sd, rm, isTruncated) {
  35011. var digits,
  35012. i,
  35013. j,
  35014. k,
  35015. rd,
  35016. roundUp,
  35017. w,
  35018. xd,
  35019. xdi,
  35020. Ctor = x.constructor;
  35021. // Don't round if sd is null or undefined.
  35022. out: if (sd != null) {
  35023. xd = x.d;
  35024. // Infinity/NaN.
  35025. if (!xd) return x;
  35026. // rd: the rounding digit, i.e. the digit after the digit that may be rounded up.
  35027. // w: the word of xd containing rd, a base 1e7 number.
  35028. // xdi: the index of w within xd.
  35029. // digits: the number of digits of w.
  35030. // i: what would be the index of rd within w if all the numbers were 7 digits long (i.e. if
  35031. // they had leading zeros)
  35032. // j: if > 0, the actual index of rd within w (if < 0, rd is a leading zero).
  35033. // Get the length of the first word of the digits array xd.
  35034. for (digits = 1, k = xd[0]; k >= 10; k /= 10) {
  35035. digits++;
  35036. }i = sd - digits;
  35037. // Is the rounding digit in the first word of xd?
  35038. if (i < 0) {
  35039. i += LOG_BASE;
  35040. j = sd;
  35041. w = xd[xdi = 0];
  35042. // Get the rounding digit at index j of w.
  35043. rd = w / mathpow(10, digits - j - 1) % 10 | 0;
  35044. } else {
  35045. xdi = Math.ceil((i + 1) / LOG_BASE);
  35046. k = xd.length;
  35047. if (xdi >= k) {
  35048. if (isTruncated) {
  35049. // Needed by `naturalExponential`, `naturalLogarithm` and `squareRoot`.
  35050. for (; k++ <= xdi;) {
  35051. xd.push(0);
  35052. }w = rd = 0;
  35053. digits = 1;
  35054. i %= LOG_BASE;
  35055. j = i - LOG_BASE + 1;
  35056. } else {
  35057. break out;
  35058. }
  35059. } else {
  35060. w = k = xd[xdi];
  35061. // Get the number of digits of w.
  35062. for (digits = 1; k >= 10; k /= 10) {
  35063. digits++;
  35064. } // Get the index of rd within w.
  35065. i %= LOG_BASE;
  35066. // Get the index of rd within w, adjusted for leading zeros.
  35067. // The number of leading zeros of w is given by LOG_BASE - digits.
  35068. j = i - LOG_BASE + digits;
  35069. // Get the rounding digit at index j of w.
  35070. rd = j < 0 ? 0 : w / mathpow(10, digits - j - 1) % 10 | 0;
  35071. }
  35072. }
  35073. // Are there any non-zero digits after the rounding digit?
  35074. isTruncated = isTruncated || sd < 0 || xd[xdi + 1] !== void 0 || (j < 0 ? w : w % mathpow(10, digits - j - 1));
  35075. // The expression `w % mathpow(10, digits - j - 1)` returns all the digits of w to the right
  35076. // of the digit at (left-to-right) index j, e.g. if w is 908714 and j is 2, the expression
  35077. // will give 714.
  35078. roundUp = rm < 4 ? (rd || isTruncated) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) : rd > 5 || rd == 5 && (rm == 4 || isTruncated || rm == 6 &&
  35079. // Check whether the digit to the left of the rounding digit is odd.
  35080. (i > 0 ? j > 0 ? w / mathpow(10, digits - j) : 0 : xd[xdi - 1]) % 10 & 1 || rm == (x.s < 0 ? 8 : 7));
  35081. if (sd < 1 || !xd[0]) {
  35082. xd.length = 0;
  35083. if (roundUp) {
  35084. // Convert sd to decimal places.
  35085. sd -= x.e + 1;
  35086. // 1, 0.1, 0.01, 0.001, 0.0001 etc.
  35087. xd[0] = mathpow(10, (LOG_BASE - sd % LOG_BASE) % LOG_BASE);
  35088. x.e = -sd || 0;
  35089. } else {
  35090. // Zero.
  35091. xd[0] = x.e = 0;
  35092. }
  35093. return x;
  35094. }
  35095. // Remove excess digits.
  35096. if (i == 0) {
  35097. xd.length = xdi;
  35098. k = 1;
  35099. xdi--;
  35100. } else {
  35101. xd.length = xdi + 1;
  35102. k = mathpow(10, LOG_BASE - i);
  35103. // E.g. 56700 becomes 56000 if 7 is the rounding digit.
  35104. // j > 0 means i > number of leading zeros of w.
  35105. xd[xdi] = j > 0 ? (w / mathpow(10, digits - j) % mathpow(10, j) | 0) * k : 0;
  35106. }
  35107. if (roundUp) {
  35108. for (;;) {
  35109. // Is the digit to be rounded up in the first word of xd?
  35110. if (xdi == 0) {
  35111. // i will be the length of xd[0] before k is added.
  35112. for (i = 1, j = xd[0]; j >= 10; j /= 10) {
  35113. i++;
  35114. }j = xd[0] += k;
  35115. for (k = 1; j >= 10; j /= 10) {
  35116. k++;
  35117. } // if i != k the length has increased.
  35118. if (i != k) {
  35119. x.e++;
  35120. if (xd[0] == BASE) xd[0] = 1;
  35121. }
  35122. break;
  35123. } else {
  35124. xd[xdi] += k;
  35125. if (xd[xdi] != BASE) break;
  35126. xd[xdi--] = 0;
  35127. k = 1;
  35128. }
  35129. }
  35130. }
  35131. // Remove trailing zeros.
  35132. for (i = xd.length; xd[--i] === 0;) {
  35133. xd.pop();
  35134. }
  35135. }
  35136. if (external) {
  35137. // Overflow?
  35138. if (x.e > Ctor.maxE) {
  35139. // Infinity.
  35140. x.d = null;
  35141. x.e = NaN;
  35142. // Underflow?
  35143. } else if (x.e < Ctor.minE) {
  35144. // Zero.
  35145. x.e = 0;
  35146. x.d = [0];
  35147. // Ctor.underflow = true;
  35148. } // else Ctor.underflow = false;
  35149. }
  35150. return x;
  35151. }
  35152. function finiteToString(x, isExp, sd) {
  35153. if (!x.isFinite()) return nonFiniteToString(x);
  35154. var k,
  35155. e = x.e,
  35156. str = digitsToString(x.d),
  35157. len = str.length;
  35158. if (isExp) {
  35159. if (sd && (k = sd - len) > 0) {
  35160. str = str.charAt(0) + '.' + str.slice(1) + getZeroString(k);
  35161. } else if (len > 1) {
  35162. str = str.charAt(0) + '.' + str.slice(1);
  35163. }
  35164. str = str + (x.e < 0 ? 'e' : 'e+') + x.e;
  35165. } else if (e < 0) {
  35166. str = '0.' + getZeroString(-e - 1) + str;
  35167. if (sd && (k = sd - len) > 0) str += getZeroString(k);
  35168. } else if (e >= len) {
  35169. str += getZeroString(e + 1 - len);
  35170. if (sd && (k = sd - e - 1) > 0) str = str + '.' + getZeroString(k);
  35171. } else {
  35172. if ((k = e + 1) < len) str = str.slice(0, k) + '.' + str.slice(k);
  35173. if (sd && (k = sd - len) > 0) {
  35174. if (e + 1 === len) str += '.';
  35175. str += getZeroString(k);
  35176. }
  35177. }
  35178. return str;
  35179. }
  35180. // Calculate the base 10 exponent from the base 1e7 exponent.
  35181. function getBase10Exponent(digits, e) {
  35182. var w = digits[0];
  35183. // Add the number of digits of the first word of the digits array.
  35184. for (e *= LOG_BASE; w >= 10; w /= 10) {
  35185. e++;
  35186. }return e;
  35187. }
  35188. function getLn10(Ctor, sd, pr) {
  35189. if (sd > LN10_PRECISION) {
  35190. // Reset global state in case the exception is caught.
  35191. external = true;
  35192. if (pr) Ctor.precision = pr;
  35193. throw Error(precisionLimitExceeded);
  35194. }
  35195. return finalise(new Ctor(LN10), sd, 1, true);
  35196. }
  35197. function getPi(Ctor, sd, rm) {
  35198. if (sd > PI_PRECISION) throw Error(precisionLimitExceeded);
  35199. return finalise(new Ctor(PI), sd, rm, true);
  35200. }
  35201. function getPrecision(digits) {
  35202. var w = digits.length - 1,
  35203. len = w * LOG_BASE + 1;
  35204. w = digits[w];
  35205. // If non-zero...
  35206. if (w) {
  35207. // Subtract the number of trailing zeros of the last word.
  35208. for (; w % 10 == 0; w /= 10) {
  35209. len--;
  35210. } // Add the number of digits of the first word.
  35211. for (w = digits[0]; w >= 10; w /= 10) {
  35212. len++;
  35213. }
  35214. }
  35215. return len;
  35216. }
  35217. function getZeroString(k) {
  35218. var zs = '';
  35219. for (; k--;) {
  35220. zs += '0';
  35221. }return zs;
  35222. }
  35223. /*
  35224. * Return a new Decimal whose value is the value of Decimal `x` to the power `n`, where `n` is an
  35225. * integer of type number.
  35226. *
  35227. * Implements 'exponentiation by squaring'. Called by `pow` and `parseOther`.
  35228. *
  35229. */
  35230. function intPow(Ctor, x, n, pr) {
  35231. var isTruncated,
  35232. r = new Ctor(1),
  35233. // Max n of 9007199254740991 takes 53 loop iterations.
  35234. // Maximum digits array length; leaves [28, 34] guard digits.
  35235. k = Math.ceil(pr / LOG_BASE + 4);
  35236. external = false;
  35237. for (;;) {
  35238. if (n % 2) {
  35239. r = r.times(x);
  35240. if (truncate(r.d, k)) isTruncated = true;
  35241. }
  35242. n = mathfloor(n / 2);
  35243. if (n === 0) {
  35244. // To ensure correct rounding when r.d is truncated, increment the last word if it is zero.
  35245. n = r.d.length - 1;
  35246. if (isTruncated && r.d[n] === 0) ++r.d[n];
  35247. break;
  35248. }
  35249. x = x.times(x);
  35250. truncate(x.d, k);
  35251. }
  35252. external = true;
  35253. return r;
  35254. }
  35255. function isOdd(n) {
  35256. return n.d[n.d.length - 1] & 1;
  35257. }
  35258. /*
  35259. * Handle `max` and `min`. `ltgt` is 'lt' or 'gt'.
  35260. */
  35261. function maxOrMin(Ctor, args, ltgt) {
  35262. var y,
  35263. x = new Ctor(args[0]),
  35264. i = 0;
  35265. for (; ++i < args.length;) {
  35266. y = new Ctor(args[i]);
  35267. if (!y.s) {
  35268. x = y;
  35269. break;
  35270. } else if (x[ltgt](y)) {
  35271. x = y;
  35272. }
  35273. }
  35274. return x;
  35275. }
  35276. /*
  35277. * Return a new Decimal whose value is the natural exponential of `x` rounded to `sd` significant
  35278. * digits.
  35279. *
  35280. * Taylor/Maclaurin series.
  35281. *
  35282. * exp(x) = x^0/0! + x^1/1! + x^2/2! + x^3/3! + ...
  35283. *
  35284. * Argument reduction:
  35285. * Repeat x = x / 32, k += 5, until |x| < 0.1
  35286. * exp(x) = exp(x / 2^k)^(2^k)
  35287. *
  35288. * Previously, the argument was initially reduced by
  35289. * exp(x) = exp(r) * 10^k where r = x - k * ln10, k = floor(x / ln10)
  35290. * to first put r in the range [0, ln10], before dividing by 32 until |x| < 0.1, but this was
  35291. * found to be slower than just dividing repeatedly by 32 as above.
  35292. *
  35293. * Max integer argument: exp('20723265836946413') = 6.3e+9000000000000000
  35294. * Min integer argument: exp('-20723265836946411') = 1.2e-9000000000000000
  35295. * (Math object integer min/max: Math.exp(709) = 8.2e+307, Math.exp(-745) = 5e-324)
  35296. *
  35297. * exp(Infinity) = Infinity
  35298. * exp(-Infinity) = 0
  35299. * exp(NaN) = NaN
  35300. * exp(±0) = 1
  35301. *
  35302. * exp(x) is non-terminating for any finite, non-zero x.
  35303. *
  35304. * The result will always be correctly rounded.
  35305. *
  35306. */
  35307. function naturalExponential(x, sd) {
  35308. var denominator,
  35309. guard,
  35310. j,
  35311. pow,
  35312. sum,
  35313. t,
  35314. wpr,
  35315. rep = 0,
  35316. i = 0,
  35317. k = 0,
  35318. Ctor = x.constructor,
  35319. rm = Ctor.rounding,
  35320. pr = Ctor.precision;
  35321. // 0/NaN/Infinity?
  35322. if (!x.d || !x.d[0] || x.e > 17) {
  35323. return new Ctor(x.d ? !x.d[0] ? 1 : x.s < 0 ? 0 : 1 / 0 : x.s ? x.s < 0 ? 0 : x : 0 / 0);
  35324. }
  35325. if (sd == null) {
  35326. external = false;
  35327. wpr = pr;
  35328. } else {
  35329. wpr = sd;
  35330. }
  35331. t = new Ctor(0.03125);
  35332. // while abs(x) >= 0.1
  35333. while (x.e > -2) {
  35334. // x = x / 2^5
  35335. x = x.times(t);
  35336. k += 5;
  35337. }
  35338. // Use 2 * log10(2^k) + 5 (empirically derived) to estimate the increase in precision
  35339. // necessary to ensure the first 4 rounding digits are correct.
  35340. guard = Math.log(mathpow(2, k)) / Math.LN10 * 2 + 5 | 0;
  35341. wpr += guard;
  35342. denominator = pow = sum = new Ctor(1);
  35343. Ctor.precision = wpr;
  35344. for (;;) {
  35345. pow = finalise(pow.times(x), wpr, 1);
  35346. denominator = denominator.times(++i);
  35347. t = sum.plus(divide(pow, denominator, wpr, 1));
  35348. if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) {
  35349. j = k;
  35350. while (j--) {
  35351. sum = finalise(sum.times(sum), wpr, 1);
  35352. } // Check to see if the first 4 rounding digits are [49]999.
  35353. // If so, repeat the summation with a higher precision, otherwise
  35354. // e.g. with precision: 18, rounding: 1
  35355. // exp(18.404272462595034083567793919843761) = 98372560.1229999999 (should be 98372560.123)
  35356. // `wpr - guard` is the index of first rounding digit.
  35357. if (sd == null) {
  35358. if (rep < 3 && checkRoundingDigits(sum.d, wpr - guard, rm, rep)) {
  35359. Ctor.precision = wpr += 10;
  35360. denominator = pow = t = new Ctor(1);
  35361. i = 0;
  35362. rep++;
  35363. } else {
  35364. return finalise(sum, Ctor.precision = pr, rm, external = true);
  35365. }
  35366. } else {
  35367. Ctor.precision = pr;
  35368. return sum;
  35369. }
  35370. }
  35371. sum = t;
  35372. }
  35373. }
  35374. /*
  35375. * Return a new Decimal whose value is the natural logarithm of `x` rounded to `sd` significant
  35376. * digits.
  35377. *
  35378. * ln(-n) = NaN
  35379. * ln(0) = -Infinity
  35380. * ln(-0) = -Infinity
  35381. * ln(1) = 0
  35382. * ln(Infinity) = Infinity
  35383. * ln(-Infinity) = NaN
  35384. * ln(NaN) = NaN
  35385. *
  35386. * ln(n) (n != 1) is non-terminating.
  35387. *
  35388. */
  35389. function naturalLogarithm(y, sd) {
  35390. var c,
  35391. c0,
  35392. denominator,
  35393. e,
  35394. numerator,
  35395. rep,
  35396. sum,
  35397. t,
  35398. wpr,
  35399. x1,
  35400. x2,
  35401. n = 1,
  35402. guard = 10,
  35403. x = y,
  35404. xd = x.d,
  35405. Ctor = x.constructor,
  35406. rm = Ctor.rounding,
  35407. pr = Ctor.precision;
  35408. // Is x negative or Infinity, NaN, 0 or 1?
  35409. if (x.s < 0 || !xd || !xd[0] || !x.e && xd[0] == 1 && xd.length == 1) {
  35410. return new Ctor(xd && !xd[0] ? -1 / 0 : x.s != 1 ? NaN : xd ? 0 : x);
  35411. }
  35412. if (sd == null) {
  35413. external = false;
  35414. wpr = pr;
  35415. } else {
  35416. wpr = sd;
  35417. }
  35418. Ctor.precision = wpr += guard;
  35419. c = digitsToString(xd);
  35420. c0 = c.charAt(0);
  35421. if (Math.abs(e = x.e) < 1.5e15) {
  35422. // Argument reduction.
  35423. // The series converges faster the closer the argument is to 1, so using
  35424. // ln(a^b) = b * ln(a), ln(a) = ln(a^b) / b
  35425. // multiply the argument by itself until the leading digits of the significand are 7, 8, 9,
  35426. // 10, 11, 12 or 13, recording the number of multiplications so the sum of the series can
  35427. // later be divided by this number, then separate out the power of 10 using
  35428. // ln(a*10^b) = ln(a) + b*ln(10).
  35429. // max n is 21 (gives 0.9, 1.0 or 1.1) (9e15 / 21 = 4.2e14).
  35430. //while (c0 < 9 && c0 != 1 || c0 == 1 && c.charAt(1) > 1) {
  35431. // max n is 6 (gives 0.7 - 1.3)
  35432. while (c0 < 7 && c0 != 1 || c0 == 1 && c.charAt(1) > 3) {
  35433. x = x.times(y);
  35434. c = digitsToString(x.d);
  35435. c0 = c.charAt(0);
  35436. n++;
  35437. }
  35438. e = x.e;
  35439. if (c0 > 1) {
  35440. x = new Ctor('0.' + c);
  35441. e++;
  35442. } else {
  35443. x = new Ctor(c0 + '.' + c.slice(1));
  35444. }
  35445. } else {
  35446. // The argument reduction method above may result in overflow if the argument y is a massive
  35447. // number with exponent >= 1500000000000000 (9e15 / 6 = 1.5e15), so instead recall this
  35448. // function using ln(x*10^e) = ln(x) + e*ln(10).
  35449. t = getLn10(Ctor, wpr + 2, pr).times(e + '');
  35450. x = naturalLogarithm(new Ctor(c0 + '.' + c.slice(1)), wpr - guard).plus(t);
  35451. Ctor.precision = pr;
  35452. return sd == null ? finalise(x, pr, rm, external = true) : x;
  35453. }
  35454. // x1 is x reduced to a value near 1.
  35455. x1 = x;
  35456. // Taylor series.
  35457. // ln(y) = ln((1 + x)/(1 - x)) = 2(x + x^3/3 + x^5/5 + x^7/7 + ...)
  35458. // where x = (y - 1)/(y + 1) (|x| < 1)
  35459. sum = numerator = x = divide(x.minus(1), x.plus(1), wpr, 1);
  35460. x2 = finalise(x.times(x), wpr, 1);
  35461. denominator = 3;
  35462. for (;;) {
  35463. numerator = finalise(numerator.times(x2), wpr, 1);
  35464. t = sum.plus(divide(numerator, new Ctor(denominator), wpr, 1));
  35465. if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) {
  35466. sum = sum.times(2);
  35467. // Reverse the argument reduction. Check that e is not 0 because, besides preventing an
  35468. // unnecessary calculation, -0 + 0 = +0 and to ensure correct rounding -0 needs to stay -0.
  35469. if (e !== 0) sum = sum.plus(getLn10(Ctor, wpr + 2, pr).times(e + ''));
  35470. sum = divide(sum, new Ctor(n), wpr, 1);
  35471. // Is rm > 3 and the first 4 rounding digits 4999, or rm < 4 (or the summation has
  35472. // been repeated previously) and the first 4 rounding digits 9999?
  35473. // If so, restart the summation with a higher precision, otherwise
  35474. // e.g. with precision: 12, rounding: 1
  35475. // ln(135520028.6126091714265381533) = 18.7246299999 when it should be 18.72463.
  35476. // `wpr - guard` is the index of first rounding digit.
  35477. if (sd == null) {
  35478. if (checkRoundingDigits(sum.d, wpr - guard, rm, rep)) {
  35479. Ctor.precision = wpr += guard;
  35480. t = numerator = x = divide(x1.minus(1), x1.plus(1), wpr, 1);
  35481. x2 = finalise(x.times(x), wpr, 1);
  35482. denominator = rep = 1;
  35483. } else {
  35484. return finalise(sum, Ctor.precision = pr, rm, external = true);
  35485. }
  35486. } else {
  35487. Ctor.precision = pr;
  35488. return sum;
  35489. }
  35490. }
  35491. sum = t;
  35492. denominator += 2;
  35493. }
  35494. }
  35495. // ±Infinity, NaN.
  35496. function nonFiniteToString(x) {
  35497. // Unsigned.
  35498. return String(x.s * x.s / 0);
  35499. }
  35500. /*
  35501. * Parse the value of a new Decimal `x` from string `str`.
  35502. */
  35503. function parseDecimal(x, str) {
  35504. var e, i, len;
  35505. // Decimal point?
  35506. if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');
  35507. // Exponential form?
  35508. if ((i = str.search(/e/i)) > 0) {
  35509. // Determine exponent.
  35510. if (e < 0) e = i;
  35511. e += +str.slice(i + 1);
  35512. str = str.substring(0, i);
  35513. } else if (e < 0) {
  35514. // Integer.
  35515. e = str.length;
  35516. }
  35517. // Determine leading zeros.
  35518. for (i = 0; str.charCodeAt(i) === 48; i++) {}
  35519. // Determine trailing zeros.
  35520. for (len = str.length; str.charCodeAt(len - 1) === 48; --len) {}
  35521. str = str.slice(i, len);
  35522. if (str) {
  35523. len -= i;
  35524. x.e = e = e - i - 1;
  35525. x.d = [];
  35526. // Transform base
  35527. // e is the base 10 exponent.
  35528. // i is where to slice str to get the first word of the digits array.
  35529. i = (e + 1) % LOG_BASE;
  35530. if (e < 0) i += LOG_BASE;
  35531. if (i < len) {
  35532. if (i) x.d.push(+str.slice(0, i));
  35533. for (len -= LOG_BASE; i < len;) {
  35534. x.d.push(+str.slice(i, i += LOG_BASE));
  35535. }str = str.slice(i);
  35536. i = LOG_BASE - str.length;
  35537. } else {
  35538. i -= len;
  35539. }
  35540. for (; i--;) {
  35541. str += '0';
  35542. }x.d.push(+str);
  35543. if (external) {
  35544. // Overflow?
  35545. if (x.e > x.constructor.maxE) {
  35546. // Infinity.
  35547. x.d = null;
  35548. x.e = NaN;
  35549. // Underflow?
  35550. } else if (x.e < x.constructor.minE) {
  35551. // Zero.
  35552. x.e = 0;
  35553. x.d = [0];
  35554. // x.constructor.underflow = true;
  35555. } // else x.constructor.underflow = false;
  35556. }
  35557. } else {
  35558. // Zero.
  35559. x.e = 0;
  35560. x.d = [0];
  35561. }
  35562. return x;
  35563. }
  35564. /*
  35565. * Parse the value of a new Decimal `x` from a string `str`, which is not a decimal value.
  35566. */
  35567. function parseOther(x, str) {
  35568. var base, Ctor, divisor, i, isFloat, len, p, xd, xe;
  35569. if (str === 'Infinity' || str === 'NaN') {
  35570. if (!+str) x.s = NaN;
  35571. x.e = NaN;
  35572. x.d = null;
  35573. return x;
  35574. }
  35575. if (isHex.test(str)) {
  35576. base = 16;
  35577. str = str.toLowerCase();
  35578. } else if (isBinary.test(str)) {
  35579. base = 2;
  35580. } else if (isOctal.test(str)) {
  35581. base = 8;
  35582. } else {
  35583. throw Error(invalidArgument + str);
  35584. }
  35585. // Is there a binary exponent part?
  35586. i = str.search(/p/i);
  35587. if (i > 0) {
  35588. p = +str.slice(i + 1);
  35589. str = str.substring(2, i);
  35590. } else {
  35591. str = str.slice(2);
  35592. }
  35593. // Convert `str` as an integer then divide the result by `base` raised to a power such that the
  35594. // fraction part will be restored.
  35595. i = str.indexOf('.');
  35596. isFloat = i >= 0;
  35597. Ctor = x.constructor;
  35598. if (isFloat) {
  35599. str = str.replace('.', '');
  35600. len = str.length;
  35601. i = len - i;
  35602. // log[10](16) = 1.2041... , log[10](88) = 1.9444....
  35603. divisor = intPow(Ctor, new Ctor(base), i, i * 2);
  35604. }
  35605. xd = convertBase(str, base, BASE);
  35606. xe = xd.length - 1;
  35607. // Remove trailing zeros.
  35608. for (i = xe; xd[i] === 0; --i) {
  35609. xd.pop();
  35610. }if (i < 0) return new Ctor(x.s * 0);
  35611. x.e = getBase10Exponent(xd, xe);
  35612. x.d = xd;
  35613. external = false;
  35614. // At what precision to perform the division to ensure exact conversion?
  35615. // maxDecimalIntegerPartDigitCount = ceil(log[10](b) * otherBaseIntegerPartDigitCount)
  35616. // log[10](2) = 0.30103, log[10](8) = 0.90309, log[10](16) = 1.20412
  35617. // E.g. ceil(1.2 * 3) = 4, so up to 4 decimal digits are needed to represent 3 hex int digits.
  35618. // maxDecimalFractionPartDigitCount = {Hex:4|Oct:3|Bin:1} * otherBaseFractionPartDigitCount
  35619. // Therefore using 4 * the number of digits of str will always be enough.
  35620. if (isFloat) x = divide(x, divisor, len * 4);
  35621. // Multiply by the binary exponent part if present.
  35622. if (p) x = x.times(Math.abs(p) < 54 ? Math.pow(2, p) : Decimal.pow(2, p));
  35623. external = true;
  35624. return x;
  35625. }
  35626. /*
  35627. * sin(x) = x - x^3/3! + x^5/5! - ...
  35628. * |x| < pi/2
  35629. *
  35630. */
  35631. function sine(Ctor, x) {
  35632. var k,
  35633. len = x.d.length;
  35634. if (len < 3) return taylorSeries(Ctor, 2, x, x);
  35635. // Argument reduction: sin(5x) = 16*sin^5(x) - 20*sin^3(x) + 5*sin(x)
  35636. // i.e. sin(x) = 16*sin^5(x/5) - 20*sin^3(x/5) + 5*sin(x/5)
  35637. // and sin(x) = sin(x/5)(5 + sin^2(x/5)(16sin^2(x/5) - 20))
  35638. // Estimate the optimum number of times to use the argument reduction.
  35639. k = 1.4 * Math.sqrt(len);
  35640. k = k > 16 ? 16 : k | 0;
  35641. // Max k before Math.pow precision loss is 22
  35642. x = x.times(Math.pow(5, -k));
  35643. x = taylorSeries(Ctor, 2, x, x);
  35644. // Reverse argument reduction
  35645. var sin2_x,
  35646. d5 = new Ctor(5),
  35647. d16 = new Ctor(16),
  35648. d20 = new Ctor(20);
  35649. for (; k--;) {
  35650. sin2_x = x.times(x);
  35651. x = x.times(d5.plus(sin2_x.times(d16.times(sin2_x).minus(d20))));
  35652. }
  35653. return x;
  35654. }
  35655. // Calculate Taylor series for `cos`, `cosh`, `sin` and `sinh`.
  35656. function taylorSeries(Ctor, n, x, y, isHyperbolic) {
  35657. var j,
  35658. t,
  35659. u,
  35660. x2,
  35661. i = 1,
  35662. pr = Ctor.precision,
  35663. k = Math.ceil(pr / LOG_BASE);
  35664. external = false;
  35665. x2 = x.times(x);
  35666. u = new Ctor(y);
  35667. for (;;) {
  35668. t = divide(u.times(x2), new Ctor(n++ * n++), pr, 1);
  35669. u = isHyperbolic ? y.plus(t) : y.minus(t);
  35670. y = divide(t.times(x2), new Ctor(n++ * n++), pr, 1);
  35671. t = u.plus(y);
  35672. if (t.d[k] !== void 0) {
  35673. for (j = k; t.d[j] === u.d[j] && j--;) {}
  35674. if (j == -1) break;
  35675. }
  35676. j = u;
  35677. u = y;
  35678. y = t;
  35679. t = j;
  35680. i++;
  35681. }
  35682. external = true;
  35683. t.d.length = k + 1;
  35684. return t;
  35685. }
  35686. // Return the absolute value of `x` reduced to less than or equal to half pi.
  35687. function toLessThanHalfPi(Ctor, x) {
  35688. var t,
  35689. isNeg = x.s < 0,
  35690. pi = getPi(Ctor, Ctor.precision, 1),
  35691. halfPi = pi.times(0.5);
  35692. x = x.abs();
  35693. if (x.lte(halfPi)) {
  35694. quadrant = isNeg ? 4 : 1;
  35695. return x;
  35696. }
  35697. t = x.divToInt(pi);
  35698. if (t.isZero()) {
  35699. quadrant = isNeg ? 3 : 2;
  35700. } else {
  35701. x = x.minus(t.times(pi));
  35702. // 0 <= x < pi
  35703. if (x.lte(halfPi)) {
  35704. quadrant = isOdd(t) ? isNeg ? 2 : 3 : isNeg ? 4 : 1;
  35705. return x;
  35706. }
  35707. quadrant = isOdd(t) ? isNeg ? 1 : 4 : isNeg ? 3 : 2;
  35708. }
  35709. return x.minus(pi).abs();
  35710. }
  35711. /*
  35712. * Return the value of Decimal `x` as a string in base `baseOut`.
  35713. *
  35714. * If the optional `sd` argument is present include a binary exponent suffix.
  35715. */
  35716. function toStringBinary(x, baseOut, sd, rm) {
  35717. var base,
  35718. e,
  35719. i,
  35720. k,
  35721. len,
  35722. roundUp,
  35723. str,
  35724. xd,
  35725. y,
  35726. Ctor = x.constructor,
  35727. isExp = sd !== void 0;
  35728. if (isExp) {
  35729. checkInt32(sd, 1, MAX_DIGITS);
  35730. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  35731. } else {
  35732. sd = Ctor.precision;
  35733. rm = Ctor.rounding;
  35734. }
  35735. if (!x.isFinite()) {
  35736. str = nonFiniteToString(x);
  35737. } else {
  35738. str = finiteToString(x);
  35739. i = str.indexOf('.');
  35740. // Use exponential notation according to `toExpPos` and `toExpNeg`? No, but if required:
  35741. // maxBinaryExponent = floor((decimalExponent + 1) * log[2](10))
  35742. // minBinaryExponent = floor(decimalExponent * log[2](10))
  35743. // log[2](10) = 3.321928094887362347870319429489390175864
  35744. if (isExp) {
  35745. base = 2;
  35746. if (baseOut == 16) {
  35747. sd = sd * 4 - 3;
  35748. } else if (baseOut == 8) {
  35749. sd = sd * 3 - 2;
  35750. }
  35751. } else {
  35752. base = baseOut;
  35753. }
  35754. // Convert the number as an integer then divide the result by its base raised to a power such
  35755. // that the fraction part will be restored.
  35756. // Non-integer.
  35757. if (i >= 0) {
  35758. str = str.replace('.', '');
  35759. y = new Ctor(1);
  35760. y.e = str.length - i;
  35761. y.d = convertBase(finiteToString(y), 10, base);
  35762. y.e = y.d.length;
  35763. }
  35764. xd = convertBase(str, 10, base);
  35765. e = len = xd.length;
  35766. // Remove trailing zeros.
  35767. for (; xd[--len] == 0;) {
  35768. xd.pop();
  35769. }if (!xd[0]) {
  35770. str = isExp ? '0p+0' : '0';
  35771. } else {
  35772. if (i < 0) {
  35773. e--;
  35774. } else {
  35775. x = new Ctor(x);
  35776. x.d = xd;
  35777. x.e = e;
  35778. x = divide(x, y, sd, rm, 0, base);
  35779. xd = x.d;
  35780. e = x.e;
  35781. roundUp = inexact;
  35782. }
  35783. // The rounding digit, i.e. the digit after the digit that may be rounded up.
  35784. i = xd[sd];
  35785. k = base / 2;
  35786. roundUp = roundUp || xd[sd + 1] !== void 0;
  35787. roundUp = rm < 4 ? (i !== void 0 || roundUp) && (rm === 0 || rm === (x.s < 0 ? 3 : 2)) : i > k || i === k && (rm === 4 || roundUp || rm === 6 && xd[sd - 1] & 1 || rm === (x.s < 0 ? 8 : 7));
  35788. xd.length = sd;
  35789. if (roundUp) {
  35790. // Rounding up may mean the previous digit has to be rounded up and so on.
  35791. for (; ++xd[--sd] > base - 1;) {
  35792. xd[sd] = 0;
  35793. if (!sd) {
  35794. ++e;
  35795. xd.unshift(1);
  35796. }
  35797. }
  35798. }
  35799. // Determine trailing zeros.
  35800. for (len = xd.length; !xd[len - 1]; --len) {}
  35801. // E.g. [4, 11, 15] becomes 4bf.
  35802. for (i = 0, str = ''; i < len; i++) {
  35803. str += NUMERALS.charAt(xd[i]);
  35804. } // Add binary exponent suffix?
  35805. if (isExp) {
  35806. if (len > 1) {
  35807. if (baseOut == 16 || baseOut == 8) {
  35808. i = baseOut == 16 ? 4 : 3;
  35809. for (--len; len % i; len++) {
  35810. str += '0';
  35811. }xd = convertBase(str, base, baseOut);
  35812. for (len = xd.length; !xd[len - 1]; --len) {}
  35813. // xd[0] will always be be 1
  35814. for (i = 1, str = '1.'; i < len; i++) {
  35815. str += NUMERALS.charAt(xd[i]);
  35816. }
  35817. } else {
  35818. str = str.charAt(0) + '.' + str.slice(1);
  35819. }
  35820. }
  35821. str = str + (e < 0 ? 'p' : 'p+') + e;
  35822. } else if (e < 0) {
  35823. for (; ++e;) {
  35824. str = '0' + str;
  35825. }str = '0.' + str;
  35826. } else {
  35827. if (++e > len) for (e -= len; e--;) {
  35828. str += '0';
  35829. } else if (e < len) str = str.slice(0, e) + '.' + str.slice(e);
  35830. }
  35831. }
  35832. str = (baseOut == 16 ? '0x' : baseOut == 2 ? '0b' : baseOut == 8 ? '0o' : '') + str;
  35833. }
  35834. return x.s < 0 ? '-' + str : str;
  35835. }
  35836. // Does not strip trailing zeros.
  35837. function truncate(arr, len) {
  35838. if (arr.length > len) {
  35839. arr.length = len;
  35840. return true;
  35841. }
  35842. }
  35843. // Decimal methods
  35844. /*
  35845. * abs
  35846. * acos
  35847. * acosh
  35848. * add
  35849. * asin
  35850. * asinh
  35851. * atan
  35852. * atanh
  35853. * atan2
  35854. * cbrt
  35855. * ceil
  35856. * clone
  35857. * config
  35858. * cos
  35859. * cosh
  35860. * div
  35861. * exp
  35862. * floor
  35863. * hypot
  35864. * ln
  35865. * log
  35866. * log2
  35867. * log10
  35868. * max
  35869. * min
  35870. * mod
  35871. * mul
  35872. * pow
  35873. * random
  35874. * round
  35875. * set
  35876. * sign
  35877. * sin
  35878. * sinh
  35879. * sqrt
  35880. * sub
  35881. * tan
  35882. * tanh
  35883. * trunc
  35884. */
  35885. /*
  35886. * Return a new Decimal whose value is the absolute value of `x`.
  35887. *
  35888. * x {number|string|Decimal}
  35889. *
  35890. */
  35891. function abs(x) {
  35892. return new this(x).abs();
  35893. }
  35894. /*
  35895. * Return a new Decimal whose value is the arccosine in radians of `x`.
  35896. *
  35897. * x {number|string|Decimal}
  35898. *
  35899. */
  35900. function acos(x) {
  35901. return new this(x).acos();
  35902. }
  35903. /*
  35904. * Return a new Decimal whose value is the inverse of the hyperbolic cosine of `x`, rounded to
  35905. * `precision` significant digits using rounding mode `rounding`.
  35906. *
  35907. * x {number|string|Decimal} A value in radians.
  35908. *
  35909. */
  35910. function acosh(x) {
  35911. return new this(x).acosh();
  35912. }
  35913. /*
  35914. * Return a new Decimal whose value is the sum of `x` and `y`, rounded to `precision` significant
  35915. * digits using rounding mode `rounding`.
  35916. *
  35917. * x {number|string|Decimal}
  35918. * y {number|string|Decimal}
  35919. *
  35920. */
  35921. function add(x, y) {
  35922. return new this(x).plus(y);
  35923. }
  35924. /*
  35925. * Return a new Decimal whose value is the arcsine in radians of `x`, rounded to `precision`
  35926. * significant digits using rounding mode `rounding`.
  35927. *
  35928. * x {number|string|Decimal}
  35929. *
  35930. */
  35931. function asin(x) {
  35932. return new this(x).asin();
  35933. }
  35934. /*
  35935. * Return a new Decimal whose value is the inverse of the hyperbolic sine of `x`, rounded to
  35936. * `precision` significant digits using rounding mode `rounding`.
  35937. *
  35938. * x {number|string|Decimal} A value in radians.
  35939. *
  35940. */
  35941. function asinh(x) {
  35942. return new this(x).asinh();
  35943. }
  35944. /*
  35945. * Return a new Decimal whose value is the arctangent in radians of `x`, rounded to `precision`
  35946. * significant digits using rounding mode `rounding`.
  35947. *
  35948. * x {number|string|Decimal}
  35949. *
  35950. */
  35951. function atan(x) {
  35952. return new this(x).atan();
  35953. }
  35954. /*
  35955. * Return a new Decimal whose value is the inverse of the hyperbolic tangent of `x`, rounded to
  35956. * `precision` significant digits using rounding mode `rounding`.
  35957. *
  35958. * x {number|string|Decimal} A value in radians.
  35959. *
  35960. */
  35961. function atanh(x) {
  35962. return new this(x).atanh();
  35963. }
  35964. /*
  35965. * Return a new Decimal whose value is the arctangent in radians of `y/x` in the range -pi to pi
  35966. * (inclusive), rounded to `precision` significant digits using rounding mode `rounding`.
  35967. *
  35968. * Domain: [-Infinity, Infinity]
  35969. * Range: [-pi, pi]
  35970. *
  35971. * y {number|string|Decimal} The y-coordinate.
  35972. * x {number|string|Decimal} The x-coordinate.
  35973. *
  35974. * atan2(±0, -0) = ±pi
  35975. * atan2(±0, +0) = ±0
  35976. * atan2(±0, -x) = ±pi for x > 0
  35977. * atan2(±0, x) = ±0 for x > 0
  35978. * atan2(-y, ±0) = -pi/2 for y > 0
  35979. * atan2(y, ±0) = pi/2 for y > 0
  35980. * atan2(±y, -Infinity) = ±pi for finite y > 0
  35981. * atan2(±y, +Infinity) = ±0 for finite y > 0
  35982. * atan2(±Infinity, x) = ±pi/2 for finite x
  35983. * atan2(±Infinity, -Infinity) = ±3*pi/4
  35984. * atan2(±Infinity, +Infinity) = ±pi/4
  35985. * atan2(NaN, x) = NaN
  35986. * atan2(y, NaN) = NaN
  35987. *
  35988. */
  35989. function atan2(y, x) {
  35990. y = new this(y);
  35991. x = new this(x);
  35992. var r,
  35993. pr = this.precision,
  35994. rm = this.rounding,
  35995. wpr = pr + 4;
  35996. // Either NaN
  35997. if (!y.s || !x.s) {
  35998. r = new this(NaN);
  35999. // Both ±Infinity
  36000. } else if (!y.d && !x.d) {
  36001. r = getPi(this, wpr, 1).times(x.s > 0 ? 0.25 : 0.75);
  36002. r.s = y.s;
  36003. // x is ±Infinity or y is ±0
  36004. } else if (!x.d || y.isZero()) {
  36005. r = x.s < 0 ? getPi(this, pr, rm) : new this(0);
  36006. r.s = y.s;
  36007. // y is ±Infinity or x is ±0
  36008. } else if (!y.d || x.isZero()) {
  36009. r = getPi(this, wpr, 1).times(0.5);
  36010. r.s = y.s;
  36011. // Both non-zero and finite
  36012. } else if (x.s < 0) {
  36013. this.precision = wpr;
  36014. this.rounding = 1;
  36015. r = this.atan(divide(y, x, wpr, 1));
  36016. x = getPi(this, wpr, 1);
  36017. this.precision = pr;
  36018. this.rounding = rm;
  36019. r = y.s < 0 ? r.minus(x) : r.plus(x);
  36020. } else {
  36021. r = this.atan(divide(y, x, wpr, 1));
  36022. }
  36023. return r;
  36024. }
  36025. /*
  36026. * Return a new Decimal whose value is the cube root of `x`, rounded to `precision` significant
  36027. * digits using rounding mode `rounding`.
  36028. *
  36029. * x {number|string|Decimal}
  36030. *
  36031. */
  36032. function cbrt(x) {
  36033. return new this(x).cbrt();
  36034. }
  36035. /*
  36036. * Return a new Decimal whose value is `x` rounded to an integer using `ROUND_CEIL`.
  36037. *
  36038. * x {number|string|Decimal}
  36039. *
  36040. */
  36041. function ceil(x) {
  36042. return finalise(x = new this(x), x.e + 1, 2);
  36043. }
  36044. /*
  36045. * Configure global settings for a Decimal constructor.
  36046. *
  36047. * `obj` is an object with one or more of the following properties,
  36048. *
  36049. * precision {number}
  36050. * rounding {number}
  36051. * toExpNeg {number}
  36052. * toExpPos {number}
  36053. * maxE {number}
  36054. * minE {number}
  36055. * modulo {number}
  36056. * crypto {boolean|number}
  36057. * defaults {true}
  36058. *
  36059. * E.g. Decimal.config({ precision: 20, rounding: 4 })
  36060. *
  36061. */
  36062. function config(obj) {
  36063. if (!obj || (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) !== 'object') throw Error(decimalError + 'Object expected');
  36064. var i,
  36065. p,
  36066. v,
  36067. useDefaults = obj.defaults === true,
  36068. ps = ['precision', 1, MAX_DIGITS, 'rounding', 0, 8, 'toExpNeg', -EXP_LIMIT, 0, 'toExpPos', 0, EXP_LIMIT, 'maxE', 0, EXP_LIMIT, 'minE', -EXP_LIMIT, 0, 'modulo', 0, 9];
  36069. for (i = 0; i < ps.length; i += 3) {
  36070. if (p = ps[i], useDefaults) this[p] = DEFAULTS[p];
  36071. if ((v = obj[p]) !== void 0) {
  36072. if (mathfloor(v) === v && v >= ps[i + 1] && v <= ps[i + 2]) this[p] = v;else throw Error(invalidArgument + p + ': ' + v);
  36073. }
  36074. }
  36075. if (p = 'crypto', useDefaults) this[p] = DEFAULTS[p];
  36076. if ((v = obj[p]) !== void 0) {
  36077. if (v === true || v === false || v === 0 || v === 1) {
  36078. if (v) {
  36079. if (typeof crypto != 'undefined' && crypto && (crypto.getRandomValues || crypto.randomBytes)) {
  36080. this[p] = true;
  36081. } else {
  36082. throw Error(cryptoUnavailable);
  36083. }
  36084. } else {
  36085. this[p] = false;
  36086. }
  36087. } else {
  36088. throw Error(invalidArgument + p + ': ' + v);
  36089. }
  36090. }
  36091. return this;
  36092. }
  36093. /*
  36094. * Return a new Decimal whose value is the cosine of `x`, rounded to `precision` significant
  36095. * digits using rounding mode `rounding`.
  36096. *
  36097. * x {number|string|Decimal} A value in radians.
  36098. *
  36099. */
  36100. function cos(x) {
  36101. return new this(x).cos();
  36102. }
  36103. /*
  36104. * Return a new Decimal whose value is the hyperbolic cosine of `x`, rounded to precision
  36105. * significant digits using rounding mode `rounding`.
  36106. *
  36107. * x {number|string|Decimal} A value in radians.
  36108. *
  36109. */
  36110. function cosh(x) {
  36111. return new this(x).cosh();
  36112. }
  36113. /*
  36114. * Create and return a Decimal constructor with the same configuration properties as this Decimal
  36115. * constructor.
  36116. *
  36117. */
  36118. function clone(obj) {
  36119. var i, p, ps;
  36120. /*
  36121. * The Decimal constructor and exported function.
  36122. * Return a new Decimal instance.
  36123. *
  36124. * v {number|string|Decimal} A numeric value.
  36125. *
  36126. */
  36127. function Decimal(v) {
  36128. var e,
  36129. i,
  36130. t,
  36131. x = this;
  36132. // Decimal called without new.
  36133. if (!(x instanceof Decimal)) return new Decimal(v);
  36134. // Retain a reference to this Decimal constructor, and shadow Decimal.prototype.constructor
  36135. // which points to Object.
  36136. x.constructor = Decimal;
  36137. // Duplicate.
  36138. if (v instanceof Decimal) {
  36139. x.s = v.s;
  36140. x.e = v.e;
  36141. x.d = (v = v.d) ? v.slice() : v;
  36142. return;
  36143. }
  36144. t = typeof v === 'undefined' ? 'undefined' : _typeof(v);
  36145. if (t === 'number') {
  36146. if (v === 0) {
  36147. x.s = 1 / v < 0 ? -1 : 1;
  36148. x.e = 0;
  36149. x.d = [0];
  36150. return;
  36151. }
  36152. if (v < 0) {
  36153. v = -v;
  36154. x.s = -1;
  36155. } else {
  36156. x.s = 1;
  36157. }
  36158. // Fast path for small integers.
  36159. if (v === ~~v && v < 1e7) {
  36160. for (e = 0, i = v; i >= 10; i /= 10) {
  36161. e++;
  36162. }x.e = e;
  36163. x.d = [v];
  36164. return;
  36165. // Infinity, NaN.
  36166. } else if (v * 0 !== 0) {
  36167. if (!v) x.s = NaN;
  36168. x.e = NaN;
  36169. x.d = null;
  36170. return;
  36171. }
  36172. return parseDecimal(x, v.toString());
  36173. } else if (t !== 'string') {
  36174. throw Error(invalidArgument + v);
  36175. }
  36176. // Minus sign?
  36177. if (v.charCodeAt(0) === 45) {
  36178. v = v.slice(1);
  36179. x.s = -1;
  36180. } else {
  36181. x.s = 1;
  36182. }
  36183. return isDecimal.test(v) ? parseDecimal(x, v) : parseOther(x, v);
  36184. }
  36185. Decimal.prototype = P;
  36186. Decimal.ROUND_UP = 0;
  36187. Decimal.ROUND_DOWN = 1;
  36188. Decimal.ROUND_CEIL = 2;
  36189. Decimal.ROUND_FLOOR = 3;
  36190. Decimal.ROUND_HALF_UP = 4;
  36191. Decimal.ROUND_HALF_DOWN = 5;
  36192. Decimal.ROUND_HALF_EVEN = 6;
  36193. Decimal.ROUND_HALF_CEIL = 7;
  36194. Decimal.ROUND_HALF_FLOOR = 8;
  36195. Decimal.EUCLID = 9;
  36196. Decimal.config = Decimal.set = config;
  36197. Decimal.clone = clone;
  36198. Decimal.isDecimal = isDecimalInstance;
  36199. Decimal.abs = abs;
  36200. Decimal.acos = acos;
  36201. Decimal.acosh = acosh; // ES6
  36202. Decimal.add = add;
  36203. Decimal.asin = asin;
  36204. Decimal.asinh = asinh; // ES6
  36205. Decimal.atan = atan;
  36206. Decimal.atanh = atanh; // ES6
  36207. Decimal.atan2 = atan2;
  36208. Decimal.cbrt = cbrt; // ES6
  36209. Decimal.ceil = ceil;
  36210. Decimal.cos = cos;
  36211. Decimal.cosh = cosh; // ES6
  36212. Decimal.div = div;
  36213. Decimal.exp = exp;
  36214. Decimal.floor = floor;
  36215. Decimal.hypot = hypot; // ES6
  36216. Decimal.ln = ln;
  36217. Decimal.log = log;
  36218. Decimal.log10 = log10; // ES6
  36219. Decimal.log2 = log2; // ES6
  36220. Decimal.max = max;
  36221. Decimal.min = min;
  36222. Decimal.mod = mod;
  36223. Decimal.mul = mul;
  36224. Decimal.pow = pow;
  36225. Decimal.random = random;
  36226. Decimal.round = round;
  36227. Decimal.sign = sign; // ES6
  36228. Decimal.sin = sin;
  36229. Decimal.sinh = sinh; // ES6
  36230. Decimal.sqrt = sqrt;
  36231. Decimal.sub = sub;
  36232. Decimal.tan = tan;
  36233. Decimal.tanh = tanh; // ES6
  36234. Decimal.trunc = trunc; // ES6
  36235. if (obj === void 0) obj = {};
  36236. if (obj) {
  36237. if (obj.defaults !== true) {
  36238. ps = ['precision', 'rounding', 'toExpNeg', 'toExpPos', 'maxE', 'minE', 'modulo', 'crypto'];
  36239. for (i = 0; i < ps.length;) {
  36240. if (!obj.hasOwnProperty(p = ps[i++])) obj[p] = this[p];
  36241. }
  36242. }
  36243. }
  36244. Decimal.config(obj);
  36245. return Decimal;
  36246. }
  36247. /*
  36248. * Return a new Decimal whose value is `x` divided by `y`, rounded to `precision` significant
  36249. * digits using rounding mode `rounding`.
  36250. *
  36251. * x {number|string|Decimal}
  36252. * y {number|string|Decimal}
  36253. *
  36254. */
  36255. function div(x, y) {
  36256. return new this(x).div(y);
  36257. }
  36258. /*
  36259. * Return a new Decimal whose value is the natural exponential of `x`, rounded to `precision`
  36260. * significant digits using rounding mode `rounding`.
  36261. *
  36262. * x {number|string|Decimal} The power to which to raise the base of the natural log.
  36263. *
  36264. */
  36265. function exp(x) {
  36266. return new this(x).exp();
  36267. }
  36268. /*
  36269. * Return a new Decimal whose value is `x` round to an integer using `ROUND_FLOOR`.
  36270. *
  36271. * x {number|string|Decimal}
  36272. *
  36273. */
  36274. function floor(x) {
  36275. return finalise(x = new this(x), x.e + 1, 3);
  36276. }
  36277. /*
  36278. * Return a new Decimal whose value is the square root of the sum of the squares of the arguments,
  36279. * rounded to `precision` significant digits using rounding mode `rounding`.
  36280. *
  36281. * hypot(a, b, ...) = sqrt(a^2 + b^2 + ...)
  36282. *
  36283. */
  36284. function hypot() {
  36285. var i,
  36286. n,
  36287. t = new this(0);
  36288. external = false;
  36289. for (i = 0; i < arguments.length;) {
  36290. n = new this(arguments[i++]);
  36291. if (!n.d) {
  36292. if (n.s) {
  36293. external = true;
  36294. return new this(1 / 0);
  36295. }
  36296. t = n;
  36297. } else if (t.d) {
  36298. t = t.plus(n.times(n));
  36299. }
  36300. }
  36301. external = true;
  36302. return t.sqrt();
  36303. }
  36304. /*
  36305. * Return true if object is a Decimal instance (where Decimal is any Decimal constructor),
  36306. * otherwise return false.
  36307. *
  36308. */
  36309. function isDecimalInstance(obj) {
  36310. return obj instanceof Decimal || obj && obj.name === '[object Decimal]' || false;
  36311. }
  36312. /*
  36313. * Return a new Decimal whose value is the natural logarithm of `x`, rounded to `precision`
  36314. * significant digits using rounding mode `rounding`.
  36315. *
  36316. * x {number|string|Decimal}
  36317. *
  36318. */
  36319. function ln(x) {
  36320. return new this(x).ln();
  36321. }
  36322. /*
  36323. * Return a new Decimal whose value is the log of `x` to the base `y`, or to base 10 if no base
  36324. * is specified, rounded to `precision` significant digits using rounding mode `rounding`.
  36325. *
  36326. * log[y](x)
  36327. *
  36328. * x {number|string|Decimal} The argument of the logarithm.
  36329. * y {number|string|Decimal} The base of the logarithm.
  36330. *
  36331. */
  36332. function log(x, y) {
  36333. return new this(x).log(y);
  36334. }
  36335. /*
  36336. * Return a new Decimal whose value is the base 2 logarithm of `x`, rounded to `precision`
  36337. * significant digits using rounding mode `rounding`.
  36338. *
  36339. * x {number|string|Decimal}
  36340. *
  36341. */
  36342. function log2(x) {
  36343. return new this(x).log(2);
  36344. }
  36345. /*
  36346. * Return a new Decimal whose value is the base 10 logarithm of `x`, rounded to `precision`
  36347. * significant digits using rounding mode `rounding`.
  36348. *
  36349. * x {number|string|Decimal}
  36350. *
  36351. */
  36352. function log10(x) {
  36353. return new this(x).log(10);
  36354. }
  36355. /*
  36356. * Return a new Decimal whose value is the maximum of the arguments.
  36357. *
  36358. * arguments {number|string|Decimal}
  36359. *
  36360. */
  36361. function max() {
  36362. return maxOrMin(this, arguments, 'lt');
  36363. }
  36364. /*
  36365. * Return a new Decimal whose value is the minimum of the arguments.
  36366. *
  36367. * arguments {number|string|Decimal}
  36368. *
  36369. */
  36370. function min() {
  36371. return maxOrMin(this, arguments, 'gt');
  36372. }
  36373. /*
  36374. * Return a new Decimal whose value is `x` modulo `y`, rounded to `precision` significant digits
  36375. * using rounding mode `rounding`.
  36376. *
  36377. * x {number|string|Decimal}
  36378. * y {number|string|Decimal}
  36379. *
  36380. */
  36381. function mod(x, y) {
  36382. return new this(x).mod(y);
  36383. }
  36384. /*
  36385. * Return a new Decimal whose value is `x` multiplied by `y`, rounded to `precision` significant
  36386. * digits using rounding mode `rounding`.
  36387. *
  36388. * x {number|string|Decimal}
  36389. * y {number|string|Decimal}
  36390. *
  36391. */
  36392. function mul(x, y) {
  36393. return new this(x).mul(y);
  36394. }
  36395. /*
  36396. * Return a new Decimal whose value is `x` raised to the power `y`, rounded to precision
  36397. * significant digits using rounding mode `rounding`.
  36398. *
  36399. * x {number|string|Decimal} The base.
  36400. * y {number|string|Decimal} The exponent.
  36401. *
  36402. */
  36403. function pow(x, y) {
  36404. return new this(x).pow(y);
  36405. }
  36406. /*
  36407. * Returns a new Decimal with a random value equal to or greater than 0 and less than 1, and with
  36408. * `sd`, or `Decimal.precision` if `sd` is omitted, significant digits (or less if trailing zeros
  36409. * are produced).
  36410. *
  36411. * [sd] {number} Significant digits. Integer, 0 to MAX_DIGITS inclusive.
  36412. *
  36413. */
  36414. function random(sd) {
  36415. var d,
  36416. e,
  36417. k,
  36418. n,
  36419. i = 0,
  36420. r = new this(1),
  36421. rd = [];
  36422. if (sd === void 0) sd = this.precision;else checkInt32(sd, 1, MAX_DIGITS);
  36423. k = Math.ceil(sd / LOG_BASE);
  36424. if (!this.crypto) {
  36425. for (; i < k;) {
  36426. rd[i++] = Math.random() * 1e7 | 0;
  36427. } // Browsers supporting crypto.getRandomValues.
  36428. } else if (crypto.getRandomValues) {
  36429. d = crypto.getRandomValues(new Uint32Array(k));
  36430. for (; i < k;) {
  36431. n = d[i];
  36432. // 0 <= n < 4294967296
  36433. // Probability n >= 4.29e9, is 4967296 / 4294967296 = 0.00116 (1 in 865).
  36434. if (n >= 4.29e9) {
  36435. d[i] = crypto.getRandomValues(new Uint32Array(1))[0];
  36436. } else {
  36437. // 0 <= n <= 4289999999
  36438. // 0 <= (n % 1e7) <= 9999999
  36439. rd[i++] = n % 1e7;
  36440. }
  36441. }
  36442. // Node.js supporting crypto.randomBytes.
  36443. } else if (crypto.randomBytes) {
  36444. // buffer
  36445. d = crypto.randomBytes(k *= 4);
  36446. for (; i < k;) {
  36447. // 0 <= n < 2147483648
  36448. n = d[i] + (d[i + 1] << 8) + (d[i + 2] << 16) + ((d[i + 3] & 0x7f) << 24);
  36449. // Probability n >= 2.14e9, is 7483648 / 2147483648 = 0.0035 (1 in 286).
  36450. if (n >= 2.14e9) {
  36451. crypto.randomBytes(4).copy(d, i);
  36452. } else {
  36453. // 0 <= n <= 2139999999
  36454. // 0 <= (n % 1e7) <= 9999999
  36455. rd.push(n % 1e7);
  36456. i += 4;
  36457. }
  36458. }
  36459. i = k / 4;
  36460. } else {
  36461. throw Error(cryptoUnavailable);
  36462. }
  36463. k = rd[--i];
  36464. sd %= LOG_BASE;
  36465. // Convert trailing digits to zeros according to sd.
  36466. if (k && sd) {
  36467. n = mathpow(10, LOG_BASE - sd);
  36468. rd[i] = (k / n | 0) * n;
  36469. }
  36470. // Remove trailing words which are zero.
  36471. for (; rd[i] === 0; i--) {
  36472. rd.pop();
  36473. } // Zero?
  36474. if (i < 0) {
  36475. e = 0;
  36476. rd = [0];
  36477. } else {
  36478. e = -1;
  36479. // Remove leading words which are zero and adjust exponent accordingly.
  36480. for (; rd[0] === 0; e -= LOG_BASE) {
  36481. rd.shift();
  36482. } // Count the digits of the first word of rd to determine leading zeros.
  36483. for (k = 1, n = rd[0]; n >= 10; n /= 10) {
  36484. k++;
  36485. } // Adjust the exponent for leading zeros of the first word of rd.
  36486. if (k < LOG_BASE) e -= LOG_BASE - k;
  36487. }
  36488. r.e = e;
  36489. r.d = rd;
  36490. return r;
  36491. }
  36492. /*
  36493. * Return a new Decimal whose value is `x` rounded to an integer using rounding mode `rounding`.
  36494. *
  36495. * To emulate `Math.round`, set rounding to 7 (ROUND_HALF_CEIL).
  36496. *
  36497. * x {number|string|Decimal}
  36498. *
  36499. */
  36500. function round(x) {
  36501. return finalise(x = new this(x), x.e + 1, this.rounding);
  36502. }
  36503. /*
  36504. * Return
  36505. * 1 if x > 0,
  36506. * -1 if x < 0,
  36507. * 0 if x is 0,
  36508. * -0 if x is -0,
  36509. * NaN otherwise
  36510. *
  36511. */
  36512. function sign(x) {
  36513. x = new this(x);
  36514. return x.d ? x.d[0] ? x.s : 0 * x.s : x.s || NaN;
  36515. }
  36516. /*
  36517. * Return a new Decimal whose value is the sine of `x`, rounded to `precision` significant digits
  36518. * using rounding mode `rounding`.
  36519. *
  36520. * x {number|string|Decimal} A value in radians.
  36521. *
  36522. */
  36523. function sin(x) {
  36524. return new this(x).sin();
  36525. }
  36526. /*
  36527. * Return a new Decimal whose value is the hyperbolic sine of `x`, rounded to `precision`
  36528. * significant digits using rounding mode `rounding`.
  36529. *
  36530. * x {number|string|Decimal} A value in radians.
  36531. *
  36532. */
  36533. function sinh(x) {
  36534. return new this(x).sinh();
  36535. }
  36536. /*
  36537. * Return a new Decimal whose value is the square root of `x`, rounded to `precision` significant
  36538. * digits using rounding mode `rounding`.
  36539. *
  36540. * x {number|string|Decimal}
  36541. *
  36542. */
  36543. function sqrt(x) {
  36544. return new this(x).sqrt();
  36545. }
  36546. /*
  36547. * Return a new Decimal whose value is `x` minus `y`, rounded to `precision` significant digits
  36548. * using rounding mode `rounding`.
  36549. *
  36550. * x {number|string|Decimal}
  36551. * y {number|string|Decimal}
  36552. *
  36553. */
  36554. function sub(x, y) {
  36555. return new this(x).sub(y);
  36556. }
  36557. /*
  36558. * Return a new Decimal whose value is the tangent of `x`, rounded to `precision` significant
  36559. * digits using rounding mode `rounding`.
  36560. *
  36561. * x {number|string|Decimal} A value in radians.
  36562. *
  36563. */
  36564. function tan(x) {
  36565. return new this(x).tan();
  36566. }
  36567. /*
  36568. * Return a new Decimal whose value is the hyperbolic tangent of `x`, rounded to `precision`
  36569. * significant digits using rounding mode `rounding`.
  36570. *
  36571. * x {number|string|Decimal} A value in radians.
  36572. *
  36573. */
  36574. function tanh(x) {
  36575. return new this(x).tanh();
  36576. }
  36577. /*
  36578. * Return a new Decimal whose value is `x` truncated to an integer.
  36579. *
  36580. * x {number|string|Decimal}
  36581. *
  36582. */
  36583. function trunc(x) {
  36584. return finalise(x = new this(x), x.e + 1, 1);
  36585. }
  36586. // Create and configure initial Decimal constructor.
  36587. Decimal = clone(DEFAULTS);
  36588. Decimal['default'] = Decimal.Decimal = Decimal;
  36589. // Create the internal constants from their string values.
  36590. LN10 = new Decimal(LN10);
  36591. PI = new Decimal(PI);
  36592. // Export.
  36593. // AMD.
  36594. if (true) {
  36595. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function () {
  36596. return Decimal;
  36597. }).call(exports, __webpack_require__, exports, module),
  36598. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  36599. // Node and other environments that support module.exports.
  36600. } else {}
  36601. })(undefined);
  36602. /***/ }),
  36603. /***/ "./node_modules/jquery/dist/jquery.js":
  36604. /*!********************************************!*\
  36605. !*** ./node_modules/jquery/dist/jquery.js ***!
  36606. \********************************************/
  36607. /*! no static exports found */
  36608. /***/ (function(module, exports, __webpack_require__) {
  36609. "use strict";
  36610. /* WEBPACK VAR INJECTION */(function(module) {var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  36611. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  36612. /*!
  36613. * jQuery JavaScript Library v3.3.1
  36614. * https://jquery.com/
  36615. *
  36616. * Includes Sizzle.js
  36617. * https://sizzlejs.com/
  36618. *
  36619. * Copyright JS Foundation and other contributors
  36620. * Released under the MIT license
  36621. * https://jquery.org/license
  36622. *
  36623. * Date: 2018-01-20T17:24Z
  36624. */
  36625. (function (global, factory) {
  36626. "use strict";
  36627. if (( false ? undefined : _typeof(module)) === "object" && _typeof(module.exports) === "object") {
  36628. // For CommonJS and CommonJS-like environments where a proper `window`
  36629. // is present, execute the factory and get jQuery.
  36630. // For environments that do not have a `window` with a `document`
  36631. // (such as Node.js), expose a factory as module.exports.
  36632. // This accentuates the need for the creation of a real `window`.
  36633. // e.g. var jQuery = require("jquery")(window);
  36634. // See ticket #14549 for more info.
  36635. module.exports = global.document ? factory(global, true) : function (w) {
  36636. if (!w.document) {
  36637. throw new Error("jQuery requires a window with a document");
  36638. }
  36639. return factory(w);
  36640. };
  36641. } else {
  36642. factory(global);
  36643. }
  36644. // Pass this if window is not defined yet
  36645. })(typeof window !== "undefined" ? window : undefined, function (window, noGlobal) {
  36646. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  36647. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  36648. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  36649. // enough that all such attempts are guarded in a try block.
  36650. "use strict";
  36651. var arr = [];
  36652. var document = window.document;
  36653. var getProto = Object.getPrototypeOf;
  36654. var _slice = arr.slice;
  36655. var concat = arr.concat;
  36656. var push = arr.push;
  36657. var indexOf = arr.indexOf;
  36658. var class2type = {};
  36659. var toString = class2type.toString;
  36660. var hasOwn = class2type.hasOwnProperty;
  36661. var fnToString = hasOwn.toString;
  36662. var ObjectFunctionString = fnToString.call(Object);
  36663. var support = {};
  36664. var isFunction = function isFunction(obj) {
  36665. // Support: Chrome <=57, Firefox <=52
  36666. // In some browsers, typeof returns "function" for HTML <object> elements
  36667. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  36668. // We don't want to classify *any* DOM node as a function.
  36669. return typeof obj === "function" && typeof obj.nodeType !== "number";
  36670. };
  36671. var isWindow = function isWindow(obj) {
  36672. return obj != null && obj === obj.window;
  36673. };
  36674. var preservedScriptAttributes = {
  36675. type: true,
  36676. src: true,
  36677. noModule: true
  36678. };
  36679. function DOMEval(code, doc, node) {
  36680. doc = doc || document;
  36681. var i,
  36682. script = doc.createElement("script");
  36683. script.text = code;
  36684. if (node) {
  36685. for (i in preservedScriptAttributes) {
  36686. if (node[i]) {
  36687. script[i] = node[i];
  36688. }
  36689. }
  36690. }
  36691. doc.head.appendChild(script).parentNode.removeChild(script);
  36692. }
  36693. function toType(obj) {
  36694. if (obj == null) {
  36695. return obj + "";
  36696. }
  36697. // Support: Android <=2.3 only (functionish RegExp)
  36698. return (typeof obj === "undefined" ? "undefined" : _typeof(obj)) === "object" || typeof obj === "function" ? class2type[toString.call(obj)] || "object" : typeof obj === "undefined" ? "undefined" : _typeof(obj);
  36699. }
  36700. /* global Symbol */
  36701. // Defining this global in .eslintrc.json would create a danger of using the global
  36702. // unguarded in another place, it seems safer to define global only for this module
  36703. var version = "3.3.1",
  36704. // Define a local copy of jQuery
  36705. jQuery = function jQuery(selector, context) {
  36706. // The jQuery object is actually just the init constructor 'enhanced'
  36707. // Need init if jQuery is called (just allow error to be thrown if not included)
  36708. return new jQuery.fn.init(selector, context);
  36709. },
  36710. // Support: Android <=4.0 only
  36711. // Make sure we trim BOM and NBSP
  36712. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  36713. jQuery.fn = jQuery.prototype = {
  36714. // The current version of jQuery being used
  36715. jquery: version,
  36716. constructor: jQuery,
  36717. // The default length of a jQuery object is 0
  36718. length: 0,
  36719. toArray: function toArray() {
  36720. return _slice.call(this);
  36721. },
  36722. // Get the Nth element in the matched element set OR
  36723. // Get the whole matched element set as a clean array
  36724. get: function get(num) {
  36725. // Return all the elements in a clean array
  36726. if (num == null) {
  36727. return _slice.call(this);
  36728. }
  36729. // Return just the one element from the set
  36730. return num < 0 ? this[num + this.length] : this[num];
  36731. },
  36732. // Take an array of elements and push it onto the stack
  36733. // (returning the new matched element set)
  36734. pushStack: function pushStack(elems) {
  36735. // Build a new jQuery matched element set
  36736. var ret = jQuery.merge(this.constructor(), elems);
  36737. // Add the old object onto the stack (as a reference)
  36738. ret.prevObject = this;
  36739. // Return the newly-formed element set
  36740. return ret;
  36741. },
  36742. // Execute a callback for every element in the matched set.
  36743. each: function each(callback) {
  36744. return jQuery.each(this, callback);
  36745. },
  36746. map: function map(callback) {
  36747. return this.pushStack(jQuery.map(this, function (elem, i) {
  36748. return callback.call(elem, i, elem);
  36749. }));
  36750. },
  36751. slice: function slice() {
  36752. return this.pushStack(_slice.apply(this, arguments));
  36753. },
  36754. first: function first() {
  36755. return this.eq(0);
  36756. },
  36757. last: function last() {
  36758. return this.eq(-1);
  36759. },
  36760. eq: function eq(i) {
  36761. var len = this.length,
  36762. j = +i + (i < 0 ? len : 0);
  36763. return this.pushStack(j >= 0 && j < len ? [this[j]] : []);
  36764. },
  36765. end: function end() {
  36766. return this.prevObject || this.constructor();
  36767. },
  36768. // For internal use only.
  36769. // Behaves like an Array's method, not like a jQuery method.
  36770. push: push,
  36771. sort: arr.sort,
  36772. splice: arr.splice
  36773. };
  36774. jQuery.extend = jQuery.fn.extend = function () {
  36775. var options,
  36776. name,
  36777. src,
  36778. copy,
  36779. copyIsArray,
  36780. clone,
  36781. target = arguments[0] || {},
  36782. i = 1,
  36783. length = arguments.length,
  36784. deep = false;
  36785. // Handle a deep copy situation
  36786. if (typeof target === "boolean") {
  36787. deep = target;
  36788. // Skip the boolean and the target
  36789. target = arguments[i] || {};
  36790. i++;
  36791. }
  36792. // Handle case when target is a string or something (possible in deep copy)
  36793. if ((typeof target === "undefined" ? "undefined" : _typeof(target)) !== "object" && !isFunction(target)) {
  36794. target = {};
  36795. }
  36796. // Extend jQuery itself if only one argument is passed
  36797. if (i === length) {
  36798. target = this;
  36799. i--;
  36800. }
  36801. for (; i < length; i++) {
  36802. // Only deal with non-null/undefined values
  36803. if ((options = arguments[i]) != null) {
  36804. // Extend the base object
  36805. for (name in options) {
  36806. src = target[name];
  36807. copy = options[name];
  36808. // Prevent never-ending loop
  36809. if (target === copy) {
  36810. continue;
  36811. }
  36812. // Recurse if we're merging plain objects or arrays
  36813. if (deep && copy && (jQuery.isPlainObject(copy) || (copyIsArray = Array.isArray(copy)))) {
  36814. if (copyIsArray) {
  36815. copyIsArray = false;
  36816. clone = src && Array.isArray(src) ? src : [];
  36817. } else {
  36818. clone = src && jQuery.isPlainObject(src) ? src : {};
  36819. }
  36820. // Never move original objects, clone them
  36821. target[name] = jQuery.extend(deep, clone, copy);
  36822. // Don't bring in undefined values
  36823. } else if (copy !== undefined) {
  36824. target[name] = copy;
  36825. }
  36826. }
  36827. }
  36828. }
  36829. // Return the modified object
  36830. return target;
  36831. };
  36832. jQuery.extend({
  36833. // Unique for each copy of jQuery on the page
  36834. expando: "jQuery" + (version + Math.random()).replace(/\D/g, ""),
  36835. // Assume jQuery is ready without the ready module
  36836. isReady: true,
  36837. error: function error(msg) {
  36838. throw new Error(msg);
  36839. },
  36840. noop: function noop() {},
  36841. isPlainObject: function isPlainObject(obj) {
  36842. var proto, Ctor;
  36843. // Detect obvious negatives
  36844. // Use toString instead of jQuery.type to catch host objects
  36845. if (!obj || toString.call(obj) !== "[object Object]") {
  36846. return false;
  36847. }
  36848. proto = getProto(obj);
  36849. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  36850. if (!proto) {
  36851. return true;
  36852. }
  36853. // Objects with prototype are plain iff they were constructed by a global Object function
  36854. Ctor = hasOwn.call(proto, "constructor") && proto.constructor;
  36855. return typeof Ctor === "function" && fnToString.call(Ctor) === ObjectFunctionString;
  36856. },
  36857. isEmptyObject: function isEmptyObject(obj) {
  36858. /* eslint-disable no-unused-vars */
  36859. // See https://github.com/eslint/eslint/issues/6125
  36860. var name;
  36861. for (name in obj) {
  36862. return false;
  36863. }
  36864. return true;
  36865. },
  36866. // Evaluates a script in a global context
  36867. globalEval: function globalEval(code) {
  36868. DOMEval(code);
  36869. },
  36870. each: function each(obj, callback) {
  36871. var length,
  36872. i = 0;
  36873. if (isArrayLike(obj)) {
  36874. length = obj.length;
  36875. for (; i < length; i++) {
  36876. if (callback.call(obj[i], i, obj[i]) === false) {
  36877. break;
  36878. }
  36879. }
  36880. } else {
  36881. for (i in obj) {
  36882. if (callback.call(obj[i], i, obj[i]) === false) {
  36883. break;
  36884. }
  36885. }
  36886. }
  36887. return obj;
  36888. },
  36889. // Support: Android <=4.0 only
  36890. trim: function trim(text) {
  36891. return text == null ? "" : (text + "").replace(rtrim, "");
  36892. },
  36893. // results is for internal usage only
  36894. makeArray: function makeArray(arr, results) {
  36895. var ret = results || [];
  36896. if (arr != null) {
  36897. if (isArrayLike(Object(arr))) {
  36898. jQuery.merge(ret, typeof arr === "string" ? [arr] : arr);
  36899. } else {
  36900. push.call(ret, arr);
  36901. }
  36902. }
  36903. return ret;
  36904. },
  36905. inArray: function inArray(elem, arr, i) {
  36906. return arr == null ? -1 : indexOf.call(arr, elem, i);
  36907. },
  36908. // Support: Android <=4.0 only, PhantomJS 1 only
  36909. // push.apply(_, arraylike) throws on ancient WebKit
  36910. merge: function merge(first, second) {
  36911. var len = +second.length,
  36912. j = 0,
  36913. i = first.length;
  36914. for (; j < len; j++) {
  36915. first[i++] = second[j];
  36916. }
  36917. first.length = i;
  36918. return first;
  36919. },
  36920. grep: function grep(elems, callback, invert) {
  36921. var callbackInverse,
  36922. matches = [],
  36923. i = 0,
  36924. length = elems.length,
  36925. callbackExpect = !invert;
  36926. // Go through the array, only saving the items
  36927. // that pass the validator function
  36928. for (; i < length; i++) {
  36929. callbackInverse = !callback(elems[i], i);
  36930. if (callbackInverse !== callbackExpect) {
  36931. matches.push(elems[i]);
  36932. }
  36933. }
  36934. return matches;
  36935. },
  36936. // arg is for internal usage only
  36937. map: function map(elems, callback, arg) {
  36938. var length,
  36939. value,
  36940. i = 0,
  36941. ret = [];
  36942. // Go through the array, translating each of the items to their new values
  36943. if (isArrayLike(elems)) {
  36944. length = elems.length;
  36945. for (; i < length; i++) {
  36946. value = callback(elems[i], i, arg);
  36947. if (value != null) {
  36948. ret.push(value);
  36949. }
  36950. }
  36951. // Go through every key on the object,
  36952. } else {
  36953. for (i in elems) {
  36954. value = callback(elems[i], i, arg);
  36955. if (value != null) {
  36956. ret.push(value);
  36957. }
  36958. }
  36959. }
  36960. // Flatten any nested arrays
  36961. return concat.apply([], ret);
  36962. },
  36963. // A global GUID counter for objects
  36964. guid: 1,
  36965. // jQuery.support is not used in Core but other projects attach their
  36966. // properties to it so it needs to exist.
  36967. support: support
  36968. });
  36969. if (typeof Symbol === "function") {
  36970. jQuery.fn[Symbol.iterator] = arr[Symbol.iterator];
  36971. }
  36972. // Populate the class2type map
  36973. jQuery.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "), function (i, name) {
  36974. class2type["[object " + name + "]"] = name.toLowerCase();
  36975. });
  36976. function isArrayLike(obj) {
  36977. // Support: real iOS 8.2 only (not reproducible in simulator)
  36978. // `in` check used to prevent JIT error (gh-2145)
  36979. // hasOwn isn't used here due to false negatives
  36980. // regarding Nodelist length in IE
  36981. var length = !!obj && "length" in obj && obj.length,
  36982. type = toType(obj);
  36983. if (isFunction(obj) || isWindow(obj)) {
  36984. return false;
  36985. }
  36986. return type === "array" || length === 0 || typeof length === "number" && length > 0 && length - 1 in obj;
  36987. }
  36988. var Sizzle =
  36989. /*!
  36990. * Sizzle CSS Selector Engine v2.3.3
  36991. * https://sizzlejs.com/
  36992. *
  36993. * Copyright jQuery Foundation and other contributors
  36994. * Released under the MIT license
  36995. * http://jquery.org/license
  36996. *
  36997. * Date: 2016-08-08
  36998. */
  36999. function (window) {
  37000. var i,
  37001. support,
  37002. Expr,
  37003. getText,
  37004. isXML,
  37005. tokenize,
  37006. compile,
  37007. select,
  37008. outermostContext,
  37009. sortInput,
  37010. hasDuplicate,
  37011. // Local document vars
  37012. setDocument,
  37013. document,
  37014. docElem,
  37015. documentIsHTML,
  37016. rbuggyQSA,
  37017. rbuggyMatches,
  37018. matches,
  37019. contains,
  37020. // Instance-specific data
  37021. expando = "sizzle" + 1 * new Date(),
  37022. preferredDoc = window.document,
  37023. dirruns = 0,
  37024. done = 0,
  37025. classCache = createCache(),
  37026. tokenCache = createCache(),
  37027. compilerCache = createCache(),
  37028. sortOrder = function sortOrder(a, b) {
  37029. if (a === b) {
  37030. hasDuplicate = true;
  37031. }
  37032. return 0;
  37033. },
  37034. // Instance methods
  37035. hasOwn = {}.hasOwnProperty,
  37036. arr = [],
  37037. pop = arr.pop,
  37038. push_native = arr.push,
  37039. push = arr.push,
  37040. slice = arr.slice,
  37041. // Use a stripped-down indexOf as it's faster than native
  37042. // https://jsperf.com/thor-indexof-vs-for/5
  37043. indexOf = function indexOf(list, elem) {
  37044. var i = 0,
  37045. len = list.length;
  37046. for (; i < len; i++) {
  37047. if (list[i] === elem) {
  37048. return i;
  37049. }
  37050. }
  37051. return -1;
  37052. },
  37053. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  37054. // Regular expressions
  37055. // http://www.w3.org/TR/css3-selectors/#whitespace
  37056. whitespace = "[\\x20\\t\\r\\n\\f]",
  37057. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  37058. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  37059. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  37060. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  37061. // Operator (capture 2)
  37062. "*([*^$|!~]?=)" + whitespace +
  37063. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  37064. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + "*\\]",
  37065. pseudos = ":(" + identifier + ")(?:\\((" +
  37066. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  37067. // 1. quoted (capture 3; capture 4 or capture 5)
  37068. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  37069. // 2. simple (capture 6)
  37070. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  37071. // 3. anything else (capture 2)
  37072. ".*" + ")\\)|)",
  37073. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  37074. rwhitespace = new RegExp(whitespace + "+", "g"),
  37075. rtrim = new RegExp("^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g"),
  37076. rcomma = new RegExp("^" + whitespace + "*," + whitespace + "*"),
  37077. rcombinators = new RegExp("^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*"),
  37078. rattributeQuotes = new RegExp("=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g"),
  37079. rpseudo = new RegExp(pseudos),
  37080. ridentifier = new RegExp("^" + identifier + "$"),
  37081. matchExpr = {
  37082. "ID": new RegExp("^#(" + identifier + ")"),
  37083. "CLASS": new RegExp("^\\.(" + identifier + ")"),
  37084. "TAG": new RegExp("^(" + identifier + "|[*])"),
  37085. "ATTR": new RegExp("^" + attributes),
  37086. "PSEUDO": new RegExp("^" + pseudos),
  37087. "CHILD": new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i"),
  37088. "bool": new RegExp("^(?:" + booleans + ")$", "i"),
  37089. // For use in libraries implementing .is()
  37090. // We use this for POS matching in `select`
  37091. "needsContext": new RegExp("^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i")
  37092. },
  37093. rinputs = /^(?:input|select|textarea|button)$/i,
  37094. rheader = /^h\d$/i,
  37095. rnative = /^[^{]+\{\s*\[native \w/,
  37096. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  37097. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  37098. rsibling = /[+~]/,
  37099. // CSS escapes
  37100. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  37101. runescape = new RegExp("\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig"),
  37102. funescape = function funescape(_, escaped, escapedWhitespace) {
  37103. var high = "0x" + escaped - 0x10000;
  37104. // NaN means non-codepoint
  37105. // Support: Firefox<24
  37106. // Workaround erroneous numeric interpretation of +"0x"
  37107. return high !== high || escapedWhitespace ? escaped : high < 0 ?
  37108. // BMP codepoint
  37109. String.fromCharCode(high + 0x10000) :
  37110. // Supplemental Plane codepoint (surrogate pair)
  37111. String.fromCharCode(high >> 10 | 0xD800, high & 0x3FF | 0xDC00);
  37112. },
  37113. // CSS string/identifier serialization
  37114. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  37115. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  37116. fcssescape = function fcssescape(ch, asCodePoint) {
  37117. if (asCodePoint) {
  37118. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  37119. if (ch === "\0") {
  37120. return "\uFFFD";
  37121. }
  37122. // Control characters and (dependent upon position) numbers get escaped as code points
  37123. return ch.slice(0, -1) + "\\" + ch.charCodeAt(ch.length - 1).toString(16) + " ";
  37124. }
  37125. // Other potentially-special ASCII characters get backslash-escaped
  37126. return "\\" + ch;
  37127. },
  37128. // Used for iframes
  37129. // See setDocument()
  37130. // Removing the function wrapper causes a "Permission Denied"
  37131. // error in IE
  37132. unloadHandler = function unloadHandler() {
  37133. setDocument();
  37134. },
  37135. disabledAncestor = addCombinator(function (elem) {
  37136. return elem.disabled === true && ("form" in elem || "label" in elem);
  37137. }, { dir: "parentNode", next: "legend" });
  37138. // Optimize for push.apply( _, NodeList )
  37139. try {
  37140. push.apply(arr = slice.call(preferredDoc.childNodes), preferredDoc.childNodes);
  37141. // Support: Android<4.0
  37142. // Detect silently failing push.apply
  37143. arr[preferredDoc.childNodes.length].nodeType;
  37144. } catch (e) {
  37145. push = { apply: arr.length ?
  37146. // Leverage slice if possible
  37147. function (target, els) {
  37148. push_native.apply(target, slice.call(els));
  37149. } :
  37150. // Support: IE<9
  37151. // Otherwise append directly
  37152. function (target, els) {
  37153. var j = target.length,
  37154. i = 0;
  37155. // Can't trust NodeList.length
  37156. while (target[j++] = els[i++]) {}
  37157. target.length = j - 1;
  37158. }
  37159. };
  37160. }
  37161. function Sizzle(selector, context, results, seed) {
  37162. var m,
  37163. i,
  37164. elem,
  37165. nid,
  37166. match,
  37167. groups,
  37168. newSelector,
  37169. newContext = context && context.ownerDocument,
  37170. // nodeType defaults to 9, since context defaults to document
  37171. nodeType = context ? context.nodeType : 9;
  37172. results = results || [];
  37173. // Return early from calls with invalid selector or context
  37174. if (typeof selector !== "string" || !selector || nodeType !== 1 && nodeType !== 9 && nodeType !== 11) {
  37175. return results;
  37176. }
  37177. // Try to shortcut find operations (as opposed to filters) in HTML documents
  37178. if (!seed) {
  37179. if ((context ? context.ownerDocument || context : preferredDoc) !== document) {
  37180. setDocument(context);
  37181. }
  37182. context = context || document;
  37183. if (documentIsHTML) {
  37184. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  37185. // (excepting DocumentFragment context, where the methods don't exist)
  37186. if (nodeType !== 11 && (match = rquickExpr.exec(selector))) {
  37187. // ID selector
  37188. if (m = match[1]) {
  37189. // Document context
  37190. if (nodeType === 9) {
  37191. if (elem = context.getElementById(m)) {
  37192. // Support: IE, Opera, Webkit
  37193. // TODO: identify versions
  37194. // getElementById can match elements by name instead of ID
  37195. if (elem.id === m) {
  37196. results.push(elem);
  37197. return results;
  37198. }
  37199. } else {
  37200. return results;
  37201. }
  37202. // Element context
  37203. } else {
  37204. // Support: IE, Opera, Webkit
  37205. // TODO: identify versions
  37206. // getElementById can match elements by name instead of ID
  37207. if (newContext && (elem = newContext.getElementById(m)) && contains(context, elem) && elem.id === m) {
  37208. results.push(elem);
  37209. return results;
  37210. }
  37211. }
  37212. // Type selector
  37213. } else if (match[2]) {
  37214. push.apply(results, context.getElementsByTagName(selector));
  37215. return results;
  37216. // Class selector
  37217. } else if ((m = match[3]) && support.getElementsByClassName && context.getElementsByClassName) {
  37218. push.apply(results, context.getElementsByClassName(m));
  37219. return results;
  37220. }
  37221. }
  37222. // Take advantage of querySelectorAll
  37223. if (support.qsa && !compilerCache[selector + " "] && (!rbuggyQSA || !rbuggyQSA.test(selector))) {
  37224. if (nodeType !== 1) {
  37225. newContext = context;
  37226. newSelector = selector;
  37227. // qSA looks outside Element context, which is not what we want
  37228. // Thanks to Andrew Dupont for this workaround technique
  37229. // Support: IE <=8
  37230. // Exclude object elements
  37231. } else if (context.nodeName.toLowerCase() !== "object") {
  37232. // Capture the context ID, setting it first if necessary
  37233. if (nid = context.getAttribute("id")) {
  37234. nid = nid.replace(rcssescape, fcssescape);
  37235. } else {
  37236. context.setAttribute("id", nid = expando);
  37237. }
  37238. // Prefix every selector in the list
  37239. groups = tokenize(selector);
  37240. i = groups.length;
  37241. while (i--) {
  37242. groups[i] = "#" + nid + " " + toSelector(groups[i]);
  37243. }
  37244. newSelector = groups.join(",");
  37245. // Expand context for sibling selectors
  37246. newContext = rsibling.test(selector) && testContext(context.parentNode) || context;
  37247. }
  37248. if (newSelector) {
  37249. try {
  37250. push.apply(results, newContext.querySelectorAll(newSelector));
  37251. return results;
  37252. } catch (qsaError) {} finally {
  37253. if (nid === expando) {
  37254. context.removeAttribute("id");
  37255. }
  37256. }
  37257. }
  37258. }
  37259. }
  37260. }
  37261. // All others
  37262. return select(selector.replace(rtrim, "$1"), context, results, seed);
  37263. }
  37264. /**
  37265. * Create key-value caches of limited size
  37266. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  37267. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  37268. * deleting the oldest entry
  37269. */
  37270. function createCache() {
  37271. var keys = [];
  37272. function cache(key, value) {
  37273. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  37274. if (keys.push(key + " ") > Expr.cacheLength) {
  37275. // Only keep the most recent entries
  37276. delete cache[keys.shift()];
  37277. }
  37278. return cache[key + " "] = value;
  37279. }
  37280. return cache;
  37281. }
  37282. /**
  37283. * Mark a function for special use by Sizzle
  37284. * @param {Function} fn The function to mark
  37285. */
  37286. function markFunction(fn) {
  37287. fn[expando] = true;
  37288. return fn;
  37289. }
  37290. /**
  37291. * Support testing using an element
  37292. * @param {Function} fn Passed the created element and returns a boolean result
  37293. */
  37294. function assert(fn) {
  37295. var el = document.createElement("fieldset");
  37296. try {
  37297. return !!fn(el);
  37298. } catch (e) {
  37299. return false;
  37300. } finally {
  37301. // Remove from its parent by default
  37302. if (el.parentNode) {
  37303. el.parentNode.removeChild(el);
  37304. }
  37305. // release memory in IE
  37306. el = null;
  37307. }
  37308. }
  37309. /**
  37310. * Adds the same handler for all of the specified attrs
  37311. * @param {String} attrs Pipe-separated list of attributes
  37312. * @param {Function} handler The method that will be applied
  37313. */
  37314. function addHandle(attrs, handler) {
  37315. var arr = attrs.split("|"),
  37316. i = arr.length;
  37317. while (i--) {
  37318. Expr.attrHandle[arr[i]] = handler;
  37319. }
  37320. }
  37321. /**
  37322. * Checks document order of two siblings
  37323. * @param {Element} a
  37324. * @param {Element} b
  37325. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  37326. */
  37327. function siblingCheck(a, b) {
  37328. var cur = b && a,
  37329. diff = cur && a.nodeType === 1 && b.nodeType === 1 && a.sourceIndex - b.sourceIndex;
  37330. // Use IE sourceIndex if available on both nodes
  37331. if (diff) {
  37332. return diff;
  37333. }
  37334. // Check if b follows a
  37335. if (cur) {
  37336. while (cur = cur.nextSibling) {
  37337. if (cur === b) {
  37338. return -1;
  37339. }
  37340. }
  37341. }
  37342. return a ? 1 : -1;
  37343. }
  37344. /**
  37345. * Returns a function to use in pseudos for input types
  37346. * @param {String} type
  37347. */
  37348. function createInputPseudo(type) {
  37349. return function (elem) {
  37350. var name = elem.nodeName.toLowerCase();
  37351. return name === "input" && elem.type === type;
  37352. };
  37353. }
  37354. /**
  37355. * Returns a function to use in pseudos for buttons
  37356. * @param {String} type
  37357. */
  37358. function createButtonPseudo(type) {
  37359. return function (elem) {
  37360. var name = elem.nodeName.toLowerCase();
  37361. return (name === "input" || name === "button") && elem.type === type;
  37362. };
  37363. }
  37364. /**
  37365. * Returns a function to use in pseudos for :enabled/:disabled
  37366. * @param {Boolean} disabled true for :disabled; false for :enabled
  37367. */
  37368. function createDisabledPseudo(disabled) {
  37369. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  37370. return function (elem) {
  37371. // Only certain elements can match :enabled or :disabled
  37372. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  37373. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  37374. if ("form" in elem) {
  37375. // Check for inherited disabledness on relevant non-disabled elements:
  37376. // * listed form-associated elements in a disabled fieldset
  37377. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  37378. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  37379. // * option elements in a disabled optgroup
  37380. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  37381. // All such elements have a "form" property.
  37382. if (elem.parentNode && elem.disabled === false) {
  37383. // Option elements defer to a parent optgroup if present
  37384. if ("label" in elem) {
  37385. if ("label" in elem.parentNode) {
  37386. return elem.parentNode.disabled === disabled;
  37387. } else {
  37388. return elem.disabled === disabled;
  37389. }
  37390. }
  37391. // Support: IE 6 - 11
  37392. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  37393. return elem.isDisabled === disabled ||
  37394. // Where there is no isDisabled, check manually
  37395. /* jshint -W018 */
  37396. elem.isDisabled !== !disabled && disabledAncestor(elem) === disabled;
  37397. }
  37398. return elem.disabled === disabled;
  37399. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  37400. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  37401. // even exist on them, let alone have a boolean value.
  37402. } else if ("label" in elem) {
  37403. return elem.disabled === disabled;
  37404. }
  37405. // Remaining elements are neither :enabled nor :disabled
  37406. return false;
  37407. };
  37408. }
  37409. /**
  37410. * Returns a function to use in pseudos for positionals
  37411. * @param {Function} fn
  37412. */
  37413. function createPositionalPseudo(fn) {
  37414. return markFunction(function (argument) {
  37415. argument = +argument;
  37416. return markFunction(function (seed, matches) {
  37417. var j,
  37418. matchIndexes = fn([], seed.length, argument),
  37419. i = matchIndexes.length;
  37420. // Match elements found at the specified indexes
  37421. while (i--) {
  37422. if (seed[j = matchIndexes[i]]) {
  37423. seed[j] = !(matches[j] = seed[j]);
  37424. }
  37425. }
  37426. });
  37427. });
  37428. }
  37429. /**
  37430. * Checks a node for validity as a Sizzle context
  37431. * @param {Element|Object=} context
  37432. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  37433. */
  37434. function testContext(context) {
  37435. return context && typeof context.getElementsByTagName !== "undefined" && context;
  37436. }
  37437. // Expose support vars for convenience
  37438. support = Sizzle.support = {};
  37439. /**
  37440. * Detects XML nodes
  37441. * @param {Element|Object} elem An element or a document
  37442. * @returns {Boolean} True iff elem is a non-HTML XML node
  37443. */
  37444. isXML = Sizzle.isXML = function (elem) {
  37445. // documentElement is verified for cases where it doesn't yet exist
  37446. // (such as loading iframes in IE - #4833)
  37447. var documentElement = elem && (elem.ownerDocument || elem).documentElement;
  37448. return documentElement ? documentElement.nodeName !== "HTML" : false;
  37449. };
  37450. /**
  37451. * Sets document-related variables once based on the current document
  37452. * @param {Element|Object} [doc] An element or document object to use to set the document
  37453. * @returns {Object} Returns the current document
  37454. */
  37455. setDocument = Sizzle.setDocument = function (node) {
  37456. var hasCompare,
  37457. subWindow,
  37458. doc = node ? node.ownerDocument || node : preferredDoc;
  37459. // Return early if doc is invalid or already selected
  37460. if (doc === document || doc.nodeType !== 9 || !doc.documentElement) {
  37461. return document;
  37462. }
  37463. // Update global variables
  37464. document = doc;
  37465. docElem = document.documentElement;
  37466. documentIsHTML = !isXML(document);
  37467. // Support: IE 9-11, Edge
  37468. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  37469. if (preferredDoc !== document && (subWindow = document.defaultView) && subWindow.top !== subWindow) {
  37470. // Support: IE 11, Edge
  37471. if (subWindow.addEventListener) {
  37472. subWindow.addEventListener("unload", unloadHandler, false);
  37473. // Support: IE 9 - 10 only
  37474. } else if (subWindow.attachEvent) {
  37475. subWindow.attachEvent("onunload", unloadHandler);
  37476. }
  37477. }
  37478. /* Attributes
  37479. ---------------------------------------------------------------------- */
  37480. // Support: IE<8
  37481. // Verify that getAttribute really returns attributes and not properties
  37482. // (excepting IE8 booleans)
  37483. support.attributes = assert(function (el) {
  37484. el.className = "i";
  37485. return !el.getAttribute("className");
  37486. });
  37487. /* getElement(s)By*
  37488. ---------------------------------------------------------------------- */
  37489. // Check if getElementsByTagName("*") returns only elements
  37490. support.getElementsByTagName = assert(function (el) {
  37491. el.appendChild(document.createComment(""));
  37492. return !el.getElementsByTagName("*").length;
  37493. });
  37494. // Support: IE<9
  37495. support.getElementsByClassName = rnative.test(document.getElementsByClassName);
  37496. // Support: IE<10
  37497. // Check if getElementById returns elements by name
  37498. // The broken getElementById methods don't pick up programmatically-set names,
  37499. // so use a roundabout getElementsByName test
  37500. support.getById = assert(function (el) {
  37501. docElem.appendChild(el).id = expando;
  37502. return !document.getElementsByName || !document.getElementsByName(expando).length;
  37503. });
  37504. // ID filter and find
  37505. if (support.getById) {
  37506. Expr.filter["ID"] = function (id) {
  37507. var attrId = id.replace(runescape, funescape);
  37508. return function (elem) {
  37509. return elem.getAttribute("id") === attrId;
  37510. };
  37511. };
  37512. Expr.find["ID"] = function (id, context) {
  37513. if (typeof context.getElementById !== "undefined" && documentIsHTML) {
  37514. var elem = context.getElementById(id);
  37515. return elem ? [elem] : [];
  37516. }
  37517. };
  37518. } else {
  37519. Expr.filter["ID"] = function (id) {
  37520. var attrId = id.replace(runescape, funescape);
  37521. return function (elem) {
  37522. var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
  37523. return node && node.value === attrId;
  37524. };
  37525. };
  37526. // Support: IE 6 - 7 only
  37527. // getElementById is not reliable as a find shortcut
  37528. Expr.find["ID"] = function (id, context) {
  37529. if (typeof context.getElementById !== "undefined" && documentIsHTML) {
  37530. var node,
  37531. i,
  37532. elems,
  37533. elem = context.getElementById(id);
  37534. if (elem) {
  37535. // Verify the id attribute
  37536. node = elem.getAttributeNode("id");
  37537. if (node && node.value === id) {
  37538. return [elem];
  37539. }
  37540. // Fall back on getElementsByName
  37541. elems = context.getElementsByName(id);
  37542. i = 0;
  37543. while (elem = elems[i++]) {
  37544. node = elem.getAttributeNode("id");
  37545. if (node && node.value === id) {
  37546. return [elem];
  37547. }
  37548. }
  37549. }
  37550. return [];
  37551. }
  37552. };
  37553. }
  37554. // Tag
  37555. Expr.find["TAG"] = support.getElementsByTagName ? function (tag, context) {
  37556. if (typeof context.getElementsByTagName !== "undefined") {
  37557. return context.getElementsByTagName(tag);
  37558. // DocumentFragment nodes don't have gEBTN
  37559. } else if (support.qsa) {
  37560. return context.querySelectorAll(tag);
  37561. }
  37562. } : function (tag, context) {
  37563. var elem,
  37564. tmp = [],
  37565. i = 0,
  37566. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  37567. results = context.getElementsByTagName(tag);
  37568. // Filter out possible comments
  37569. if (tag === "*") {
  37570. while (elem = results[i++]) {
  37571. if (elem.nodeType === 1) {
  37572. tmp.push(elem);
  37573. }
  37574. }
  37575. return tmp;
  37576. }
  37577. return results;
  37578. };
  37579. // Class
  37580. Expr.find["CLASS"] = support.getElementsByClassName && function (className, context) {
  37581. if (typeof context.getElementsByClassName !== "undefined" && documentIsHTML) {
  37582. return context.getElementsByClassName(className);
  37583. }
  37584. };
  37585. /* QSA/matchesSelector
  37586. ---------------------------------------------------------------------- */
  37587. // QSA and matchesSelector support
  37588. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  37589. rbuggyMatches = [];
  37590. // qSa(:focus) reports false when true (Chrome 21)
  37591. // We allow this because of a bug in IE8/9 that throws an error
  37592. // whenever `document.activeElement` is accessed on an iframe
  37593. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  37594. // See https://bugs.jquery.com/ticket/13378
  37595. rbuggyQSA = [];
  37596. if (support.qsa = rnative.test(document.querySelectorAll)) {
  37597. // Build QSA regex
  37598. // Regex strategy adopted from Diego Perini
  37599. assert(function (el) {
  37600. // Select is set to empty string on purpose
  37601. // This is to test IE's treatment of not explicitly
  37602. // setting a boolean content attribute,
  37603. // since its presence should be enough
  37604. // https://bugs.jquery.com/ticket/12359
  37605. docElem.appendChild(el).innerHTML = "<a id='" + expando + "'></a>" + "<select id='" + expando + "-\r\\' msallowcapture=''>" + "<option selected=''></option></select>";
  37606. // Support: IE8, Opera 11-12.16
  37607. // Nothing should be selected when empty strings follow ^= or $= or *=
  37608. // The test attribute must be unknown in Opera but "safe" for WinRT
  37609. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  37610. if (el.querySelectorAll("[msallowcapture^='']").length) {
  37611. rbuggyQSA.push("[*^$]=" + whitespace + "*(?:''|\"\")");
  37612. }
  37613. // Support: IE8
  37614. // Boolean attributes and "value" are not treated correctly
  37615. if (!el.querySelectorAll("[selected]").length) {
  37616. rbuggyQSA.push("\\[" + whitespace + "*(?:value|" + booleans + ")");
  37617. }
  37618. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  37619. if (!el.querySelectorAll("[id~=" + expando + "-]").length) {
  37620. rbuggyQSA.push("~=");
  37621. }
  37622. // Webkit/Opera - :checked should return selected option elements
  37623. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  37624. // IE8 throws error here and will not see later tests
  37625. if (!el.querySelectorAll(":checked").length) {
  37626. rbuggyQSA.push(":checked");
  37627. }
  37628. // Support: Safari 8+, iOS 8+
  37629. // https://bugs.webkit.org/show_bug.cgi?id=136851
  37630. // In-page `selector#id sibling-combinator selector` fails
  37631. if (!el.querySelectorAll("a#" + expando + "+*").length) {
  37632. rbuggyQSA.push(".#.+[+~]");
  37633. }
  37634. });
  37635. assert(function (el) {
  37636. el.innerHTML = "<a href='' disabled='disabled'></a>" + "<select disabled='disabled'><option/></select>";
  37637. // Support: Windows 8 Native Apps
  37638. // The type and name attributes are restricted during .innerHTML assignment
  37639. var input = document.createElement("input");
  37640. input.setAttribute("type", "hidden");
  37641. el.appendChild(input).setAttribute("name", "D");
  37642. // Support: IE8
  37643. // Enforce case-sensitivity of name attribute
  37644. if (el.querySelectorAll("[name=d]").length) {
  37645. rbuggyQSA.push("name" + whitespace + "*[*^$|!~]?=");
  37646. }
  37647. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  37648. // IE8 throws error here and will not see later tests
  37649. if (el.querySelectorAll(":enabled").length !== 2) {
  37650. rbuggyQSA.push(":enabled", ":disabled");
  37651. }
  37652. // Support: IE9-11+
  37653. // IE's :disabled selector does not pick up the children of disabled fieldsets
  37654. docElem.appendChild(el).disabled = true;
  37655. if (el.querySelectorAll(":disabled").length !== 2) {
  37656. rbuggyQSA.push(":enabled", ":disabled");
  37657. }
  37658. // Opera 10-11 does not throw on post-comma invalid pseudos
  37659. el.querySelectorAll("*,:x");
  37660. rbuggyQSA.push(",.*:");
  37661. });
  37662. }
  37663. if (support.matchesSelector = rnative.test(matches = docElem.matches || docElem.webkitMatchesSelector || docElem.mozMatchesSelector || docElem.oMatchesSelector || docElem.msMatchesSelector)) {
  37664. assert(function (el) {
  37665. // Check to see if it's possible to do matchesSelector
  37666. // on a disconnected node (IE 9)
  37667. support.disconnectedMatch = matches.call(el, "*");
  37668. // This should fail with an exception
  37669. // Gecko does not error, returns false instead
  37670. matches.call(el, "[s!='']:x");
  37671. rbuggyMatches.push("!=", pseudos);
  37672. });
  37673. }
  37674. rbuggyQSA = rbuggyQSA.length && new RegExp(rbuggyQSA.join("|"));
  37675. rbuggyMatches = rbuggyMatches.length && new RegExp(rbuggyMatches.join("|"));
  37676. /* Contains
  37677. ---------------------------------------------------------------------- */
  37678. hasCompare = rnative.test(docElem.compareDocumentPosition);
  37679. // Element contains another
  37680. // Purposefully self-exclusive
  37681. // As in, an element does not contain itself
  37682. contains = hasCompare || rnative.test(docElem.contains) ? function (a, b) {
  37683. var adown = a.nodeType === 9 ? a.documentElement : a,
  37684. bup = b && b.parentNode;
  37685. return a === bup || !!(bup && bup.nodeType === 1 && (adown.contains ? adown.contains(bup) : a.compareDocumentPosition && a.compareDocumentPosition(bup) & 16));
  37686. } : function (a, b) {
  37687. if (b) {
  37688. while (b = b.parentNode) {
  37689. if (b === a) {
  37690. return true;
  37691. }
  37692. }
  37693. }
  37694. return false;
  37695. };
  37696. /* Sorting
  37697. ---------------------------------------------------------------------- */
  37698. // Document order sorting
  37699. sortOrder = hasCompare ? function (a, b) {
  37700. // Flag for duplicate removal
  37701. if (a === b) {
  37702. hasDuplicate = true;
  37703. return 0;
  37704. }
  37705. // Sort on method existence if only one input has compareDocumentPosition
  37706. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  37707. if (compare) {
  37708. return compare;
  37709. }
  37710. // Calculate position if both inputs belong to the same document
  37711. compare = (a.ownerDocument || a) === (b.ownerDocument || b) ? a.compareDocumentPosition(b) :
  37712. // Otherwise we know they are disconnected
  37713. 1;
  37714. // Disconnected nodes
  37715. if (compare & 1 || !support.sortDetached && b.compareDocumentPosition(a) === compare) {
  37716. // Choose the first element that is related to our preferred document
  37717. if (a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a)) {
  37718. return -1;
  37719. }
  37720. if (b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b)) {
  37721. return 1;
  37722. }
  37723. // Maintain original order
  37724. return sortInput ? indexOf(sortInput, a) - indexOf(sortInput, b) : 0;
  37725. }
  37726. return compare & 4 ? -1 : 1;
  37727. } : function (a, b) {
  37728. // Exit early if the nodes are identical
  37729. if (a === b) {
  37730. hasDuplicate = true;
  37731. return 0;
  37732. }
  37733. var cur,
  37734. i = 0,
  37735. aup = a.parentNode,
  37736. bup = b.parentNode,
  37737. ap = [a],
  37738. bp = [b];
  37739. // Parentless nodes are either documents or disconnected
  37740. if (!aup || !bup) {
  37741. return a === document ? -1 : b === document ? 1 : aup ? -1 : bup ? 1 : sortInput ? indexOf(sortInput, a) - indexOf(sortInput, b) : 0;
  37742. // If the nodes are siblings, we can do a quick check
  37743. } else if (aup === bup) {
  37744. return siblingCheck(a, b);
  37745. }
  37746. // Otherwise we need full lists of their ancestors for comparison
  37747. cur = a;
  37748. while (cur = cur.parentNode) {
  37749. ap.unshift(cur);
  37750. }
  37751. cur = b;
  37752. while (cur = cur.parentNode) {
  37753. bp.unshift(cur);
  37754. }
  37755. // Walk down the tree looking for a discrepancy
  37756. while (ap[i] === bp[i]) {
  37757. i++;
  37758. }
  37759. return i ?
  37760. // Do a sibling check if the nodes have a common ancestor
  37761. siblingCheck(ap[i], bp[i]) :
  37762. // Otherwise nodes in our document sort first
  37763. ap[i] === preferredDoc ? -1 : bp[i] === preferredDoc ? 1 : 0;
  37764. };
  37765. return document;
  37766. };
  37767. Sizzle.matches = function (expr, elements) {
  37768. return Sizzle(expr, null, null, elements);
  37769. };
  37770. Sizzle.matchesSelector = function (elem, expr) {
  37771. // Set document vars if needed
  37772. if ((elem.ownerDocument || elem) !== document) {
  37773. setDocument(elem);
  37774. }
  37775. // Make sure that attribute selectors are quoted
  37776. expr = expr.replace(rattributeQuotes, "='$1']");
  37777. if (support.matchesSelector && documentIsHTML && !compilerCache[expr + " "] && (!rbuggyMatches || !rbuggyMatches.test(expr)) && (!rbuggyQSA || !rbuggyQSA.test(expr))) {
  37778. try {
  37779. var ret = matches.call(elem, expr);
  37780. // IE 9's matchesSelector returns false on disconnected nodes
  37781. if (ret || support.disconnectedMatch ||
  37782. // As well, disconnected nodes are said to be in a document
  37783. // fragment in IE 9
  37784. elem.document && elem.document.nodeType !== 11) {
  37785. return ret;
  37786. }
  37787. } catch (e) {}
  37788. }
  37789. return Sizzle(expr, document, null, [elem]).length > 0;
  37790. };
  37791. Sizzle.contains = function (context, elem) {
  37792. // Set document vars if needed
  37793. if ((context.ownerDocument || context) !== document) {
  37794. setDocument(context);
  37795. }
  37796. return contains(context, elem);
  37797. };
  37798. Sizzle.attr = function (elem, name) {
  37799. // Set document vars if needed
  37800. if ((elem.ownerDocument || elem) !== document) {
  37801. setDocument(elem);
  37802. }
  37803. var fn = Expr.attrHandle[name.toLowerCase()],
  37804. // Don't get fooled by Object.prototype properties (jQuery #13807)
  37805. val = fn && hasOwn.call(Expr.attrHandle, name.toLowerCase()) ? fn(elem, name, !documentIsHTML) : undefined;
  37806. return val !== undefined ? val : support.attributes || !documentIsHTML ? elem.getAttribute(name) : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null;
  37807. };
  37808. Sizzle.escape = function (sel) {
  37809. return (sel + "").replace(rcssescape, fcssescape);
  37810. };
  37811. Sizzle.error = function (msg) {
  37812. throw new Error("Syntax error, unrecognized expression: " + msg);
  37813. };
  37814. /**
  37815. * Document sorting and removing duplicates
  37816. * @param {ArrayLike} results
  37817. */
  37818. Sizzle.uniqueSort = function (results) {
  37819. var elem,
  37820. duplicates = [],
  37821. j = 0,
  37822. i = 0;
  37823. // Unless we *know* we can detect duplicates, assume their presence
  37824. hasDuplicate = !support.detectDuplicates;
  37825. sortInput = !support.sortStable && results.slice(0);
  37826. results.sort(sortOrder);
  37827. if (hasDuplicate) {
  37828. while (elem = results[i++]) {
  37829. if (elem === results[i]) {
  37830. j = duplicates.push(i);
  37831. }
  37832. }
  37833. while (j--) {
  37834. results.splice(duplicates[j], 1);
  37835. }
  37836. }
  37837. // Clear input after sorting to release objects
  37838. // See https://github.com/jquery/sizzle/pull/225
  37839. sortInput = null;
  37840. return results;
  37841. };
  37842. /**
  37843. * Utility function for retrieving the text value of an array of DOM nodes
  37844. * @param {Array|Element} elem
  37845. */
  37846. getText = Sizzle.getText = function (elem) {
  37847. var node,
  37848. ret = "",
  37849. i = 0,
  37850. nodeType = elem.nodeType;
  37851. if (!nodeType) {
  37852. // If no nodeType, this is expected to be an array
  37853. while (node = elem[i++]) {
  37854. // Do not traverse comment nodes
  37855. ret += getText(node);
  37856. }
  37857. } else if (nodeType === 1 || nodeType === 9 || nodeType === 11) {
  37858. // Use textContent for elements
  37859. // innerText usage removed for consistency of new lines (jQuery #11153)
  37860. if (typeof elem.textContent === "string") {
  37861. return elem.textContent;
  37862. } else {
  37863. // Traverse its children
  37864. for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
  37865. ret += getText(elem);
  37866. }
  37867. }
  37868. } else if (nodeType === 3 || nodeType === 4) {
  37869. return elem.nodeValue;
  37870. }
  37871. // Do not include comment or processing instruction nodes
  37872. return ret;
  37873. };
  37874. Expr = Sizzle.selectors = {
  37875. // Can be adjusted by the user
  37876. cacheLength: 50,
  37877. createPseudo: markFunction,
  37878. match: matchExpr,
  37879. attrHandle: {},
  37880. find: {},
  37881. relative: {
  37882. ">": { dir: "parentNode", first: true },
  37883. " ": { dir: "parentNode" },
  37884. "+": { dir: "previousSibling", first: true },
  37885. "~": { dir: "previousSibling" }
  37886. },
  37887. preFilter: {
  37888. "ATTR": function ATTR(match) {
  37889. match[1] = match[1].replace(runescape, funescape);
  37890. // Move the given value to match[3] whether quoted or unquoted
  37891. match[3] = (match[3] || match[4] || match[5] || "").replace(runescape, funescape);
  37892. if (match[2] === "~=") {
  37893. match[3] = " " + match[3] + " ";
  37894. }
  37895. return match.slice(0, 4);
  37896. },
  37897. "CHILD": function CHILD(match) {
  37898. /* matches from matchExpr["CHILD"]
  37899. 1 type (only|nth|...)
  37900. 2 what (child|of-type)
  37901. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  37902. 4 xn-component of xn+y argument ([+-]?\d*n|)
  37903. 5 sign of xn-component
  37904. 6 x of xn-component
  37905. 7 sign of y-component
  37906. 8 y of y-component
  37907. */
  37908. match[1] = match[1].toLowerCase();
  37909. if (match[1].slice(0, 3) === "nth") {
  37910. // nth-* requires argument
  37911. if (!match[3]) {
  37912. Sizzle.error(match[0]);
  37913. }
  37914. // numeric x and y parameters for Expr.filter.CHILD
  37915. // remember that false/true cast respectively to 0/1
  37916. match[4] = +(match[4] ? match[5] + (match[6] || 1) : 2 * (match[3] === "even" || match[3] === "odd"));
  37917. match[5] = +(match[7] + match[8] || match[3] === "odd");
  37918. // other types prohibit arguments
  37919. } else if (match[3]) {
  37920. Sizzle.error(match[0]);
  37921. }
  37922. return match;
  37923. },
  37924. "PSEUDO": function PSEUDO(match) {
  37925. var excess,
  37926. unquoted = !match[6] && match[2];
  37927. if (matchExpr["CHILD"].test(match[0])) {
  37928. return null;
  37929. }
  37930. // Accept quoted arguments as-is
  37931. if (match[3]) {
  37932. match[2] = match[4] || match[5] || "";
  37933. // Strip excess characters from unquoted arguments
  37934. } else if (unquoted && rpseudo.test(unquoted) && (
  37935. // Get excess from tokenize (recursively)
  37936. excess = tokenize(unquoted, true)) && (
  37937. // advance to the next closing parenthesis
  37938. excess = unquoted.indexOf(")", unquoted.length - excess) - unquoted.length)) {
  37939. // excess is a negative index
  37940. match[0] = match[0].slice(0, excess);
  37941. match[2] = unquoted.slice(0, excess);
  37942. }
  37943. // Return only captures needed by the pseudo filter method (type and argument)
  37944. return match.slice(0, 3);
  37945. }
  37946. },
  37947. filter: {
  37948. "TAG": function TAG(nodeNameSelector) {
  37949. var nodeName = nodeNameSelector.replace(runescape, funescape).toLowerCase();
  37950. return nodeNameSelector === "*" ? function () {
  37951. return true;
  37952. } : function (elem) {
  37953. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  37954. };
  37955. },
  37956. "CLASS": function CLASS(className) {
  37957. var pattern = classCache[className + " "];
  37958. return pattern || (pattern = new RegExp("(^|" + whitespace + ")" + className + "(" + whitespace + "|$)")) && classCache(className, function (elem) {
  37959. return pattern.test(typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "");
  37960. });
  37961. },
  37962. "ATTR": function ATTR(name, operator, check) {
  37963. return function (elem) {
  37964. var result = Sizzle.attr(elem, name);
  37965. if (result == null) {
  37966. return operator === "!=";
  37967. }
  37968. if (!operator) {
  37969. return true;
  37970. }
  37971. result += "";
  37972. return operator === "=" ? result === check : operator === "!=" ? result !== check : operator === "^=" ? check && result.indexOf(check) === 0 : operator === "*=" ? check && result.indexOf(check) > -1 : operator === "$=" ? check && result.slice(-check.length) === check : operator === "~=" ? (" " + result.replace(rwhitespace, " ") + " ").indexOf(check) > -1 : operator === "|=" ? result === check || result.slice(0, check.length + 1) === check + "-" : false;
  37973. };
  37974. },
  37975. "CHILD": function CHILD(type, what, argument, first, last) {
  37976. var simple = type.slice(0, 3) !== "nth",
  37977. forward = type.slice(-4) !== "last",
  37978. ofType = what === "of-type";
  37979. return first === 1 && last === 0 ?
  37980. // Shortcut for :nth-*(n)
  37981. function (elem) {
  37982. return !!elem.parentNode;
  37983. } : function (elem, context, xml) {
  37984. var cache,
  37985. uniqueCache,
  37986. outerCache,
  37987. node,
  37988. nodeIndex,
  37989. start,
  37990. dir = simple !== forward ? "nextSibling" : "previousSibling",
  37991. parent = elem.parentNode,
  37992. name = ofType && elem.nodeName.toLowerCase(),
  37993. useCache = !xml && !ofType,
  37994. diff = false;
  37995. if (parent) {
  37996. // :(first|last|only)-(child|of-type)
  37997. if (simple) {
  37998. while (dir) {
  37999. node = elem;
  38000. while (node = node[dir]) {
  38001. if (ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) {
  38002. return false;
  38003. }
  38004. }
  38005. // Reverse direction for :only-* (if we haven't yet done so)
  38006. start = dir = type === "only" && !start && "nextSibling";
  38007. }
  38008. return true;
  38009. }
  38010. start = [forward ? parent.firstChild : parent.lastChild];
  38011. // non-xml :nth-child(...) stores cache data on `parent`
  38012. if (forward && useCache) {
  38013. // Seek `elem` from a previously-cached index
  38014. // ...in a gzip-friendly way
  38015. node = parent;
  38016. outerCache = node[expando] || (node[expando] = {});
  38017. // Support: IE <9 only
  38018. // Defend against cloned attroperties (jQuery gh-1709)
  38019. uniqueCache = outerCache[node.uniqueID] || (outerCache[node.uniqueID] = {});
  38020. cache = uniqueCache[type] || [];
  38021. nodeIndex = cache[0] === dirruns && cache[1];
  38022. diff = nodeIndex && cache[2];
  38023. node = nodeIndex && parent.childNodes[nodeIndex];
  38024. while (node = ++nodeIndex && node && node[dir] || (
  38025. // Fallback to seeking `elem` from the start
  38026. diff = nodeIndex = 0) || start.pop()) {
  38027. // When found, cache indexes on `parent` and break
  38028. if (node.nodeType === 1 && ++diff && node === elem) {
  38029. uniqueCache[type] = [dirruns, nodeIndex, diff];
  38030. break;
  38031. }
  38032. }
  38033. } else {
  38034. // Use previously-cached element index if available
  38035. if (useCache) {
  38036. // ...in a gzip-friendly way
  38037. node = elem;
  38038. outerCache = node[expando] || (node[expando] = {});
  38039. // Support: IE <9 only
  38040. // Defend against cloned attroperties (jQuery gh-1709)
  38041. uniqueCache = outerCache[node.uniqueID] || (outerCache[node.uniqueID] = {});
  38042. cache = uniqueCache[type] || [];
  38043. nodeIndex = cache[0] === dirruns && cache[1];
  38044. diff = nodeIndex;
  38045. }
  38046. // xml :nth-child(...)
  38047. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  38048. if (diff === false) {
  38049. // Use the same loop as above to seek `elem` from the start
  38050. while (node = ++nodeIndex && node && node[dir] || (diff = nodeIndex = 0) || start.pop()) {
  38051. if ((ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) && ++diff) {
  38052. // Cache the index of each encountered element
  38053. if (useCache) {
  38054. outerCache = node[expando] || (node[expando] = {});
  38055. // Support: IE <9 only
  38056. // Defend against cloned attroperties (jQuery gh-1709)
  38057. uniqueCache = outerCache[node.uniqueID] || (outerCache[node.uniqueID] = {});
  38058. uniqueCache[type] = [dirruns, diff];
  38059. }
  38060. if (node === elem) {
  38061. break;
  38062. }
  38063. }
  38064. }
  38065. }
  38066. }
  38067. // Incorporate the offset, then check against cycle size
  38068. diff -= last;
  38069. return diff === first || diff % first === 0 && diff / first >= 0;
  38070. }
  38071. };
  38072. },
  38073. "PSEUDO": function PSEUDO(pseudo, argument) {
  38074. // pseudo-class names are case-insensitive
  38075. // http://www.w3.org/TR/selectors/#pseudo-classes
  38076. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  38077. // Remember that setFilters inherits from pseudos
  38078. var args,
  38079. fn = Expr.pseudos[pseudo] || Expr.setFilters[pseudo.toLowerCase()] || Sizzle.error("unsupported pseudo: " + pseudo);
  38080. // The user may use createPseudo to indicate that
  38081. // arguments are needed to create the filter function
  38082. // just as Sizzle does
  38083. if (fn[expando]) {
  38084. return fn(argument);
  38085. }
  38086. // But maintain support for old signatures
  38087. if (fn.length > 1) {
  38088. args = [pseudo, pseudo, "", argument];
  38089. return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase()) ? markFunction(function (seed, matches) {
  38090. var idx,
  38091. matched = fn(seed, argument),
  38092. i = matched.length;
  38093. while (i--) {
  38094. idx = indexOf(seed, matched[i]);
  38095. seed[idx] = !(matches[idx] = matched[i]);
  38096. }
  38097. }) : function (elem) {
  38098. return fn(elem, 0, args);
  38099. };
  38100. }
  38101. return fn;
  38102. }
  38103. },
  38104. pseudos: {
  38105. // Potentially complex pseudos
  38106. "not": markFunction(function (selector) {
  38107. // Trim the selector passed to compile
  38108. // to avoid treating leading and trailing
  38109. // spaces as combinators
  38110. var input = [],
  38111. results = [],
  38112. matcher = compile(selector.replace(rtrim, "$1"));
  38113. return matcher[expando] ? markFunction(function (seed, matches, context, xml) {
  38114. var elem,
  38115. unmatched = matcher(seed, null, xml, []),
  38116. i = seed.length;
  38117. // Match elements unmatched by `matcher`
  38118. while (i--) {
  38119. if (elem = unmatched[i]) {
  38120. seed[i] = !(matches[i] = elem);
  38121. }
  38122. }
  38123. }) : function (elem, context, xml) {
  38124. input[0] = elem;
  38125. matcher(input, null, xml, results);
  38126. // Don't keep the element (issue #299)
  38127. input[0] = null;
  38128. return !results.pop();
  38129. };
  38130. }),
  38131. "has": markFunction(function (selector) {
  38132. return function (elem) {
  38133. return Sizzle(selector, elem).length > 0;
  38134. };
  38135. }),
  38136. "contains": markFunction(function (text) {
  38137. text = text.replace(runescape, funescape);
  38138. return function (elem) {
  38139. return (elem.textContent || elem.innerText || getText(elem)).indexOf(text) > -1;
  38140. };
  38141. }),
  38142. // "Whether an element is represented by a :lang() selector
  38143. // is based solely on the element's language value
  38144. // being equal to the identifier C,
  38145. // or beginning with the identifier C immediately followed by "-".
  38146. // The matching of C against the element's language value is performed case-insensitively.
  38147. // The identifier C does not have to be a valid language name."
  38148. // http://www.w3.org/TR/selectors/#lang-pseudo
  38149. "lang": markFunction(function (lang) {
  38150. // lang value must be a valid identifier
  38151. if (!ridentifier.test(lang || "")) {
  38152. Sizzle.error("unsupported lang: " + lang);
  38153. }
  38154. lang = lang.replace(runescape, funescape).toLowerCase();
  38155. return function (elem) {
  38156. var elemLang;
  38157. do {
  38158. if (elemLang = documentIsHTML ? elem.lang : elem.getAttribute("xml:lang") || elem.getAttribute("lang")) {
  38159. elemLang = elemLang.toLowerCase();
  38160. return elemLang === lang || elemLang.indexOf(lang + "-") === 0;
  38161. }
  38162. } while ((elem = elem.parentNode) && elem.nodeType === 1);
  38163. return false;
  38164. };
  38165. }),
  38166. // Miscellaneous
  38167. "target": function target(elem) {
  38168. var hash = window.location && window.location.hash;
  38169. return hash && hash.slice(1) === elem.id;
  38170. },
  38171. "root": function root(elem) {
  38172. return elem === docElem;
  38173. },
  38174. "focus": function focus(elem) {
  38175. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  38176. },
  38177. // Boolean properties
  38178. "enabled": createDisabledPseudo(false),
  38179. "disabled": createDisabledPseudo(true),
  38180. "checked": function checked(elem) {
  38181. // In CSS3, :checked should return both checked and selected elements
  38182. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  38183. var nodeName = elem.nodeName.toLowerCase();
  38184. return nodeName === "input" && !!elem.checked || nodeName === "option" && !!elem.selected;
  38185. },
  38186. "selected": function selected(elem) {
  38187. // Accessing this property makes selected-by-default
  38188. // options in Safari work properly
  38189. if (elem.parentNode) {
  38190. elem.parentNode.selectedIndex;
  38191. }
  38192. return elem.selected === true;
  38193. },
  38194. // Contents
  38195. "empty": function empty(elem) {
  38196. // http://www.w3.org/TR/selectors/#empty-pseudo
  38197. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  38198. // but not by others (comment: 8; processing instruction: 7; etc.)
  38199. // nodeType < 6 works because attributes (2) do not appear as children
  38200. for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
  38201. if (elem.nodeType < 6) {
  38202. return false;
  38203. }
  38204. }
  38205. return true;
  38206. },
  38207. "parent": function parent(elem) {
  38208. return !Expr.pseudos["empty"](elem);
  38209. },
  38210. // Element/input types
  38211. "header": function header(elem) {
  38212. return rheader.test(elem.nodeName);
  38213. },
  38214. "input": function input(elem) {
  38215. return rinputs.test(elem.nodeName);
  38216. },
  38217. "button": function button(elem) {
  38218. var name = elem.nodeName.toLowerCase();
  38219. return name === "input" && elem.type === "button" || name === "button";
  38220. },
  38221. "text": function text(elem) {
  38222. var attr;
  38223. return elem.nodeName.toLowerCase() === "input" && elem.type === "text" && (
  38224. // Support: IE<8
  38225. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  38226. (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text");
  38227. },
  38228. // Position-in-collection
  38229. "first": createPositionalPseudo(function () {
  38230. return [0];
  38231. }),
  38232. "last": createPositionalPseudo(function (matchIndexes, length) {
  38233. return [length - 1];
  38234. }),
  38235. "eq": createPositionalPseudo(function (matchIndexes, length, argument) {
  38236. return [argument < 0 ? argument + length : argument];
  38237. }),
  38238. "even": createPositionalPseudo(function (matchIndexes, length) {
  38239. var i = 0;
  38240. for (; i < length; i += 2) {
  38241. matchIndexes.push(i);
  38242. }
  38243. return matchIndexes;
  38244. }),
  38245. "odd": createPositionalPseudo(function (matchIndexes, length) {
  38246. var i = 1;
  38247. for (; i < length; i += 2) {
  38248. matchIndexes.push(i);
  38249. }
  38250. return matchIndexes;
  38251. }),
  38252. "lt": createPositionalPseudo(function (matchIndexes, length, argument) {
  38253. var i = argument < 0 ? argument + length : argument;
  38254. for (; --i >= 0;) {
  38255. matchIndexes.push(i);
  38256. }
  38257. return matchIndexes;
  38258. }),
  38259. "gt": createPositionalPseudo(function (matchIndexes, length, argument) {
  38260. var i = argument < 0 ? argument + length : argument;
  38261. for (; ++i < length;) {
  38262. matchIndexes.push(i);
  38263. }
  38264. return matchIndexes;
  38265. })
  38266. }
  38267. };
  38268. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  38269. // Add button/input type pseudos
  38270. for (i in { radio: true, checkbox: true, file: true, password: true, image: true }) {
  38271. Expr.pseudos[i] = createInputPseudo(i);
  38272. }
  38273. for (i in { submit: true, reset: true }) {
  38274. Expr.pseudos[i] = createButtonPseudo(i);
  38275. }
  38276. // Easy API for creating new setFilters
  38277. function setFilters() {}
  38278. setFilters.prototype = Expr.filters = Expr.pseudos;
  38279. Expr.setFilters = new setFilters();
  38280. tokenize = Sizzle.tokenize = function (selector, parseOnly) {
  38281. var matched,
  38282. match,
  38283. tokens,
  38284. type,
  38285. soFar,
  38286. groups,
  38287. preFilters,
  38288. cached = tokenCache[selector + " "];
  38289. if (cached) {
  38290. return parseOnly ? 0 : cached.slice(0);
  38291. }
  38292. soFar = selector;
  38293. groups = [];
  38294. preFilters = Expr.preFilter;
  38295. while (soFar) {
  38296. // Comma and first run
  38297. if (!matched || (match = rcomma.exec(soFar))) {
  38298. if (match) {
  38299. // Don't consume trailing commas as valid
  38300. soFar = soFar.slice(match[0].length) || soFar;
  38301. }
  38302. groups.push(tokens = []);
  38303. }
  38304. matched = false;
  38305. // Combinators
  38306. if (match = rcombinators.exec(soFar)) {
  38307. matched = match.shift();
  38308. tokens.push({
  38309. value: matched,
  38310. // Cast descendant combinators to space
  38311. type: match[0].replace(rtrim, " ")
  38312. });
  38313. soFar = soFar.slice(matched.length);
  38314. }
  38315. // Filters
  38316. for (type in Expr.filter) {
  38317. if ((match = matchExpr[type].exec(soFar)) && (!preFilters[type] || (match = preFilters[type](match)))) {
  38318. matched = match.shift();
  38319. tokens.push({
  38320. value: matched,
  38321. type: type,
  38322. matches: match
  38323. });
  38324. soFar = soFar.slice(matched.length);
  38325. }
  38326. }
  38327. if (!matched) {
  38328. break;
  38329. }
  38330. }
  38331. // Return the length of the invalid excess
  38332. // if we're just parsing
  38333. // Otherwise, throw an error or return tokens
  38334. return parseOnly ? soFar.length : soFar ? Sizzle.error(selector) :
  38335. // Cache the tokens
  38336. tokenCache(selector, groups).slice(0);
  38337. };
  38338. function toSelector(tokens) {
  38339. var i = 0,
  38340. len = tokens.length,
  38341. selector = "";
  38342. for (; i < len; i++) {
  38343. selector += tokens[i].value;
  38344. }
  38345. return selector;
  38346. }
  38347. function addCombinator(matcher, combinator, base) {
  38348. var dir = combinator.dir,
  38349. skip = combinator.next,
  38350. key = skip || dir,
  38351. checkNonElements = base && key === "parentNode",
  38352. doneName = done++;
  38353. return combinator.first ?
  38354. // Check against closest ancestor/preceding element
  38355. function (elem, context, xml) {
  38356. while (elem = elem[dir]) {
  38357. if (elem.nodeType === 1 || checkNonElements) {
  38358. return matcher(elem, context, xml);
  38359. }
  38360. }
  38361. return false;
  38362. } :
  38363. // Check against all ancestor/preceding elements
  38364. function (elem, context, xml) {
  38365. var oldCache,
  38366. uniqueCache,
  38367. outerCache,
  38368. newCache = [dirruns, doneName];
  38369. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  38370. if (xml) {
  38371. while (elem = elem[dir]) {
  38372. if (elem.nodeType === 1 || checkNonElements) {
  38373. if (matcher(elem, context, xml)) {
  38374. return true;
  38375. }
  38376. }
  38377. }
  38378. } else {
  38379. while (elem = elem[dir]) {
  38380. if (elem.nodeType === 1 || checkNonElements) {
  38381. outerCache = elem[expando] || (elem[expando] = {});
  38382. // Support: IE <9 only
  38383. // Defend against cloned attroperties (jQuery gh-1709)
  38384. uniqueCache = outerCache[elem.uniqueID] || (outerCache[elem.uniqueID] = {});
  38385. if (skip && skip === elem.nodeName.toLowerCase()) {
  38386. elem = elem[dir] || elem;
  38387. } else if ((oldCache = uniqueCache[key]) && oldCache[0] === dirruns && oldCache[1] === doneName) {
  38388. // Assign to newCache so results back-propagate to previous elements
  38389. return newCache[2] = oldCache[2];
  38390. } else {
  38391. // Reuse newcache so results back-propagate to previous elements
  38392. uniqueCache[key] = newCache;
  38393. // A match means we're done; a fail means we have to keep checking
  38394. if (newCache[2] = matcher(elem, context, xml)) {
  38395. return true;
  38396. }
  38397. }
  38398. }
  38399. }
  38400. }
  38401. return false;
  38402. };
  38403. }
  38404. function elementMatcher(matchers) {
  38405. return matchers.length > 1 ? function (elem, context, xml) {
  38406. var i = matchers.length;
  38407. while (i--) {
  38408. if (!matchers[i](elem, context, xml)) {
  38409. return false;
  38410. }
  38411. }
  38412. return true;
  38413. } : matchers[0];
  38414. }
  38415. function multipleContexts(selector, contexts, results) {
  38416. var i = 0,
  38417. len = contexts.length;
  38418. for (; i < len; i++) {
  38419. Sizzle(selector, contexts[i], results);
  38420. }
  38421. return results;
  38422. }
  38423. function condense(unmatched, map, filter, context, xml) {
  38424. var elem,
  38425. newUnmatched = [],
  38426. i = 0,
  38427. len = unmatched.length,
  38428. mapped = map != null;
  38429. for (; i < len; i++) {
  38430. if (elem = unmatched[i]) {
  38431. if (!filter || filter(elem, context, xml)) {
  38432. newUnmatched.push(elem);
  38433. if (mapped) {
  38434. map.push(i);
  38435. }
  38436. }
  38437. }
  38438. }
  38439. return newUnmatched;
  38440. }
  38441. function setMatcher(preFilter, selector, matcher, postFilter, postFinder, postSelector) {
  38442. if (postFilter && !postFilter[expando]) {
  38443. postFilter = setMatcher(postFilter);
  38444. }
  38445. if (postFinder && !postFinder[expando]) {
  38446. postFinder = setMatcher(postFinder, postSelector);
  38447. }
  38448. return markFunction(function (seed, results, context, xml) {
  38449. var temp,
  38450. i,
  38451. elem,
  38452. preMap = [],
  38453. postMap = [],
  38454. preexisting = results.length,
  38455. // Get initial elements from seed or context
  38456. elems = seed || multipleContexts(selector || "*", context.nodeType ? [context] : context, []),
  38457. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  38458. matcherIn = preFilter && (seed || !selector) ? condense(elems, preMap, preFilter, context, xml) : elems,
  38459. matcherOut = matcher ?
  38460. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  38461. postFinder || (seed ? preFilter : preexisting || postFilter) ?
  38462. // ...intermediate processing is necessary
  38463. [] :
  38464. // ...otherwise use results directly
  38465. results : matcherIn;
  38466. // Find primary matches
  38467. if (matcher) {
  38468. matcher(matcherIn, matcherOut, context, xml);
  38469. }
  38470. // Apply postFilter
  38471. if (postFilter) {
  38472. temp = condense(matcherOut, postMap);
  38473. postFilter(temp, [], context, xml);
  38474. // Un-match failing elements by moving them back to matcherIn
  38475. i = temp.length;
  38476. while (i--) {
  38477. if (elem = temp[i]) {
  38478. matcherOut[postMap[i]] = !(matcherIn[postMap[i]] = elem);
  38479. }
  38480. }
  38481. }
  38482. if (seed) {
  38483. if (postFinder || preFilter) {
  38484. if (postFinder) {
  38485. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  38486. temp = [];
  38487. i = matcherOut.length;
  38488. while (i--) {
  38489. if (elem = matcherOut[i]) {
  38490. // Restore matcherIn since elem is not yet a final match
  38491. temp.push(matcherIn[i] = elem);
  38492. }
  38493. }
  38494. postFinder(null, matcherOut = [], temp, xml);
  38495. }
  38496. // Move matched elements from seed to results to keep them synchronized
  38497. i = matcherOut.length;
  38498. while (i--) {
  38499. if ((elem = matcherOut[i]) && (temp = postFinder ? indexOf(seed, elem) : preMap[i]) > -1) {
  38500. seed[temp] = !(results[temp] = elem);
  38501. }
  38502. }
  38503. }
  38504. // Add elements to results, through postFinder if defined
  38505. } else {
  38506. matcherOut = condense(matcherOut === results ? matcherOut.splice(preexisting, matcherOut.length) : matcherOut);
  38507. if (postFinder) {
  38508. postFinder(null, results, matcherOut, xml);
  38509. } else {
  38510. push.apply(results, matcherOut);
  38511. }
  38512. }
  38513. });
  38514. }
  38515. function matcherFromTokens(tokens) {
  38516. var checkContext,
  38517. matcher,
  38518. j,
  38519. len = tokens.length,
  38520. leadingRelative = Expr.relative[tokens[0].type],
  38521. implicitRelative = leadingRelative || Expr.relative[" "],
  38522. i = leadingRelative ? 1 : 0,
  38523. // The foundational matcher ensures that elements are reachable from top-level context(s)
  38524. matchContext = addCombinator(function (elem) {
  38525. return elem === checkContext;
  38526. }, implicitRelative, true),
  38527. matchAnyContext = addCombinator(function (elem) {
  38528. return indexOf(checkContext, elem) > -1;
  38529. }, implicitRelative, true),
  38530. matchers = [function (elem, context, xml) {
  38531. var ret = !leadingRelative && (xml || context !== outermostContext) || ((checkContext = context).nodeType ? matchContext(elem, context, xml) : matchAnyContext(elem, context, xml));
  38532. // Avoid hanging onto element (issue #299)
  38533. checkContext = null;
  38534. return ret;
  38535. }];
  38536. for (; i < len; i++) {
  38537. if (matcher = Expr.relative[tokens[i].type]) {
  38538. matchers = [addCombinator(elementMatcher(matchers), matcher)];
  38539. } else {
  38540. matcher = Expr.filter[tokens[i].type].apply(null, tokens[i].matches);
  38541. // Return special upon seeing a positional matcher
  38542. if (matcher[expando]) {
  38543. // Find the next relative operator (if any) for proper handling
  38544. j = ++i;
  38545. for (; j < len; j++) {
  38546. if (Expr.relative[tokens[j].type]) {
  38547. break;
  38548. }
  38549. }
  38550. return setMatcher(i > 1 && elementMatcher(matchers), i > 1 && toSelector(
  38551. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  38552. tokens.slice(0, i - 1).concat({ value: tokens[i - 2].type === " " ? "*" : "" })).replace(rtrim, "$1"), matcher, i < j && matcherFromTokens(tokens.slice(i, j)), j < len && matcherFromTokens(tokens = tokens.slice(j)), j < len && toSelector(tokens));
  38553. }
  38554. matchers.push(matcher);
  38555. }
  38556. }
  38557. return elementMatcher(matchers);
  38558. }
  38559. function matcherFromGroupMatchers(elementMatchers, setMatchers) {
  38560. var bySet = setMatchers.length > 0,
  38561. byElement = elementMatchers.length > 0,
  38562. superMatcher = function superMatcher(seed, context, xml, results, outermost) {
  38563. var elem,
  38564. j,
  38565. matcher,
  38566. matchedCount = 0,
  38567. i = "0",
  38568. unmatched = seed && [],
  38569. setMatched = [],
  38570. contextBackup = outermostContext,
  38571. // We must always have either seed elements or outermost context
  38572. elems = seed || byElement && Expr.find["TAG"]("*", outermost),
  38573. // Use integer dirruns iff this is the outermost matcher
  38574. dirrunsUnique = dirruns += contextBackup == null ? 1 : Math.random() || 0.1,
  38575. len = elems.length;
  38576. if (outermost) {
  38577. outermostContext = context === document || context || outermost;
  38578. }
  38579. // Add elements passing elementMatchers directly to results
  38580. // Support: IE<9, Safari
  38581. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  38582. for (; i !== len && (elem = elems[i]) != null; i++) {
  38583. if (byElement && elem) {
  38584. j = 0;
  38585. if (!context && elem.ownerDocument !== document) {
  38586. setDocument(elem);
  38587. xml = !documentIsHTML;
  38588. }
  38589. while (matcher = elementMatchers[j++]) {
  38590. if (matcher(elem, context || document, xml)) {
  38591. results.push(elem);
  38592. break;
  38593. }
  38594. }
  38595. if (outermost) {
  38596. dirruns = dirrunsUnique;
  38597. }
  38598. }
  38599. // Track unmatched elements for set filters
  38600. if (bySet) {
  38601. // They will have gone through all possible matchers
  38602. if (elem = !matcher && elem) {
  38603. matchedCount--;
  38604. }
  38605. // Lengthen the array for every element, matched or not
  38606. if (seed) {
  38607. unmatched.push(elem);
  38608. }
  38609. }
  38610. }
  38611. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  38612. // makes the latter nonnegative.
  38613. matchedCount += i;
  38614. // Apply set filters to unmatched elements
  38615. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  38616. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  38617. // no element matchers and no seed.
  38618. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  38619. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  38620. // numerically zero.
  38621. if (bySet && i !== matchedCount) {
  38622. j = 0;
  38623. while (matcher = setMatchers[j++]) {
  38624. matcher(unmatched, setMatched, context, xml);
  38625. }
  38626. if (seed) {
  38627. // Reintegrate element matches to eliminate the need for sorting
  38628. if (matchedCount > 0) {
  38629. while (i--) {
  38630. if (!(unmatched[i] || setMatched[i])) {
  38631. setMatched[i] = pop.call(results);
  38632. }
  38633. }
  38634. }
  38635. // Discard index placeholder values to get only actual matches
  38636. setMatched = condense(setMatched);
  38637. }
  38638. // Add matches to results
  38639. push.apply(results, setMatched);
  38640. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  38641. if (outermost && !seed && setMatched.length > 0 && matchedCount + setMatchers.length > 1) {
  38642. Sizzle.uniqueSort(results);
  38643. }
  38644. }
  38645. // Override manipulation of globals by nested matchers
  38646. if (outermost) {
  38647. dirruns = dirrunsUnique;
  38648. outermostContext = contextBackup;
  38649. }
  38650. return unmatched;
  38651. };
  38652. return bySet ? markFunction(superMatcher) : superMatcher;
  38653. }
  38654. compile = Sizzle.compile = function (selector, match /* Internal Use Only */) {
  38655. var i,
  38656. setMatchers = [],
  38657. elementMatchers = [],
  38658. cached = compilerCache[selector + " "];
  38659. if (!cached) {
  38660. // Generate a function of recursive functions that can be used to check each element
  38661. if (!match) {
  38662. match = tokenize(selector);
  38663. }
  38664. i = match.length;
  38665. while (i--) {
  38666. cached = matcherFromTokens(match[i]);
  38667. if (cached[expando]) {
  38668. setMatchers.push(cached);
  38669. } else {
  38670. elementMatchers.push(cached);
  38671. }
  38672. }
  38673. // Cache the compiled function
  38674. cached = compilerCache(selector, matcherFromGroupMatchers(elementMatchers, setMatchers));
  38675. // Save selector and tokenization
  38676. cached.selector = selector;
  38677. }
  38678. return cached;
  38679. };
  38680. /**
  38681. * A low-level selection function that works with Sizzle's compiled
  38682. * selector functions
  38683. * @param {String|Function} selector A selector or a pre-compiled
  38684. * selector function built with Sizzle.compile
  38685. * @param {Element} context
  38686. * @param {Array} [results]
  38687. * @param {Array} [seed] A set of elements to match against
  38688. */
  38689. select = Sizzle.select = function (selector, context, results, seed) {
  38690. var i,
  38691. tokens,
  38692. token,
  38693. type,
  38694. find,
  38695. compiled = typeof selector === "function" && selector,
  38696. match = !seed && tokenize(selector = compiled.selector || selector);
  38697. results = results || [];
  38698. // Try to minimize operations if there is only one selector in the list and no seed
  38699. // (the latter of which guarantees us context)
  38700. if (match.length === 1) {
  38701. // Reduce context if the leading compound selector is an ID
  38702. tokens = match[0] = match[0].slice(0);
  38703. if (tokens.length > 2 && (token = tokens[0]).type === "ID" && context.nodeType === 9 && documentIsHTML && Expr.relative[tokens[1].type]) {
  38704. context = (Expr.find["ID"](token.matches[0].replace(runescape, funescape), context) || [])[0];
  38705. if (!context) {
  38706. return results;
  38707. // Precompiled matchers will still verify ancestry, so step up a level
  38708. } else if (compiled) {
  38709. context = context.parentNode;
  38710. }
  38711. selector = selector.slice(tokens.shift().value.length);
  38712. }
  38713. // Fetch a seed set for right-to-left matching
  38714. i = matchExpr["needsContext"].test(selector) ? 0 : tokens.length;
  38715. while (i--) {
  38716. token = tokens[i];
  38717. // Abort if we hit a combinator
  38718. if (Expr.relative[type = token.type]) {
  38719. break;
  38720. }
  38721. if (find = Expr.find[type]) {
  38722. // Search, expanding context for leading sibling combinators
  38723. if (seed = find(token.matches[0].replace(runescape, funescape), rsibling.test(tokens[0].type) && testContext(context.parentNode) || context)) {
  38724. // If seed is empty or no tokens remain, we can return early
  38725. tokens.splice(i, 1);
  38726. selector = seed.length && toSelector(tokens);
  38727. if (!selector) {
  38728. push.apply(results, seed);
  38729. return results;
  38730. }
  38731. break;
  38732. }
  38733. }
  38734. }
  38735. }
  38736. // Compile and execute a filtering function if one is not provided
  38737. // Provide `match` to avoid retokenization if we modified the selector above
  38738. (compiled || compile(selector, match))(seed, context, !documentIsHTML, results, !context || rsibling.test(selector) && testContext(context.parentNode) || context);
  38739. return results;
  38740. };
  38741. // One-time assignments
  38742. // Sort stability
  38743. support.sortStable = expando.split("").sort(sortOrder).join("") === expando;
  38744. // Support: Chrome 14-35+
  38745. // Always assume duplicates if they aren't passed to the comparison function
  38746. support.detectDuplicates = !!hasDuplicate;
  38747. // Initialize against the default document
  38748. setDocument();
  38749. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  38750. // Detached nodes confoundingly follow *each other*
  38751. support.sortDetached = assert(function (el) {
  38752. // Should return 1, but returns 4 (following)
  38753. return el.compareDocumentPosition(document.createElement("fieldset")) & 1;
  38754. });
  38755. // Support: IE<8
  38756. // Prevent attribute/property "interpolation"
  38757. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  38758. if (!assert(function (el) {
  38759. el.innerHTML = "<a href='#'></a>";
  38760. return el.firstChild.getAttribute("href") === "#";
  38761. })) {
  38762. addHandle("type|href|height|width", function (elem, name, isXML) {
  38763. if (!isXML) {
  38764. return elem.getAttribute(name, name.toLowerCase() === "type" ? 1 : 2);
  38765. }
  38766. });
  38767. }
  38768. // Support: IE<9
  38769. // Use defaultValue in place of getAttribute("value")
  38770. if (!support.attributes || !assert(function (el) {
  38771. el.innerHTML = "<input/>";
  38772. el.firstChild.setAttribute("value", "");
  38773. return el.firstChild.getAttribute("value") === "";
  38774. })) {
  38775. addHandle("value", function (elem, name, isXML) {
  38776. if (!isXML && elem.nodeName.toLowerCase() === "input") {
  38777. return elem.defaultValue;
  38778. }
  38779. });
  38780. }
  38781. // Support: IE<9
  38782. // Use getAttributeNode to fetch booleans when getAttribute lies
  38783. if (!assert(function (el) {
  38784. return el.getAttribute("disabled") == null;
  38785. })) {
  38786. addHandle(booleans, function (elem, name, isXML) {
  38787. var val;
  38788. if (!isXML) {
  38789. return elem[name] === true ? name.toLowerCase() : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null;
  38790. }
  38791. });
  38792. }
  38793. return Sizzle;
  38794. }(window);
  38795. jQuery.find = Sizzle;
  38796. jQuery.expr = Sizzle.selectors;
  38797. // Deprecated
  38798. jQuery.expr[":"] = jQuery.expr.pseudos;
  38799. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  38800. jQuery.text = Sizzle.getText;
  38801. jQuery.isXMLDoc = Sizzle.isXML;
  38802. jQuery.contains = Sizzle.contains;
  38803. jQuery.escapeSelector = Sizzle.escape;
  38804. var dir = function dir(elem, _dir, until) {
  38805. var matched = [],
  38806. truncate = until !== undefined;
  38807. while ((elem = elem[_dir]) && elem.nodeType !== 9) {
  38808. if (elem.nodeType === 1) {
  38809. if (truncate && jQuery(elem).is(until)) {
  38810. break;
  38811. }
  38812. matched.push(elem);
  38813. }
  38814. }
  38815. return matched;
  38816. };
  38817. var _siblings = function _siblings(n, elem) {
  38818. var matched = [];
  38819. for (; n; n = n.nextSibling) {
  38820. if (n.nodeType === 1 && n !== elem) {
  38821. matched.push(n);
  38822. }
  38823. }
  38824. return matched;
  38825. };
  38826. var rneedsContext = jQuery.expr.match.needsContext;
  38827. function nodeName(elem, name) {
  38828. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  38829. };
  38830. var rsingleTag = /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;
  38831. // Implement the identical functionality for filter and not
  38832. function winnow(elements, qualifier, not) {
  38833. if (isFunction(qualifier)) {
  38834. return jQuery.grep(elements, function (elem, i) {
  38835. return !!qualifier.call(elem, i, elem) !== not;
  38836. });
  38837. }
  38838. // Single element
  38839. if (qualifier.nodeType) {
  38840. return jQuery.grep(elements, function (elem) {
  38841. return elem === qualifier !== not;
  38842. });
  38843. }
  38844. // Arraylike of elements (jQuery, arguments, Array)
  38845. if (typeof qualifier !== "string") {
  38846. return jQuery.grep(elements, function (elem) {
  38847. return indexOf.call(qualifier, elem) > -1 !== not;
  38848. });
  38849. }
  38850. // Filtered directly for both simple and complex selectors
  38851. return jQuery.filter(qualifier, elements, not);
  38852. }
  38853. jQuery.filter = function (expr, elems, not) {
  38854. var elem = elems[0];
  38855. if (not) {
  38856. expr = ":not(" + expr + ")";
  38857. }
  38858. if (elems.length === 1 && elem.nodeType === 1) {
  38859. return jQuery.find.matchesSelector(elem, expr) ? [elem] : [];
  38860. }
  38861. return jQuery.find.matches(expr, jQuery.grep(elems, function (elem) {
  38862. return elem.nodeType === 1;
  38863. }));
  38864. };
  38865. jQuery.fn.extend({
  38866. find: function find(selector) {
  38867. var i,
  38868. ret,
  38869. len = this.length,
  38870. self = this;
  38871. if (typeof selector !== "string") {
  38872. return this.pushStack(jQuery(selector).filter(function () {
  38873. for (i = 0; i < len; i++) {
  38874. if (jQuery.contains(self[i], this)) {
  38875. return true;
  38876. }
  38877. }
  38878. }));
  38879. }
  38880. ret = this.pushStack([]);
  38881. for (i = 0; i < len; i++) {
  38882. jQuery.find(selector, self[i], ret);
  38883. }
  38884. return len > 1 ? jQuery.uniqueSort(ret) : ret;
  38885. },
  38886. filter: function filter(selector) {
  38887. return this.pushStack(winnow(this, selector || [], false));
  38888. },
  38889. not: function not(selector) {
  38890. return this.pushStack(winnow(this, selector || [], true));
  38891. },
  38892. is: function is(selector) {
  38893. return !!winnow(this,
  38894. // If this is a positional/relative selector, check membership in the returned set
  38895. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  38896. typeof selector === "string" && rneedsContext.test(selector) ? jQuery(selector) : selector || [], false).length;
  38897. }
  38898. });
  38899. // Initialize a jQuery object
  38900. // A central reference to the root jQuery(document)
  38901. var rootjQuery,
  38902. // A simple way to check for HTML strings
  38903. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  38904. // Strict HTML recognition (#11290: must start with <)
  38905. // Shortcut simple #id case for speed
  38906. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  38907. init = jQuery.fn.init = function (selector, context, root) {
  38908. var match, elem;
  38909. // HANDLE: $(""), $(null), $(undefined), $(false)
  38910. if (!selector) {
  38911. return this;
  38912. }
  38913. // Method init() accepts an alternate rootjQuery
  38914. // so migrate can support jQuery.sub (gh-2101)
  38915. root = root || rootjQuery;
  38916. // Handle HTML strings
  38917. if (typeof selector === "string") {
  38918. if (selector[0] === "<" && selector[selector.length - 1] === ">" && selector.length >= 3) {
  38919. // Assume that strings that start and end with <> are HTML and skip the regex check
  38920. match = [null, selector, null];
  38921. } else {
  38922. match = rquickExpr.exec(selector);
  38923. }
  38924. // Match html or make sure no context is specified for #id
  38925. if (match && (match[1] || !context)) {
  38926. // HANDLE: $(html) -> $(array)
  38927. if (match[1]) {
  38928. context = context instanceof jQuery ? context[0] : context;
  38929. // Option to run scripts is true for back-compat
  38930. // Intentionally let the error be thrown if parseHTML is not present
  38931. jQuery.merge(this, jQuery.parseHTML(match[1], context && context.nodeType ? context.ownerDocument || context : document, true));
  38932. // HANDLE: $(html, props)
  38933. if (rsingleTag.test(match[1]) && jQuery.isPlainObject(context)) {
  38934. for (match in context) {
  38935. // Properties of context are called as methods if possible
  38936. if (isFunction(this[match])) {
  38937. this[match](context[match]);
  38938. // ...and otherwise set as attributes
  38939. } else {
  38940. this.attr(match, context[match]);
  38941. }
  38942. }
  38943. }
  38944. return this;
  38945. // HANDLE: $(#id)
  38946. } else {
  38947. elem = document.getElementById(match[2]);
  38948. if (elem) {
  38949. // Inject the element directly into the jQuery object
  38950. this[0] = elem;
  38951. this.length = 1;
  38952. }
  38953. return this;
  38954. }
  38955. // HANDLE: $(expr, $(...))
  38956. } else if (!context || context.jquery) {
  38957. return (context || root).find(selector);
  38958. // HANDLE: $(expr, context)
  38959. // (which is just equivalent to: $(context).find(expr)
  38960. } else {
  38961. return this.constructor(context).find(selector);
  38962. }
  38963. // HANDLE: $(DOMElement)
  38964. } else if (selector.nodeType) {
  38965. this[0] = selector;
  38966. this.length = 1;
  38967. return this;
  38968. // HANDLE: $(function)
  38969. // Shortcut for document ready
  38970. } else if (isFunction(selector)) {
  38971. return root.ready !== undefined ? root.ready(selector) :
  38972. // Execute immediately if ready is not present
  38973. selector(jQuery);
  38974. }
  38975. return jQuery.makeArray(selector, this);
  38976. };
  38977. // Give the init function the jQuery prototype for later instantiation
  38978. init.prototype = jQuery.fn;
  38979. // Initialize central reference
  38980. rootjQuery = jQuery(document);
  38981. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  38982. // Methods guaranteed to produce a unique set when starting from a unique set
  38983. guaranteedUnique = {
  38984. children: true,
  38985. contents: true,
  38986. next: true,
  38987. prev: true
  38988. };
  38989. jQuery.fn.extend({
  38990. has: function has(target) {
  38991. var targets = jQuery(target, this),
  38992. l = targets.length;
  38993. return this.filter(function () {
  38994. var i = 0;
  38995. for (; i < l; i++) {
  38996. if (jQuery.contains(this, targets[i])) {
  38997. return true;
  38998. }
  38999. }
  39000. });
  39001. },
  39002. closest: function closest(selectors, context) {
  39003. var cur,
  39004. i = 0,
  39005. l = this.length,
  39006. matched = [],
  39007. targets = typeof selectors !== "string" && jQuery(selectors);
  39008. // Positional selectors never match, since there's no _selection_ context
  39009. if (!rneedsContext.test(selectors)) {
  39010. for (; i < l; i++) {
  39011. for (cur = this[i]; cur && cur !== context; cur = cur.parentNode) {
  39012. // Always skip document fragments
  39013. if (cur.nodeType < 11 && (targets ? targets.index(cur) > -1 :
  39014. // Don't pass non-elements to Sizzle
  39015. cur.nodeType === 1 && jQuery.find.matchesSelector(cur, selectors))) {
  39016. matched.push(cur);
  39017. break;
  39018. }
  39019. }
  39020. }
  39021. }
  39022. return this.pushStack(matched.length > 1 ? jQuery.uniqueSort(matched) : matched);
  39023. },
  39024. // Determine the position of an element within the set
  39025. index: function index(elem) {
  39026. // No argument, return index in parent
  39027. if (!elem) {
  39028. return this[0] && this[0].parentNode ? this.first().prevAll().length : -1;
  39029. }
  39030. // Index in selector
  39031. if (typeof elem === "string") {
  39032. return indexOf.call(jQuery(elem), this[0]);
  39033. }
  39034. // Locate the position of the desired element
  39035. return indexOf.call(this,
  39036. // If it receives a jQuery object, the first element is used
  39037. elem.jquery ? elem[0] : elem);
  39038. },
  39039. add: function add(selector, context) {
  39040. return this.pushStack(jQuery.uniqueSort(jQuery.merge(this.get(), jQuery(selector, context))));
  39041. },
  39042. addBack: function addBack(selector) {
  39043. return this.add(selector == null ? this.prevObject : this.prevObject.filter(selector));
  39044. }
  39045. });
  39046. function sibling(cur, dir) {
  39047. while ((cur = cur[dir]) && cur.nodeType !== 1) {}
  39048. return cur;
  39049. }
  39050. jQuery.each({
  39051. parent: function parent(elem) {
  39052. var parent = elem.parentNode;
  39053. return parent && parent.nodeType !== 11 ? parent : null;
  39054. },
  39055. parents: function parents(elem) {
  39056. return dir(elem, "parentNode");
  39057. },
  39058. parentsUntil: function parentsUntil(elem, i, until) {
  39059. return dir(elem, "parentNode", until);
  39060. },
  39061. next: function next(elem) {
  39062. return sibling(elem, "nextSibling");
  39063. },
  39064. prev: function prev(elem) {
  39065. return sibling(elem, "previousSibling");
  39066. },
  39067. nextAll: function nextAll(elem) {
  39068. return dir(elem, "nextSibling");
  39069. },
  39070. prevAll: function prevAll(elem) {
  39071. return dir(elem, "previousSibling");
  39072. },
  39073. nextUntil: function nextUntil(elem, i, until) {
  39074. return dir(elem, "nextSibling", until);
  39075. },
  39076. prevUntil: function prevUntil(elem, i, until) {
  39077. return dir(elem, "previousSibling", until);
  39078. },
  39079. siblings: function siblings(elem) {
  39080. return _siblings((elem.parentNode || {}).firstChild, elem);
  39081. },
  39082. children: function children(elem) {
  39083. return _siblings(elem.firstChild);
  39084. },
  39085. contents: function contents(elem) {
  39086. if (nodeName(elem, "iframe")) {
  39087. return elem.contentDocument;
  39088. }
  39089. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  39090. // Treat the template element as a regular one in browsers that
  39091. // don't support it.
  39092. if (nodeName(elem, "template")) {
  39093. elem = elem.content || elem;
  39094. }
  39095. return jQuery.merge([], elem.childNodes);
  39096. }
  39097. }, function (name, fn) {
  39098. jQuery.fn[name] = function (until, selector) {
  39099. var matched = jQuery.map(this, fn, until);
  39100. if (name.slice(-5) !== "Until") {
  39101. selector = until;
  39102. }
  39103. if (selector && typeof selector === "string") {
  39104. matched = jQuery.filter(selector, matched);
  39105. }
  39106. if (this.length > 1) {
  39107. // Remove duplicates
  39108. if (!guaranteedUnique[name]) {
  39109. jQuery.uniqueSort(matched);
  39110. }
  39111. // Reverse order for parents* and prev-derivatives
  39112. if (rparentsprev.test(name)) {
  39113. matched.reverse();
  39114. }
  39115. }
  39116. return this.pushStack(matched);
  39117. };
  39118. });
  39119. var rnothtmlwhite = /[^\x20\t\r\n\f]+/g;
  39120. // Convert String-formatted options into Object-formatted ones
  39121. function createOptions(options) {
  39122. var object = {};
  39123. jQuery.each(options.match(rnothtmlwhite) || [], function (_, flag) {
  39124. object[flag] = true;
  39125. });
  39126. return object;
  39127. }
  39128. /*
  39129. * Create a callback list using the following parameters:
  39130. *
  39131. * options: an optional list of space-separated options that will change how
  39132. * the callback list behaves or a more traditional option object
  39133. *
  39134. * By default a callback list will act like an event callback list and can be
  39135. * "fired" multiple times.
  39136. *
  39137. * Possible options:
  39138. *
  39139. * once: will ensure the callback list can only be fired once (like a Deferred)
  39140. *
  39141. * memory: will keep track of previous values and will call any callback added
  39142. * after the list has been fired right away with the latest "memorized"
  39143. * values (like a Deferred)
  39144. *
  39145. * unique: will ensure a callback can only be added once (no duplicate in the list)
  39146. *
  39147. * stopOnFalse: interrupt callings when a callback returns false
  39148. *
  39149. */
  39150. jQuery.Callbacks = function (options) {
  39151. // Convert options from String-formatted to Object-formatted if needed
  39152. // (we check in cache first)
  39153. options = typeof options === "string" ? createOptions(options) : jQuery.extend({}, options);
  39154. var // Flag to know if list is currently firing
  39155. firing,
  39156. // Last fire value for non-forgettable lists
  39157. memory,
  39158. // Flag to know if list was already fired
  39159. _fired,
  39160. // Flag to prevent firing
  39161. _locked,
  39162. // Actual callback list
  39163. list = [],
  39164. // Queue of execution data for repeatable lists
  39165. queue = [],
  39166. // Index of currently firing callback (modified by add/remove as needed)
  39167. firingIndex = -1,
  39168. // Fire callbacks
  39169. fire = function fire() {
  39170. // Enforce single-firing
  39171. _locked = _locked || options.once;
  39172. // Execute callbacks for all pending executions,
  39173. // respecting firingIndex overrides and runtime changes
  39174. _fired = firing = true;
  39175. for (; queue.length; firingIndex = -1) {
  39176. memory = queue.shift();
  39177. while (++firingIndex < list.length) {
  39178. // Run callback and check for early termination
  39179. if (list[firingIndex].apply(memory[0], memory[1]) === false && options.stopOnFalse) {
  39180. // Jump to end and forget the data so .add doesn't re-fire
  39181. firingIndex = list.length;
  39182. memory = false;
  39183. }
  39184. }
  39185. }
  39186. // Forget the data if we're done with it
  39187. if (!options.memory) {
  39188. memory = false;
  39189. }
  39190. firing = false;
  39191. // Clean up if we're done firing for good
  39192. if (_locked) {
  39193. // Keep an empty list if we have data for future add calls
  39194. if (memory) {
  39195. list = [];
  39196. // Otherwise, this object is spent
  39197. } else {
  39198. list = "";
  39199. }
  39200. }
  39201. },
  39202. // Actual Callbacks object
  39203. self = {
  39204. // Add a callback or a collection of callbacks to the list
  39205. add: function add() {
  39206. if (list) {
  39207. // If we have memory from a past run, we should fire after adding
  39208. if (memory && !firing) {
  39209. firingIndex = list.length - 1;
  39210. queue.push(memory);
  39211. }
  39212. (function add(args) {
  39213. jQuery.each(args, function (_, arg) {
  39214. if (isFunction(arg)) {
  39215. if (!options.unique || !self.has(arg)) {
  39216. list.push(arg);
  39217. }
  39218. } else if (arg && arg.length && toType(arg) !== "string") {
  39219. // Inspect recursively
  39220. add(arg);
  39221. }
  39222. });
  39223. })(arguments);
  39224. if (memory && !firing) {
  39225. fire();
  39226. }
  39227. }
  39228. return this;
  39229. },
  39230. // Remove a callback from the list
  39231. remove: function remove() {
  39232. jQuery.each(arguments, function (_, arg) {
  39233. var index;
  39234. while ((index = jQuery.inArray(arg, list, index)) > -1) {
  39235. list.splice(index, 1);
  39236. // Handle firing indexes
  39237. if (index <= firingIndex) {
  39238. firingIndex--;
  39239. }
  39240. }
  39241. });
  39242. return this;
  39243. },
  39244. // Check if a given callback is in the list.
  39245. // If no argument is given, return whether or not list has callbacks attached.
  39246. has: function has(fn) {
  39247. return fn ? jQuery.inArray(fn, list) > -1 : list.length > 0;
  39248. },
  39249. // Remove all callbacks from the list
  39250. empty: function empty() {
  39251. if (list) {
  39252. list = [];
  39253. }
  39254. return this;
  39255. },
  39256. // Disable .fire and .add
  39257. // Abort any current/pending executions
  39258. // Clear all callbacks and values
  39259. disable: function disable() {
  39260. _locked = queue = [];
  39261. list = memory = "";
  39262. return this;
  39263. },
  39264. disabled: function disabled() {
  39265. return !list;
  39266. },
  39267. // Disable .fire
  39268. // Also disable .add unless we have memory (since it would have no effect)
  39269. // Abort any pending executions
  39270. lock: function lock() {
  39271. _locked = queue = [];
  39272. if (!memory && !firing) {
  39273. list = memory = "";
  39274. }
  39275. return this;
  39276. },
  39277. locked: function locked() {
  39278. return !!_locked;
  39279. },
  39280. // Call all callbacks with the given context and arguments
  39281. fireWith: function fireWith(context, args) {
  39282. if (!_locked) {
  39283. args = args || [];
  39284. args = [context, args.slice ? args.slice() : args];
  39285. queue.push(args);
  39286. if (!firing) {
  39287. fire();
  39288. }
  39289. }
  39290. return this;
  39291. },
  39292. // Call all the callbacks with the given arguments
  39293. fire: function fire() {
  39294. self.fireWith(this, arguments);
  39295. return this;
  39296. },
  39297. // To know if the callbacks have already been called at least once
  39298. fired: function fired() {
  39299. return !!_fired;
  39300. }
  39301. };
  39302. return self;
  39303. };
  39304. function Identity(v) {
  39305. return v;
  39306. }
  39307. function Thrower(ex) {
  39308. throw ex;
  39309. }
  39310. function adoptValue(value, resolve, reject, noValue) {
  39311. var method;
  39312. try {
  39313. // Check for promise aspect first to privilege synchronous behavior
  39314. if (value && isFunction(method = value.promise)) {
  39315. method.call(value).done(resolve).fail(reject);
  39316. // Other thenables
  39317. } else if (value && isFunction(method = value.then)) {
  39318. method.call(value, resolve, reject);
  39319. // Other non-thenables
  39320. } else {
  39321. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  39322. // * false: [ value ].slice( 0 ) => resolve( value )
  39323. // * true: [ value ].slice( 1 ) => resolve()
  39324. resolve.apply(undefined, [value].slice(noValue));
  39325. }
  39326. // For Promises/A+, convert exceptions into rejections
  39327. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  39328. // Deferred#then to conditionally suppress rejection.
  39329. } catch (value) {
  39330. // Support: Android 4.0 only
  39331. // Strict mode functions invoked without .call/.apply get global-object context
  39332. reject.apply(undefined, [value]);
  39333. }
  39334. }
  39335. jQuery.extend({
  39336. Deferred: function Deferred(func) {
  39337. var tuples = [
  39338. // action, add listener, callbacks,
  39339. // ... .then handlers, argument index, [final state]
  39340. ["notify", "progress", jQuery.Callbacks("memory"), jQuery.Callbacks("memory"), 2], ["resolve", "done", jQuery.Callbacks("once memory"), jQuery.Callbacks("once memory"), 0, "resolved"], ["reject", "fail", jQuery.Callbacks("once memory"), jQuery.Callbacks("once memory"), 1, "rejected"]],
  39341. _state = "pending",
  39342. _promise = {
  39343. state: function state() {
  39344. return _state;
  39345. },
  39346. always: function always() {
  39347. deferred.done(arguments).fail(arguments);
  39348. return this;
  39349. },
  39350. "catch": function _catch(fn) {
  39351. return _promise.then(null, fn);
  39352. },
  39353. // Keep pipe for back-compat
  39354. pipe: function pipe() /* fnDone, fnFail, fnProgress */{
  39355. var fns = arguments;
  39356. return jQuery.Deferred(function (newDefer) {
  39357. jQuery.each(tuples, function (i, tuple) {
  39358. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  39359. var fn = isFunction(fns[tuple[4]]) && fns[tuple[4]];
  39360. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  39361. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  39362. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  39363. deferred[tuple[1]](function () {
  39364. var returned = fn && fn.apply(this, arguments);
  39365. if (returned && isFunction(returned.promise)) {
  39366. returned.promise().progress(newDefer.notify).done(newDefer.resolve).fail(newDefer.reject);
  39367. } else {
  39368. newDefer[tuple[0] + "With"](this, fn ? [returned] : arguments);
  39369. }
  39370. });
  39371. });
  39372. fns = null;
  39373. }).promise();
  39374. },
  39375. then: function then(onFulfilled, onRejected, onProgress) {
  39376. var maxDepth = 0;
  39377. function resolve(depth, deferred, handler, special) {
  39378. return function () {
  39379. var that = this,
  39380. args = arguments,
  39381. mightThrow = function mightThrow() {
  39382. var returned, then;
  39383. // Support: Promises/A+ section 2.3.3.3.3
  39384. // https://promisesaplus.com/#point-59
  39385. // Ignore double-resolution attempts
  39386. if (depth < maxDepth) {
  39387. return;
  39388. }
  39389. returned = handler.apply(that, args);
  39390. // Support: Promises/A+ section 2.3.1
  39391. // https://promisesaplus.com/#point-48
  39392. if (returned === deferred.promise()) {
  39393. throw new TypeError("Thenable self-resolution");
  39394. }
  39395. // Support: Promises/A+ sections 2.3.3.1, 3.5
  39396. // https://promisesaplus.com/#point-54
  39397. // https://promisesaplus.com/#point-75
  39398. // Retrieve `then` only once
  39399. then = returned && (
  39400. // Support: Promises/A+ section 2.3.4
  39401. // https://promisesaplus.com/#point-64
  39402. // Only check objects and functions for thenability
  39403. (typeof returned === "undefined" ? "undefined" : _typeof(returned)) === "object" || typeof returned === "function") && returned.then;
  39404. // Handle a returned thenable
  39405. if (isFunction(then)) {
  39406. // Special processors (notify) just wait for resolution
  39407. if (special) {
  39408. then.call(returned, resolve(maxDepth, deferred, Identity, special), resolve(maxDepth, deferred, Thrower, special));
  39409. // Normal processors (resolve) also hook into progress
  39410. } else {
  39411. // ...and disregard older resolution values
  39412. maxDepth++;
  39413. then.call(returned, resolve(maxDepth, deferred, Identity, special), resolve(maxDepth, deferred, Thrower, special), resolve(maxDepth, deferred, Identity, deferred.notifyWith));
  39414. }
  39415. // Handle all other returned values
  39416. } else {
  39417. // Only substitute handlers pass on context
  39418. // and multiple values (non-spec behavior)
  39419. if (handler !== Identity) {
  39420. that = undefined;
  39421. args = [returned];
  39422. }
  39423. // Process the value(s)
  39424. // Default process is resolve
  39425. (special || deferred.resolveWith)(that, args);
  39426. }
  39427. },
  39428. // Only normal processors (resolve) catch and reject exceptions
  39429. process = special ? mightThrow : function () {
  39430. try {
  39431. mightThrow();
  39432. } catch (e) {
  39433. if (jQuery.Deferred.exceptionHook) {
  39434. jQuery.Deferred.exceptionHook(e, process.stackTrace);
  39435. }
  39436. // Support: Promises/A+ section 2.3.3.3.4.1
  39437. // https://promisesaplus.com/#point-61
  39438. // Ignore post-resolution exceptions
  39439. if (depth + 1 >= maxDepth) {
  39440. // Only substitute handlers pass on context
  39441. // and multiple values (non-spec behavior)
  39442. if (handler !== Thrower) {
  39443. that = undefined;
  39444. args = [e];
  39445. }
  39446. deferred.rejectWith(that, args);
  39447. }
  39448. }
  39449. };
  39450. // Support: Promises/A+ section 2.3.3.3.1
  39451. // https://promisesaplus.com/#point-57
  39452. // Re-resolve promises immediately to dodge false rejection from
  39453. // subsequent errors
  39454. if (depth) {
  39455. process();
  39456. } else {
  39457. // Call an optional hook to record the stack, in case of exception
  39458. // since it's otherwise lost when execution goes async
  39459. if (jQuery.Deferred.getStackHook) {
  39460. process.stackTrace = jQuery.Deferred.getStackHook();
  39461. }
  39462. window.setTimeout(process);
  39463. }
  39464. };
  39465. }
  39466. return jQuery.Deferred(function (newDefer) {
  39467. // progress_handlers.add( ... )
  39468. tuples[0][3].add(resolve(0, newDefer, isFunction(onProgress) ? onProgress : Identity, newDefer.notifyWith));
  39469. // fulfilled_handlers.add( ... )
  39470. tuples[1][3].add(resolve(0, newDefer, isFunction(onFulfilled) ? onFulfilled : Identity));
  39471. // rejected_handlers.add( ... )
  39472. tuples[2][3].add(resolve(0, newDefer, isFunction(onRejected) ? onRejected : Thrower));
  39473. }).promise();
  39474. },
  39475. // Get a promise for this deferred
  39476. // If obj is provided, the promise aspect is added to the object
  39477. promise: function promise(obj) {
  39478. return obj != null ? jQuery.extend(obj, _promise) : _promise;
  39479. }
  39480. },
  39481. deferred = {};
  39482. // Add list-specific methods
  39483. jQuery.each(tuples, function (i, tuple) {
  39484. var list = tuple[2],
  39485. stateString = tuple[5];
  39486. // promise.progress = list.add
  39487. // promise.done = list.add
  39488. // promise.fail = list.add
  39489. _promise[tuple[1]] = list.add;
  39490. // Handle state
  39491. if (stateString) {
  39492. list.add(function () {
  39493. // state = "resolved" (i.e., fulfilled)
  39494. // state = "rejected"
  39495. _state = stateString;
  39496. },
  39497. // rejected_callbacks.disable
  39498. // fulfilled_callbacks.disable
  39499. tuples[3 - i][2].disable,
  39500. // rejected_handlers.disable
  39501. // fulfilled_handlers.disable
  39502. tuples[3 - i][3].disable,
  39503. // progress_callbacks.lock
  39504. tuples[0][2].lock,
  39505. // progress_handlers.lock
  39506. tuples[0][3].lock);
  39507. }
  39508. // progress_handlers.fire
  39509. // fulfilled_handlers.fire
  39510. // rejected_handlers.fire
  39511. list.add(tuple[3].fire);
  39512. // deferred.notify = function() { deferred.notifyWith(...) }
  39513. // deferred.resolve = function() { deferred.resolveWith(...) }
  39514. // deferred.reject = function() { deferred.rejectWith(...) }
  39515. deferred[tuple[0]] = function () {
  39516. deferred[tuple[0] + "With"](this === deferred ? undefined : this, arguments);
  39517. return this;
  39518. };
  39519. // deferred.notifyWith = list.fireWith
  39520. // deferred.resolveWith = list.fireWith
  39521. // deferred.rejectWith = list.fireWith
  39522. deferred[tuple[0] + "With"] = list.fireWith;
  39523. });
  39524. // Make the deferred a promise
  39525. _promise.promise(deferred);
  39526. // Call given func if any
  39527. if (func) {
  39528. func.call(deferred, deferred);
  39529. }
  39530. // All done!
  39531. return deferred;
  39532. },
  39533. // Deferred helper
  39534. when: function when(singleValue) {
  39535. var
  39536. // count of uncompleted subordinates
  39537. remaining = arguments.length,
  39538. // count of unprocessed arguments
  39539. i = remaining,
  39540. // subordinate fulfillment data
  39541. resolveContexts = Array(i),
  39542. resolveValues = _slice.call(arguments),
  39543. // the master Deferred
  39544. master = jQuery.Deferred(),
  39545. // subordinate callback factory
  39546. updateFunc = function updateFunc(i) {
  39547. return function (value) {
  39548. resolveContexts[i] = this;
  39549. resolveValues[i] = arguments.length > 1 ? _slice.call(arguments) : value;
  39550. if (! --remaining) {
  39551. master.resolveWith(resolveContexts, resolveValues);
  39552. }
  39553. };
  39554. };
  39555. // Single- and empty arguments are adopted like Promise.resolve
  39556. if (remaining <= 1) {
  39557. adoptValue(singleValue, master.done(updateFunc(i)).resolve, master.reject, !remaining);
  39558. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  39559. if (master.state() === "pending" || isFunction(resolveValues[i] && resolveValues[i].then)) {
  39560. return master.then();
  39561. }
  39562. }
  39563. // Multiple arguments are aggregated like Promise.all array elements
  39564. while (i--) {
  39565. adoptValue(resolveValues[i], updateFunc(i), master.reject);
  39566. }
  39567. return master.promise();
  39568. }
  39569. });
  39570. // These usually indicate a programmer mistake during development,
  39571. // warn about them ASAP rather than swallowing them by default.
  39572. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  39573. jQuery.Deferred.exceptionHook = function (error, stack) {
  39574. // Support: IE 8 - 9 only
  39575. // Console exists when dev tools are open, which can happen at any time
  39576. if (window.console && window.console.warn && error && rerrorNames.test(error.name)) {
  39577. window.console.warn("jQuery.Deferred exception: " + error.message, error.stack, stack);
  39578. }
  39579. };
  39580. jQuery.readyException = function (error) {
  39581. window.setTimeout(function () {
  39582. throw error;
  39583. });
  39584. };
  39585. // The deferred used on DOM ready
  39586. var readyList = jQuery.Deferred();
  39587. jQuery.fn.ready = function (fn) {
  39588. readyList.then(fn)
  39589. // Wrap jQuery.readyException in a function so that the lookup
  39590. // happens at the time of error handling instead of callback
  39591. // registration.
  39592. .catch(function (error) {
  39593. jQuery.readyException(error);
  39594. });
  39595. return this;
  39596. };
  39597. jQuery.extend({
  39598. // Is the DOM ready to be used? Set to true once it occurs.
  39599. isReady: false,
  39600. // A counter to track how many items to wait for before
  39601. // the ready event fires. See #6781
  39602. readyWait: 1,
  39603. // Handle when the DOM is ready
  39604. ready: function ready(wait) {
  39605. // Abort if there are pending holds or we're already ready
  39606. if (wait === true ? --jQuery.readyWait : jQuery.isReady) {
  39607. return;
  39608. }
  39609. // Remember that the DOM is ready
  39610. jQuery.isReady = true;
  39611. // If a normal DOM Ready event fired, decrement, and wait if need be
  39612. if (wait !== true && --jQuery.readyWait > 0) {
  39613. return;
  39614. }
  39615. // If there are functions bound, to execute
  39616. readyList.resolveWith(document, [jQuery]);
  39617. }
  39618. });
  39619. jQuery.ready.then = readyList.then;
  39620. // The ready event handler and self cleanup method
  39621. function completed() {
  39622. document.removeEventListener("DOMContentLoaded", completed);
  39623. window.removeEventListener("load", completed);
  39624. jQuery.ready();
  39625. }
  39626. // Catch cases where $(document).ready() is called
  39627. // after the browser event has already occurred.
  39628. // Support: IE <=9 - 10 only
  39629. // Older IE sometimes signals "interactive" too soon
  39630. if (document.readyState === "complete" || document.readyState !== "loading" && !document.documentElement.doScroll) {
  39631. // Handle it asynchronously to allow scripts the opportunity to delay ready
  39632. window.setTimeout(jQuery.ready);
  39633. } else {
  39634. // Use the handy event callback
  39635. document.addEventListener("DOMContentLoaded", completed);
  39636. // A fallback to window.onload, that will always work
  39637. window.addEventListener("load", completed);
  39638. }
  39639. // Multifunctional method to get and set values of a collection
  39640. // The value/s can optionally be executed if it's a function
  39641. var access = function access(elems, fn, key, value, chainable, emptyGet, raw) {
  39642. var i = 0,
  39643. len = elems.length,
  39644. bulk = key == null;
  39645. // Sets many values
  39646. if (toType(key) === "object") {
  39647. chainable = true;
  39648. for (i in key) {
  39649. access(elems, fn, i, key[i], true, emptyGet, raw);
  39650. }
  39651. // Sets one value
  39652. } else if (value !== undefined) {
  39653. chainable = true;
  39654. if (!isFunction(value)) {
  39655. raw = true;
  39656. }
  39657. if (bulk) {
  39658. // Bulk operations run against the entire set
  39659. if (raw) {
  39660. fn.call(elems, value);
  39661. fn = null;
  39662. // ...except when executing function values
  39663. } else {
  39664. bulk = fn;
  39665. fn = function fn(elem, key, value) {
  39666. return bulk.call(jQuery(elem), value);
  39667. };
  39668. }
  39669. }
  39670. if (fn) {
  39671. for (; i < len; i++) {
  39672. fn(elems[i], key, raw ? value : value.call(elems[i], i, fn(elems[i], key)));
  39673. }
  39674. }
  39675. }
  39676. if (chainable) {
  39677. return elems;
  39678. }
  39679. // Gets
  39680. if (bulk) {
  39681. return fn.call(elems);
  39682. }
  39683. return len ? fn(elems[0], key) : emptyGet;
  39684. };
  39685. // Matches dashed string for camelizing
  39686. var rmsPrefix = /^-ms-/,
  39687. rdashAlpha = /-([a-z])/g;
  39688. // Used by camelCase as callback to replace()
  39689. function fcamelCase(all, letter) {
  39690. return letter.toUpperCase();
  39691. }
  39692. // Convert dashed to camelCase; used by the css and data modules
  39693. // Support: IE <=9 - 11, Edge 12 - 15
  39694. // Microsoft forgot to hump their vendor prefix (#9572)
  39695. function camelCase(string) {
  39696. return string.replace(rmsPrefix, "ms-").replace(rdashAlpha, fcamelCase);
  39697. }
  39698. var acceptData = function acceptData(owner) {
  39699. // Accepts only:
  39700. // - Node
  39701. // - Node.ELEMENT_NODE
  39702. // - Node.DOCUMENT_NODE
  39703. // - Object
  39704. // - Any
  39705. return owner.nodeType === 1 || owner.nodeType === 9 || !+owner.nodeType;
  39706. };
  39707. function Data() {
  39708. this.expando = jQuery.expando + Data.uid++;
  39709. }
  39710. Data.uid = 1;
  39711. Data.prototype = {
  39712. cache: function cache(owner) {
  39713. // Check if the owner object already has a cache
  39714. var value = owner[this.expando];
  39715. // If not, create one
  39716. if (!value) {
  39717. value = {};
  39718. // We can accept data for non-element nodes in modern browsers,
  39719. // but we should not, see #8335.
  39720. // Always return an empty object.
  39721. if (acceptData(owner)) {
  39722. // If it is a node unlikely to be stringify-ed or looped over
  39723. // use plain assignment
  39724. if (owner.nodeType) {
  39725. owner[this.expando] = value;
  39726. // Otherwise secure it in a non-enumerable property
  39727. // configurable must be true to allow the property to be
  39728. // deleted when data is removed
  39729. } else {
  39730. Object.defineProperty(owner, this.expando, {
  39731. value: value,
  39732. configurable: true
  39733. });
  39734. }
  39735. }
  39736. }
  39737. return value;
  39738. },
  39739. set: function set(owner, data, value) {
  39740. var prop,
  39741. cache = this.cache(owner);
  39742. // Handle: [ owner, key, value ] args
  39743. // Always use camelCase key (gh-2257)
  39744. if (typeof data === "string") {
  39745. cache[camelCase(data)] = value;
  39746. // Handle: [ owner, { properties } ] args
  39747. } else {
  39748. // Copy the properties one-by-one to the cache object
  39749. for (prop in data) {
  39750. cache[camelCase(prop)] = data[prop];
  39751. }
  39752. }
  39753. return cache;
  39754. },
  39755. get: function get(owner, key) {
  39756. return key === undefined ? this.cache(owner) :
  39757. // Always use camelCase key (gh-2257)
  39758. owner[this.expando] && owner[this.expando][camelCase(key)];
  39759. },
  39760. access: function access(owner, key, value) {
  39761. // In cases where either:
  39762. //
  39763. // 1. No key was specified
  39764. // 2. A string key was specified, but no value provided
  39765. //
  39766. // Take the "read" path and allow the get method to determine
  39767. // which value to return, respectively either:
  39768. //
  39769. // 1. The entire cache object
  39770. // 2. The data stored at the key
  39771. //
  39772. if (key === undefined || key && typeof key === "string" && value === undefined) {
  39773. return this.get(owner, key);
  39774. }
  39775. // When the key is not a string, or both a key and value
  39776. // are specified, set or extend (existing objects) with either:
  39777. //
  39778. // 1. An object of properties
  39779. // 2. A key and value
  39780. //
  39781. this.set(owner, key, value);
  39782. // Since the "set" path can have two possible entry points
  39783. // return the expected data based on which path was taken[*]
  39784. return value !== undefined ? value : key;
  39785. },
  39786. remove: function remove(owner, key) {
  39787. var i,
  39788. cache = owner[this.expando];
  39789. if (cache === undefined) {
  39790. return;
  39791. }
  39792. if (key !== undefined) {
  39793. // Support array or space separated string of keys
  39794. if (Array.isArray(key)) {
  39795. // If key is an array of keys...
  39796. // We always set camelCase keys, so remove that.
  39797. key = key.map(camelCase);
  39798. } else {
  39799. key = camelCase(key);
  39800. // If a key with the spaces exists, use it.
  39801. // Otherwise, create an array by matching non-whitespace
  39802. key = key in cache ? [key] : key.match(rnothtmlwhite) || [];
  39803. }
  39804. i = key.length;
  39805. while (i--) {
  39806. delete cache[key[i]];
  39807. }
  39808. }
  39809. // Remove the expando if there's no more data
  39810. if (key === undefined || jQuery.isEmptyObject(cache)) {
  39811. // Support: Chrome <=35 - 45
  39812. // Webkit & Blink performance suffers when deleting properties
  39813. // from DOM nodes, so set to undefined instead
  39814. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  39815. if (owner.nodeType) {
  39816. owner[this.expando] = undefined;
  39817. } else {
  39818. delete owner[this.expando];
  39819. }
  39820. }
  39821. },
  39822. hasData: function hasData(owner) {
  39823. var cache = owner[this.expando];
  39824. return cache !== undefined && !jQuery.isEmptyObject(cache);
  39825. }
  39826. };
  39827. var dataPriv = new Data();
  39828. var dataUser = new Data();
  39829. // Implementation Summary
  39830. //
  39831. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  39832. // 2. Improve the module's maintainability by reducing the storage
  39833. // paths to a single mechanism.
  39834. // 3. Use the same single mechanism to support "private" and "user" data.
  39835. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  39836. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  39837. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  39838. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  39839. rmultiDash = /[A-Z]/g;
  39840. function getData(data) {
  39841. if (data === "true") {
  39842. return true;
  39843. }
  39844. if (data === "false") {
  39845. return false;
  39846. }
  39847. if (data === "null") {
  39848. return null;
  39849. }
  39850. // Only convert to a number if it doesn't change the string
  39851. if (data === +data + "") {
  39852. return +data;
  39853. }
  39854. if (rbrace.test(data)) {
  39855. return JSON.parse(data);
  39856. }
  39857. return data;
  39858. }
  39859. function dataAttr(elem, key, data) {
  39860. var name;
  39861. // If nothing was found internally, try to fetch any
  39862. // data from the HTML5 data-* attribute
  39863. if (data === undefined && elem.nodeType === 1) {
  39864. name = "data-" + key.replace(rmultiDash, "-$&").toLowerCase();
  39865. data = elem.getAttribute(name);
  39866. if (typeof data === "string") {
  39867. try {
  39868. data = getData(data);
  39869. } catch (e) {}
  39870. // Make sure we set the data so it isn't changed later
  39871. dataUser.set(elem, key, data);
  39872. } else {
  39873. data = undefined;
  39874. }
  39875. }
  39876. return data;
  39877. }
  39878. jQuery.extend({
  39879. hasData: function hasData(elem) {
  39880. return dataUser.hasData(elem) || dataPriv.hasData(elem);
  39881. },
  39882. data: function data(elem, name, _data) {
  39883. return dataUser.access(elem, name, _data);
  39884. },
  39885. removeData: function removeData(elem, name) {
  39886. dataUser.remove(elem, name);
  39887. },
  39888. // TODO: Now that all calls to _data and _removeData have been replaced
  39889. // with direct calls to dataPriv methods, these can be deprecated.
  39890. _data: function _data(elem, name, data) {
  39891. return dataPriv.access(elem, name, data);
  39892. },
  39893. _removeData: function _removeData(elem, name) {
  39894. dataPriv.remove(elem, name);
  39895. }
  39896. });
  39897. jQuery.fn.extend({
  39898. data: function data(key, value) {
  39899. var i,
  39900. name,
  39901. data,
  39902. elem = this[0],
  39903. attrs = elem && elem.attributes;
  39904. // Gets all values
  39905. if (key === undefined) {
  39906. if (this.length) {
  39907. data = dataUser.get(elem);
  39908. if (elem.nodeType === 1 && !dataPriv.get(elem, "hasDataAttrs")) {
  39909. i = attrs.length;
  39910. while (i--) {
  39911. // Support: IE 11 only
  39912. // The attrs elements can be null (#14894)
  39913. if (attrs[i]) {
  39914. name = attrs[i].name;
  39915. if (name.indexOf("data-") === 0) {
  39916. name = camelCase(name.slice(5));
  39917. dataAttr(elem, name, data[name]);
  39918. }
  39919. }
  39920. }
  39921. dataPriv.set(elem, "hasDataAttrs", true);
  39922. }
  39923. }
  39924. return data;
  39925. }
  39926. // Sets multiple values
  39927. if ((typeof key === "undefined" ? "undefined" : _typeof(key)) === "object") {
  39928. return this.each(function () {
  39929. dataUser.set(this, key);
  39930. });
  39931. }
  39932. return access(this, function (value) {
  39933. var data;
  39934. // The calling jQuery object (element matches) is not empty
  39935. // (and therefore has an element appears at this[ 0 ]) and the
  39936. // `value` parameter was not undefined. An empty jQuery object
  39937. // will result in `undefined` for elem = this[ 0 ] which will
  39938. // throw an exception if an attempt to read a data cache is made.
  39939. if (elem && value === undefined) {
  39940. // Attempt to get data from the cache
  39941. // The key will always be camelCased in Data
  39942. data = dataUser.get(elem, key);
  39943. if (data !== undefined) {
  39944. return data;
  39945. }
  39946. // Attempt to "discover" the data in
  39947. // HTML5 custom data-* attrs
  39948. data = dataAttr(elem, key);
  39949. if (data !== undefined) {
  39950. return data;
  39951. }
  39952. // We tried really hard, but the data doesn't exist.
  39953. return;
  39954. }
  39955. // Set the data...
  39956. this.each(function () {
  39957. // We always store the camelCased key
  39958. dataUser.set(this, key, value);
  39959. });
  39960. }, null, value, arguments.length > 1, null, true);
  39961. },
  39962. removeData: function removeData(key) {
  39963. return this.each(function () {
  39964. dataUser.remove(this, key);
  39965. });
  39966. }
  39967. });
  39968. jQuery.extend({
  39969. queue: function queue(elem, type, data) {
  39970. var queue;
  39971. if (elem) {
  39972. type = (type || "fx") + "queue";
  39973. queue = dataPriv.get(elem, type);
  39974. // Speed up dequeue by getting out quickly if this is just a lookup
  39975. if (data) {
  39976. if (!queue || Array.isArray(data)) {
  39977. queue = dataPriv.access(elem, type, jQuery.makeArray(data));
  39978. } else {
  39979. queue.push(data);
  39980. }
  39981. }
  39982. return queue || [];
  39983. }
  39984. },
  39985. dequeue: function dequeue(elem, type) {
  39986. type = type || "fx";
  39987. var queue = jQuery.queue(elem, type),
  39988. startLength = queue.length,
  39989. fn = queue.shift(),
  39990. hooks = jQuery._queueHooks(elem, type),
  39991. next = function next() {
  39992. jQuery.dequeue(elem, type);
  39993. };
  39994. // If the fx queue is dequeued, always remove the progress sentinel
  39995. if (fn === "inprogress") {
  39996. fn = queue.shift();
  39997. startLength--;
  39998. }
  39999. if (fn) {
  40000. // Add a progress sentinel to prevent the fx queue from being
  40001. // automatically dequeued
  40002. if (type === "fx") {
  40003. queue.unshift("inprogress");
  40004. }
  40005. // Clear up the last queue stop function
  40006. delete hooks.stop;
  40007. fn.call(elem, next, hooks);
  40008. }
  40009. if (!startLength && hooks) {
  40010. hooks.empty.fire();
  40011. }
  40012. },
  40013. // Not public - generate a queueHooks object, or return the current one
  40014. _queueHooks: function _queueHooks(elem, type) {
  40015. var key = type + "queueHooks";
  40016. return dataPriv.get(elem, key) || dataPriv.access(elem, key, {
  40017. empty: jQuery.Callbacks("once memory").add(function () {
  40018. dataPriv.remove(elem, [type + "queue", key]);
  40019. })
  40020. });
  40021. }
  40022. });
  40023. jQuery.fn.extend({
  40024. queue: function queue(type, data) {
  40025. var setter = 2;
  40026. if (typeof type !== "string") {
  40027. data = type;
  40028. type = "fx";
  40029. setter--;
  40030. }
  40031. if (arguments.length < setter) {
  40032. return jQuery.queue(this[0], type);
  40033. }
  40034. return data === undefined ? this : this.each(function () {
  40035. var queue = jQuery.queue(this, type, data);
  40036. // Ensure a hooks for this queue
  40037. jQuery._queueHooks(this, type);
  40038. if (type === "fx" && queue[0] !== "inprogress") {
  40039. jQuery.dequeue(this, type);
  40040. }
  40041. });
  40042. },
  40043. dequeue: function dequeue(type) {
  40044. return this.each(function () {
  40045. jQuery.dequeue(this, type);
  40046. });
  40047. },
  40048. clearQueue: function clearQueue(type) {
  40049. return this.queue(type || "fx", []);
  40050. },
  40051. // Get a promise resolved when queues of a certain type
  40052. // are emptied (fx is the type by default)
  40053. promise: function promise(type, obj) {
  40054. var tmp,
  40055. count = 1,
  40056. defer = jQuery.Deferred(),
  40057. elements = this,
  40058. i = this.length,
  40059. resolve = function resolve() {
  40060. if (! --count) {
  40061. defer.resolveWith(elements, [elements]);
  40062. }
  40063. };
  40064. if (typeof type !== "string") {
  40065. obj = type;
  40066. type = undefined;
  40067. }
  40068. type = type || "fx";
  40069. while (i--) {
  40070. tmp = dataPriv.get(elements[i], type + "queueHooks");
  40071. if (tmp && tmp.empty) {
  40072. count++;
  40073. tmp.empty.add(resolve);
  40074. }
  40075. }
  40076. resolve();
  40077. return defer.promise(obj);
  40078. }
  40079. });
  40080. var pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source;
  40081. var rcssNum = new RegExp("^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i");
  40082. var cssExpand = ["Top", "Right", "Bottom", "Left"];
  40083. var isHiddenWithinTree = function isHiddenWithinTree(elem, el) {
  40084. // isHiddenWithinTree might be called from jQuery#filter function;
  40085. // in that case, element will be second argument
  40086. elem = el || elem;
  40087. // Inline style trumps all
  40088. return elem.style.display === "none" || elem.style.display === "" &&
  40089. // Otherwise, check computed style
  40090. // Support: Firefox <=43 - 45
  40091. // Disconnected elements can have computed display: none, so first confirm that elem is
  40092. // in the document.
  40093. jQuery.contains(elem.ownerDocument, elem) && jQuery.css(elem, "display") === "none";
  40094. };
  40095. var swap = function swap(elem, options, callback, args) {
  40096. var ret,
  40097. name,
  40098. old = {};
  40099. // Remember the old values, and insert the new ones
  40100. for (name in options) {
  40101. old[name] = elem.style[name];
  40102. elem.style[name] = options[name];
  40103. }
  40104. ret = callback.apply(elem, args || []);
  40105. // Revert the old values
  40106. for (name in options) {
  40107. elem.style[name] = old[name];
  40108. }
  40109. return ret;
  40110. };
  40111. function adjustCSS(elem, prop, valueParts, tween) {
  40112. var adjusted,
  40113. scale,
  40114. maxIterations = 20,
  40115. currentValue = tween ? function () {
  40116. return tween.cur();
  40117. } : function () {
  40118. return jQuery.css(elem, prop, "");
  40119. },
  40120. initial = currentValue(),
  40121. unit = valueParts && valueParts[3] || (jQuery.cssNumber[prop] ? "" : "px"),
  40122. // Starting value computation is required for potential unit mismatches
  40123. initialInUnit = (jQuery.cssNumber[prop] || unit !== "px" && +initial) && rcssNum.exec(jQuery.css(elem, prop));
  40124. if (initialInUnit && initialInUnit[3] !== unit) {
  40125. // Support: Firefox <=54
  40126. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  40127. initial = initial / 2;
  40128. // Trust units reported by jQuery.css
  40129. unit = unit || initialInUnit[3];
  40130. // Iteratively approximate from a nonzero starting point
  40131. initialInUnit = +initial || 1;
  40132. while (maxIterations--) {
  40133. // Evaluate and update our best guess (doubling guesses that zero out).
  40134. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  40135. jQuery.style(elem, prop, initialInUnit + unit);
  40136. if ((1 - scale) * (1 - (scale = currentValue() / initial || 0.5)) <= 0) {
  40137. maxIterations = 0;
  40138. }
  40139. initialInUnit = initialInUnit / scale;
  40140. }
  40141. initialInUnit = initialInUnit * 2;
  40142. jQuery.style(elem, prop, initialInUnit + unit);
  40143. // Make sure we update the tween properties later on
  40144. valueParts = valueParts || [];
  40145. }
  40146. if (valueParts) {
  40147. initialInUnit = +initialInUnit || +initial || 0;
  40148. // Apply relative offset (+=/-=) if specified
  40149. adjusted = valueParts[1] ? initialInUnit + (valueParts[1] + 1) * valueParts[2] : +valueParts[2];
  40150. if (tween) {
  40151. tween.unit = unit;
  40152. tween.start = initialInUnit;
  40153. tween.end = adjusted;
  40154. }
  40155. }
  40156. return adjusted;
  40157. }
  40158. var defaultDisplayMap = {};
  40159. function getDefaultDisplay(elem) {
  40160. var temp,
  40161. doc = elem.ownerDocument,
  40162. nodeName = elem.nodeName,
  40163. display = defaultDisplayMap[nodeName];
  40164. if (display) {
  40165. return display;
  40166. }
  40167. temp = doc.body.appendChild(doc.createElement(nodeName));
  40168. display = jQuery.css(temp, "display");
  40169. temp.parentNode.removeChild(temp);
  40170. if (display === "none") {
  40171. display = "block";
  40172. }
  40173. defaultDisplayMap[nodeName] = display;
  40174. return display;
  40175. }
  40176. function showHide(elements, show) {
  40177. var display,
  40178. elem,
  40179. values = [],
  40180. index = 0,
  40181. length = elements.length;
  40182. // Determine new display value for elements that need to change
  40183. for (; index < length; index++) {
  40184. elem = elements[index];
  40185. if (!elem.style) {
  40186. continue;
  40187. }
  40188. display = elem.style.display;
  40189. if (show) {
  40190. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  40191. // check is required in this first loop unless we have a nonempty display value (either
  40192. // inline or about-to-be-restored)
  40193. if (display === "none") {
  40194. values[index] = dataPriv.get(elem, "display") || null;
  40195. if (!values[index]) {
  40196. elem.style.display = "";
  40197. }
  40198. }
  40199. if (elem.style.display === "" && isHiddenWithinTree(elem)) {
  40200. values[index] = getDefaultDisplay(elem);
  40201. }
  40202. } else {
  40203. if (display !== "none") {
  40204. values[index] = "none";
  40205. // Remember what we're overwriting
  40206. dataPriv.set(elem, "display", display);
  40207. }
  40208. }
  40209. }
  40210. // Set the display of the elements in a second loop to avoid constant reflow
  40211. for (index = 0; index < length; index++) {
  40212. if (values[index] != null) {
  40213. elements[index].style.display = values[index];
  40214. }
  40215. }
  40216. return elements;
  40217. }
  40218. jQuery.fn.extend({
  40219. show: function show() {
  40220. return showHide(this, true);
  40221. },
  40222. hide: function hide() {
  40223. return showHide(this);
  40224. },
  40225. toggle: function toggle(state) {
  40226. if (typeof state === "boolean") {
  40227. return state ? this.show() : this.hide();
  40228. }
  40229. return this.each(function () {
  40230. if (isHiddenWithinTree(this)) {
  40231. jQuery(this).show();
  40232. } else {
  40233. jQuery(this).hide();
  40234. }
  40235. });
  40236. }
  40237. });
  40238. var rcheckableType = /^(?:checkbox|radio)$/i;
  40239. var rtagName = /<([a-z][^\/\0>\x20\t\r\n\f]+)/i;
  40240. var rscriptType = /^$|^module$|\/(?:java|ecma)script/i;
  40241. // We have to close these tags to support XHTML (#13200)
  40242. var wrapMap = {
  40243. // Support: IE <=9 only
  40244. option: [1, "<select multiple='multiple'>", "</select>"],
  40245. // XHTML parsers do not magically insert elements in the
  40246. // same way that tag soup parsers do. So we cannot shorten
  40247. // this by omitting <tbody> or other required elements.
  40248. thead: [1, "<table>", "</table>"],
  40249. col: [2, "<table><colgroup>", "</colgroup></table>"],
  40250. tr: [2, "<table><tbody>", "</tbody></table>"],
  40251. td: [3, "<table><tbody><tr>", "</tr></tbody></table>"],
  40252. _default: [0, "", ""]
  40253. };
  40254. // Support: IE <=9 only
  40255. wrapMap.optgroup = wrapMap.option;
  40256. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  40257. wrapMap.th = wrapMap.td;
  40258. function getAll(context, tag) {
  40259. // Support: IE <=9 - 11 only
  40260. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  40261. var ret;
  40262. if (typeof context.getElementsByTagName !== "undefined") {
  40263. ret = context.getElementsByTagName(tag || "*");
  40264. } else if (typeof context.querySelectorAll !== "undefined") {
  40265. ret = context.querySelectorAll(tag || "*");
  40266. } else {
  40267. ret = [];
  40268. }
  40269. if (tag === undefined || tag && nodeName(context, tag)) {
  40270. return jQuery.merge([context], ret);
  40271. }
  40272. return ret;
  40273. }
  40274. // Mark scripts as having already been evaluated
  40275. function setGlobalEval(elems, refElements) {
  40276. var i = 0,
  40277. l = elems.length;
  40278. for (; i < l; i++) {
  40279. dataPriv.set(elems[i], "globalEval", !refElements || dataPriv.get(refElements[i], "globalEval"));
  40280. }
  40281. }
  40282. var rhtml = /<|&#?\w+;/;
  40283. function buildFragment(elems, context, scripts, selection, ignored) {
  40284. var elem,
  40285. tmp,
  40286. tag,
  40287. wrap,
  40288. contains,
  40289. j,
  40290. fragment = context.createDocumentFragment(),
  40291. nodes = [],
  40292. i = 0,
  40293. l = elems.length;
  40294. for (; i < l; i++) {
  40295. elem = elems[i];
  40296. if (elem || elem === 0) {
  40297. // Add nodes directly
  40298. if (toType(elem) === "object") {
  40299. // Support: Android <=4.0 only, PhantomJS 1 only
  40300. // push.apply(_, arraylike) throws on ancient WebKit
  40301. jQuery.merge(nodes, elem.nodeType ? [elem] : elem);
  40302. // Convert non-html into a text node
  40303. } else if (!rhtml.test(elem)) {
  40304. nodes.push(context.createTextNode(elem));
  40305. // Convert html into DOM nodes
  40306. } else {
  40307. tmp = tmp || fragment.appendChild(context.createElement("div"));
  40308. // Deserialize a standard representation
  40309. tag = (rtagName.exec(elem) || ["", ""])[1].toLowerCase();
  40310. wrap = wrapMap[tag] || wrapMap._default;
  40311. tmp.innerHTML = wrap[1] + jQuery.htmlPrefilter(elem) + wrap[2];
  40312. // Descend through wrappers to the right content
  40313. j = wrap[0];
  40314. while (j--) {
  40315. tmp = tmp.lastChild;
  40316. }
  40317. // Support: Android <=4.0 only, PhantomJS 1 only
  40318. // push.apply(_, arraylike) throws on ancient WebKit
  40319. jQuery.merge(nodes, tmp.childNodes);
  40320. // Remember the top-level container
  40321. tmp = fragment.firstChild;
  40322. // Ensure the created nodes are orphaned (#12392)
  40323. tmp.textContent = "";
  40324. }
  40325. }
  40326. }
  40327. // Remove wrapper from fragment
  40328. fragment.textContent = "";
  40329. i = 0;
  40330. while (elem = nodes[i++]) {
  40331. // Skip elements already in the context collection (trac-4087)
  40332. if (selection && jQuery.inArray(elem, selection) > -1) {
  40333. if (ignored) {
  40334. ignored.push(elem);
  40335. }
  40336. continue;
  40337. }
  40338. contains = jQuery.contains(elem.ownerDocument, elem);
  40339. // Append to fragment
  40340. tmp = getAll(fragment.appendChild(elem), "script");
  40341. // Preserve script evaluation history
  40342. if (contains) {
  40343. setGlobalEval(tmp);
  40344. }
  40345. // Capture executables
  40346. if (scripts) {
  40347. j = 0;
  40348. while (elem = tmp[j++]) {
  40349. if (rscriptType.test(elem.type || "")) {
  40350. scripts.push(elem);
  40351. }
  40352. }
  40353. }
  40354. }
  40355. return fragment;
  40356. }
  40357. (function () {
  40358. var fragment = document.createDocumentFragment(),
  40359. div = fragment.appendChild(document.createElement("div")),
  40360. input = document.createElement("input");
  40361. // Support: Android 4.0 - 4.3 only
  40362. // Check state lost if the name is set (#11217)
  40363. // Support: Windows Web Apps (WWA)
  40364. // `name` and `type` must use .setAttribute for WWA (#14901)
  40365. input.setAttribute("type", "radio");
  40366. input.setAttribute("checked", "checked");
  40367. input.setAttribute("name", "t");
  40368. div.appendChild(input);
  40369. // Support: Android <=4.1 only
  40370. // Older WebKit doesn't clone checked state correctly in fragments
  40371. support.checkClone = div.cloneNode(true).cloneNode(true).lastChild.checked;
  40372. // Support: IE <=11 only
  40373. // Make sure textarea (and checkbox) defaultValue is properly cloned
  40374. div.innerHTML = "<textarea>x</textarea>";
  40375. support.noCloneChecked = !!div.cloneNode(true).lastChild.defaultValue;
  40376. })();
  40377. var documentElement = document.documentElement;
  40378. var rkeyEvent = /^key/,
  40379. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  40380. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  40381. function returnTrue() {
  40382. return true;
  40383. }
  40384. function returnFalse() {
  40385. return false;
  40386. }
  40387. // Support: IE <=9 only
  40388. // See #13393 for more info
  40389. function safeActiveElement() {
  40390. try {
  40391. return document.activeElement;
  40392. } catch (err) {}
  40393. }
  40394. function _on(elem, types, selector, data, fn, one) {
  40395. var origFn, type;
  40396. // Types can be a map of types/handlers
  40397. if ((typeof types === "undefined" ? "undefined" : _typeof(types)) === "object") {
  40398. // ( types-Object, selector, data )
  40399. if (typeof selector !== "string") {
  40400. // ( types-Object, data )
  40401. data = data || selector;
  40402. selector = undefined;
  40403. }
  40404. for (type in types) {
  40405. _on(elem, type, selector, data, types[type], one);
  40406. }
  40407. return elem;
  40408. }
  40409. if (data == null && fn == null) {
  40410. // ( types, fn )
  40411. fn = selector;
  40412. data = selector = undefined;
  40413. } else if (fn == null) {
  40414. if (typeof selector === "string") {
  40415. // ( types, selector, fn )
  40416. fn = data;
  40417. data = undefined;
  40418. } else {
  40419. // ( types, data, fn )
  40420. fn = data;
  40421. data = selector;
  40422. selector = undefined;
  40423. }
  40424. }
  40425. if (fn === false) {
  40426. fn = returnFalse;
  40427. } else if (!fn) {
  40428. return elem;
  40429. }
  40430. if (one === 1) {
  40431. origFn = fn;
  40432. fn = function fn(event) {
  40433. // Can use an empty set, since event contains the info
  40434. jQuery().off(event);
  40435. return origFn.apply(this, arguments);
  40436. };
  40437. // Use same guid so caller can remove using origFn
  40438. fn.guid = origFn.guid || (origFn.guid = jQuery.guid++);
  40439. }
  40440. return elem.each(function () {
  40441. jQuery.event.add(this, types, fn, data, selector);
  40442. });
  40443. }
  40444. /*
  40445. * Helper functions for managing events -- not part of the public interface.
  40446. * Props to Dean Edwards' addEvent library for many of the ideas.
  40447. */
  40448. jQuery.event = {
  40449. global: {},
  40450. add: function add(elem, types, handler, data, selector) {
  40451. var handleObjIn,
  40452. eventHandle,
  40453. tmp,
  40454. events,
  40455. t,
  40456. handleObj,
  40457. special,
  40458. handlers,
  40459. type,
  40460. namespaces,
  40461. origType,
  40462. elemData = dataPriv.get(elem);
  40463. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  40464. if (!elemData) {
  40465. return;
  40466. }
  40467. // Caller can pass in an object of custom data in lieu of the handler
  40468. if (handler.handler) {
  40469. handleObjIn = handler;
  40470. handler = handleObjIn.handler;
  40471. selector = handleObjIn.selector;
  40472. }
  40473. // Ensure that invalid selectors throw exceptions at attach time
  40474. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  40475. if (selector) {
  40476. jQuery.find.matchesSelector(documentElement, selector);
  40477. }
  40478. // Make sure that the handler has a unique ID, used to find/remove it later
  40479. if (!handler.guid) {
  40480. handler.guid = jQuery.guid++;
  40481. }
  40482. // Init the element's event structure and main handler, if this is the first
  40483. if (!(events = elemData.events)) {
  40484. events = elemData.events = {};
  40485. }
  40486. if (!(eventHandle = elemData.handle)) {
  40487. eventHandle = elemData.handle = function (e) {
  40488. // Discard the second event of a jQuery.event.trigger() and
  40489. // when an event is called after a page has unloaded
  40490. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? jQuery.event.dispatch.apply(elem, arguments) : undefined;
  40491. };
  40492. }
  40493. // Handle multiple events separated by a space
  40494. types = (types || "").match(rnothtmlwhite) || [""];
  40495. t = types.length;
  40496. while (t--) {
  40497. tmp = rtypenamespace.exec(types[t]) || [];
  40498. type = origType = tmp[1];
  40499. namespaces = (tmp[2] || "").split(".").sort();
  40500. // There *must* be a type, no attaching namespace-only handlers
  40501. if (!type) {
  40502. continue;
  40503. }
  40504. // If event changes its type, use the special event handlers for the changed type
  40505. special = jQuery.event.special[type] || {};
  40506. // If selector defined, determine special event api type, otherwise given type
  40507. type = (selector ? special.delegateType : special.bindType) || type;
  40508. // Update special based on newly reset type
  40509. special = jQuery.event.special[type] || {};
  40510. // handleObj is passed to all event handlers
  40511. handleObj = jQuery.extend({
  40512. type: type,
  40513. origType: origType,
  40514. data: data,
  40515. handler: handler,
  40516. guid: handler.guid,
  40517. selector: selector,
  40518. needsContext: selector && jQuery.expr.match.needsContext.test(selector),
  40519. namespace: namespaces.join(".")
  40520. }, handleObjIn);
  40521. // Init the event handler queue if we're the first
  40522. if (!(handlers = events[type])) {
  40523. handlers = events[type] = [];
  40524. handlers.delegateCount = 0;
  40525. // Only use addEventListener if the special events handler returns false
  40526. if (!special.setup || special.setup.call(elem, data, namespaces, eventHandle) === false) {
  40527. if (elem.addEventListener) {
  40528. elem.addEventListener(type, eventHandle);
  40529. }
  40530. }
  40531. }
  40532. if (special.add) {
  40533. special.add.call(elem, handleObj);
  40534. if (!handleObj.handler.guid) {
  40535. handleObj.handler.guid = handler.guid;
  40536. }
  40537. }
  40538. // Add to the element's handler list, delegates in front
  40539. if (selector) {
  40540. handlers.splice(handlers.delegateCount++, 0, handleObj);
  40541. } else {
  40542. handlers.push(handleObj);
  40543. }
  40544. // Keep track of which events have ever been used, for event optimization
  40545. jQuery.event.global[type] = true;
  40546. }
  40547. },
  40548. // Detach an event or set of events from an element
  40549. remove: function remove(elem, types, handler, selector, mappedTypes) {
  40550. var j,
  40551. origCount,
  40552. tmp,
  40553. events,
  40554. t,
  40555. handleObj,
  40556. special,
  40557. handlers,
  40558. type,
  40559. namespaces,
  40560. origType,
  40561. elemData = dataPriv.hasData(elem) && dataPriv.get(elem);
  40562. if (!elemData || !(events = elemData.events)) {
  40563. return;
  40564. }
  40565. // Once for each type.namespace in types; type may be omitted
  40566. types = (types || "").match(rnothtmlwhite) || [""];
  40567. t = types.length;
  40568. while (t--) {
  40569. tmp = rtypenamespace.exec(types[t]) || [];
  40570. type = origType = tmp[1];
  40571. namespaces = (tmp[2] || "").split(".").sort();
  40572. // Unbind all events (on this namespace, if provided) for the element
  40573. if (!type) {
  40574. for (type in events) {
  40575. jQuery.event.remove(elem, type + types[t], handler, selector, true);
  40576. }
  40577. continue;
  40578. }
  40579. special = jQuery.event.special[type] || {};
  40580. type = (selector ? special.delegateType : special.bindType) || type;
  40581. handlers = events[type] || [];
  40582. tmp = tmp[2] && new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)");
  40583. // Remove matching events
  40584. origCount = j = handlers.length;
  40585. while (j--) {
  40586. handleObj = handlers[j];
  40587. if ((mappedTypes || origType === handleObj.origType) && (!handler || handler.guid === handleObj.guid) && (!tmp || tmp.test(handleObj.namespace)) && (!selector || selector === handleObj.selector || selector === "**" && handleObj.selector)) {
  40588. handlers.splice(j, 1);
  40589. if (handleObj.selector) {
  40590. handlers.delegateCount--;
  40591. }
  40592. if (special.remove) {
  40593. special.remove.call(elem, handleObj);
  40594. }
  40595. }
  40596. }
  40597. // Remove generic event handler if we removed something and no more handlers exist
  40598. // (avoids potential for endless recursion during removal of special event handlers)
  40599. if (origCount && !handlers.length) {
  40600. if (!special.teardown || special.teardown.call(elem, namespaces, elemData.handle) === false) {
  40601. jQuery.removeEvent(elem, type, elemData.handle);
  40602. }
  40603. delete events[type];
  40604. }
  40605. }
  40606. // Remove data and the expando if it's no longer used
  40607. if (jQuery.isEmptyObject(events)) {
  40608. dataPriv.remove(elem, "handle events");
  40609. }
  40610. },
  40611. dispatch: function dispatch(nativeEvent) {
  40612. // Make a writable jQuery.Event from the native event object
  40613. var event = jQuery.event.fix(nativeEvent);
  40614. var i,
  40615. j,
  40616. ret,
  40617. matched,
  40618. handleObj,
  40619. handlerQueue,
  40620. args = new Array(arguments.length),
  40621. handlers = (dataPriv.get(this, "events") || {})[event.type] || [],
  40622. special = jQuery.event.special[event.type] || {};
  40623. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  40624. args[0] = event;
  40625. for (i = 1; i < arguments.length; i++) {
  40626. args[i] = arguments[i];
  40627. }
  40628. event.delegateTarget = this;
  40629. // Call the preDispatch hook for the mapped type, and let it bail if desired
  40630. if (special.preDispatch && special.preDispatch.call(this, event) === false) {
  40631. return;
  40632. }
  40633. // Determine handlers
  40634. handlerQueue = jQuery.event.handlers.call(this, event, handlers);
  40635. // Run delegates first; they may want to stop propagation beneath us
  40636. i = 0;
  40637. while ((matched = handlerQueue[i++]) && !event.isPropagationStopped()) {
  40638. event.currentTarget = matched.elem;
  40639. j = 0;
  40640. while ((handleObj = matched.handlers[j++]) && !event.isImmediatePropagationStopped()) {
  40641. // Triggered event must either 1) have no namespace, or 2) have namespace(s)
  40642. // a subset or equal to those in the bound event (both can have no namespace).
  40643. if (!event.rnamespace || event.rnamespace.test(handleObj.namespace)) {
  40644. event.handleObj = handleObj;
  40645. event.data = handleObj.data;
  40646. ret = ((jQuery.event.special[handleObj.origType] || {}).handle || handleObj.handler).apply(matched.elem, args);
  40647. if (ret !== undefined) {
  40648. if ((event.result = ret) === false) {
  40649. event.preventDefault();
  40650. event.stopPropagation();
  40651. }
  40652. }
  40653. }
  40654. }
  40655. }
  40656. // Call the postDispatch hook for the mapped type
  40657. if (special.postDispatch) {
  40658. special.postDispatch.call(this, event);
  40659. }
  40660. return event.result;
  40661. },
  40662. handlers: function handlers(event, _handlers) {
  40663. var i,
  40664. handleObj,
  40665. sel,
  40666. matchedHandlers,
  40667. matchedSelectors,
  40668. handlerQueue = [],
  40669. delegateCount = _handlers.delegateCount,
  40670. cur = event.target;
  40671. // Find delegate handlers
  40672. if (delegateCount &&
  40673. // Support: IE <=9
  40674. // Black-hole SVG <use> instance trees (trac-13180)
  40675. cur.nodeType &&
  40676. // Support: Firefox <=42
  40677. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  40678. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  40679. // Support: IE 11 only
  40680. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  40681. !(event.type === "click" && event.button >= 1)) {
  40682. for (; cur !== this; cur = cur.parentNode || this) {
  40683. // Don't check non-elements (#13208)
  40684. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  40685. if (cur.nodeType === 1 && !(event.type === "click" && cur.disabled === true)) {
  40686. matchedHandlers = [];
  40687. matchedSelectors = {};
  40688. for (i = 0; i < delegateCount; i++) {
  40689. handleObj = _handlers[i];
  40690. // Don't conflict with Object.prototype properties (#13203)
  40691. sel = handleObj.selector + " ";
  40692. if (matchedSelectors[sel] === undefined) {
  40693. matchedSelectors[sel] = handleObj.needsContext ? jQuery(sel, this).index(cur) > -1 : jQuery.find(sel, this, null, [cur]).length;
  40694. }
  40695. if (matchedSelectors[sel]) {
  40696. matchedHandlers.push(handleObj);
  40697. }
  40698. }
  40699. if (matchedHandlers.length) {
  40700. handlerQueue.push({ elem: cur, handlers: matchedHandlers });
  40701. }
  40702. }
  40703. }
  40704. }
  40705. // Add the remaining (directly-bound) handlers
  40706. cur = this;
  40707. if (delegateCount < _handlers.length) {
  40708. handlerQueue.push({ elem: cur, handlers: _handlers.slice(delegateCount) });
  40709. }
  40710. return handlerQueue;
  40711. },
  40712. addProp: function addProp(name, hook) {
  40713. Object.defineProperty(jQuery.Event.prototype, name, {
  40714. enumerable: true,
  40715. configurable: true,
  40716. get: isFunction(hook) ? function () {
  40717. if (this.originalEvent) {
  40718. return hook(this.originalEvent);
  40719. }
  40720. } : function () {
  40721. if (this.originalEvent) {
  40722. return this.originalEvent[name];
  40723. }
  40724. },
  40725. set: function set(value) {
  40726. Object.defineProperty(this, name, {
  40727. enumerable: true,
  40728. configurable: true,
  40729. writable: true,
  40730. value: value
  40731. });
  40732. }
  40733. });
  40734. },
  40735. fix: function fix(originalEvent) {
  40736. return originalEvent[jQuery.expando] ? originalEvent : new jQuery.Event(originalEvent);
  40737. },
  40738. special: {
  40739. load: {
  40740. // Prevent triggered image.load events from bubbling to window.load
  40741. noBubble: true
  40742. },
  40743. focus: {
  40744. // Fire native event if possible so blur/focus sequence is correct
  40745. trigger: function trigger() {
  40746. if (this !== safeActiveElement() && this.focus) {
  40747. this.focus();
  40748. return false;
  40749. }
  40750. },
  40751. delegateType: "focusin"
  40752. },
  40753. blur: {
  40754. trigger: function trigger() {
  40755. if (this === safeActiveElement() && this.blur) {
  40756. this.blur();
  40757. return false;
  40758. }
  40759. },
  40760. delegateType: "focusout"
  40761. },
  40762. click: {
  40763. // For checkbox, fire native event so checked state will be right
  40764. trigger: function trigger() {
  40765. if (this.type === "checkbox" && this.click && nodeName(this, "input")) {
  40766. this.click();
  40767. return false;
  40768. }
  40769. },
  40770. // For cross-browser consistency, don't fire native .click() on links
  40771. _default: function _default(event) {
  40772. return nodeName(event.target, "a");
  40773. }
  40774. },
  40775. beforeunload: {
  40776. postDispatch: function postDispatch(event) {
  40777. // Support: Firefox 20+
  40778. // Firefox doesn't alert if the returnValue field is not set.
  40779. if (event.result !== undefined && event.originalEvent) {
  40780. event.originalEvent.returnValue = event.result;
  40781. }
  40782. }
  40783. }
  40784. }
  40785. };
  40786. jQuery.removeEvent = function (elem, type, handle) {
  40787. // This "if" is needed for plain objects
  40788. if (elem.removeEventListener) {
  40789. elem.removeEventListener(type, handle);
  40790. }
  40791. };
  40792. jQuery.Event = function (src, props) {
  40793. // Allow instantiation without the 'new' keyword
  40794. if (!(this instanceof jQuery.Event)) {
  40795. return new jQuery.Event(src, props);
  40796. }
  40797. // Event object
  40798. if (src && src.type) {
  40799. this.originalEvent = src;
  40800. this.type = src.type;
  40801. // Events bubbling up the document may have been marked as prevented
  40802. // by a handler lower down the tree; reflect the correct value.
  40803. this.isDefaultPrevented = src.defaultPrevented || src.defaultPrevented === undefined &&
  40804. // Support: Android <=2.3 only
  40805. src.returnValue === false ? returnTrue : returnFalse;
  40806. // Create target properties
  40807. // Support: Safari <=6 - 7 only
  40808. // Target should not be a text node (#504, #13143)
  40809. this.target = src.target && src.target.nodeType === 3 ? src.target.parentNode : src.target;
  40810. this.currentTarget = src.currentTarget;
  40811. this.relatedTarget = src.relatedTarget;
  40812. // Event type
  40813. } else {
  40814. this.type = src;
  40815. }
  40816. // Put explicitly provided properties onto the event object
  40817. if (props) {
  40818. jQuery.extend(this, props);
  40819. }
  40820. // Create a timestamp if incoming event doesn't have one
  40821. this.timeStamp = src && src.timeStamp || Date.now();
  40822. // Mark it as fixed
  40823. this[jQuery.expando] = true;
  40824. };
  40825. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  40826. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  40827. jQuery.Event.prototype = {
  40828. constructor: jQuery.Event,
  40829. isDefaultPrevented: returnFalse,
  40830. isPropagationStopped: returnFalse,
  40831. isImmediatePropagationStopped: returnFalse,
  40832. isSimulated: false,
  40833. preventDefault: function preventDefault() {
  40834. var e = this.originalEvent;
  40835. this.isDefaultPrevented = returnTrue;
  40836. if (e && !this.isSimulated) {
  40837. e.preventDefault();
  40838. }
  40839. },
  40840. stopPropagation: function stopPropagation() {
  40841. var e = this.originalEvent;
  40842. this.isPropagationStopped = returnTrue;
  40843. if (e && !this.isSimulated) {
  40844. e.stopPropagation();
  40845. }
  40846. },
  40847. stopImmediatePropagation: function stopImmediatePropagation() {
  40848. var e = this.originalEvent;
  40849. this.isImmediatePropagationStopped = returnTrue;
  40850. if (e && !this.isSimulated) {
  40851. e.stopImmediatePropagation();
  40852. }
  40853. this.stopPropagation();
  40854. }
  40855. };
  40856. // Includes all common event props including KeyEvent and MouseEvent specific props
  40857. jQuery.each({
  40858. altKey: true,
  40859. bubbles: true,
  40860. cancelable: true,
  40861. changedTouches: true,
  40862. ctrlKey: true,
  40863. detail: true,
  40864. eventPhase: true,
  40865. metaKey: true,
  40866. pageX: true,
  40867. pageY: true,
  40868. shiftKey: true,
  40869. view: true,
  40870. "char": true,
  40871. charCode: true,
  40872. key: true,
  40873. keyCode: true,
  40874. button: true,
  40875. buttons: true,
  40876. clientX: true,
  40877. clientY: true,
  40878. offsetX: true,
  40879. offsetY: true,
  40880. pointerId: true,
  40881. pointerType: true,
  40882. screenX: true,
  40883. screenY: true,
  40884. targetTouches: true,
  40885. toElement: true,
  40886. touches: true,
  40887. which: function which(event) {
  40888. var button = event.button;
  40889. // Add which for key events
  40890. if (event.which == null && rkeyEvent.test(event.type)) {
  40891. return event.charCode != null ? event.charCode : event.keyCode;
  40892. }
  40893. // Add which for click: 1 === left; 2 === middle; 3 === right
  40894. if (!event.which && button !== undefined && rmouseEvent.test(event.type)) {
  40895. if (button & 1) {
  40896. return 1;
  40897. }
  40898. if (button & 2) {
  40899. return 3;
  40900. }
  40901. if (button & 4) {
  40902. return 2;
  40903. }
  40904. return 0;
  40905. }
  40906. return event.which;
  40907. }
  40908. }, jQuery.event.addProp);
  40909. // Create mouseenter/leave events using mouseover/out and event-time checks
  40910. // so that event delegation works in jQuery.
  40911. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  40912. //
  40913. // Support: Safari 7 only
  40914. // Safari sends mouseenter too often; see:
  40915. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  40916. // for the description of the bug (it existed in older Chrome versions as well).
  40917. jQuery.each({
  40918. mouseenter: "mouseover",
  40919. mouseleave: "mouseout",
  40920. pointerenter: "pointerover",
  40921. pointerleave: "pointerout"
  40922. }, function (orig, fix) {
  40923. jQuery.event.special[orig] = {
  40924. delegateType: fix,
  40925. bindType: fix,
  40926. handle: function handle(event) {
  40927. var ret,
  40928. target = this,
  40929. related = event.relatedTarget,
  40930. handleObj = event.handleObj;
  40931. // For mouseenter/leave call the handler if related is outside the target.
  40932. // NB: No relatedTarget if the mouse left/entered the browser window
  40933. if (!related || related !== target && !jQuery.contains(target, related)) {
  40934. event.type = handleObj.origType;
  40935. ret = handleObj.handler.apply(this, arguments);
  40936. event.type = fix;
  40937. }
  40938. return ret;
  40939. }
  40940. };
  40941. });
  40942. jQuery.fn.extend({
  40943. on: function on(types, selector, data, fn) {
  40944. return _on(this, types, selector, data, fn);
  40945. },
  40946. one: function one(types, selector, data, fn) {
  40947. return _on(this, types, selector, data, fn, 1);
  40948. },
  40949. off: function off(types, selector, fn) {
  40950. var handleObj, type;
  40951. if (types && types.preventDefault && types.handleObj) {
  40952. // ( event ) dispatched jQuery.Event
  40953. handleObj = types.handleObj;
  40954. jQuery(types.delegateTarget).off(handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, handleObj.selector, handleObj.handler);
  40955. return this;
  40956. }
  40957. if ((typeof types === "undefined" ? "undefined" : _typeof(types)) === "object") {
  40958. // ( types-object [, selector] )
  40959. for (type in types) {
  40960. this.off(type, selector, types[type]);
  40961. }
  40962. return this;
  40963. }
  40964. if (selector === false || typeof selector === "function") {
  40965. // ( types [, fn] )
  40966. fn = selector;
  40967. selector = undefined;
  40968. }
  40969. if (fn === false) {
  40970. fn = returnFalse;
  40971. }
  40972. return this.each(function () {
  40973. jQuery.event.remove(this, types, fn, selector);
  40974. });
  40975. }
  40976. });
  40977. var
  40978. /* eslint-disable max-len */
  40979. // See https://github.com/eslint/eslint/issues/3229
  40980. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  40981. /* eslint-enable */
  40982. // Support: IE <=10 - 11, Edge 12 - 13 only
  40983. // In IE/Edge using regex groups here causes severe slowdowns.
  40984. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  40985. rnoInnerhtml = /<script|<style|<link/i,
  40986. // checked="checked" or checked
  40987. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  40988. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  40989. // Prefer a tbody over its parent table for containing new rows
  40990. function manipulationTarget(elem, content) {
  40991. if (nodeName(elem, "table") && nodeName(content.nodeType !== 11 ? content : content.firstChild, "tr")) {
  40992. return jQuery(elem).children("tbody")[0] || elem;
  40993. }
  40994. return elem;
  40995. }
  40996. // Replace/restore the type attribute of script elements for safe DOM manipulation
  40997. function disableScript(elem) {
  40998. elem.type = (elem.getAttribute("type") !== null) + "/" + elem.type;
  40999. return elem;
  41000. }
  41001. function restoreScript(elem) {
  41002. if ((elem.type || "").slice(0, 5) === "true/") {
  41003. elem.type = elem.type.slice(5);
  41004. } else {
  41005. elem.removeAttribute("type");
  41006. }
  41007. return elem;
  41008. }
  41009. function cloneCopyEvent(src, dest) {
  41010. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  41011. if (dest.nodeType !== 1) {
  41012. return;
  41013. }
  41014. // 1. Copy private data: events, handlers, etc.
  41015. if (dataPriv.hasData(src)) {
  41016. pdataOld = dataPriv.access(src);
  41017. pdataCur = dataPriv.set(dest, pdataOld);
  41018. events = pdataOld.events;
  41019. if (events) {
  41020. delete pdataCur.handle;
  41021. pdataCur.events = {};
  41022. for (type in events) {
  41023. for (i = 0, l = events[type].length; i < l; i++) {
  41024. jQuery.event.add(dest, type, events[type][i]);
  41025. }
  41026. }
  41027. }
  41028. }
  41029. // 2. Copy user data
  41030. if (dataUser.hasData(src)) {
  41031. udataOld = dataUser.access(src);
  41032. udataCur = jQuery.extend({}, udataOld);
  41033. dataUser.set(dest, udataCur);
  41034. }
  41035. }
  41036. // Fix IE bugs, see support tests
  41037. function fixInput(src, dest) {
  41038. var nodeName = dest.nodeName.toLowerCase();
  41039. // Fails to persist the checked state of a cloned checkbox or radio button.
  41040. if (nodeName === "input" && rcheckableType.test(src.type)) {
  41041. dest.checked = src.checked;
  41042. // Fails to return the selected option to the default selected state when cloning options
  41043. } else if (nodeName === "input" || nodeName === "textarea") {
  41044. dest.defaultValue = src.defaultValue;
  41045. }
  41046. }
  41047. function domManip(collection, args, callback, ignored) {
  41048. // Flatten any nested arrays
  41049. args = concat.apply([], args);
  41050. var fragment,
  41051. first,
  41052. scripts,
  41053. hasScripts,
  41054. node,
  41055. doc,
  41056. i = 0,
  41057. l = collection.length,
  41058. iNoClone = l - 1,
  41059. value = args[0],
  41060. valueIsFunction = isFunction(value);
  41061. // We can't cloneNode fragments that contain checked, in WebKit
  41062. if (valueIsFunction || l > 1 && typeof value === "string" && !support.checkClone && rchecked.test(value)) {
  41063. return collection.each(function (index) {
  41064. var self = collection.eq(index);
  41065. if (valueIsFunction) {
  41066. args[0] = value.call(this, index, self.html());
  41067. }
  41068. domManip(self, args, callback, ignored);
  41069. });
  41070. }
  41071. if (l) {
  41072. fragment = buildFragment(args, collection[0].ownerDocument, false, collection, ignored);
  41073. first = fragment.firstChild;
  41074. if (fragment.childNodes.length === 1) {
  41075. fragment = first;
  41076. }
  41077. // Require either new content or an interest in ignored elements to invoke the callback
  41078. if (first || ignored) {
  41079. scripts = jQuery.map(getAll(fragment, "script"), disableScript);
  41080. hasScripts = scripts.length;
  41081. // Use the original fragment for the last item
  41082. // instead of the first because it can end up
  41083. // being emptied incorrectly in certain situations (#8070).
  41084. for (; i < l; i++) {
  41085. node = fragment;
  41086. if (i !== iNoClone) {
  41087. node = jQuery.clone(node, true, true);
  41088. // Keep references to cloned scripts for later restoration
  41089. if (hasScripts) {
  41090. // Support: Android <=4.0 only, PhantomJS 1 only
  41091. // push.apply(_, arraylike) throws on ancient WebKit
  41092. jQuery.merge(scripts, getAll(node, "script"));
  41093. }
  41094. }
  41095. callback.call(collection[i], node, i);
  41096. }
  41097. if (hasScripts) {
  41098. doc = scripts[scripts.length - 1].ownerDocument;
  41099. // Reenable scripts
  41100. jQuery.map(scripts, restoreScript);
  41101. // Evaluate executable scripts on first document insertion
  41102. for (i = 0; i < hasScripts; i++) {
  41103. node = scripts[i];
  41104. if (rscriptType.test(node.type || "") && !dataPriv.access(node, "globalEval") && jQuery.contains(doc, node)) {
  41105. if (node.src && (node.type || "").toLowerCase() !== "module") {
  41106. // Optional AJAX dependency, but won't run scripts if not present
  41107. if (jQuery._evalUrl) {
  41108. jQuery._evalUrl(node.src);
  41109. }
  41110. } else {
  41111. DOMEval(node.textContent.replace(rcleanScript, ""), doc, node);
  41112. }
  41113. }
  41114. }
  41115. }
  41116. }
  41117. }
  41118. return collection;
  41119. }
  41120. function _remove(elem, selector, keepData) {
  41121. var node,
  41122. nodes = selector ? jQuery.filter(selector, elem) : elem,
  41123. i = 0;
  41124. for (; (node = nodes[i]) != null; i++) {
  41125. if (!keepData && node.nodeType === 1) {
  41126. jQuery.cleanData(getAll(node));
  41127. }
  41128. if (node.parentNode) {
  41129. if (keepData && jQuery.contains(node.ownerDocument, node)) {
  41130. setGlobalEval(getAll(node, "script"));
  41131. }
  41132. node.parentNode.removeChild(node);
  41133. }
  41134. }
  41135. return elem;
  41136. }
  41137. jQuery.extend({
  41138. htmlPrefilter: function htmlPrefilter(html) {
  41139. return html.replace(rxhtmlTag, "<$1></$2>");
  41140. },
  41141. clone: function clone(elem, dataAndEvents, deepDataAndEvents) {
  41142. var i,
  41143. l,
  41144. srcElements,
  41145. destElements,
  41146. clone = elem.cloneNode(true),
  41147. inPage = jQuery.contains(elem.ownerDocument, elem);
  41148. // Fix IE cloning issues
  41149. if (!support.noCloneChecked && (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem)) {
  41150. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  41151. destElements = getAll(clone);
  41152. srcElements = getAll(elem);
  41153. for (i = 0, l = srcElements.length; i < l; i++) {
  41154. fixInput(srcElements[i], destElements[i]);
  41155. }
  41156. }
  41157. // Copy the events from the original to the clone
  41158. if (dataAndEvents) {
  41159. if (deepDataAndEvents) {
  41160. srcElements = srcElements || getAll(elem);
  41161. destElements = destElements || getAll(clone);
  41162. for (i = 0, l = srcElements.length; i < l; i++) {
  41163. cloneCopyEvent(srcElements[i], destElements[i]);
  41164. }
  41165. } else {
  41166. cloneCopyEvent(elem, clone);
  41167. }
  41168. }
  41169. // Preserve script evaluation history
  41170. destElements = getAll(clone, "script");
  41171. if (destElements.length > 0) {
  41172. setGlobalEval(destElements, !inPage && getAll(elem, "script"));
  41173. }
  41174. // Return the cloned set
  41175. return clone;
  41176. },
  41177. cleanData: function cleanData(elems) {
  41178. var data,
  41179. elem,
  41180. type,
  41181. special = jQuery.event.special,
  41182. i = 0;
  41183. for (; (elem = elems[i]) !== undefined; i++) {
  41184. if (acceptData(elem)) {
  41185. if (data = elem[dataPriv.expando]) {
  41186. if (data.events) {
  41187. for (type in data.events) {
  41188. if (special[type]) {
  41189. jQuery.event.remove(elem, type);
  41190. // This is a shortcut to avoid jQuery.event.remove's overhead
  41191. } else {
  41192. jQuery.removeEvent(elem, type, data.handle);
  41193. }
  41194. }
  41195. }
  41196. // Support: Chrome <=35 - 45+
  41197. // Assign undefined instead of using delete, see Data#remove
  41198. elem[dataPriv.expando] = undefined;
  41199. }
  41200. if (elem[dataUser.expando]) {
  41201. // Support: Chrome <=35 - 45+
  41202. // Assign undefined instead of using delete, see Data#remove
  41203. elem[dataUser.expando] = undefined;
  41204. }
  41205. }
  41206. }
  41207. }
  41208. });
  41209. jQuery.fn.extend({
  41210. detach: function detach(selector) {
  41211. return _remove(this, selector, true);
  41212. },
  41213. remove: function remove(selector) {
  41214. return _remove(this, selector);
  41215. },
  41216. text: function text(value) {
  41217. return access(this, function (value) {
  41218. return value === undefined ? jQuery.text(this) : this.empty().each(function () {
  41219. if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
  41220. this.textContent = value;
  41221. }
  41222. });
  41223. }, null, value, arguments.length);
  41224. },
  41225. append: function append() {
  41226. return domManip(this, arguments, function (elem) {
  41227. if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
  41228. var target = manipulationTarget(this, elem);
  41229. target.appendChild(elem);
  41230. }
  41231. });
  41232. },
  41233. prepend: function prepend() {
  41234. return domManip(this, arguments, function (elem) {
  41235. if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
  41236. var target = manipulationTarget(this, elem);
  41237. target.insertBefore(elem, target.firstChild);
  41238. }
  41239. });
  41240. },
  41241. before: function before() {
  41242. return domManip(this, arguments, function (elem) {
  41243. if (this.parentNode) {
  41244. this.parentNode.insertBefore(elem, this);
  41245. }
  41246. });
  41247. },
  41248. after: function after() {
  41249. return domManip(this, arguments, function (elem) {
  41250. if (this.parentNode) {
  41251. this.parentNode.insertBefore(elem, this.nextSibling);
  41252. }
  41253. });
  41254. },
  41255. empty: function empty() {
  41256. var elem,
  41257. i = 0;
  41258. for (; (elem = this[i]) != null; i++) {
  41259. if (elem.nodeType === 1) {
  41260. // Prevent memory leaks
  41261. jQuery.cleanData(getAll(elem, false));
  41262. // Remove any remaining nodes
  41263. elem.textContent = "";
  41264. }
  41265. }
  41266. return this;
  41267. },
  41268. clone: function clone(dataAndEvents, deepDataAndEvents) {
  41269. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  41270. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  41271. return this.map(function () {
  41272. return jQuery.clone(this, dataAndEvents, deepDataAndEvents);
  41273. });
  41274. },
  41275. html: function html(value) {
  41276. return access(this, function (value) {
  41277. var elem = this[0] || {},
  41278. i = 0,
  41279. l = this.length;
  41280. if (value === undefined && elem.nodeType === 1) {
  41281. return elem.innerHTML;
  41282. }
  41283. // See if we can take a shortcut and just use innerHTML
  41284. if (typeof value === "string" && !rnoInnerhtml.test(value) && !wrapMap[(rtagName.exec(value) || ["", ""])[1].toLowerCase()]) {
  41285. value = jQuery.htmlPrefilter(value);
  41286. try {
  41287. for (; i < l; i++) {
  41288. elem = this[i] || {};
  41289. // Remove element nodes and prevent memory leaks
  41290. if (elem.nodeType === 1) {
  41291. jQuery.cleanData(getAll(elem, false));
  41292. elem.innerHTML = value;
  41293. }
  41294. }
  41295. elem = 0;
  41296. // If using innerHTML throws an exception, use the fallback method
  41297. } catch (e) {}
  41298. }
  41299. if (elem) {
  41300. this.empty().append(value);
  41301. }
  41302. }, null, value, arguments.length);
  41303. },
  41304. replaceWith: function replaceWith() {
  41305. var ignored = [];
  41306. // Make the changes, replacing each non-ignored context element with the new content
  41307. return domManip(this, arguments, function (elem) {
  41308. var parent = this.parentNode;
  41309. if (jQuery.inArray(this, ignored) < 0) {
  41310. jQuery.cleanData(getAll(this));
  41311. if (parent) {
  41312. parent.replaceChild(elem, this);
  41313. }
  41314. }
  41315. // Force callback invocation
  41316. }, ignored);
  41317. }
  41318. });
  41319. jQuery.each({
  41320. appendTo: "append",
  41321. prependTo: "prepend",
  41322. insertBefore: "before",
  41323. insertAfter: "after",
  41324. replaceAll: "replaceWith"
  41325. }, function (name, original) {
  41326. jQuery.fn[name] = function (selector) {
  41327. var elems,
  41328. ret = [],
  41329. insert = jQuery(selector),
  41330. last = insert.length - 1,
  41331. i = 0;
  41332. for (; i <= last; i++) {
  41333. elems = i === last ? this : this.clone(true);
  41334. jQuery(insert[i])[original](elems);
  41335. // Support: Android <=4.0 only, PhantomJS 1 only
  41336. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  41337. push.apply(ret, elems.get());
  41338. }
  41339. return this.pushStack(ret);
  41340. };
  41341. });
  41342. var rnumnonpx = new RegExp("^(" + pnum + ")(?!px)[a-z%]+$", "i");
  41343. var getStyles = function getStyles(elem) {
  41344. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  41345. // IE throws on elements created in popups
  41346. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  41347. var view = elem.ownerDocument.defaultView;
  41348. if (!view || !view.opener) {
  41349. view = window;
  41350. }
  41351. return view.getComputedStyle(elem);
  41352. };
  41353. var rboxStyle = new RegExp(cssExpand.join("|"), "i");
  41354. (function () {
  41355. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  41356. // so they're executed at the same time to save the second computation.
  41357. function computeStyleTests() {
  41358. // This is a singleton, we need to execute it only once
  41359. if (!div) {
  41360. return;
  41361. }
  41362. container.style.cssText = "position:absolute;left:-11111px;width:60px;" + "margin-top:1px;padding:0;border:0";
  41363. div.style.cssText = "position:relative;display:block;box-sizing:border-box;overflow:scroll;" + "margin:auto;border:1px;padding:1px;" + "width:60%;top:1%";
  41364. documentElement.appendChild(container).appendChild(div);
  41365. var divStyle = window.getComputedStyle(div);
  41366. pixelPositionVal = divStyle.top !== "1%";
  41367. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  41368. reliableMarginLeftVal = roundPixelMeasures(divStyle.marginLeft) === 12;
  41369. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  41370. // Some styles come back with percentage values, even though they shouldn't
  41371. div.style.right = "60%";
  41372. pixelBoxStylesVal = roundPixelMeasures(divStyle.right) === 36;
  41373. // Support: IE 9 - 11 only
  41374. // Detect misreporting of content dimensions for box-sizing:border-box elements
  41375. boxSizingReliableVal = roundPixelMeasures(divStyle.width) === 36;
  41376. // Support: IE 9 only
  41377. // Detect overflow:scroll screwiness (gh-3699)
  41378. div.style.position = "absolute";
  41379. scrollboxSizeVal = div.offsetWidth === 36 || "absolute";
  41380. documentElement.removeChild(container);
  41381. // Nullify the div so it wouldn't be stored in the memory and
  41382. // it will also be a sign that checks already performed
  41383. div = null;
  41384. }
  41385. function roundPixelMeasures(measure) {
  41386. return Math.round(parseFloat(measure));
  41387. }
  41388. var pixelPositionVal,
  41389. boxSizingReliableVal,
  41390. scrollboxSizeVal,
  41391. pixelBoxStylesVal,
  41392. reliableMarginLeftVal,
  41393. container = document.createElement("div"),
  41394. div = document.createElement("div");
  41395. // Finish early in limited (non-browser) environments
  41396. if (!div.style) {
  41397. return;
  41398. }
  41399. // Support: IE <=9 - 11 only
  41400. // Style of cloned element affects source element cloned (#8908)
  41401. div.style.backgroundClip = "content-box";
  41402. div.cloneNode(true).style.backgroundClip = "";
  41403. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  41404. jQuery.extend(support, {
  41405. boxSizingReliable: function boxSizingReliable() {
  41406. computeStyleTests();
  41407. return boxSizingReliableVal;
  41408. },
  41409. pixelBoxStyles: function pixelBoxStyles() {
  41410. computeStyleTests();
  41411. return pixelBoxStylesVal;
  41412. },
  41413. pixelPosition: function pixelPosition() {
  41414. computeStyleTests();
  41415. return pixelPositionVal;
  41416. },
  41417. reliableMarginLeft: function reliableMarginLeft() {
  41418. computeStyleTests();
  41419. return reliableMarginLeftVal;
  41420. },
  41421. scrollboxSize: function scrollboxSize() {
  41422. computeStyleTests();
  41423. return scrollboxSizeVal;
  41424. }
  41425. });
  41426. })();
  41427. function curCSS(elem, name, computed) {
  41428. var width,
  41429. minWidth,
  41430. maxWidth,
  41431. ret,
  41432. // Support: Firefox 51+
  41433. // Retrieving style before computed somehow
  41434. // fixes an issue with getting wrong values
  41435. // on detached elements
  41436. style = elem.style;
  41437. computed = computed || getStyles(elem);
  41438. // getPropertyValue is needed for:
  41439. // .css('filter') (IE 9 only, #12537)
  41440. // .css('--customProperty) (#3144)
  41441. if (computed) {
  41442. ret = computed.getPropertyValue(name) || computed[name];
  41443. if (ret === "" && !jQuery.contains(elem.ownerDocument, elem)) {
  41444. ret = jQuery.style(elem, name);
  41445. }
  41446. // A tribute to the "awesome hack by Dean Edwards"
  41447. // Android Browser returns percentage for some values,
  41448. // but width seems to be reliably pixels.
  41449. // This is against the CSSOM draft spec:
  41450. // https://drafts.csswg.org/cssom/#resolved-values
  41451. if (!support.pixelBoxStyles() && rnumnonpx.test(ret) && rboxStyle.test(name)) {
  41452. // Remember the original values
  41453. width = style.width;
  41454. minWidth = style.minWidth;
  41455. maxWidth = style.maxWidth;
  41456. // Put in the new values to get a computed value out
  41457. style.minWidth = style.maxWidth = style.width = ret;
  41458. ret = computed.width;
  41459. // Revert the changed values
  41460. style.width = width;
  41461. style.minWidth = minWidth;
  41462. style.maxWidth = maxWidth;
  41463. }
  41464. }
  41465. return ret !== undefined ?
  41466. // Support: IE <=9 - 11 only
  41467. // IE returns zIndex value as an integer.
  41468. ret + "" : ret;
  41469. }
  41470. function addGetHookIf(conditionFn, hookFn) {
  41471. // Define the hook, we'll check on the first run if it's really needed.
  41472. return {
  41473. get: function get() {
  41474. if (conditionFn()) {
  41475. // Hook not needed (or it's not possible to use it due
  41476. // to missing dependency), remove it.
  41477. delete this.get;
  41478. return;
  41479. }
  41480. // Hook needed; redefine it so that the support test is not executed again.
  41481. return (this.get = hookFn).apply(this, arguments);
  41482. }
  41483. };
  41484. }
  41485. var
  41486. // Swappable if display is none or starts with table
  41487. // except "table", "table-cell", or "table-caption"
  41488. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  41489. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  41490. rcustomProp = /^--/,
  41491. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  41492. cssNormalTransform = {
  41493. letterSpacing: "0",
  41494. fontWeight: "400"
  41495. },
  41496. cssPrefixes = ["Webkit", "Moz", "ms"],
  41497. emptyStyle = document.createElement("div").style;
  41498. // Return a css property mapped to a potentially vendor prefixed property
  41499. function vendorPropName(name) {
  41500. // Shortcut for names that are not vendor prefixed
  41501. if (name in emptyStyle) {
  41502. return name;
  41503. }
  41504. // Check for vendor prefixed names
  41505. var capName = name[0].toUpperCase() + name.slice(1),
  41506. i = cssPrefixes.length;
  41507. while (i--) {
  41508. name = cssPrefixes[i] + capName;
  41509. if (name in emptyStyle) {
  41510. return name;
  41511. }
  41512. }
  41513. }
  41514. // Return a property mapped along what jQuery.cssProps suggests or to
  41515. // a vendor prefixed property.
  41516. function finalPropName(name) {
  41517. var ret = jQuery.cssProps[name];
  41518. if (!ret) {
  41519. ret = jQuery.cssProps[name] = vendorPropName(name) || name;
  41520. }
  41521. return ret;
  41522. }
  41523. function setPositiveNumber(elem, value, subtract) {
  41524. // Any relative (+/-) values have already been
  41525. // normalized at this point
  41526. var matches = rcssNum.exec(value);
  41527. return matches ?
  41528. // Guard against undefined "subtract", e.g., when used as in cssHooks
  41529. Math.max(0, matches[2] - (subtract || 0)) + (matches[3] || "px") : value;
  41530. }
  41531. function boxModelAdjustment(elem, dimension, box, isBorderBox, styles, computedVal) {
  41532. var i = dimension === "width" ? 1 : 0,
  41533. extra = 0,
  41534. delta = 0;
  41535. // Adjustment may not be necessary
  41536. if (box === (isBorderBox ? "border" : "content")) {
  41537. return 0;
  41538. }
  41539. for (; i < 4; i += 2) {
  41540. // Both box models exclude margin
  41541. if (box === "margin") {
  41542. delta += jQuery.css(elem, box + cssExpand[i], true, styles);
  41543. }
  41544. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  41545. if (!isBorderBox) {
  41546. // Add padding
  41547. delta += jQuery.css(elem, "padding" + cssExpand[i], true, styles);
  41548. // For "border" or "margin", add border
  41549. if (box !== "padding") {
  41550. delta += jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles);
  41551. // But still keep track of it otherwise
  41552. } else {
  41553. extra += jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles);
  41554. }
  41555. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  41556. // "padding" or "margin"
  41557. } else {
  41558. // For "content", subtract padding
  41559. if (box === "content") {
  41560. delta -= jQuery.css(elem, "padding" + cssExpand[i], true, styles);
  41561. }
  41562. // For "content" or "padding", subtract border
  41563. if (box !== "margin") {
  41564. delta -= jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles);
  41565. }
  41566. }
  41567. }
  41568. // Account for positive content-box scroll gutter when requested by providing computedVal
  41569. if (!isBorderBox && computedVal >= 0) {
  41570. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  41571. // Assuming integer scroll gutter, subtract the rest and round down
  41572. delta += Math.max(0, Math.ceil(elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)] - computedVal - delta - extra - 0.5));
  41573. }
  41574. return delta;
  41575. }
  41576. function getWidthOrHeight(elem, dimension, extra) {
  41577. // Start with computed style
  41578. var styles = getStyles(elem),
  41579. val = curCSS(elem, dimension, styles),
  41580. isBorderBox = jQuery.css(elem, "boxSizing", false, styles) === "border-box",
  41581. valueIsBorderBox = isBorderBox;
  41582. // Support: Firefox <=54
  41583. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  41584. if (rnumnonpx.test(val)) {
  41585. if (!extra) {
  41586. return val;
  41587. }
  41588. val = "auto";
  41589. }
  41590. // Check for style in case a browser which returns unreliable values
  41591. // for getComputedStyle silently falls back to the reliable elem.style
  41592. valueIsBorderBox = valueIsBorderBox && (support.boxSizingReliable() || val === elem.style[dimension]);
  41593. // Fall back to offsetWidth/offsetHeight when value is "auto"
  41594. // This happens for inline elements with no explicit setting (gh-3571)
  41595. // Support: Android <=4.1 - 4.3 only
  41596. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  41597. if (val === "auto" || !parseFloat(val) && jQuery.css(elem, "display", false, styles) === "inline") {
  41598. val = elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)];
  41599. // offsetWidth/offsetHeight provide border-box values
  41600. valueIsBorderBox = true;
  41601. }
  41602. // Normalize "" and auto
  41603. val = parseFloat(val) || 0;
  41604. // Adjust for the element's box model
  41605. return val + boxModelAdjustment(elem, dimension, extra || (isBorderBox ? "border" : "content"), valueIsBorderBox, styles,
  41606. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  41607. val) + "px";
  41608. }
  41609. jQuery.extend({
  41610. // Add in style property hooks for overriding the default
  41611. // behavior of getting and setting a style property
  41612. cssHooks: {
  41613. opacity: {
  41614. get: function get(elem, computed) {
  41615. if (computed) {
  41616. // We should always get a number back from opacity
  41617. var ret = curCSS(elem, "opacity");
  41618. return ret === "" ? "1" : ret;
  41619. }
  41620. }
  41621. }
  41622. },
  41623. // Don't automatically add "px" to these possibly-unitless properties
  41624. cssNumber: {
  41625. "animationIterationCount": true,
  41626. "columnCount": true,
  41627. "fillOpacity": true,
  41628. "flexGrow": true,
  41629. "flexShrink": true,
  41630. "fontWeight": true,
  41631. "lineHeight": true,
  41632. "opacity": true,
  41633. "order": true,
  41634. "orphans": true,
  41635. "widows": true,
  41636. "zIndex": true,
  41637. "zoom": true
  41638. },
  41639. // Add in properties whose names you wish to fix before
  41640. // setting or getting the value
  41641. cssProps: {},
  41642. // Get and set the style property on a DOM Node
  41643. style: function style(elem, name, value, extra) {
  41644. // Don't set styles on text and comment nodes
  41645. if (!elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style) {
  41646. return;
  41647. }
  41648. // Make sure that we're working with the right name
  41649. var ret,
  41650. type,
  41651. hooks,
  41652. origName = camelCase(name),
  41653. isCustomProp = rcustomProp.test(name),
  41654. style = elem.style;
  41655. // Make sure that we're working with the right name. We don't
  41656. // want to query the value if it is a CSS custom property
  41657. // since they are user-defined.
  41658. if (!isCustomProp) {
  41659. name = finalPropName(origName);
  41660. }
  41661. // Gets hook for the prefixed version, then unprefixed version
  41662. hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName];
  41663. // Check if we're setting a value
  41664. if (value !== undefined) {
  41665. type = typeof value === "undefined" ? "undefined" : _typeof(value);
  41666. // Convert "+=" or "-=" to relative numbers (#7345)
  41667. if (type === "string" && (ret = rcssNum.exec(value)) && ret[1]) {
  41668. value = adjustCSS(elem, name, ret);
  41669. // Fixes bug #9237
  41670. type = "number";
  41671. }
  41672. // Make sure that null and NaN values aren't set (#7116)
  41673. if (value == null || value !== value) {
  41674. return;
  41675. }
  41676. // If a number was passed in, add the unit (except for certain CSS properties)
  41677. if (type === "number") {
  41678. value += ret && ret[3] || (jQuery.cssNumber[origName] ? "" : "px");
  41679. }
  41680. // background-* props affect original clone's values
  41681. if (!support.clearCloneStyle && value === "" && name.indexOf("background") === 0) {
  41682. style[name] = "inherit";
  41683. }
  41684. // If a hook was provided, use that value, otherwise just set the specified value
  41685. if (!hooks || !("set" in hooks) || (value = hooks.set(elem, value, extra)) !== undefined) {
  41686. if (isCustomProp) {
  41687. style.setProperty(name, value);
  41688. } else {
  41689. style[name] = value;
  41690. }
  41691. }
  41692. } else {
  41693. // If a hook was provided get the non-computed value from there
  41694. if (hooks && "get" in hooks && (ret = hooks.get(elem, false, extra)) !== undefined) {
  41695. return ret;
  41696. }
  41697. // Otherwise just get the value from the style object
  41698. return style[name];
  41699. }
  41700. },
  41701. css: function css(elem, name, extra, styles) {
  41702. var val,
  41703. num,
  41704. hooks,
  41705. origName = camelCase(name),
  41706. isCustomProp = rcustomProp.test(name);
  41707. // Make sure that we're working with the right name. We don't
  41708. // want to modify the value if it is a CSS custom property
  41709. // since they are user-defined.
  41710. if (!isCustomProp) {
  41711. name = finalPropName(origName);
  41712. }
  41713. // Try prefixed name followed by the unprefixed name
  41714. hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName];
  41715. // If a hook was provided get the computed value from there
  41716. if (hooks && "get" in hooks) {
  41717. val = hooks.get(elem, true, extra);
  41718. }
  41719. // Otherwise, if a way to get the computed value exists, use that
  41720. if (val === undefined) {
  41721. val = curCSS(elem, name, styles);
  41722. }
  41723. // Convert "normal" to computed value
  41724. if (val === "normal" && name in cssNormalTransform) {
  41725. val = cssNormalTransform[name];
  41726. }
  41727. // Make numeric if forced or a qualifier was provided and val looks numeric
  41728. if (extra === "" || extra) {
  41729. num = parseFloat(val);
  41730. return extra === true || isFinite(num) ? num || 0 : val;
  41731. }
  41732. return val;
  41733. }
  41734. });
  41735. jQuery.each(["height", "width"], function (i, dimension) {
  41736. jQuery.cssHooks[dimension] = {
  41737. get: function get(elem, computed, extra) {
  41738. if (computed) {
  41739. // Certain elements can have dimension info if we invisibly show them
  41740. // but it must have a current display style that would benefit
  41741. return rdisplayswap.test(jQuery.css(elem, "display")) && (
  41742. // Support: Safari 8+
  41743. // Table columns in Safari have non-zero offsetWidth & zero
  41744. // getBoundingClientRect().width unless display is changed.
  41745. // Support: IE <=11 only
  41746. // Running getBoundingClientRect on a disconnected node
  41747. // in IE throws an error.
  41748. !elem.getClientRects().length || !elem.getBoundingClientRect().width) ? swap(elem, cssShow, function () {
  41749. return getWidthOrHeight(elem, dimension, extra);
  41750. }) : getWidthOrHeight(elem, dimension, extra);
  41751. }
  41752. },
  41753. set: function set(elem, value, extra) {
  41754. var matches,
  41755. styles = getStyles(elem),
  41756. isBorderBox = jQuery.css(elem, "boxSizing", false, styles) === "border-box",
  41757. subtract = extra && boxModelAdjustment(elem, dimension, extra, isBorderBox, styles);
  41758. // Account for unreliable border-box dimensions by comparing offset* to computed and
  41759. // faking a content-box to get border and padding (gh-3699)
  41760. if (isBorderBox && support.scrollboxSize() === styles.position) {
  41761. subtract -= Math.ceil(elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)] - parseFloat(styles[dimension]) - boxModelAdjustment(elem, dimension, "border", false, styles) - 0.5);
  41762. }
  41763. // Convert to pixels if value adjustment is needed
  41764. if (subtract && (matches = rcssNum.exec(value)) && (matches[3] || "px") !== "px") {
  41765. elem.style[dimension] = value;
  41766. value = jQuery.css(elem, dimension);
  41767. }
  41768. return setPositiveNumber(elem, value, subtract);
  41769. }
  41770. };
  41771. });
  41772. jQuery.cssHooks.marginLeft = addGetHookIf(support.reliableMarginLeft, function (elem, computed) {
  41773. if (computed) {
  41774. return (parseFloat(curCSS(elem, "marginLeft")) || elem.getBoundingClientRect().left - swap(elem, { marginLeft: 0 }, function () {
  41775. return elem.getBoundingClientRect().left;
  41776. })) + "px";
  41777. }
  41778. });
  41779. // These hooks are used by animate to expand properties
  41780. jQuery.each({
  41781. margin: "",
  41782. padding: "",
  41783. border: "Width"
  41784. }, function (prefix, suffix) {
  41785. jQuery.cssHooks[prefix + suffix] = {
  41786. expand: function expand(value) {
  41787. var i = 0,
  41788. expanded = {},
  41789. // Assumes a single number if not a string
  41790. parts = typeof value === "string" ? value.split(" ") : [value];
  41791. for (; i < 4; i++) {
  41792. expanded[prefix + cssExpand[i] + suffix] = parts[i] || parts[i - 2] || parts[0];
  41793. }
  41794. return expanded;
  41795. }
  41796. };
  41797. if (prefix !== "margin") {
  41798. jQuery.cssHooks[prefix + suffix].set = setPositiveNumber;
  41799. }
  41800. });
  41801. jQuery.fn.extend({
  41802. css: function css(name, value) {
  41803. return access(this, function (elem, name, value) {
  41804. var styles,
  41805. len,
  41806. map = {},
  41807. i = 0;
  41808. if (Array.isArray(name)) {
  41809. styles = getStyles(elem);
  41810. len = name.length;
  41811. for (; i < len; i++) {
  41812. map[name[i]] = jQuery.css(elem, name[i], false, styles);
  41813. }
  41814. return map;
  41815. }
  41816. return value !== undefined ? jQuery.style(elem, name, value) : jQuery.css(elem, name);
  41817. }, name, value, arguments.length > 1);
  41818. }
  41819. });
  41820. function Tween(elem, options, prop, end, easing) {
  41821. return new Tween.prototype.init(elem, options, prop, end, easing);
  41822. }
  41823. jQuery.Tween = Tween;
  41824. Tween.prototype = {
  41825. constructor: Tween,
  41826. init: function init(elem, options, prop, end, easing, unit) {
  41827. this.elem = elem;
  41828. this.prop = prop;
  41829. this.easing = easing || jQuery.easing._default;
  41830. this.options = options;
  41831. this.start = this.now = this.cur();
  41832. this.end = end;
  41833. this.unit = unit || (jQuery.cssNumber[prop] ? "" : "px");
  41834. },
  41835. cur: function cur() {
  41836. var hooks = Tween.propHooks[this.prop];
  41837. return hooks && hooks.get ? hooks.get(this) : Tween.propHooks._default.get(this);
  41838. },
  41839. run: function run(percent) {
  41840. var eased,
  41841. hooks = Tween.propHooks[this.prop];
  41842. if (this.options.duration) {
  41843. this.pos = eased = jQuery.easing[this.easing](percent, this.options.duration * percent, 0, 1, this.options.duration);
  41844. } else {
  41845. this.pos = eased = percent;
  41846. }
  41847. this.now = (this.end - this.start) * eased + this.start;
  41848. if (this.options.step) {
  41849. this.options.step.call(this.elem, this.now, this);
  41850. }
  41851. if (hooks && hooks.set) {
  41852. hooks.set(this);
  41853. } else {
  41854. Tween.propHooks._default.set(this);
  41855. }
  41856. return this;
  41857. }
  41858. };
  41859. Tween.prototype.init.prototype = Tween.prototype;
  41860. Tween.propHooks = {
  41861. _default: {
  41862. get: function get(tween) {
  41863. var result;
  41864. // Use a property on the element directly when it is not a DOM element,
  41865. // or when there is no matching style property that exists.
  41866. if (tween.elem.nodeType !== 1 || tween.elem[tween.prop] != null && tween.elem.style[tween.prop] == null) {
  41867. return tween.elem[tween.prop];
  41868. }
  41869. // Passing an empty string as a 3rd parameter to .css will automatically
  41870. // attempt a parseFloat and fallback to a string if the parse fails.
  41871. // Simple values such as "10px" are parsed to Float;
  41872. // complex values such as "rotate(1rad)" are returned as-is.
  41873. result = jQuery.css(tween.elem, tween.prop, "");
  41874. // Empty strings, null, undefined and "auto" are converted to 0.
  41875. return !result || result === "auto" ? 0 : result;
  41876. },
  41877. set: function set(tween) {
  41878. // Use step hook for back compat.
  41879. // Use cssHook if its there.
  41880. // Use .style if available and use plain properties where available.
  41881. if (jQuery.fx.step[tween.prop]) {
  41882. jQuery.fx.step[tween.prop](tween);
  41883. } else if (tween.elem.nodeType === 1 && (tween.elem.style[jQuery.cssProps[tween.prop]] != null || jQuery.cssHooks[tween.prop])) {
  41884. jQuery.style(tween.elem, tween.prop, tween.now + tween.unit);
  41885. } else {
  41886. tween.elem[tween.prop] = tween.now;
  41887. }
  41888. }
  41889. }
  41890. };
  41891. // Support: IE <=9 only
  41892. // Panic based approach to setting things on disconnected nodes
  41893. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  41894. set: function set(tween) {
  41895. if (tween.elem.nodeType && tween.elem.parentNode) {
  41896. tween.elem[tween.prop] = tween.now;
  41897. }
  41898. }
  41899. };
  41900. jQuery.easing = {
  41901. linear: function linear(p) {
  41902. return p;
  41903. },
  41904. swing: function swing(p) {
  41905. return 0.5 - Math.cos(p * Math.PI) / 2;
  41906. },
  41907. _default: "swing"
  41908. };
  41909. jQuery.fx = Tween.prototype.init;
  41910. // Back compat <1.8 extension point
  41911. jQuery.fx.step = {};
  41912. var fxNow,
  41913. inProgress,
  41914. rfxtypes = /^(?:toggle|show|hide)$/,
  41915. rrun = /queueHooks$/;
  41916. function schedule() {
  41917. if (inProgress) {
  41918. if (document.hidden === false && window.requestAnimationFrame) {
  41919. window.requestAnimationFrame(schedule);
  41920. } else {
  41921. window.setTimeout(schedule, jQuery.fx.interval);
  41922. }
  41923. jQuery.fx.tick();
  41924. }
  41925. }
  41926. // Animations created synchronously will run synchronously
  41927. function createFxNow() {
  41928. window.setTimeout(function () {
  41929. fxNow = undefined;
  41930. });
  41931. return fxNow = Date.now();
  41932. }
  41933. // Generate parameters to create a standard animation
  41934. function genFx(type, includeWidth) {
  41935. var which,
  41936. i = 0,
  41937. attrs = { height: type };
  41938. // If we include width, step value is 1 to do all cssExpand values,
  41939. // otherwise step value is 2 to skip over Left and Right
  41940. includeWidth = includeWidth ? 1 : 0;
  41941. for (; i < 4; i += 2 - includeWidth) {
  41942. which = cssExpand[i];
  41943. attrs["margin" + which] = attrs["padding" + which] = type;
  41944. }
  41945. if (includeWidth) {
  41946. attrs.opacity = attrs.width = type;
  41947. }
  41948. return attrs;
  41949. }
  41950. function createTween(value, prop, animation) {
  41951. var tween,
  41952. collection = (Animation.tweeners[prop] || []).concat(Animation.tweeners["*"]),
  41953. index = 0,
  41954. length = collection.length;
  41955. for (; index < length; index++) {
  41956. if (tween = collection[index].call(animation, prop, value)) {
  41957. // We're done with this property
  41958. return tween;
  41959. }
  41960. }
  41961. }
  41962. function defaultPrefilter(elem, props, opts) {
  41963. var prop,
  41964. value,
  41965. toggle,
  41966. hooks,
  41967. oldfire,
  41968. propTween,
  41969. restoreDisplay,
  41970. display,
  41971. isBox = "width" in props || "height" in props,
  41972. anim = this,
  41973. orig = {},
  41974. style = elem.style,
  41975. hidden = elem.nodeType && isHiddenWithinTree(elem),
  41976. dataShow = dataPriv.get(elem, "fxshow");
  41977. // Queue-skipping animations hijack the fx hooks
  41978. if (!opts.queue) {
  41979. hooks = jQuery._queueHooks(elem, "fx");
  41980. if (hooks.unqueued == null) {
  41981. hooks.unqueued = 0;
  41982. oldfire = hooks.empty.fire;
  41983. hooks.empty.fire = function () {
  41984. if (!hooks.unqueued) {
  41985. oldfire();
  41986. }
  41987. };
  41988. }
  41989. hooks.unqueued++;
  41990. anim.always(function () {
  41991. // Ensure the complete handler is called before this completes
  41992. anim.always(function () {
  41993. hooks.unqueued--;
  41994. if (!jQuery.queue(elem, "fx").length) {
  41995. hooks.empty.fire();
  41996. }
  41997. });
  41998. });
  41999. }
  42000. // Detect show/hide animations
  42001. for (prop in props) {
  42002. value = props[prop];
  42003. if (rfxtypes.test(value)) {
  42004. delete props[prop];
  42005. toggle = toggle || value === "toggle";
  42006. if (value === (hidden ? "hide" : "show")) {
  42007. // Pretend to be hidden if this is a "show" and
  42008. // there is still data from a stopped show/hide
  42009. if (value === "show" && dataShow && dataShow[prop] !== undefined) {
  42010. hidden = true;
  42011. // Ignore all other no-op show/hide data
  42012. } else {
  42013. continue;
  42014. }
  42015. }
  42016. orig[prop] = dataShow && dataShow[prop] || jQuery.style(elem, prop);
  42017. }
  42018. }
  42019. // Bail out if this is a no-op like .hide().hide()
  42020. propTween = !jQuery.isEmptyObject(props);
  42021. if (!propTween && jQuery.isEmptyObject(orig)) {
  42022. return;
  42023. }
  42024. // Restrict "overflow" and "display" styles during box animations
  42025. if (isBox && elem.nodeType === 1) {
  42026. // Support: IE <=9 - 11, Edge 12 - 15
  42027. // Record all 3 overflow attributes because IE does not infer the shorthand
  42028. // from identically-valued overflowX and overflowY and Edge just mirrors
  42029. // the overflowX value there.
  42030. opts.overflow = [style.overflow, style.overflowX, style.overflowY];
  42031. // Identify a display type, preferring old show/hide data over the CSS cascade
  42032. restoreDisplay = dataShow && dataShow.display;
  42033. if (restoreDisplay == null) {
  42034. restoreDisplay = dataPriv.get(elem, "display");
  42035. }
  42036. display = jQuery.css(elem, "display");
  42037. if (display === "none") {
  42038. if (restoreDisplay) {
  42039. display = restoreDisplay;
  42040. } else {
  42041. // Get nonempty value(s) by temporarily forcing visibility
  42042. showHide([elem], true);
  42043. restoreDisplay = elem.style.display || restoreDisplay;
  42044. display = jQuery.css(elem, "display");
  42045. showHide([elem]);
  42046. }
  42047. }
  42048. // Animate inline elements as inline-block
  42049. if (display === "inline" || display === "inline-block" && restoreDisplay != null) {
  42050. if (jQuery.css(elem, "float") === "none") {
  42051. // Restore the original display value at the end of pure show/hide animations
  42052. if (!propTween) {
  42053. anim.done(function () {
  42054. style.display = restoreDisplay;
  42055. });
  42056. if (restoreDisplay == null) {
  42057. display = style.display;
  42058. restoreDisplay = display === "none" ? "" : display;
  42059. }
  42060. }
  42061. style.display = "inline-block";
  42062. }
  42063. }
  42064. }
  42065. if (opts.overflow) {
  42066. style.overflow = "hidden";
  42067. anim.always(function () {
  42068. style.overflow = opts.overflow[0];
  42069. style.overflowX = opts.overflow[1];
  42070. style.overflowY = opts.overflow[2];
  42071. });
  42072. }
  42073. // Implement show/hide animations
  42074. propTween = false;
  42075. for (prop in orig) {
  42076. // General show/hide setup for this element animation
  42077. if (!propTween) {
  42078. if (dataShow) {
  42079. if ("hidden" in dataShow) {
  42080. hidden = dataShow.hidden;
  42081. }
  42082. } else {
  42083. dataShow = dataPriv.access(elem, "fxshow", { display: restoreDisplay });
  42084. }
  42085. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  42086. if (toggle) {
  42087. dataShow.hidden = !hidden;
  42088. }
  42089. // Show elements before animating them
  42090. if (hidden) {
  42091. showHide([elem], true);
  42092. }
  42093. /* eslint-disable no-loop-func */
  42094. anim.done(function () {
  42095. /* eslint-enable no-loop-func */
  42096. // The final step of a "hide" animation is actually hiding the element
  42097. if (!hidden) {
  42098. showHide([elem]);
  42099. }
  42100. dataPriv.remove(elem, "fxshow");
  42101. for (prop in orig) {
  42102. jQuery.style(elem, prop, orig[prop]);
  42103. }
  42104. });
  42105. }
  42106. // Per-property setup
  42107. propTween = createTween(hidden ? dataShow[prop] : 0, prop, anim);
  42108. if (!(prop in dataShow)) {
  42109. dataShow[prop] = propTween.start;
  42110. if (hidden) {
  42111. propTween.end = propTween.start;
  42112. propTween.start = 0;
  42113. }
  42114. }
  42115. }
  42116. }
  42117. function propFilter(props, specialEasing) {
  42118. var index, name, easing, value, hooks;
  42119. // camelCase, specialEasing and expand cssHook pass
  42120. for (index in props) {
  42121. name = camelCase(index);
  42122. easing = specialEasing[name];
  42123. value = props[index];
  42124. if (Array.isArray(value)) {
  42125. easing = value[1];
  42126. value = props[index] = value[0];
  42127. }
  42128. if (index !== name) {
  42129. props[name] = value;
  42130. delete props[index];
  42131. }
  42132. hooks = jQuery.cssHooks[name];
  42133. if (hooks && "expand" in hooks) {
  42134. value = hooks.expand(value);
  42135. delete props[name];
  42136. // Not quite $.extend, this won't overwrite existing keys.
  42137. // Reusing 'index' because we have the correct "name"
  42138. for (index in value) {
  42139. if (!(index in props)) {
  42140. props[index] = value[index];
  42141. specialEasing[index] = easing;
  42142. }
  42143. }
  42144. } else {
  42145. specialEasing[name] = easing;
  42146. }
  42147. }
  42148. }
  42149. function Animation(elem, properties, options) {
  42150. var result,
  42151. stopped,
  42152. index = 0,
  42153. length = Animation.prefilters.length,
  42154. deferred = jQuery.Deferred().always(function () {
  42155. // Don't match elem in the :animated selector
  42156. delete tick.elem;
  42157. }),
  42158. tick = function tick() {
  42159. if (stopped) {
  42160. return false;
  42161. }
  42162. var currentTime = fxNow || createFxNow(),
  42163. remaining = Math.max(0, animation.startTime + animation.duration - currentTime),
  42164. // Support: Android 2.3 only
  42165. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  42166. temp = remaining / animation.duration || 0,
  42167. percent = 1 - temp,
  42168. index = 0,
  42169. length = animation.tweens.length;
  42170. for (; index < length; index++) {
  42171. animation.tweens[index].run(percent);
  42172. }
  42173. deferred.notifyWith(elem, [animation, percent, remaining]);
  42174. // If there's more to do, yield
  42175. if (percent < 1 && length) {
  42176. return remaining;
  42177. }
  42178. // If this was an empty animation, synthesize a final progress notification
  42179. if (!length) {
  42180. deferred.notifyWith(elem, [animation, 1, 0]);
  42181. }
  42182. // Resolve the animation and report its conclusion
  42183. deferred.resolveWith(elem, [animation]);
  42184. return false;
  42185. },
  42186. animation = deferred.promise({
  42187. elem: elem,
  42188. props: jQuery.extend({}, properties),
  42189. opts: jQuery.extend(true, {
  42190. specialEasing: {},
  42191. easing: jQuery.easing._default
  42192. }, options),
  42193. originalProperties: properties,
  42194. originalOptions: options,
  42195. startTime: fxNow || createFxNow(),
  42196. duration: options.duration,
  42197. tweens: [],
  42198. createTween: function createTween(prop, end) {
  42199. var tween = jQuery.Tween(elem, animation.opts, prop, end, animation.opts.specialEasing[prop] || animation.opts.easing);
  42200. animation.tweens.push(tween);
  42201. return tween;
  42202. },
  42203. stop: function stop(gotoEnd) {
  42204. var index = 0,
  42205. // If we are going to the end, we want to run all the tweens
  42206. // otherwise we skip this part
  42207. length = gotoEnd ? animation.tweens.length : 0;
  42208. if (stopped) {
  42209. return this;
  42210. }
  42211. stopped = true;
  42212. for (; index < length; index++) {
  42213. animation.tweens[index].run(1);
  42214. }
  42215. // Resolve when we played the last frame; otherwise, reject
  42216. if (gotoEnd) {
  42217. deferred.notifyWith(elem, [animation, 1, 0]);
  42218. deferred.resolveWith(elem, [animation, gotoEnd]);
  42219. } else {
  42220. deferred.rejectWith(elem, [animation, gotoEnd]);
  42221. }
  42222. return this;
  42223. }
  42224. }),
  42225. props = animation.props;
  42226. propFilter(props, animation.opts.specialEasing);
  42227. for (; index < length; index++) {
  42228. result = Animation.prefilters[index].call(animation, elem, props, animation.opts);
  42229. if (result) {
  42230. if (isFunction(result.stop)) {
  42231. jQuery._queueHooks(animation.elem, animation.opts.queue).stop = result.stop.bind(result);
  42232. }
  42233. return result;
  42234. }
  42235. }
  42236. jQuery.map(props, createTween, animation);
  42237. if (isFunction(animation.opts.start)) {
  42238. animation.opts.start.call(elem, animation);
  42239. }
  42240. // Attach callbacks from options
  42241. animation.progress(animation.opts.progress).done(animation.opts.done, animation.opts.complete).fail(animation.opts.fail).always(animation.opts.always);
  42242. jQuery.fx.timer(jQuery.extend(tick, {
  42243. elem: elem,
  42244. anim: animation,
  42245. queue: animation.opts.queue
  42246. }));
  42247. return animation;
  42248. }
  42249. jQuery.Animation = jQuery.extend(Animation, {
  42250. tweeners: {
  42251. "*": [function (prop, value) {
  42252. var tween = this.createTween(prop, value);
  42253. adjustCSS(tween.elem, prop, rcssNum.exec(value), tween);
  42254. return tween;
  42255. }]
  42256. },
  42257. tweener: function tweener(props, callback) {
  42258. if (isFunction(props)) {
  42259. callback = props;
  42260. props = ["*"];
  42261. } else {
  42262. props = props.match(rnothtmlwhite);
  42263. }
  42264. var prop,
  42265. index = 0,
  42266. length = props.length;
  42267. for (; index < length; index++) {
  42268. prop = props[index];
  42269. Animation.tweeners[prop] = Animation.tweeners[prop] || [];
  42270. Animation.tweeners[prop].unshift(callback);
  42271. }
  42272. },
  42273. prefilters: [defaultPrefilter],
  42274. prefilter: function prefilter(callback, prepend) {
  42275. if (prepend) {
  42276. Animation.prefilters.unshift(callback);
  42277. } else {
  42278. Animation.prefilters.push(callback);
  42279. }
  42280. }
  42281. });
  42282. jQuery.speed = function (speed, easing, fn) {
  42283. var opt = speed && (typeof speed === "undefined" ? "undefined" : _typeof(speed)) === "object" ? jQuery.extend({}, speed) : {
  42284. complete: fn || !fn && easing || isFunction(speed) && speed,
  42285. duration: speed,
  42286. easing: fn && easing || easing && !isFunction(easing) && easing
  42287. };
  42288. // Go to the end state if fx are off
  42289. if (jQuery.fx.off) {
  42290. opt.duration = 0;
  42291. } else {
  42292. if (typeof opt.duration !== "number") {
  42293. if (opt.duration in jQuery.fx.speeds) {
  42294. opt.duration = jQuery.fx.speeds[opt.duration];
  42295. } else {
  42296. opt.duration = jQuery.fx.speeds._default;
  42297. }
  42298. }
  42299. }
  42300. // Normalize opt.queue - true/undefined/null -> "fx"
  42301. if (opt.queue == null || opt.queue === true) {
  42302. opt.queue = "fx";
  42303. }
  42304. // Queueing
  42305. opt.old = opt.complete;
  42306. opt.complete = function () {
  42307. if (isFunction(opt.old)) {
  42308. opt.old.call(this);
  42309. }
  42310. if (opt.queue) {
  42311. jQuery.dequeue(this, opt.queue);
  42312. }
  42313. };
  42314. return opt;
  42315. };
  42316. jQuery.fn.extend({
  42317. fadeTo: function fadeTo(speed, to, easing, callback) {
  42318. // Show any hidden elements after setting opacity to 0
  42319. return this.filter(isHiddenWithinTree).css("opacity", 0).show()
  42320. // Animate to the value specified
  42321. .end().animate({ opacity: to }, speed, easing, callback);
  42322. },
  42323. animate: function animate(prop, speed, easing, callback) {
  42324. var empty = jQuery.isEmptyObject(prop),
  42325. optall = jQuery.speed(speed, easing, callback),
  42326. doAnimation = function doAnimation() {
  42327. // Operate on a copy of prop so per-property easing won't be lost
  42328. var anim = Animation(this, jQuery.extend({}, prop), optall);
  42329. // Empty animations, or finishing resolves immediately
  42330. if (empty || dataPriv.get(this, "finish")) {
  42331. anim.stop(true);
  42332. }
  42333. };
  42334. doAnimation.finish = doAnimation;
  42335. return empty || optall.queue === false ? this.each(doAnimation) : this.queue(optall.queue, doAnimation);
  42336. },
  42337. stop: function stop(type, clearQueue, gotoEnd) {
  42338. var stopQueue = function stopQueue(hooks) {
  42339. var stop = hooks.stop;
  42340. delete hooks.stop;
  42341. stop(gotoEnd);
  42342. };
  42343. if (typeof type !== "string") {
  42344. gotoEnd = clearQueue;
  42345. clearQueue = type;
  42346. type = undefined;
  42347. }
  42348. if (clearQueue && type !== false) {
  42349. this.queue(type || "fx", []);
  42350. }
  42351. return this.each(function () {
  42352. var dequeue = true,
  42353. index = type != null && type + "queueHooks",
  42354. timers = jQuery.timers,
  42355. data = dataPriv.get(this);
  42356. if (index) {
  42357. if (data[index] && data[index].stop) {
  42358. stopQueue(data[index]);
  42359. }
  42360. } else {
  42361. for (index in data) {
  42362. if (data[index] && data[index].stop && rrun.test(index)) {
  42363. stopQueue(data[index]);
  42364. }
  42365. }
  42366. }
  42367. for (index = timers.length; index--;) {
  42368. if (timers[index].elem === this && (type == null || timers[index].queue === type)) {
  42369. timers[index].anim.stop(gotoEnd);
  42370. dequeue = false;
  42371. timers.splice(index, 1);
  42372. }
  42373. }
  42374. // Start the next in the queue if the last step wasn't forced.
  42375. // Timers currently will call their complete callbacks, which
  42376. // will dequeue but only if they were gotoEnd.
  42377. if (dequeue || !gotoEnd) {
  42378. jQuery.dequeue(this, type);
  42379. }
  42380. });
  42381. },
  42382. finish: function finish(type) {
  42383. if (type !== false) {
  42384. type = type || "fx";
  42385. }
  42386. return this.each(function () {
  42387. var index,
  42388. data = dataPriv.get(this),
  42389. queue = data[type + "queue"],
  42390. hooks = data[type + "queueHooks"],
  42391. timers = jQuery.timers,
  42392. length = queue ? queue.length : 0;
  42393. // Enable finishing flag on private data
  42394. data.finish = true;
  42395. // Empty the queue first
  42396. jQuery.queue(this, type, []);
  42397. if (hooks && hooks.stop) {
  42398. hooks.stop.call(this, true);
  42399. }
  42400. // Look for any active animations, and finish them
  42401. for (index = timers.length; index--;) {
  42402. if (timers[index].elem === this && timers[index].queue === type) {
  42403. timers[index].anim.stop(true);
  42404. timers.splice(index, 1);
  42405. }
  42406. }
  42407. // Look for any animations in the old queue and finish them
  42408. for (index = 0; index < length; index++) {
  42409. if (queue[index] && queue[index].finish) {
  42410. queue[index].finish.call(this);
  42411. }
  42412. }
  42413. // Turn off finishing flag
  42414. delete data.finish;
  42415. });
  42416. }
  42417. });
  42418. jQuery.each(["toggle", "show", "hide"], function (i, name) {
  42419. var cssFn = jQuery.fn[name];
  42420. jQuery.fn[name] = function (speed, easing, callback) {
  42421. return speed == null || typeof speed === "boolean" ? cssFn.apply(this, arguments) : this.animate(genFx(name, true), speed, easing, callback);
  42422. };
  42423. });
  42424. // Generate shortcuts for custom animations
  42425. jQuery.each({
  42426. slideDown: genFx("show"),
  42427. slideUp: genFx("hide"),
  42428. slideToggle: genFx("toggle"),
  42429. fadeIn: { opacity: "show" },
  42430. fadeOut: { opacity: "hide" },
  42431. fadeToggle: { opacity: "toggle" }
  42432. }, function (name, props) {
  42433. jQuery.fn[name] = function (speed, easing, callback) {
  42434. return this.animate(props, speed, easing, callback);
  42435. };
  42436. });
  42437. jQuery.timers = [];
  42438. jQuery.fx.tick = function () {
  42439. var timer,
  42440. i = 0,
  42441. timers = jQuery.timers;
  42442. fxNow = Date.now();
  42443. for (; i < timers.length; i++) {
  42444. timer = timers[i];
  42445. // Run the timer and safely remove it when done (allowing for external removal)
  42446. if (!timer() && timers[i] === timer) {
  42447. timers.splice(i--, 1);
  42448. }
  42449. }
  42450. if (!timers.length) {
  42451. jQuery.fx.stop();
  42452. }
  42453. fxNow = undefined;
  42454. };
  42455. jQuery.fx.timer = function (timer) {
  42456. jQuery.timers.push(timer);
  42457. jQuery.fx.start();
  42458. };
  42459. jQuery.fx.interval = 13;
  42460. jQuery.fx.start = function () {
  42461. if (inProgress) {
  42462. return;
  42463. }
  42464. inProgress = true;
  42465. schedule();
  42466. };
  42467. jQuery.fx.stop = function () {
  42468. inProgress = null;
  42469. };
  42470. jQuery.fx.speeds = {
  42471. slow: 600,
  42472. fast: 200,
  42473. // Default speed
  42474. _default: 400
  42475. };
  42476. // Based off of the plugin by Clint Helfers, with permission.
  42477. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  42478. jQuery.fn.delay = function (time, type) {
  42479. time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
  42480. type = type || "fx";
  42481. return this.queue(type, function (next, hooks) {
  42482. var timeout = window.setTimeout(next, time);
  42483. hooks.stop = function () {
  42484. window.clearTimeout(timeout);
  42485. };
  42486. });
  42487. };
  42488. (function () {
  42489. var input = document.createElement("input"),
  42490. select = document.createElement("select"),
  42491. opt = select.appendChild(document.createElement("option"));
  42492. input.type = "checkbox";
  42493. // Support: Android <=4.3 only
  42494. // Default value for a checkbox should be "on"
  42495. support.checkOn = input.value !== "";
  42496. // Support: IE <=11 only
  42497. // Must access selectedIndex to make default options select
  42498. support.optSelected = opt.selected;
  42499. // Support: IE <=11 only
  42500. // An input loses its value after becoming a radio
  42501. input = document.createElement("input");
  42502. input.value = "t";
  42503. input.type = "radio";
  42504. support.radioValue = input.value === "t";
  42505. })();
  42506. var boolHook,
  42507. attrHandle = jQuery.expr.attrHandle;
  42508. jQuery.fn.extend({
  42509. attr: function attr(name, value) {
  42510. return access(this, jQuery.attr, name, value, arguments.length > 1);
  42511. },
  42512. removeAttr: function removeAttr(name) {
  42513. return this.each(function () {
  42514. jQuery.removeAttr(this, name);
  42515. });
  42516. }
  42517. });
  42518. jQuery.extend({
  42519. attr: function attr(elem, name, value) {
  42520. var ret,
  42521. hooks,
  42522. nType = elem.nodeType;
  42523. // Don't get/set attributes on text, comment and attribute nodes
  42524. if (nType === 3 || nType === 8 || nType === 2) {
  42525. return;
  42526. }
  42527. // Fallback to prop when attributes are not supported
  42528. if (typeof elem.getAttribute === "undefined") {
  42529. return jQuery.prop(elem, name, value);
  42530. }
  42531. // Attribute hooks are determined by the lowercase version
  42532. // Grab necessary hook if one is defined
  42533. if (nType !== 1 || !jQuery.isXMLDoc(elem)) {
  42534. hooks = jQuery.attrHooks[name.toLowerCase()] || (jQuery.expr.match.bool.test(name) ? boolHook : undefined);
  42535. }
  42536. if (value !== undefined) {
  42537. if (value === null) {
  42538. jQuery.removeAttr(elem, name);
  42539. return;
  42540. }
  42541. if (hooks && "set" in hooks && (ret = hooks.set(elem, value, name)) !== undefined) {
  42542. return ret;
  42543. }
  42544. elem.setAttribute(name, value + "");
  42545. return value;
  42546. }
  42547. if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) {
  42548. return ret;
  42549. }
  42550. ret = jQuery.find.attr(elem, name);
  42551. // Non-existent attributes return null, we normalize to undefined
  42552. return ret == null ? undefined : ret;
  42553. },
  42554. attrHooks: {
  42555. type: {
  42556. set: function set(elem, value) {
  42557. if (!support.radioValue && value === "radio" && nodeName(elem, "input")) {
  42558. var val = elem.value;
  42559. elem.setAttribute("type", value);
  42560. if (val) {
  42561. elem.value = val;
  42562. }
  42563. return value;
  42564. }
  42565. }
  42566. }
  42567. },
  42568. removeAttr: function removeAttr(elem, value) {
  42569. var name,
  42570. i = 0,
  42571. // Attribute names can contain non-HTML whitespace characters
  42572. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  42573. attrNames = value && value.match(rnothtmlwhite);
  42574. if (attrNames && elem.nodeType === 1) {
  42575. while (name = attrNames[i++]) {
  42576. elem.removeAttribute(name);
  42577. }
  42578. }
  42579. }
  42580. });
  42581. // Hooks for boolean attributes
  42582. boolHook = {
  42583. set: function set(elem, value, name) {
  42584. if (value === false) {
  42585. // Remove boolean attributes when set to false
  42586. jQuery.removeAttr(elem, name);
  42587. } else {
  42588. elem.setAttribute(name, name);
  42589. }
  42590. return name;
  42591. }
  42592. };
  42593. jQuery.each(jQuery.expr.match.bool.source.match(/\w+/g), function (i, name) {
  42594. var getter = attrHandle[name] || jQuery.find.attr;
  42595. attrHandle[name] = function (elem, name, isXML) {
  42596. var ret,
  42597. handle,
  42598. lowercaseName = name.toLowerCase();
  42599. if (!isXML) {
  42600. // Avoid an infinite loop by temporarily removing this function from the getter
  42601. handle = attrHandle[lowercaseName];
  42602. attrHandle[lowercaseName] = ret;
  42603. ret = getter(elem, name, isXML) != null ? lowercaseName : null;
  42604. attrHandle[lowercaseName] = handle;
  42605. }
  42606. return ret;
  42607. };
  42608. });
  42609. var rfocusable = /^(?:input|select|textarea|button)$/i,
  42610. rclickable = /^(?:a|area)$/i;
  42611. jQuery.fn.extend({
  42612. prop: function prop(name, value) {
  42613. return access(this, jQuery.prop, name, value, arguments.length > 1);
  42614. },
  42615. removeProp: function removeProp(name) {
  42616. return this.each(function () {
  42617. delete this[jQuery.propFix[name] || name];
  42618. });
  42619. }
  42620. });
  42621. jQuery.extend({
  42622. prop: function prop(elem, name, value) {
  42623. var ret,
  42624. hooks,
  42625. nType = elem.nodeType;
  42626. // Don't get/set properties on text, comment and attribute nodes
  42627. if (nType === 3 || nType === 8 || nType === 2) {
  42628. return;
  42629. }
  42630. if (nType !== 1 || !jQuery.isXMLDoc(elem)) {
  42631. // Fix name and attach hooks
  42632. name = jQuery.propFix[name] || name;
  42633. hooks = jQuery.propHooks[name];
  42634. }
  42635. if (value !== undefined) {
  42636. if (hooks && "set" in hooks && (ret = hooks.set(elem, value, name)) !== undefined) {
  42637. return ret;
  42638. }
  42639. return elem[name] = value;
  42640. }
  42641. if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) {
  42642. return ret;
  42643. }
  42644. return elem[name];
  42645. },
  42646. propHooks: {
  42647. tabIndex: {
  42648. get: function get(elem) {
  42649. // Support: IE <=9 - 11 only
  42650. // elem.tabIndex doesn't always return the
  42651. // correct value when it hasn't been explicitly set
  42652. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  42653. // Use proper attribute retrieval(#12072)
  42654. var tabindex = jQuery.find.attr(elem, "tabindex");
  42655. if (tabindex) {
  42656. return parseInt(tabindex, 10);
  42657. }
  42658. if (rfocusable.test(elem.nodeName) || rclickable.test(elem.nodeName) && elem.href) {
  42659. return 0;
  42660. }
  42661. return -1;
  42662. }
  42663. }
  42664. },
  42665. propFix: {
  42666. "for": "htmlFor",
  42667. "class": "className"
  42668. }
  42669. });
  42670. // Support: IE <=11 only
  42671. // Accessing the selectedIndex property
  42672. // forces the browser to respect setting selected
  42673. // on the option
  42674. // The getter ensures a default option is selected
  42675. // when in an optgroup
  42676. // eslint rule "no-unused-expressions" is disabled for this code
  42677. // since it considers such accessions noop
  42678. if (!support.optSelected) {
  42679. jQuery.propHooks.selected = {
  42680. get: function get(elem) {
  42681. /* eslint no-unused-expressions: "off" */
  42682. var parent = elem.parentNode;
  42683. if (parent && parent.parentNode) {
  42684. parent.parentNode.selectedIndex;
  42685. }
  42686. return null;
  42687. },
  42688. set: function set(elem) {
  42689. /* eslint no-unused-expressions: "off" */
  42690. var parent = elem.parentNode;
  42691. if (parent) {
  42692. parent.selectedIndex;
  42693. if (parent.parentNode) {
  42694. parent.parentNode.selectedIndex;
  42695. }
  42696. }
  42697. }
  42698. };
  42699. }
  42700. jQuery.each(["tabIndex", "readOnly", "maxLength", "cellSpacing", "cellPadding", "rowSpan", "colSpan", "useMap", "frameBorder", "contentEditable"], function () {
  42701. jQuery.propFix[this.toLowerCase()] = this;
  42702. });
  42703. // Strip and collapse whitespace according to HTML spec
  42704. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  42705. function stripAndCollapse(value) {
  42706. var tokens = value.match(rnothtmlwhite) || [];
  42707. return tokens.join(" ");
  42708. }
  42709. function getClass(elem) {
  42710. return elem.getAttribute && elem.getAttribute("class") || "";
  42711. }
  42712. function classesToArray(value) {
  42713. if (Array.isArray(value)) {
  42714. return value;
  42715. }
  42716. if (typeof value === "string") {
  42717. return value.match(rnothtmlwhite) || [];
  42718. }
  42719. return [];
  42720. }
  42721. jQuery.fn.extend({
  42722. addClass: function addClass(value) {
  42723. var classes,
  42724. elem,
  42725. cur,
  42726. curValue,
  42727. clazz,
  42728. j,
  42729. finalValue,
  42730. i = 0;
  42731. if (isFunction(value)) {
  42732. return this.each(function (j) {
  42733. jQuery(this).addClass(value.call(this, j, getClass(this)));
  42734. });
  42735. }
  42736. classes = classesToArray(value);
  42737. if (classes.length) {
  42738. while (elem = this[i++]) {
  42739. curValue = getClass(elem);
  42740. cur = elem.nodeType === 1 && " " + stripAndCollapse(curValue) + " ";
  42741. if (cur) {
  42742. j = 0;
  42743. while (clazz = classes[j++]) {
  42744. if (cur.indexOf(" " + clazz + " ") < 0) {
  42745. cur += clazz + " ";
  42746. }
  42747. }
  42748. // Only assign if different to avoid unneeded rendering.
  42749. finalValue = stripAndCollapse(cur);
  42750. if (curValue !== finalValue) {
  42751. elem.setAttribute("class", finalValue);
  42752. }
  42753. }
  42754. }
  42755. }
  42756. return this;
  42757. },
  42758. removeClass: function removeClass(value) {
  42759. var classes,
  42760. elem,
  42761. cur,
  42762. curValue,
  42763. clazz,
  42764. j,
  42765. finalValue,
  42766. i = 0;
  42767. if (isFunction(value)) {
  42768. return this.each(function (j) {
  42769. jQuery(this).removeClass(value.call(this, j, getClass(this)));
  42770. });
  42771. }
  42772. if (!arguments.length) {
  42773. return this.attr("class", "");
  42774. }
  42775. classes = classesToArray(value);
  42776. if (classes.length) {
  42777. while (elem = this[i++]) {
  42778. curValue = getClass(elem);
  42779. // This expression is here for better compressibility (see addClass)
  42780. cur = elem.nodeType === 1 && " " + stripAndCollapse(curValue) + " ";
  42781. if (cur) {
  42782. j = 0;
  42783. while (clazz = classes[j++]) {
  42784. // Remove *all* instances
  42785. while (cur.indexOf(" " + clazz + " ") > -1) {
  42786. cur = cur.replace(" " + clazz + " ", " ");
  42787. }
  42788. }
  42789. // Only assign if different to avoid unneeded rendering.
  42790. finalValue = stripAndCollapse(cur);
  42791. if (curValue !== finalValue) {
  42792. elem.setAttribute("class", finalValue);
  42793. }
  42794. }
  42795. }
  42796. }
  42797. return this;
  42798. },
  42799. toggleClass: function toggleClass(value, stateVal) {
  42800. var type = typeof value === "undefined" ? "undefined" : _typeof(value),
  42801. isValidValue = type === "string" || Array.isArray(value);
  42802. if (typeof stateVal === "boolean" && isValidValue) {
  42803. return stateVal ? this.addClass(value) : this.removeClass(value);
  42804. }
  42805. if (isFunction(value)) {
  42806. return this.each(function (i) {
  42807. jQuery(this).toggleClass(value.call(this, i, getClass(this), stateVal), stateVal);
  42808. });
  42809. }
  42810. return this.each(function () {
  42811. var className, i, self, classNames;
  42812. if (isValidValue) {
  42813. // Toggle individual class names
  42814. i = 0;
  42815. self = jQuery(this);
  42816. classNames = classesToArray(value);
  42817. while (className = classNames[i++]) {
  42818. // Check each className given, space separated list
  42819. if (self.hasClass(className)) {
  42820. self.removeClass(className);
  42821. } else {
  42822. self.addClass(className);
  42823. }
  42824. }
  42825. // Toggle whole class name
  42826. } else if (value === undefined || type === "boolean") {
  42827. className = getClass(this);
  42828. if (className) {
  42829. // Store className if set
  42830. dataPriv.set(this, "__className__", className);
  42831. }
  42832. // If the element has a class name or if we're passed `false`,
  42833. // then remove the whole classname (if there was one, the above saved it).
  42834. // Otherwise bring back whatever was previously saved (if anything),
  42835. // falling back to the empty string if nothing was stored.
  42836. if (this.setAttribute) {
  42837. this.setAttribute("class", className || value === false ? "" : dataPriv.get(this, "__className__") || "");
  42838. }
  42839. }
  42840. });
  42841. },
  42842. hasClass: function hasClass(selector) {
  42843. var className,
  42844. elem,
  42845. i = 0;
  42846. className = " " + selector + " ";
  42847. while (elem = this[i++]) {
  42848. if (elem.nodeType === 1 && (" " + stripAndCollapse(getClass(elem)) + " ").indexOf(className) > -1) {
  42849. return true;
  42850. }
  42851. }
  42852. return false;
  42853. }
  42854. });
  42855. var rreturn = /\r/g;
  42856. jQuery.fn.extend({
  42857. val: function val(value) {
  42858. var hooks,
  42859. ret,
  42860. valueIsFunction,
  42861. elem = this[0];
  42862. if (!arguments.length) {
  42863. if (elem) {
  42864. hooks = jQuery.valHooks[elem.type] || jQuery.valHooks[elem.nodeName.toLowerCase()];
  42865. if (hooks && "get" in hooks && (ret = hooks.get(elem, "value")) !== undefined) {
  42866. return ret;
  42867. }
  42868. ret = elem.value;
  42869. // Handle most common string cases
  42870. if (typeof ret === "string") {
  42871. return ret.replace(rreturn, "");
  42872. }
  42873. // Handle cases where value is null/undef or number
  42874. return ret == null ? "" : ret;
  42875. }
  42876. return;
  42877. }
  42878. valueIsFunction = isFunction(value);
  42879. return this.each(function (i) {
  42880. var val;
  42881. if (this.nodeType !== 1) {
  42882. return;
  42883. }
  42884. if (valueIsFunction) {
  42885. val = value.call(this, i, jQuery(this).val());
  42886. } else {
  42887. val = value;
  42888. }
  42889. // Treat null/undefined as ""; convert numbers to string
  42890. if (val == null) {
  42891. val = "";
  42892. } else if (typeof val === "number") {
  42893. val += "";
  42894. } else if (Array.isArray(val)) {
  42895. val = jQuery.map(val, function (value) {
  42896. return value == null ? "" : value + "";
  42897. });
  42898. }
  42899. hooks = jQuery.valHooks[this.type] || jQuery.valHooks[this.nodeName.toLowerCase()];
  42900. // If set returns undefined, fall back to normal setting
  42901. if (!hooks || !("set" in hooks) || hooks.set(this, val, "value") === undefined) {
  42902. this.value = val;
  42903. }
  42904. });
  42905. }
  42906. });
  42907. jQuery.extend({
  42908. valHooks: {
  42909. option: {
  42910. get: function get(elem) {
  42911. var val = jQuery.find.attr(elem, "value");
  42912. return val != null ? val :
  42913. // Support: IE <=10 - 11 only
  42914. // option.text throws exceptions (#14686, #14858)
  42915. // Strip and collapse whitespace
  42916. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  42917. stripAndCollapse(jQuery.text(elem));
  42918. }
  42919. },
  42920. select: {
  42921. get: function get(elem) {
  42922. var value,
  42923. option,
  42924. i,
  42925. options = elem.options,
  42926. index = elem.selectedIndex,
  42927. one = elem.type === "select-one",
  42928. values = one ? null : [],
  42929. max = one ? index + 1 : options.length;
  42930. if (index < 0) {
  42931. i = max;
  42932. } else {
  42933. i = one ? index : 0;
  42934. }
  42935. // Loop through all the selected options
  42936. for (; i < max; i++) {
  42937. option = options[i];
  42938. // Support: IE <=9 only
  42939. // IE8-9 doesn't update selected after form reset (#2551)
  42940. if ((option.selected || i === index) &&
  42941. // Don't return options that are disabled or in a disabled optgroup
  42942. !option.disabled && (!option.parentNode.disabled || !nodeName(option.parentNode, "optgroup"))) {
  42943. // Get the specific value for the option
  42944. value = jQuery(option).val();
  42945. // We don't need an array for one selects
  42946. if (one) {
  42947. return value;
  42948. }
  42949. // Multi-Selects return an array
  42950. values.push(value);
  42951. }
  42952. }
  42953. return values;
  42954. },
  42955. set: function set(elem, value) {
  42956. var optionSet,
  42957. option,
  42958. options = elem.options,
  42959. values = jQuery.makeArray(value),
  42960. i = options.length;
  42961. while (i--) {
  42962. option = options[i];
  42963. /* eslint-disable no-cond-assign */
  42964. if (option.selected = jQuery.inArray(jQuery.valHooks.option.get(option), values) > -1) {
  42965. optionSet = true;
  42966. }
  42967. /* eslint-enable no-cond-assign */
  42968. }
  42969. // Force browsers to behave consistently when non-matching value is set
  42970. if (!optionSet) {
  42971. elem.selectedIndex = -1;
  42972. }
  42973. return values;
  42974. }
  42975. }
  42976. }
  42977. });
  42978. // Radios and checkboxes getter/setter
  42979. jQuery.each(["radio", "checkbox"], function () {
  42980. jQuery.valHooks[this] = {
  42981. set: function set(elem, value) {
  42982. if (Array.isArray(value)) {
  42983. return elem.checked = jQuery.inArray(jQuery(elem).val(), value) > -1;
  42984. }
  42985. }
  42986. };
  42987. if (!support.checkOn) {
  42988. jQuery.valHooks[this].get = function (elem) {
  42989. return elem.getAttribute("value") === null ? "on" : elem.value;
  42990. };
  42991. }
  42992. });
  42993. // Return jQuery for attributes-only inclusion
  42994. support.focusin = "onfocusin" in window;
  42995. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  42996. stopPropagationCallback = function stopPropagationCallback(e) {
  42997. e.stopPropagation();
  42998. };
  42999. jQuery.extend(jQuery.event, {
  43000. trigger: function trigger(event, data, elem, onlyHandlers) {
  43001. var i,
  43002. cur,
  43003. tmp,
  43004. bubbleType,
  43005. ontype,
  43006. handle,
  43007. special,
  43008. lastElement,
  43009. eventPath = [elem || document],
  43010. type = hasOwn.call(event, "type") ? event.type : event,
  43011. namespaces = hasOwn.call(event, "namespace") ? event.namespace.split(".") : [];
  43012. cur = lastElement = tmp = elem = elem || document;
  43013. // Don't do events on text and comment nodes
  43014. if (elem.nodeType === 3 || elem.nodeType === 8) {
  43015. return;
  43016. }
  43017. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  43018. if (rfocusMorph.test(type + jQuery.event.triggered)) {
  43019. return;
  43020. }
  43021. if (type.indexOf(".") > -1) {
  43022. // Namespaced trigger; create a regexp to match event type in handle()
  43023. namespaces = type.split(".");
  43024. type = namespaces.shift();
  43025. namespaces.sort();
  43026. }
  43027. ontype = type.indexOf(":") < 0 && "on" + type;
  43028. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  43029. event = event[jQuery.expando] ? event : new jQuery.Event(type, (typeof event === "undefined" ? "undefined" : _typeof(event)) === "object" && event);
  43030. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  43031. event.isTrigger = onlyHandlers ? 2 : 3;
  43032. event.namespace = namespaces.join(".");
  43033. event.rnamespace = event.namespace ? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : null;
  43034. // Clean up the event in case it is being reused
  43035. event.result = undefined;
  43036. if (!event.target) {
  43037. event.target = elem;
  43038. }
  43039. // Clone any incoming data and prepend the event, creating the handler arg list
  43040. data = data == null ? [event] : jQuery.makeArray(data, [event]);
  43041. // Allow special events to draw outside the lines
  43042. special = jQuery.event.special[type] || {};
  43043. if (!onlyHandlers && special.trigger && special.trigger.apply(elem, data) === false) {
  43044. return;
  43045. }
  43046. // Determine event propagation path in advance, per W3C events spec (#9951)
  43047. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  43048. if (!onlyHandlers && !special.noBubble && !isWindow(elem)) {
  43049. bubbleType = special.delegateType || type;
  43050. if (!rfocusMorph.test(bubbleType + type)) {
  43051. cur = cur.parentNode;
  43052. }
  43053. for (; cur; cur = cur.parentNode) {
  43054. eventPath.push(cur);
  43055. tmp = cur;
  43056. }
  43057. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  43058. if (tmp === (elem.ownerDocument || document)) {
  43059. eventPath.push(tmp.defaultView || tmp.parentWindow || window);
  43060. }
  43061. }
  43062. // Fire handlers on the event path
  43063. i = 0;
  43064. while ((cur = eventPath[i++]) && !event.isPropagationStopped()) {
  43065. lastElement = cur;
  43066. event.type = i > 1 ? bubbleType : special.bindType || type;
  43067. // jQuery handler
  43068. handle = (dataPriv.get(cur, "events") || {})[event.type] && dataPriv.get(cur, "handle");
  43069. if (handle) {
  43070. handle.apply(cur, data);
  43071. }
  43072. // Native handler
  43073. handle = ontype && cur[ontype];
  43074. if (handle && handle.apply && acceptData(cur)) {
  43075. event.result = handle.apply(cur, data);
  43076. if (event.result === false) {
  43077. event.preventDefault();
  43078. }
  43079. }
  43080. }
  43081. event.type = type;
  43082. // If nobody prevented the default action, do it now
  43083. if (!onlyHandlers && !event.isDefaultPrevented()) {
  43084. if ((!special._default || special._default.apply(eventPath.pop(), data) === false) && acceptData(elem)) {
  43085. // Call a native DOM method on the target with the same name as the event.
  43086. // Don't do default actions on window, that's where global variables be (#6170)
  43087. if (ontype && isFunction(elem[type]) && !isWindow(elem)) {
  43088. // Don't re-trigger an onFOO event when we call its FOO() method
  43089. tmp = elem[ontype];
  43090. if (tmp) {
  43091. elem[ontype] = null;
  43092. }
  43093. // Prevent re-triggering of the same event, since we already bubbled it above
  43094. jQuery.event.triggered = type;
  43095. if (event.isPropagationStopped()) {
  43096. lastElement.addEventListener(type, stopPropagationCallback);
  43097. }
  43098. elem[type]();
  43099. if (event.isPropagationStopped()) {
  43100. lastElement.removeEventListener(type, stopPropagationCallback);
  43101. }
  43102. jQuery.event.triggered = undefined;
  43103. if (tmp) {
  43104. elem[ontype] = tmp;
  43105. }
  43106. }
  43107. }
  43108. }
  43109. return event.result;
  43110. },
  43111. // Piggyback on a donor event to simulate a different one
  43112. // Used only for `focus(in | out)` events
  43113. simulate: function simulate(type, elem, event) {
  43114. var e = jQuery.extend(new jQuery.Event(), event, {
  43115. type: type,
  43116. isSimulated: true
  43117. });
  43118. jQuery.event.trigger(e, null, elem);
  43119. }
  43120. });
  43121. jQuery.fn.extend({
  43122. trigger: function trigger(type, data) {
  43123. return this.each(function () {
  43124. jQuery.event.trigger(type, data, this);
  43125. });
  43126. },
  43127. triggerHandler: function triggerHandler(type, data) {
  43128. var elem = this[0];
  43129. if (elem) {
  43130. return jQuery.event.trigger(type, data, elem, true);
  43131. }
  43132. }
  43133. });
  43134. // Support: Firefox <=44
  43135. // Firefox doesn't have focus(in | out) events
  43136. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  43137. //
  43138. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  43139. // focus(in | out) events fire after focus & blur events,
  43140. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  43141. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  43142. if (!support.focusin) {
  43143. jQuery.each({ focus: "focusin", blur: "focusout" }, function (orig, fix) {
  43144. // Attach a single capturing handler on the document while someone wants focusin/focusout
  43145. var handler = function handler(event) {
  43146. jQuery.event.simulate(fix, event.target, jQuery.event.fix(event));
  43147. };
  43148. jQuery.event.special[fix] = {
  43149. setup: function setup() {
  43150. var doc = this.ownerDocument || this,
  43151. attaches = dataPriv.access(doc, fix);
  43152. if (!attaches) {
  43153. doc.addEventListener(orig, handler, true);
  43154. }
  43155. dataPriv.access(doc, fix, (attaches || 0) + 1);
  43156. },
  43157. teardown: function teardown() {
  43158. var doc = this.ownerDocument || this,
  43159. attaches = dataPriv.access(doc, fix) - 1;
  43160. if (!attaches) {
  43161. doc.removeEventListener(orig, handler, true);
  43162. dataPriv.remove(doc, fix);
  43163. } else {
  43164. dataPriv.access(doc, fix, attaches);
  43165. }
  43166. }
  43167. };
  43168. });
  43169. }
  43170. var location = window.location;
  43171. var nonce = Date.now();
  43172. var rquery = /\?/;
  43173. // Cross-browser xml parsing
  43174. jQuery.parseXML = function (data) {
  43175. var xml;
  43176. if (!data || typeof data !== "string") {
  43177. return null;
  43178. }
  43179. // Support: IE 9 - 11 only
  43180. // IE throws on parseFromString with invalid input.
  43181. try {
  43182. xml = new window.DOMParser().parseFromString(data, "text/xml");
  43183. } catch (e) {
  43184. xml = undefined;
  43185. }
  43186. if (!xml || xml.getElementsByTagName("parsererror").length) {
  43187. jQuery.error("Invalid XML: " + data);
  43188. }
  43189. return xml;
  43190. };
  43191. var rbracket = /\[\]$/,
  43192. rCRLF = /\r?\n/g,
  43193. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  43194. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  43195. function buildParams(prefix, obj, traditional, add) {
  43196. var name;
  43197. if (Array.isArray(obj)) {
  43198. // Serialize array item.
  43199. jQuery.each(obj, function (i, v) {
  43200. if (traditional || rbracket.test(prefix)) {
  43201. // Treat each array item as a scalar.
  43202. add(prefix, v);
  43203. } else {
  43204. // Item is non-scalar (array or object), encode its numeric index.
  43205. buildParams(prefix + "[" + ((typeof v === "undefined" ? "undefined" : _typeof(v)) === "object" && v != null ? i : "") + "]", v, traditional, add);
  43206. }
  43207. });
  43208. } else if (!traditional && toType(obj) === "object") {
  43209. // Serialize object item.
  43210. for (name in obj) {
  43211. buildParams(prefix + "[" + name + "]", obj[name], traditional, add);
  43212. }
  43213. } else {
  43214. // Serialize scalar item.
  43215. add(prefix, obj);
  43216. }
  43217. }
  43218. // Serialize an array of form elements or a set of
  43219. // key/values into a query string
  43220. jQuery.param = function (a, traditional) {
  43221. var prefix,
  43222. s = [],
  43223. add = function add(key, valueOrFunction) {
  43224. // If value is a function, invoke it and use its return value
  43225. var value = isFunction(valueOrFunction) ? valueOrFunction() : valueOrFunction;
  43226. s[s.length] = encodeURIComponent(key) + "=" + encodeURIComponent(value == null ? "" : value);
  43227. };
  43228. // If an array was passed in, assume that it is an array of form elements.
  43229. if (Array.isArray(a) || a.jquery && !jQuery.isPlainObject(a)) {
  43230. // Serialize the form elements
  43231. jQuery.each(a, function () {
  43232. add(this.name, this.value);
  43233. });
  43234. } else {
  43235. // If traditional, encode the "old" way (the way 1.3.2 or older
  43236. // did it), otherwise encode params recursively.
  43237. for (prefix in a) {
  43238. buildParams(prefix, a[prefix], traditional, add);
  43239. }
  43240. }
  43241. // Return the resulting serialization
  43242. return s.join("&");
  43243. };
  43244. jQuery.fn.extend({
  43245. serialize: function serialize() {
  43246. return jQuery.param(this.serializeArray());
  43247. },
  43248. serializeArray: function serializeArray() {
  43249. return this.map(function () {
  43250. // Can add propHook for "elements" to filter or add form elements
  43251. var elements = jQuery.prop(this, "elements");
  43252. return elements ? jQuery.makeArray(elements) : this;
  43253. }).filter(function () {
  43254. var type = this.type;
  43255. // Use .is( ":disabled" ) so that fieldset[disabled] works
  43256. return this.name && !jQuery(this).is(":disabled") && rsubmittable.test(this.nodeName) && !rsubmitterTypes.test(type) && (this.checked || !rcheckableType.test(type));
  43257. }).map(function (i, elem) {
  43258. var val = jQuery(this).val();
  43259. if (val == null) {
  43260. return null;
  43261. }
  43262. if (Array.isArray(val)) {
  43263. return jQuery.map(val, function (val) {
  43264. return { name: elem.name, value: val.replace(rCRLF, "\r\n") };
  43265. });
  43266. }
  43267. return { name: elem.name, value: val.replace(rCRLF, "\r\n") };
  43268. }).get();
  43269. }
  43270. });
  43271. var r20 = /%20/g,
  43272. rhash = /#.*$/,
  43273. rantiCache = /([?&])_=[^&]*/,
  43274. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  43275. // #7653, #8125, #8152: local protocol detection
  43276. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  43277. rnoContent = /^(?:GET|HEAD)$/,
  43278. rprotocol = /^\/\//,
  43279. /* Prefilters
  43280. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  43281. * 2) These are called:
  43282. * - BEFORE asking for a transport
  43283. * - AFTER param serialization (s.data is a string if s.processData is true)
  43284. * 3) key is the dataType
  43285. * 4) the catchall symbol "*" can be used
  43286. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  43287. */
  43288. prefilters = {},
  43289. /* Transports bindings
  43290. * 1) key is the dataType
  43291. * 2) the catchall symbol "*" can be used
  43292. * 3) selection will start with transport dataType and THEN go to "*" if needed
  43293. */
  43294. transports = {},
  43295. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  43296. allTypes = "*/".concat("*"),
  43297. // Anchor tag for parsing the document origin
  43298. originAnchor = document.createElement("a");
  43299. originAnchor.href = location.href;
  43300. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  43301. function addToPrefiltersOrTransports(structure) {
  43302. // dataTypeExpression is optional and defaults to "*"
  43303. return function (dataTypeExpression, func) {
  43304. if (typeof dataTypeExpression !== "string") {
  43305. func = dataTypeExpression;
  43306. dataTypeExpression = "*";
  43307. }
  43308. var dataType,
  43309. i = 0,
  43310. dataTypes = dataTypeExpression.toLowerCase().match(rnothtmlwhite) || [];
  43311. if (isFunction(func)) {
  43312. // For each dataType in the dataTypeExpression
  43313. while (dataType = dataTypes[i++]) {
  43314. // Prepend if requested
  43315. if (dataType[0] === "+") {
  43316. dataType = dataType.slice(1) || "*";
  43317. (structure[dataType] = structure[dataType] || []).unshift(func);
  43318. // Otherwise append
  43319. } else {
  43320. (structure[dataType] = structure[dataType] || []).push(func);
  43321. }
  43322. }
  43323. }
  43324. };
  43325. }
  43326. // Base inspection function for prefilters and transports
  43327. function inspectPrefiltersOrTransports(structure, options, originalOptions, jqXHR) {
  43328. var inspected = {},
  43329. seekingTransport = structure === transports;
  43330. function inspect(dataType) {
  43331. var selected;
  43332. inspected[dataType] = true;
  43333. jQuery.each(structure[dataType] || [], function (_, prefilterOrFactory) {
  43334. var dataTypeOrTransport = prefilterOrFactory(options, originalOptions, jqXHR);
  43335. if (typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[dataTypeOrTransport]) {
  43336. options.dataTypes.unshift(dataTypeOrTransport);
  43337. inspect(dataTypeOrTransport);
  43338. return false;
  43339. } else if (seekingTransport) {
  43340. return !(selected = dataTypeOrTransport);
  43341. }
  43342. });
  43343. return selected;
  43344. }
  43345. return inspect(options.dataTypes[0]) || !inspected["*"] && inspect("*");
  43346. }
  43347. // A special extend for ajax options
  43348. // that takes "flat" options (not to be deep extended)
  43349. // Fixes #9887
  43350. function ajaxExtend(target, src) {
  43351. var key,
  43352. deep,
  43353. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  43354. for (key in src) {
  43355. if (src[key] !== undefined) {
  43356. (flatOptions[key] ? target : deep || (deep = {}))[key] = src[key];
  43357. }
  43358. }
  43359. if (deep) {
  43360. jQuery.extend(true, target, deep);
  43361. }
  43362. return target;
  43363. }
  43364. /* Handles responses to an ajax request:
  43365. * - finds the right dataType (mediates between content-type and expected dataType)
  43366. * - returns the corresponding response
  43367. */
  43368. function ajaxHandleResponses(s, jqXHR, responses) {
  43369. var ct,
  43370. type,
  43371. finalDataType,
  43372. firstDataType,
  43373. contents = s.contents,
  43374. dataTypes = s.dataTypes;
  43375. // Remove auto dataType and get content-type in the process
  43376. while (dataTypes[0] === "*") {
  43377. dataTypes.shift();
  43378. if (ct === undefined) {
  43379. ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
  43380. }
  43381. }
  43382. // Check if we're dealing with a known content-type
  43383. if (ct) {
  43384. for (type in contents) {
  43385. if (contents[type] && contents[type].test(ct)) {
  43386. dataTypes.unshift(type);
  43387. break;
  43388. }
  43389. }
  43390. }
  43391. // Check to see if we have a response for the expected dataType
  43392. if (dataTypes[0] in responses) {
  43393. finalDataType = dataTypes[0];
  43394. } else {
  43395. // Try convertible dataTypes
  43396. for (type in responses) {
  43397. if (!dataTypes[0] || s.converters[type + " " + dataTypes[0]]) {
  43398. finalDataType = type;
  43399. break;
  43400. }
  43401. if (!firstDataType) {
  43402. firstDataType = type;
  43403. }
  43404. }
  43405. // Or just use first one
  43406. finalDataType = finalDataType || firstDataType;
  43407. }
  43408. // If we found a dataType
  43409. // We add the dataType to the list if needed
  43410. // and return the corresponding response
  43411. if (finalDataType) {
  43412. if (finalDataType !== dataTypes[0]) {
  43413. dataTypes.unshift(finalDataType);
  43414. }
  43415. return responses[finalDataType];
  43416. }
  43417. }
  43418. /* Chain conversions given the request and the original response
  43419. * Also sets the responseXXX fields on the jqXHR instance
  43420. */
  43421. function ajaxConvert(s, response, jqXHR, isSuccess) {
  43422. var conv2,
  43423. current,
  43424. conv,
  43425. tmp,
  43426. prev,
  43427. converters = {},
  43428. // Work with a copy of dataTypes in case we need to modify it for conversion
  43429. dataTypes = s.dataTypes.slice();
  43430. // Create converters map with lowercased keys
  43431. if (dataTypes[1]) {
  43432. for (conv in s.converters) {
  43433. converters[conv.toLowerCase()] = s.converters[conv];
  43434. }
  43435. }
  43436. current = dataTypes.shift();
  43437. // Convert to each sequential dataType
  43438. while (current) {
  43439. if (s.responseFields[current]) {
  43440. jqXHR[s.responseFields[current]] = response;
  43441. }
  43442. // Apply the dataFilter if provided
  43443. if (!prev && isSuccess && s.dataFilter) {
  43444. response = s.dataFilter(response, s.dataType);
  43445. }
  43446. prev = current;
  43447. current = dataTypes.shift();
  43448. if (current) {
  43449. // There's only work to do if current dataType is non-auto
  43450. if (current === "*") {
  43451. current = prev;
  43452. // Convert response if prev dataType is non-auto and differs from current
  43453. } else if (prev !== "*" && prev !== current) {
  43454. // Seek a direct converter
  43455. conv = converters[prev + " " + current] || converters["* " + current];
  43456. // If none found, seek a pair
  43457. if (!conv) {
  43458. for (conv2 in converters) {
  43459. // If conv2 outputs current
  43460. tmp = conv2.split(" ");
  43461. if (tmp[1] === current) {
  43462. // If prev can be converted to accepted input
  43463. conv = converters[prev + " " + tmp[0]] || converters["* " + tmp[0]];
  43464. if (conv) {
  43465. // Condense equivalence converters
  43466. if (conv === true) {
  43467. conv = converters[conv2];
  43468. // Otherwise, insert the intermediate dataType
  43469. } else if (converters[conv2] !== true) {
  43470. current = tmp[0];
  43471. dataTypes.unshift(tmp[1]);
  43472. }
  43473. break;
  43474. }
  43475. }
  43476. }
  43477. }
  43478. // Apply converter (if not an equivalence)
  43479. if (conv !== true) {
  43480. // Unless errors are allowed to bubble, catch and return them
  43481. if (conv && s.throws) {
  43482. response = conv(response);
  43483. } else {
  43484. try {
  43485. response = conv(response);
  43486. } catch (e) {
  43487. return {
  43488. state: "parsererror",
  43489. error: conv ? e : "No conversion from " + prev + " to " + current
  43490. };
  43491. }
  43492. }
  43493. }
  43494. }
  43495. }
  43496. }
  43497. return { state: "success", data: response };
  43498. }
  43499. jQuery.extend({
  43500. // Counter for holding the number of active queries
  43501. active: 0,
  43502. // Last-Modified header cache for next request
  43503. lastModified: {},
  43504. etag: {},
  43505. ajaxSettings: {
  43506. url: location.href,
  43507. type: "GET",
  43508. isLocal: rlocalProtocol.test(location.protocol),
  43509. global: true,
  43510. processData: true,
  43511. async: true,
  43512. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  43513. /*
  43514. timeout: 0,
  43515. data: null,
  43516. dataType: null,
  43517. username: null,
  43518. password: null,
  43519. cache: null,
  43520. throws: false,
  43521. traditional: false,
  43522. headers: {},
  43523. */
  43524. accepts: {
  43525. "*": allTypes,
  43526. text: "text/plain",
  43527. html: "text/html",
  43528. xml: "application/xml, text/xml",
  43529. json: "application/json, text/javascript"
  43530. },
  43531. contents: {
  43532. xml: /\bxml\b/,
  43533. html: /\bhtml/,
  43534. json: /\bjson\b/
  43535. },
  43536. responseFields: {
  43537. xml: "responseXML",
  43538. text: "responseText",
  43539. json: "responseJSON"
  43540. },
  43541. // Data converters
  43542. // Keys separate source (or catchall "*") and destination types with a single space
  43543. converters: {
  43544. // Convert anything to text
  43545. "* text": String,
  43546. // Text to html (true = no transformation)
  43547. "text html": true,
  43548. // Evaluate text as a json expression
  43549. "text json": JSON.parse,
  43550. // Parse text as xml
  43551. "text xml": jQuery.parseXML
  43552. },
  43553. // For options that shouldn't be deep extended:
  43554. // you can add your own custom options here if
  43555. // and when you create one that shouldn't be
  43556. // deep extended (see ajaxExtend)
  43557. flatOptions: {
  43558. url: true,
  43559. context: true
  43560. }
  43561. },
  43562. // Creates a full fledged settings object into target
  43563. // with both ajaxSettings and settings fields.
  43564. // If target is omitted, writes into ajaxSettings.
  43565. ajaxSetup: function ajaxSetup(target, settings) {
  43566. return settings ?
  43567. // Building a settings object
  43568. ajaxExtend(ajaxExtend(target, jQuery.ajaxSettings), settings) :
  43569. // Extending ajaxSettings
  43570. ajaxExtend(jQuery.ajaxSettings, target);
  43571. },
  43572. ajaxPrefilter: addToPrefiltersOrTransports(prefilters),
  43573. ajaxTransport: addToPrefiltersOrTransports(transports),
  43574. // Main method
  43575. ajax: function ajax(url, options) {
  43576. // If url is an object, simulate pre-1.5 signature
  43577. if ((typeof url === "undefined" ? "undefined" : _typeof(url)) === "object") {
  43578. options = url;
  43579. url = undefined;
  43580. }
  43581. // Force options to be an object
  43582. options = options || {};
  43583. var transport,
  43584. // URL without anti-cache param
  43585. cacheURL,
  43586. // Response headers
  43587. responseHeadersString,
  43588. responseHeaders,
  43589. // timeout handle
  43590. timeoutTimer,
  43591. // Url cleanup var
  43592. urlAnchor,
  43593. // Request state (becomes false upon send and true upon completion)
  43594. completed,
  43595. // To know if global events are to be dispatched
  43596. fireGlobals,
  43597. // Loop variable
  43598. i,
  43599. // uncached part of the url
  43600. uncached,
  43601. // Create the final options object
  43602. s = jQuery.ajaxSetup({}, options),
  43603. // Callbacks context
  43604. callbackContext = s.context || s,
  43605. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  43606. globalEventContext = s.context && (callbackContext.nodeType || callbackContext.jquery) ? jQuery(callbackContext) : jQuery.event,
  43607. // Deferreds
  43608. deferred = jQuery.Deferred(),
  43609. completeDeferred = jQuery.Callbacks("once memory"),
  43610. // Status-dependent callbacks
  43611. _statusCode = s.statusCode || {},
  43612. // Headers (they are sent all at once)
  43613. requestHeaders = {},
  43614. requestHeadersNames = {},
  43615. // Default abort message
  43616. strAbort = "canceled",
  43617. // Fake xhr
  43618. jqXHR = {
  43619. readyState: 0,
  43620. // Builds headers hashtable if needed
  43621. getResponseHeader: function getResponseHeader(key) {
  43622. var match;
  43623. if (completed) {
  43624. if (!responseHeaders) {
  43625. responseHeaders = {};
  43626. while (match = rheaders.exec(responseHeadersString)) {
  43627. responseHeaders[match[1].toLowerCase()] = match[2];
  43628. }
  43629. }
  43630. match = responseHeaders[key.toLowerCase()];
  43631. }
  43632. return match == null ? null : match;
  43633. },
  43634. // Raw string
  43635. getAllResponseHeaders: function getAllResponseHeaders() {
  43636. return completed ? responseHeadersString : null;
  43637. },
  43638. // Caches the header
  43639. setRequestHeader: function setRequestHeader(name, value) {
  43640. if (completed == null) {
  43641. name = requestHeadersNames[name.toLowerCase()] = requestHeadersNames[name.toLowerCase()] || name;
  43642. requestHeaders[name] = value;
  43643. }
  43644. return this;
  43645. },
  43646. // Overrides response content-type header
  43647. overrideMimeType: function overrideMimeType(type) {
  43648. if (completed == null) {
  43649. s.mimeType = type;
  43650. }
  43651. return this;
  43652. },
  43653. // Status-dependent callbacks
  43654. statusCode: function statusCode(map) {
  43655. var code;
  43656. if (map) {
  43657. if (completed) {
  43658. // Execute the appropriate callbacks
  43659. jqXHR.always(map[jqXHR.status]);
  43660. } else {
  43661. // Lazy-add the new callbacks in a way that preserves old ones
  43662. for (code in map) {
  43663. _statusCode[code] = [_statusCode[code], map[code]];
  43664. }
  43665. }
  43666. }
  43667. return this;
  43668. },
  43669. // Cancel the request
  43670. abort: function abort(statusText) {
  43671. var finalText = statusText || strAbort;
  43672. if (transport) {
  43673. transport.abort(finalText);
  43674. }
  43675. done(0, finalText);
  43676. return this;
  43677. }
  43678. };
  43679. // Attach deferreds
  43680. deferred.promise(jqXHR);
  43681. // Add protocol if not provided (prefilters might expect it)
  43682. // Handle falsy url in the settings object (#10093: consistency with old signature)
  43683. // We also use the url parameter if available
  43684. s.url = ((url || s.url || location.href) + "").replace(rprotocol, location.protocol + "//");
  43685. // Alias method option to type as per ticket #12004
  43686. s.type = options.method || options.type || s.method || s.type;
  43687. // Extract dataTypes list
  43688. s.dataTypes = (s.dataType || "*").toLowerCase().match(rnothtmlwhite) || [""];
  43689. // A cross-domain request is in order when the origin doesn't match the current origin.
  43690. if (s.crossDomain == null) {
  43691. urlAnchor = document.createElement("a");
  43692. // Support: IE <=8 - 11, Edge 12 - 15
  43693. // IE throws exception on accessing the href property if url is malformed,
  43694. // e.g. http://example.com:80x/
  43695. try {
  43696. urlAnchor.href = s.url;
  43697. // Support: IE <=8 - 11 only
  43698. // Anchor's host property isn't correctly set when s.url is relative
  43699. urlAnchor.href = urlAnchor.href;
  43700. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== urlAnchor.protocol + "//" + urlAnchor.host;
  43701. } catch (e) {
  43702. // If there is an error parsing the URL, assume it is crossDomain,
  43703. // it can be rejected by the transport if it is invalid
  43704. s.crossDomain = true;
  43705. }
  43706. }
  43707. // Convert data if not already a string
  43708. if (s.data && s.processData && typeof s.data !== "string") {
  43709. s.data = jQuery.param(s.data, s.traditional);
  43710. }
  43711. // Apply prefilters
  43712. inspectPrefiltersOrTransports(prefilters, s, options, jqXHR);
  43713. // If request was aborted inside a prefilter, stop there
  43714. if (completed) {
  43715. return jqXHR;
  43716. }
  43717. // We can fire global events as of now if asked to
  43718. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  43719. fireGlobals = jQuery.event && s.global;
  43720. // Watch for a new set of requests
  43721. if (fireGlobals && jQuery.active++ === 0) {
  43722. jQuery.event.trigger("ajaxStart");
  43723. }
  43724. // Uppercase the type
  43725. s.type = s.type.toUpperCase();
  43726. // Determine if request has content
  43727. s.hasContent = !rnoContent.test(s.type);
  43728. // Save the URL in case we're toying with the If-Modified-Since
  43729. // and/or If-None-Match header later on
  43730. // Remove hash to simplify url manipulation
  43731. cacheURL = s.url.replace(rhash, "");
  43732. // More options handling for requests with no content
  43733. if (!s.hasContent) {
  43734. // Remember the hash so we can put it back
  43735. uncached = s.url.slice(cacheURL.length);
  43736. // If data is available and should be processed, append data to url
  43737. if (s.data && (s.processData || typeof s.data === "string")) {
  43738. cacheURL += (rquery.test(cacheURL) ? "&" : "?") + s.data;
  43739. // #9682: remove data so that it's not used in an eventual retry
  43740. delete s.data;
  43741. }
  43742. // Add or update anti-cache param if needed
  43743. if (s.cache === false) {
  43744. cacheURL = cacheURL.replace(rantiCache, "$1");
  43745. uncached = (rquery.test(cacheURL) ? "&" : "?") + "_=" + nonce++ + uncached;
  43746. }
  43747. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  43748. s.url = cacheURL + uncached;
  43749. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  43750. } else if (s.data && s.processData && (s.contentType || "").indexOf("application/x-www-form-urlencoded") === 0) {
  43751. s.data = s.data.replace(r20, "+");
  43752. }
  43753. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  43754. if (s.ifModified) {
  43755. if (jQuery.lastModified[cacheURL]) {
  43756. jqXHR.setRequestHeader("If-Modified-Since", jQuery.lastModified[cacheURL]);
  43757. }
  43758. if (jQuery.etag[cacheURL]) {
  43759. jqXHR.setRequestHeader("If-None-Match", jQuery.etag[cacheURL]);
  43760. }
  43761. }
  43762. // Set the correct header, if data is being sent
  43763. if (s.data && s.hasContent && s.contentType !== false || options.contentType) {
  43764. jqXHR.setRequestHeader("Content-Type", s.contentType);
  43765. }
  43766. // Set the Accepts header for the server, depending on the dataType
  43767. jqXHR.setRequestHeader("Accept", s.dataTypes[0] && s.accepts[s.dataTypes[0]] ? s.accepts[s.dataTypes[0]] + (s.dataTypes[0] !== "*" ? ", " + allTypes + "; q=0.01" : "") : s.accepts["*"]);
  43768. // Check for headers option
  43769. for (i in s.headers) {
  43770. jqXHR.setRequestHeader(i, s.headers[i]);
  43771. }
  43772. // Allow custom headers/mimetypes and early abort
  43773. if (s.beforeSend && (s.beforeSend.call(callbackContext, jqXHR, s) === false || completed)) {
  43774. // Abort if not done already and return
  43775. return jqXHR.abort();
  43776. }
  43777. // Aborting is no longer a cancellation
  43778. strAbort = "abort";
  43779. // Install callbacks on deferreds
  43780. completeDeferred.add(s.complete);
  43781. jqXHR.done(s.success);
  43782. jqXHR.fail(s.error);
  43783. // Get transport
  43784. transport = inspectPrefiltersOrTransports(transports, s, options, jqXHR);
  43785. // If no transport, we auto-abort
  43786. if (!transport) {
  43787. done(-1, "No Transport");
  43788. } else {
  43789. jqXHR.readyState = 1;
  43790. // Send global event
  43791. if (fireGlobals) {
  43792. globalEventContext.trigger("ajaxSend", [jqXHR, s]);
  43793. }
  43794. // If request was aborted inside ajaxSend, stop there
  43795. if (completed) {
  43796. return jqXHR;
  43797. }
  43798. // Timeout
  43799. if (s.async && s.timeout > 0) {
  43800. timeoutTimer = window.setTimeout(function () {
  43801. jqXHR.abort("timeout");
  43802. }, s.timeout);
  43803. }
  43804. try {
  43805. completed = false;
  43806. transport.send(requestHeaders, done);
  43807. } catch (e) {
  43808. // Rethrow post-completion exceptions
  43809. if (completed) {
  43810. throw e;
  43811. }
  43812. // Propagate others as results
  43813. done(-1, e);
  43814. }
  43815. }
  43816. // Callback for when everything is done
  43817. function done(status, nativeStatusText, responses, headers) {
  43818. var isSuccess,
  43819. success,
  43820. error,
  43821. response,
  43822. modified,
  43823. statusText = nativeStatusText;
  43824. // Ignore repeat invocations
  43825. if (completed) {
  43826. return;
  43827. }
  43828. completed = true;
  43829. // Clear timeout if it exists
  43830. if (timeoutTimer) {
  43831. window.clearTimeout(timeoutTimer);
  43832. }
  43833. // Dereference transport for early garbage collection
  43834. // (no matter how long the jqXHR object will be used)
  43835. transport = undefined;
  43836. // Cache response headers
  43837. responseHeadersString = headers || "";
  43838. // Set readyState
  43839. jqXHR.readyState = status > 0 ? 4 : 0;
  43840. // Determine if successful
  43841. isSuccess = status >= 200 && status < 300 || status === 304;
  43842. // Get response data
  43843. if (responses) {
  43844. response = ajaxHandleResponses(s, jqXHR, responses);
  43845. }
  43846. // Convert no matter what (that way responseXXX fields are always set)
  43847. response = ajaxConvert(s, response, jqXHR, isSuccess);
  43848. // If successful, handle type chaining
  43849. if (isSuccess) {
  43850. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  43851. if (s.ifModified) {
  43852. modified = jqXHR.getResponseHeader("Last-Modified");
  43853. if (modified) {
  43854. jQuery.lastModified[cacheURL] = modified;
  43855. }
  43856. modified = jqXHR.getResponseHeader("etag");
  43857. if (modified) {
  43858. jQuery.etag[cacheURL] = modified;
  43859. }
  43860. }
  43861. // if no content
  43862. if (status === 204 || s.type === "HEAD") {
  43863. statusText = "nocontent";
  43864. // if not modified
  43865. } else if (status === 304) {
  43866. statusText = "notmodified";
  43867. // If we have data, let's convert it
  43868. } else {
  43869. statusText = response.state;
  43870. success = response.data;
  43871. error = response.error;
  43872. isSuccess = !error;
  43873. }
  43874. } else {
  43875. // Extract error from statusText and normalize for non-aborts
  43876. error = statusText;
  43877. if (status || !statusText) {
  43878. statusText = "error";
  43879. if (status < 0) {
  43880. status = 0;
  43881. }
  43882. }
  43883. }
  43884. // Set data for the fake xhr object
  43885. jqXHR.status = status;
  43886. jqXHR.statusText = (nativeStatusText || statusText) + "";
  43887. // Success/Error
  43888. if (isSuccess) {
  43889. deferred.resolveWith(callbackContext, [success, statusText, jqXHR]);
  43890. } else {
  43891. deferred.rejectWith(callbackContext, [jqXHR, statusText, error]);
  43892. }
  43893. // Status-dependent callbacks
  43894. jqXHR.statusCode(_statusCode);
  43895. _statusCode = undefined;
  43896. if (fireGlobals) {
  43897. globalEventContext.trigger(isSuccess ? "ajaxSuccess" : "ajaxError", [jqXHR, s, isSuccess ? success : error]);
  43898. }
  43899. // Complete
  43900. completeDeferred.fireWith(callbackContext, [jqXHR, statusText]);
  43901. if (fireGlobals) {
  43902. globalEventContext.trigger("ajaxComplete", [jqXHR, s]);
  43903. // Handle the global AJAX counter
  43904. if (! --jQuery.active) {
  43905. jQuery.event.trigger("ajaxStop");
  43906. }
  43907. }
  43908. }
  43909. return jqXHR;
  43910. },
  43911. getJSON: function getJSON(url, data, callback) {
  43912. return jQuery.get(url, data, callback, "json");
  43913. },
  43914. getScript: function getScript(url, callback) {
  43915. return jQuery.get(url, undefined, callback, "script");
  43916. }
  43917. });
  43918. jQuery.each(["get", "post"], function (i, method) {
  43919. jQuery[method] = function (url, data, callback, type) {
  43920. // Shift arguments if data argument was omitted
  43921. if (isFunction(data)) {
  43922. type = type || callback;
  43923. callback = data;
  43924. data = undefined;
  43925. }
  43926. // The url can be an options object (which then must have .url)
  43927. return jQuery.ajax(jQuery.extend({
  43928. url: url,
  43929. type: method,
  43930. dataType: type,
  43931. data: data,
  43932. success: callback
  43933. }, jQuery.isPlainObject(url) && url));
  43934. };
  43935. });
  43936. jQuery._evalUrl = function (url) {
  43937. return jQuery.ajax({
  43938. url: url,
  43939. // Make this explicit, since user can override this through ajaxSetup (#11264)
  43940. type: "GET",
  43941. dataType: "script",
  43942. cache: true,
  43943. async: false,
  43944. global: false,
  43945. "throws": true
  43946. });
  43947. };
  43948. jQuery.fn.extend({
  43949. wrapAll: function wrapAll(html) {
  43950. var wrap;
  43951. if (this[0]) {
  43952. if (isFunction(html)) {
  43953. html = html.call(this[0]);
  43954. }
  43955. // The elements to wrap the target around
  43956. wrap = jQuery(html, this[0].ownerDocument).eq(0).clone(true);
  43957. if (this[0].parentNode) {
  43958. wrap.insertBefore(this[0]);
  43959. }
  43960. wrap.map(function () {
  43961. var elem = this;
  43962. while (elem.firstElementChild) {
  43963. elem = elem.firstElementChild;
  43964. }
  43965. return elem;
  43966. }).append(this);
  43967. }
  43968. return this;
  43969. },
  43970. wrapInner: function wrapInner(html) {
  43971. if (isFunction(html)) {
  43972. return this.each(function (i) {
  43973. jQuery(this).wrapInner(html.call(this, i));
  43974. });
  43975. }
  43976. return this.each(function () {
  43977. var self = jQuery(this),
  43978. contents = self.contents();
  43979. if (contents.length) {
  43980. contents.wrapAll(html);
  43981. } else {
  43982. self.append(html);
  43983. }
  43984. });
  43985. },
  43986. wrap: function wrap(html) {
  43987. var htmlIsFunction = isFunction(html);
  43988. return this.each(function (i) {
  43989. jQuery(this).wrapAll(htmlIsFunction ? html.call(this, i) : html);
  43990. });
  43991. },
  43992. unwrap: function unwrap(selector) {
  43993. this.parent(selector).not("body").each(function () {
  43994. jQuery(this).replaceWith(this.childNodes);
  43995. });
  43996. return this;
  43997. }
  43998. });
  43999. jQuery.expr.pseudos.hidden = function (elem) {
  44000. return !jQuery.expr.pseudos.visible(elem);
  44001. };
  44002. jQuery.expr.pseudos.visible = function (elem) {
  44003. return !!(elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length);
  44004. };
  44005. jQuery.ajaxSettings.xhr = function () {
  44006. try {
  44007. return new window.XMLHttpRequest();
  44008. } catch (e) {}
  44009. };
  44010. var xhrSuccessStatus = {
  44011. // File protocol always yields status code 0, assume 200
  44012. 0: 200,
  44013. // Support: IE <=9 only
  44014. // #1450: sometimes IE returns 1223 when it should be 204
  44015. 1223: 204
  44016. },
  44017. xhrSupported = jQuery.ajaxSettings.xhr();
  44018. support.cors = !!xhrSupported && "withCredentials" in xhrSupported;
  44019. support.ajax = xhrSupported = !!xhrSupported;
  44020. jQuery.ajaxTransport(function (options) {
  44021. var _callback, errorCallback;
  44022. // Cross domain only allowed if supported through XMLHttpRequest
  44023. if (support.cors || xhrSupported && !options.crossDomain) {
  44024. return {
  44025. send: function send(headers, complete) {
  44026. var i,
  44027. xhr = options.xhr();
  44028. xhr.open(options.type, options.url, options.async, options.username, options.password);
  44029. // Apply custom fields if provided
  44030. if (options.xhrFields) {
  44031. for (i in options.xhrFields) {
  44032. xhr[i] = options.xhrFields[i];
  44033. }
  44034. }
  44035. // Override mime type if needed
  44036. if (options.mimeType && xhr.overrideMimeType) {
  44037. xhr.overrideMimeType(options.mimeType);
  44038. }
  44039. // X-Requested-With header
  44040. // For cross-domain requests, seeing as conditions for a preflight are
  44041. // akin to a jigsaw puzzle, we simply never set it to be sure.
  44042. // (it can always be set on a per-request basis or even using ajaxSetup)
  44043. // For same-domain requests, won't change header if already provided.
  44044. if (!options.crossDomain && !headers["X-Requested-With"]) {
  44045. headers["X-Requested-With"] = "XMLHttpRequest";
  44046. }
  44047. // Set headers
  44048. for (i in headers) {
  44049. xhr.setRequestHeader(i, headers[i]);
  44050. }
  44051. // Callback
  44052. _callback = function callback(type) {
  44053. return function () {
  44054. if (_callback) {
  44055. _callback = errorCallback = xhr.onload = xhr.onerror = xhr.onabort = xhr.ontimeout = xhr.onreadystatechange = null;
  44056. if (type === "abort") {
  44057. xhr.abort();
  44058. } else if (type === "error") {
  44059. // Support: IE <=9 only
  44060. // On a manual native abort, IE9 throws
  44061. // errors on any property access that is not readyState
  44062. if (typeof xhr.status !== "number") {
  44063. complete(0, "error");
  44064. } else {
  44065. complete(
  44066. // File: protocol always yields status 0; see #8605, #14207
  44067. xhr.status, xhr.statusText);
  44068. }
  44069. } else {
  44070. complete(xhrSuccessStatus[xhr.status] || xhr.status, xhr.statusText,
  44071. // Support: IE <=9 only
  44072. // IE9 has no XHR2 but throws on binary (trac-11426)
  44073. // For XHR2 non-text, let the caller handle it (gh-2498)
  44074. (xhr.responseType || "text") !== "text" || typeof xhr.responseText !== "string" ? { binary: xhr.response } : { text: xhr.responseText }, xhr.getAllResponseHeaders());
  44075. }
  44076. }
  44077. };
  44078. };
  44079. // Listen to events
  44080. xhr.onload = _callback();
  44081. errorCallback = xhr.onerror = xhr.ontimeout = _callback("error");
  44082. // Support: IE 9 only
  44083. // Use onreadystatechange to replace onabort
  44084. // to handle uncaught aborts
  44085. if (xhr.onabort !== undefined) {
  44086. xhr.onabort = errorCallback;
  44087. } else {
  44088. xhr.onreadystatechange = function () {
  44089. // Check readyState before timeout as it changes
  44090. if (xhr.readyState === 4) {
  44091. // Allow onerror to be called first,
  44092. // but that will not handle a native abort
  44093. // Also, save errorCallback to a variable
  44094. // as xhr.onerror cannot be accessed
  44095. window.setTimeout(function () {
  44096. if (_callback) {
  44097. errorCallback();
  44098. }
  44099. });
  44100. }
  44101. };
  44102. }
  44103. // Create the abort callback
  44104. _callback = _callback("abort");
  44105. try {
  44106. // Do send the request (this may raise an exception)
  44107. xhr.send(options.hasContent && options.data || null);
  44108. } catch (e) {
  44109. // #14683: Only rethrow if this hasn't been notified as an error yet
  44110. if (_callback) {
  44111. throw e;
  44112. }
  44113. }
  44114. },
  44115. abort: function abort() {
  44116. if (_callback) {
  44117. _callback();
  44118. }
  44119. }
  44120. };
  44121. }
  44122. });
  44123. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  44124. jQuery.ajaxPrefilter(function (s) {
  44125. if (s.crossDomain) {
  44126. s.contents.script = false;
  44127. }
  44128. });
  44129. // Install script dataType
  44130. jQuery.ajaxSetup({
  44131. accepts: {
  44132. script: "text/javascript, application/javascript, " + "application/ecmascript, application/x-ecmascript"
  44133. },
  44134. contents: {
  44135. script: /\b(?:java|ecma)script\b/
  44136. },
  44137. converters: {
  44138. "text script": function textScript(text) {
  44139. jQuery.globalEval(text);
  44140. return text;
  44141. }
  44142. }
  44143. });
  44144. // Handle cache's special case and crossDomain
  44145. jQuery.ajaxPrefilter("script", function (s) {
  44146. if (s.cache === undefined) {
  44147. s.cache = false;
  44148. }
  44149. if (s.crossDomain) {
  44150. s.type = "GET";
  44151. }
  44152. });
  44153. // Bind script tag hack transport
  44154. jQuery.ajaxTransport("script", function (s) {
  44155. // This transport only deals with cross domain requests
  44156. if (s.crossDomain) {
  44157. var script, _callback2;
  44158. return {
  44159. send: function send(_, complete) {
  44160. script = jQuery("<script>").prop({
  44161. charset: s.scriptCharset,
  44162. src: s.url
  44163. }).on("load error", _callback2 = function callback(evt) {
  44164. script.remove();
  44165. _callback2 = null;
  44166. if (evt) {
  44167. complete(evt.type === "error" ? 404 : 200, evt.type);
  44168. }
  44169. });
  44170. // Use native DOM manipulation to avoid our domManip AJAX trickery
  44171. document.head.appendChild(script[0]);
  44172. },
  44173. abort: function abort() {
  44174. if (_callback2) {
  44175. _callback2();
  44176. }
  44177. }
  44178. };
  44179. }
  44180. });
  44181. var oldCallbacks = [],
  44182. rjsonp = /(=)\?(?=&|$)|\?\?/;
  44183. // Default jsonp settings
  44184. jQuery.ajaxSetup({
  44185. jsonp: "callback",
  44186. jsonpCallback: function jsonpCallback() {
  44187. var callback = oldCallbacks.pop() || jQuery.expando + "_" + nonce++;
  44188. this[callback] = true;
  44189. return callback;
  44190. }
  44191. });
  44192. // Detect, normalize options and install callbacks for jsonp requests
  44193. jQuery.ajaxPrefilter("json jsonp", function (s, originalSettings, jqXHR) {
  44194. var callbackName,
  44195. overwritten,
  44196. responseContainer,
  44197. jsonProp = s.jsonp !== false && (rjsonp.test(s.url) ? "url" : typeof s.data === "string" && (s.contentType || "").indexOf("application/x-www-form-urlencoded") === 0 && rjsonp.test(s.data) && "data");
  44198. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  44199. if (jsonProp || s.dataTypes[0] === "jsonp") {
  44200. // Get callback name, remembering preexisting value associated with it
  44201. callbackName = s.jsonpCallback = isFunction(s.jsonpCallback) ? s.jsonpCallback() : s.jsonpCallback;
  44202. // Insert callback into url or form data
  44203. if (jsonProp) {
  44204. s[jsonProp] = s[jsonProp].replace(rjsonp, "$1" + callbackName);
  44205. } else if (s.jsonp !== false) {
  44206. s.url += (rquery.test(s.url) ? "&" : "?") + s.jsonp + "=" + callbackName;
  44207. }
  44208. // Use data converter to retrieve json after script execution
  44209. s.converters["script json"] = function () {
  44210. if (!responseContainer) {
  44211. jQuery.error(callbackName + " was not called");
  44212. }
  44213. return responseContainer[0];
  44214. };
  44215. // Force json dataType
  44216. s.dataTypes[0] = "json";
  44217. // Install callback
  44218. overwritten = window[callbackName];
  44219. window[callbackName] = function () {
  44220. responseContainer = arguments;
  44221. };
  44222. // Clean-up function (fires after converters)
  44223. jqXHR.always(function () {
  44224. // If previous value didn't exist - remove it
  44225. if (overwritten === undefined) {
  44226. jQuery(window).removeProp(callbackName);
  44227. // Otherwise restore preexisting value
  44228. } else {
  44229. window[callbackName] = overwritten;
  44230. }
  44231. // Save back as free
  44232. if (s[callbackName]) {
  44233. // Make sure that re-using the options doesn't screw things around
  44234. s.jsonpCallback = originalSettings.jsonpCallback;
  44235. // Save the callback name for future use
  44236. oldCallbacks.push(callbackName);
  44237. }
  44238. // Call if it was a function and we have a response
  44239. if (responseContainer && isFunction(overwritten)) {
  44240. overwritten(responseContainer[0]);
  44241. }
  44242. responseContainer = overwritten = undefined;
  44243. });
  44244. // Delegate to script
  44245. return "script";
  44246. }
  44247. });
  44248. // Support: Safari 8 only
  44249. // In Safari 8 documents created via document.implementation.createHTMLDocument
  44250. // collapse sibling forms: the second one becomes a child of the first one.
  44251. // Because of that, this security measure has to be disabled in Safari 8.
  44252. // https://bugs.webkit.org/show_bug.cgi?id=137337
  44253. support.createHTMLDocument = function () {
  44254. var body = document.implementation.createHTMLDocument("").body;
  44255. body.innerHTML = "<form></form><form></form>";
  44256. return body.childNodes.length === 2;
  44257. }();
  44258. // Argument "data" should be string of html
  44259. // context (optional): If specified, the fragment will be created in this context,
  44260. // defaults to document
  44261. // keepScripts (optional): If true, will include scripts passed in the html string
  44262. jQuery.parseHTML = function (data, context, keepScripts) {
  44263. if (typeof data !== "string") {
  44264. return [];
  44265. }
  44266. if (typeof context === "boolean") {
  44267. keepScripts = context;
  44268. context = false;
  44269. }
  44270. var base, parsed, scripts;
  44271. if (!context) {
  44272. // Stop scripts or inline event handlers from being executed immediately
  44273. // by using document.implementation
  44274. if (support.createHTMLDocument) {
  44275. context = document.implementation.createHTMLDocument("");
  44276. // Set the base href for the created document
  44277. // so any parsed elements with URLs
  44278. // are based on the document's URL (gh-2965)
  44279. base = context.createElement("base");
  44280. base.href = document.location.href;
  44281. context.head.appendChild(base);
  44282. } else {
  44283. context = document;
  44284. }
  44285. }
  44286. parsed = rsingleTag.exec(data);
  44287. scripts = !keepScripts && [];
  44288. // Single tag
  44289. if (parsed) {
  44290. return [context.createElement(parsed[1])];
  44291. }
  44292. parsed = buildFragment([data], context, scripts);
  44293. if (scripts && scripts.length) {
  44294. jQuery(scripts).remove();
  44295. }
  44296. return jQuery.merge([], parsed.childNodes);
  44297. };
  44298. /**
  44299. * Load a url into a page
  44300. */
  44301. jQuery.fn.load = function (url, params, callback) {
  44302. var selector,
  44303. type,
  44304. response,
  44305. self = this,
  44306. off = url.indexOf(" ");
  44307. if (off > -1) {
  44308. selector = stripAndCollapse(url.slice(off));
  44309. url = url.slice(0, off);
  44310. }
  44311. // If it's a function
  44312. if (isFunction(params)) {
  44313. // We assume that it's the callback
  44314. callback = params;
  44315. params = undefined;
  44316. // Otherwise, build a param string
  44317. } else if (params && (typeof params === "undefined" ? "undefined" : _typeof(params)) === "object") {
  44318. type = "POST";
  44319. }
  44320. // If we have elements to modify, make the request
  44321. if (self.length > 0) {
  44322. jQuery.ajax({
  44323. url: url,
  44324. // If "type" variable is undefined, then "GET" method will be used.
  44325. // Make value of this field explicit since
  44326. // user can override it through ajaxSetup method
  44327. type: type || "GET",
  44328. dataType: "html",
  44329. data: params
  44330. }).done(function (responseText) {
  44331. // Save response for use in complete callback
  44332. response = arguments;
  44333. self.html(selector ?
  44334. // If a selector was specified, locate the right elements in a dummy div
  44335. // Exclude scripts to avoid IE 'Permission Denied' errors
  44336. jQuery("<div>").append(jQuery.parseHTML(responseText)).find(selector) :
  44337. // Otherwise use the full result
  44338. responseText);
  44339. // If the request succeeds, this function gets "data", "status", "jqXHR"
  44340. // but they are ignored because response was set above.
  44341. // If it fails, this function gets "jqXHR", "status", "error"
  44342. }).always(callback && function (jqXHR, status) {
  44343. self.each(function () {
  44344. callback.apply(this, response || [jqXHR.responseText, status, jqXHR]);
  44345. });
  44346. });
  44347. }
  44348. return this;
  44349. };
  44350. // Attach a bunch of functions for handling common AJAX events
  44351. jQuery.each(["ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend"], function (i, type) {
  44352. jQuery.fn[type] = function (fn) {
  44353. return this.on(type, fn);
  44354. };
  44355. });
  44356. jQuery.expr.pseudos.animated = function (elem) {
  44357. return jQuery.grep(jQuery.timers, function (fn) {
  44358. return elem === fn.elem;
  44359. }).length;
  44360. };
  44361. jQuery.offset = {
  44362. setOffset: function setOffset(elem, options, i) {
  44363. var curPosition,
  44364. curLeft,
  44365. curCSSTop,
  44366. curTop,
  44367. curOffset,
  44368. curCSSLeft,
  44369. calculatePosition,
  44370. position = jQuery.css(elem, "position"),
  44371. curElem = jQuery(elem),
  44372. props = {};
  44373. // Set position first, in-case top/left are set even on static elem
  44374. if (position === "static") {
  44375. elem.style.position = "relative";
  44376. }
  44377. curOffset = curElem.offset();
  44378. curCSSTop = jQuery.css(elem, "top");
  44379. curCSSLeft = jQuery.css(elem, "left");
  44380. calculatePosition = (position === "absolute" || position === "fixed") && (curCSSTop + curCSSLeft).indexOf("auto") > -1;
  44381. // Need to be able to calculate position if either
  44382. // top or left is auto and position is either absolute or fixed
  44383. if (calculatePosition) {
  44384. curPosition = curElem.position();
  44385. curTop = curPosition.top;
  44386. curLeft = curPosition.left;
  44387. } else {
  44388. curTop = parseFloat(curCSSTop) || 0;
  44389. curLeft = parseFloat(curCSSLeft) || 0;
  44390. }
  44391. if (isFunction(options)) {
  44392. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  44393. options = options.call(elem, i, jQuery.extend({}, curOffset));
  44394. }
  44395. if (options.top != null) {
  44396. props.top = options.top - curOffset.top + curTop;
  44397. }
  44398. if (options.left != null) {
  44399. props.left = options.left - curOffset.left + curLeft;
  44400. }
  44401. if ("using" in options) {
  44402. options.using.call(elem, props);
  44403. } else {
  44404. curElem.css(props);
  44405. }
  44406. }
  44407. };
  44408. jQuery.fn.extend({
  44409. // offset() relates an element's border box to the document origin
  44410. offset: function offset(options) {
  44411. // Preserve chaining for setter
  44412. if (arguments.length) {
  44413. return options === undefined ? this : this.each(function (i) {
  44414. jQuery.offset.setOffset(this, options, i);
  44415. });
  44416. }
  44417. var rect,
  44418. win,
  44419. elem = this[0];
  44420. if (!elem) {
  44421. return;
  44422. }
  44423. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  44424. // Support: IE <=11 only
  44425. // Running getBoundingClientRect on a
  44426. // disconnected node in IE throws an error
  44427. if (!elem.getClientRects().length) {
  44428. return { top: 0, left: 0 };
  44429. }
  44430. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  44431. rect = elem.getBoundingClientRect();
  44432. win = elem.ownerDocument.defaultView;
  44433. return {
  44434. top: rect.top + win.pageYOffset,
  44435. left: rect.left + win.pageXOffset
  44436. };
  44437. },
  44438. // position() relates an element's margin box to its offset parent's padding box
  44439. // This corresponds to the behavior of CSS absolute positioning
  44440. position: function position() {
  44441. if (!this[0]) {
  44442. return;
  44443. }
  44444. var offsetParent,
  44445. offset,
  44446. doc,
  44447. elem = this[0],
  44448. parentOffset = { top: 0, left: 0 };
  44449. // position:fixed elements are offset from the viewport, which itself always has zero offset
  44450. if (jQuery.css(elem, "position") === "fixed") {
  44451. // Assume position:fixed implies availability of getBoundingClientRect
  44452. offset = elem.getBoundingClientRect();
  44453. } else {
  44454. offset = this.offset();
  44455. // Account for the *real* offset parent, which can be the document or its root element
  44456. // when a statically positioned element is identified
  44457. doc = elem.ownerDocument;
  44458. offsetParent = elem.offsetParent || doc.documentElement;
  44459. while (offsetParent && (offsetParent === doc.body || offsetParent === doc.documentElement) && jQuery.css(offsetParent, "position") === "static") {
  44460. offsetParent = offsetParent.parentNode;
  44461. }
  44462. if (offsetParent && offsetParent !== elem && offsetParent.nodeType === 1) {
  44463. // Incorporate borders into its offset, since they are outside its content origin
  44464. parentOffset = jQuery(offsetParent).offset();
  44465. parentOffset.top += jQuery.css(offsetParent, "borderTopWidth", true);
  44466. parentOffset.left += jQuery.css(offsetParent, "borderLeftWidth", true);
  44467. }
  44468. }
  44469. // Subtract parent offsets and element margins
  44470. return {
  44471. top: offset.top - parentOffset.top - jQuery.css(elem, "marginTop", true),
  44472. left: offset.left - parentOffset.left - jQuery.css(elem, "marginLeft", true)
  44473. };
  44474. },
  44475. // This method will return documentElement in the following cases:
  44476. // 1) For the element inside the iframe without offsetParent, this method will return
  44477. // documentElement of the parent window
  44478. // 2) For the hidden or detached element
  44479. // 3) For body or html element, i.e. in case of the html node - it will return itself
  44480. //
  44481. // but those exceptions were never presented as a real life use-cases
  44482. // and might be considered as more preferable results.
  44483. //
  44484. // This logic, however, is not guaranteed and can change at any point in the future
  44485. offsetParent: function offsetParent() {
  44486. return this.map(function () {
  44487. var offsetParent = this.offsetParent;
  44488. while (offsetParent && jQuery.css(offsetParent, "position") === "static") {
  44489. offsetParent = offsetParent.offsetParent;
  44490. }
  44491. return offsetParent || documentElement;
  44492. });
  44493. }
  44494. });
  44495. // Create scrollLeft and scrollTop methods
  44496. jQuery.each({ scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function (method, prop) {
  44497. var top = "pageYOffset" === prop;
  44498. jQuery.fn[method] = function (val) {
  44499. return access(this, function (elem, method, val) {
  44500. // Coalesce documents and windows
  44501. var win;
  44502. if (isWindow(elem)) {
  44503. win = elem;
  44504. } else if (elem.nodeType === 9) {
  44505. win = elem.defaultView;
  44506. }
  44507. if (val === undefined) {
  44508. return win ? win[prop] : elem[method];
  44509. }
  44510. if (win) {
  44511. win.scrollTo(!top ? val : win.pageXOffset, top ? val : win.pageYOffset);
  44512. } else {
  44513. elem[method] = val;
  44514. }
  44515. }, method, val, arguments.length);
  44516. };
  44517. });
  44518. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  44519. // Add the top/left cssHooks using jQuery.fn.position
  44520. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  44521. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  44522. // getComputedStyle returns percent when specified for top/left/bottom/right;
  44523. // rather than make the css module depend on the offset module, just check for it here
  44524. jQuery.each(["top", "left"], function (i, prop) {
  44525. jQuery.cssHooks[prop] = addGetHookIf(support.pixelPosition, function (elem, computed) {
  44526. if (computed) {
  44527. computed = curCSS(elem, prop);
  44528. // If curCSS returns percentage, fallback to offset
  44529. return rnumnonpx.test(computed) ? jQuery(elem).position()[prop] + "px" : computed;
  44530. }
  44531. });
  44532. });
  44533. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  44534. jQuery.each({ Height: "height", Width: "width" }, function (name, type) {
  44535. jQuery.each({ padding: "inner" + name, content: type, "": "outer" + name }, function (defaultExtra, funcName) {
  44536. // Margin is only for outerHeight, outerWidth
  44537. jQuery.fn[funcName] = function (margin, value) {
  44538. var chainable = arguments.length && (defaultExtra || typeof margin !== "boolean"),
  44539. extra = defaultExtra || (margin === true || value === true ? "margin" : "border");
  44540. return access(this, function (elem, type, value) {
  44541. var doc;
  44542. if (isWindow(elem)) {
  44543. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  44544. return funcName.indexOf("outer") === 0 ? elem["inner" + name] : elem.document.documentElement["client" + name];
  44545. }
  44546. // Get document width or height
  44547. if (elem.nodeType === 9) {
  44548. doc = elem.documentElement;
  44549. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  44550. // whichever is greatest
  44551. return Math.max(elem.body["scroll" + name], doc["scroll" + name], elem.body["offset" + name], doc["offset" + name], doc["client" + name]);
  44552. }
  44553. return value === undefined ?
  44554. // Get width or height on the element, requesting but not forcing parseFloat
  44555. jQuery.css(elem, type, extra) :
  44556. // Set width or height on the element
  44557. jQuery.style(elem, type, value, extra);
  44558. }, type, chainable ? margin : undefined, chainable);
  44559. };
  44560. });
  44561. });
  44562. jQuery.each(("blur focus focusin focusout resize scroll click dblclick " + "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + "change select submit keydown keypress keyup contextmenu").split(" "), function (i, name) {
  44563. // Handle event binding
  44564. jQuery.fn[name] = function (data, fn) {
  44565. return arguments.length > 0 ? this.on(name, null, data, fn) : this.trigger(name);
  44566. };
  44567. });
  44568. jQuery.fn.extend({
  44569. hover: function hover(fnOver, fnOut) {
  44570. return this.mouseenter(fnOver).mouseleave(fnOut || fnOver);
  44571. }
  44572. });
  44573. jQuery.fn.extend({
  44574. bind: function bind(types, data, fn) {
  44575. return this.on(types, null, data, fn);
  44576. },
  44577. unbind: function unbind(types, fn) {
  44578. return this.off(types, null, fn);
  44579. },
  44580. delegate: function delegate(selector, types, data, fn) {
  44581. return this.on(types, selector, data, fn);
  44582. },
  44583. undelegate: function undelegate(selector, types, fn) {
  44584. // ( namespace ) or ( selector, types [, fn] )
  44585. return arguments.length === 1 ? this.off(selector, "**") : this.off(types, selector || "**", fn);
  44586. }
  44587. });
  44588. // Bind a function to a context, optionally partially applying any
  44589. // arguments.
  44590. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  44591. // However, it is not slated for removal any time soon
  44592. jQuery.proxy = function (fn, context) {
  44593. var tmp, args, proxy;
  44594. if (typeof context === "string") {
  44595. tmp = fn[context];
  44596. context = fn;
  44597. fn = tmp;
  44598. }
  44599. // Quick check to determine if target is callable, in the spec
  44600. // this throws a TypeError, but we will just return undefined.
  44601. if (!isFunction(fn)) {
  44602. return undefined;
  44603. }
  44604. // Simulated bind
  44605. args = _slice.call(arguments, 2);
  44606. proxy = function proxy() {
  44607. return fn.apply(context || this, args.concat(_slice.call(arguments)));
  44608. };
  44609. // Set the guid of unique handler to the same of original handler, so it can be removed
  44610. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  44611. return proxy;
  44612. };
  44613. jQuery.holdReady = function (hold) {
  44614. if (hold) {
  44615. jQuery.readyWait++;
  44616. } else {
  44617. jQuery.ready(true);
  44618. }
  44619. };
  44620. jQuery.isArray = Array.isArray;
  44621. jQuery.parseJSON = JSON.parse;
  44622. jQuery.nodeName = nodeName;
  44623. jQuery.isFunction = isFunction;
  44624. jQuery.isWindow = isWindow;
  44625. jQuery.camelCase = camelCase;
  44626. jQuery.type = toType;
  44627. jQuery.now = Date.now;
  44628. jQuery.isNumeric = function (obj) {
  44629. // As of jQuery 3.0, isNumeric is limited to
  44630. // strings and numbers (primitives or objects)
  44631. // that can be coerced to finite numbers (gh-2662)
  44632. var type = jQuery.type(obj);
  44633. return (type === "number" || type === "string") &&
  44634. // parseFloat NaNs numeric-cast false positives ("")
  44635. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  44636. // subtraction forces infinities to NaN
  44637. !isNaN(obj - parseFloat(obj));
  44638. };
  44639. // Register as a named AMD module, since jQuery can be concatenated with other
  44640. // files that may use define, but not via a proper concatenation script that
  44641. // understands anonymous AMD modules. A named AMD is safest and most robust
  44642. // way to register. Lowercase jquery is used because AMD module names are
  44643. // derived from file names, and jQuery is normally delivered in a lowercase
  44644. // file name. Do this after creating the global so that if an AMD module wants
  44645. // to call noConflict to hide this version of jQuery, it will work.
  44646. // Note that for maximum portability, libraries that are not jQuery should
  44647. // declare themselves as anonymous modules, and avoid setting a global if an
  44648. // AMD loader is present. jQuery is a special case. For more information, see
  44649. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  44650. if (true) {
  44651. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
  44652. return jQuery;
  44653. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  44654. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  44655. }
  44656. var
  44657. // Map over jQuery in case of overwrite
  44658. _jQuery = window.jQuery,
  44659. // Map over the $ in case of overwrite
  44660. _$ = window.$;
  44661. jQuery.noConflict = function (deep) {
  44662. if (window.$ === jQuery) {
  44663. window.$ = _$;
  44664. }
  44665. if (deep && window.jQuery === jQuery) {
  44666. window.jQuery = _jQuery;
  44667. }
  44668. return jQuery;
  44669. };
  44670. // Expose jQuery and $ identifiers, even in AMD
  44671. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  44672. // and CommonJS for browser emulators (#13566)
  44673. if (!noGlobal) {
  44674. window.jQuery = window.$ = jQuery;
  44675. }
  44676. return jQuery;
  44677. });
  44678. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../webpack/buildin/module.js */ "./node_modules/webpack/buildin/module.js")(module)))
  44679. /***/ }),
  44680. /***/ "./node_modules/line-i18n/dist/LanguageService.js":
  44681. /*!********************************************************!*\
  44682. !*** ./node_modules/line-i18n/dist/LanguageService.js ***!
  44683. \********************************************************/
  44684. /*! no static exports found */
  44685. /***/ (function(module, exports, __webpack_require__) {
  44686. "use strict";
  44687. Object.defineProperty(exports, "__esModule", {
  44688. value: true
  44689. });
  44690. var LanguageService = /** @class */function () {
  44691. function LanguageService(lsKey, defaultLang) {
  44692. if (defaultLang === void 0) {
  44693. defaultLang = 'pt';
  44694. }
  44695. this.lsKey = lsKey;
  44696. this.defaultLang = defaultLang;
  44697. this.listeners = [];
  44698. this.document = document;
  44699. this.setupListener();
  44700. }
  44701. LanguageService.prototype.setupListener = function () {
  44702. var _this = this;
  44703. if (this.document !== null) {
  44704. this.document.addEventListener("storage", function (event) {
  44705. var e = event;
  44706. if (e.key === _this.lsKey) {
  44707. _this.listeners.forEach(function (l) {
  44708. return l();
  44709. });
  44710. }
  44711. });
  44712. }
  44713. };
  44714. LanguageService.prototype.getLang = function () {
  44715. var lang = localStorage.getItem(this.lsKey);
  44716. if (lang === null || lang === undefined) {
  44717. console.warn("Internal Error: User language information has not been set. Returning default...");
  44718. return this.getDefaultLang();
  44719. }
  44720. return lang;
  44721. };
  44722. LanguageService.prototype.getDefaultLang = function () {
  44723. return this.defaultLang;
  44724. };
  44725. LanguageService.prototype.registerLanguageChangeListener = function (listener) {
  44726. this.listeners.push(listener);
  44727. };
  44728. return LanguageService;
  44729. }();
  44730. exports.LanguageService = LanguageService;
  44731. /***/ }),
  44732. /***/ "./node_modules/line-i18n/dist/LanguageServiceNoLS.js":
  44733. /*!************************************************************!*\
  44734. !*** ./node_modules/line-i18n/dist/LanguageServiceNoLS.js ***!
  44735. \************************************************************/
  44736. /*! no static exports found */
  44737. /***/ (function(module, exports, __webpack_require__) {
  44738. "use strict";
  44739. Object.defineProperty(exports, "__esModule", {
  44740. value: true
  44741. });
  44742. var LanguageServiceNoLS = /** @class */function () {
  44743. function LanguageServiceNoLS(lang) {
  44744. this.lang = lang;
  44745. this.listeners = [];
  44746. }
  44747. LanguageServiceNoLS.prototype.setupListener = function () {};
  44748. LanguageServiceNoLS.prototype.notifyChange = function () {
  44749. this.listeners.forEach(function (l) {
  44750. return l();
  44751. });
  44752. };
  44753. LanguageServiceNoLS.prototype.setLang = function (lang) {
  44754. this.lang = lang;
  44755. this.notifyChange();
  44756. };
  44757. LanguageServiceNoLS.prototype.getLang = function () {
  44758. return this.lang;
  44759. };
  44760. LanguageServiceNoLS.prototype.getDefaultLang = function () {
  44761. return this.lang;
  44762. };
  44763. LanguageServiceNoLS.prototype.registerLanguageChangeListener = function (listener) {
  44764. this.listeners.push(listener);
  44765. };
  44766. return LanguageServiceNoLS;
  44767. }();
  44768. exports.LanguageServiceNoLS = LanguageServiceNoLS;
  44769. /***/ }),
  44770. /***/ "./node_modules/line-i18n/dist/LocalizedStrings.js":
  44771. /*!*********************************************************!*\
  44772. !*** ./node_modules/line-i18n/dist/LocalizedStrings.js ***!
  44773. \*********************************************************/
  44774. /*! no static exports found */
  44775. /***/ (function(module, exports, __webpack_require__) {
  44776. "use strict";
  44777. Object.defineProperty(exports, "__esModule", {
  44778. value: true
  44779. });
  44780. exports.LocalizedStrings = undefined;
  44781. var _StringTypes = __webpack_require__(/*! ./StringTypes */ "./node_modules/line-i18n/dist/StringTypes.js");
  44782. var LocalizedStrings = /** @class */function () {
  44783. function LocalizedStrings(service, i18nData, listenToChange) {
  44784. if (listenToChange === void 0) {
  44785. listenToChange = false;
  44786. }
  44787. var _this = this;
  44788. this.service = service;
  44789. this.i18nData = i18nData;
  44790. this.listenToChange = listenToChange;
  44791. this.document = document;
  44792. if (this.listenToChange) {
  44793. service.registerLanguageChangeListener(function () {
  44794. _this.updateTagText();
  44795. });
  44796. }
  44797. }
  44798. LocalizedStrings.prototype.getString = function (id, type) {
  44799. var i18nObj = this.i18nData[this.service.getLang()];
  44800. if (!!!i18nObj) {
  44801. console.warn("Internal Error. The language set at ivprog.lang is not valid: " + this.service.getLang());
  44802. i18nObj = this.i18nData[this.service.getDefaultLang()];
  44803. }
  44804. if (!!!i18nObj[type]) {
  44805. return "{MISSING_I18N_TYPE_IDENTIFIER}";
  44806. } else if (!!!i18nObj[type][id]) {
  44807. return "{MISSING_I18N_IDENTIFIER}";
  44808. } else {
  44809. return i18nObj[type][id];
  44810. }
  44811. };
  44812. LocalizedStrings.prototype.getOR = function () {
  44813. return this.getUI('join_or');
  44814. };
  44815. LocalizedStrings.prototype.getError = function (id, context) {
  44816. if (context === void 0) {
  44817. context = [];
  44818. }
  44819. var text = this.getString(id, _StringTypes.StringTypes.ERROR);
  44820. return this.processString(text, context);
  44821. };
  44822. LocalizedStrings.prototype.getMessage = function (id, context) {
  44823. if (context === void 0) {
  44824. context = [];
  44825. }
  44826. var text = this.getString(id, _StringTypes.StringTypes.MESSAGE);
  44827. return this.processString(text, context);
  44828. };
  44829. LocalizedStrings.prototype.getUI = function (id, context) {
  44830. if (context === void 0) {
  44831. context = [];
  44832. }
  44833. var text = this.getString(id, _StringTypes.StringTypes.UI);
  44834. return this.processString(text, context);
  44835. };
  44836. LocalizedStrings.prototype.processString = function (text, context) {
  44837. for (var i = 0; i < context.length; i++) {
  44838. var v = context[i];
  44839. text = text.replace('\$' + i, v);
  44840. }
  44841. return text;
  44842. };
  44843. LocalizedStrings.prototype.updateTagText = function (func) {
  44844. var _this = this;
  44845. if (func === void 0) {
  44846. func = null;
  44847. }
  44848. if (this.document !== null) {
  44849. var list = this.document.querySelectorAll("data.i18n");
  44850. list.forEach(function (node) {
  44851. if (func === null) {
  44852. node.innerHTML = _this.processTagTex(node.getAttribute("value"));
  44853. } else {
  44854. node.innerHTML = func(node.getAttribute("value"));
  44855. }
  44856. });
  44857. }
  44858. };
  44859. LocalizedStrings.prototype.processTagTex = function (text) {
  44860. if (text === null) {
  44861. return "<Invalid i18n identifier>";
  44862. }
  44863. var opts = text.split(':');
  44864. var type = opts[0].toLowerCase();
  44865. var id = opts[1];
  44866. if (_StringTypes.StringTypes.ERROR === type) {
  44867. return this.getError(id);
  44868. } else if (_StringTypes.StringTypes.MESSAGE === type) {
  44869. return this.getMessage(id);
  44870. } else if (_StringTypes.StringTypes.UI === type) {
  44871. return this.getUI(id);
  44872. } else {
  44873. console.warn(" A string has been passed to the i18n helper function that was not in the form type:id -> " + text);
  44874. return this.getString(id, type);
  44875. }
  44876. };
  44877. return LocalizedStrings;
  44878. }();
  44879. exports.LocalizedStrings = LocalizedStrings;
  44880. /***/ }),
  44881. /***/ "./node_modules/line-i18n/dist/StringTypes.js":
  44882. /*!****************************************************!*\
  44883. !*** ./node_modules/line-i18n/dist/StringTypes.js ***!
  44884. \****************************************************/
  44885. /*! no static exports found */
  44886. /***/ (function(module, exports, __webpack_require__) {
  44887. "use strict";
  44888. Object.defineProperty(exports, "__esModule", {
  44889. value: true
  44890. });
  44891. var StringTypes = exports.StringTypes = undefined;
  44892. (function (StringTypes) {
  44893. StringTypes["ERROR"] = "error";
  44894. StringTypes["MESSAGE"] = "message";
  44895. StringTypes["UI"] = "ui";
  44896. })(StringTypes || (exports.StringTypes = StringTypes = {}));
  44897. /***/ }),
  44898. /***/ "./node_modules/line-i18n/dist/index.js":
  44899. /*!**********************************************!*\
  44900. !*** ./node_modules/line-i18n/dist/index.js ***!
  44901. \**********************************************/
  44902. /*! no static exports found */
  44903. /***/ (function(module, exports, __webpack_require__) {
  44904. "use strict";
  44905. Object.defineProperty(exports, "__esModule", {
  44906. value: true
  44907. });
  44908. var _LanguageService = __webpack_require__(/*! ./LanguageService */ "./node_modules/line-i18n/dist/LanguageService.js");
  44909. var _LocalizedStrings = __webpack_require__(/*! ./LocalizedStrings */ "./node_modules/line-i18n/dist/LocalizedStrings.js");
  44910. var _StringTypes = __webpack_require__(/*! ./StringTypes */ "./node_modules/line-i18n/dist/StringTypes.js");
  44911. var _LanguageServiceNoLS = __webpack_require__(/*! ./LanguageServiceNoLS */ "./node_modules/line-i18n/dist/LanguageServiceNoLS.js");
  44912. exports.default = {
  44913. LanguageService: _LanguageService.LanguageService,
  44914. LanguageServiceNoLS: _LanguageServiceNoLS.LanguageServiceNoLS,
  44915. LocalizedStrings: _LocalizedStrings.LocalizedStrings,
  44916. StringTypes: _StringTypes.StringTypes
  44917. };
  44918. /***/ }),
  44919. /***/ "./node_modules/melanke-watchjs/src/watch.js":
  44920. /*!***************************************************!*\
  44921. !*** ./node_modules/melanke-watchjs/src/watch.js ***!
  44922. \***************************************************/
  44923. /*! no static exports found */
  44924. /***/ (function(module, exports, __webpack_require__) {
  44925. "use strict";
  44926. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
  44927. * DEVELOPED BY
  44928. * GIL LOPES BUENO
  44929. * gilbueno.mail@gmail.com
  44930. *
  44931. * WORKS WITH:
  44932. * IE8*, IE 9+, FF 4+, SF 5+, WebKit, CH 7+, OP 12+, BESEN, Rhino 1.7+
  44933. * For IE8 (and other legacy browsers) WatchJS will use dirty checking
  44934. *
  44935. * FORK:
  44936. * https://github.com/melanke/Watch.JS
  44937. *
  44938. * LICENSE: MIT
  44939. */
  44940. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  44941. (function (factory) {
  44942. if (( false ? undefined : _typeof(exports)) === 'object') {
  44943. // Node. Does not work with strict CommonJS, but
  44944. // only CommonJS-like enviroments that support module.exports,
  44945. // like Node.
  44946. module.exports = factory();
  44947. } else if (true) {
  44948. // AMD. Register as an anonymous module.
  44949. !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  44950. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  44951. (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
  44952. __WEBPACK_AMD_DEFINE_FACTORY__),
  44953. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  44954. } else {}
  44955. })(function () {
  44956. var WatchJS = {
  44957. noMore: false, // use WatchJS.suspend(obj) instead
  44958. useDirtyCheck: false, // use only dirty checking to track changes.
  44959. preserveExistingSetters: false
  44960. },
  44961. lengthsubjects = [];
  44962. var dirtyChecklist = [];
  44963. var pendingChanges = []; // used coalesce changes from defineProperty and __defineSetter__
  44964. var supportDefineProperty = false;
  44965. try {
  44966. supportDefineProperty = Object.defineProperty && Object.defineProperty({}, 'x', {});
  44967. } catch (ex) {/* not supported */}
  44968. var isFunction = function isFunction(functionToCheck) {
  44969. var getType = {};
  44970. return functionToCheck && getType.toString.call(functionToCheck) == '[object Function]';
  44971. };
  44972. var isInt = function isInt(x) {
  44973. return x % 1 === 0;
  44974. };
  44975. var isArray = function isArray(obj) {
  44976. return Object.prototype.toString.call(obj) === '[object Array]';
  44977. };
  44978. var isObject = function isObject(obj) {
  44979. return {}.toString.apply(obj) === '[object Object]';
  44980. };
  44981. var getObjDiff = function getObjDiff(a, b) {
  44982. var aplus = [],
  44983. bplus = [];
  44984. if (!(typeof a == "string") && !(typeof b == "string")) {
  44985. if (isArray(a) && b) {
  44986. for (var i = 0; i < a.length; i++) {
  44987. if (b[i] === undefined) aplus.push(i);
  44988. }
  44989. } else {
  44990. for (var i in a) {
  44991. if (a.hasOwnProperty(i)) {
  44992. if (b && !b.hasOwnProperty(i)) {
  44993. aplus.push(i);
  44994. }
  44995. }
  44996. }
  44997. }
  44998. if (isArray(b) && a) {
  44999. for (var j = 0; j < b.length; j++) {
  45000. if (a[j] === undefined) bplus.push(j);
  45001. }
  45002. } else {
  45003. for (var j in b) {
  45004. if (b.hasOwnProperty(j)) {
  45005. if (a && !a.hasOwnProperty(j)) {
  45006. bplus.push(j);
  45007. }
  45008. }
  45009. }
  45010. }
  45011. }
  45012. return {
  45013. added: aplus,
  45014. removed: bplus
  45015. };
  45016. };
  45017. var clone = function clone(obj) {
  45018. if (null == obj || "object" != (typeof obj === 'undefined' ? 'undefined' : _typeof(obj))) {
  45019. return obj;
  45020. }
  45021. var copy = obj.constructor();
  45022. for (var attr in obj) {
  45023. copy[attr] = obj[attr];
  45024. }
  45025. return copy;
  45026. };
  45027. var getExistingSetter = function getExistingSetter(obj, propName) {
  45028. if (WatchJS.preserveExistingSetters) {
  45029. var existing = Object.getOwnPropertyDescriptor(obj, propName);
  45030. return existing.set;
  45031. }
  45032. return undefined;
  45033. };
  45034. var defineGetAndSet = function defineGetAndSet(obj, propName, getter, setter) {
  45035. try {
  45036. var existingSetter = getExistingSetter(obj, propName);
  45037. Object.defineProperty(obj, propName, {
  45038. get: getter,
  45039. set: function set(value) {
  45040. setter.call(this, value, true); // coalesce changes
  45041. if (existingSetter) {
  45042. existingSetter(value);
  45043. }
  45044. },
  45045. enumerable: true,
  45046. configurable: true
  45047. });
  45048. } catch (e1) {
  45049. try {
  45050. Object.prototype.__defineGetter__.call(obj, propName, getter);
  45051. Object.prototype.__defineSetter__.call(obj, propName, function (value) {
  45052. setter.call(this, value, true); // coalesce changes
  45053. });
  45054. } catch (e2) {
  45055. observeDirtyChanges(obj, propName, setter);
  45056. //throw new Error("watchJS error: browser not supported :/")
  45057. }
  45058. }
  45059. };
  45060. var defineProp = function defineProp(obj, propName, value) {
  45061. try {
  45062. Object.defineProperty(obj, propName, {
  45063. enumerable: false,
  45064. configurable: true,
  45065. writable: false,
  45066. value: value
  45067. });
  45068. } catch (error) {
  45069. obj[propName] = value;
  45070. }
  45071. };
  45072. var observeDirtyChanges = function observeDirtyChanges(obj, propName, setter) {
  45073. dirtyChecklist[dirtyChecklist.length] = {
  45074. prop: propName,
  45075. object: obj,
  45076. orig: clone(obj[propName]),
  45077. callback: setter
  45078. };
  45079. };
  45080. var watch = function watch() {
  45081. if (isFunction(arguments[1])) {
  45082. watchAll.apply(this, arguments);
  45083. } else if (isArray(arguments[1])) {
  45084. watchMany.apply(this, arguments);
  45085. } else {
  45086. watchOne.apply(this, arguments);
  45087. }
  45088. };
  45089. var watchAll = function watchAll(obj, watcher, level, addNRemove) {
  45090. if (typeof obj == "string" || !(obj instanceof Object) && !isArray(obj)) {
  45091. //accepts only objects and array (not string)
  45092. return;
  45093. }
  45094. if (isArray(obj)) {
  45095. defineWatcher(obj, "__watchall__", watcher, level); // watch all changes on the array
  45096. if (level === undefined || level > 0) {
  45097. for (var prop = 0; prop < obj.length; prop++) {
  45098. // watch objects in array
  45099. watchAll(obj[prop], watcher, level, addNRemove);
  45100. }
  45101. }
  45102. } else {
  45103. var prop,
  45104. props = [];
  45105. for (prop in obj) {
  45106. //for each attribute if obj is an object
  45107. if (prop == "$val" || !supportDefineProperty && prop === 'watchers') {
  45108. continue;
  45109. }
  45110. if (Object.prototype.hasOwnProperty.call(obj, prop)) {
  45111. props.push(prop); //put in the props
  45112. }
  45113. }
  45114. watchMany(obj, props, watcher, level, addNRemove); //watch all items of the props
  45115. }
  45116. if (addNRemove) {
  45117. pushToLengthSubjects(obj, "$$watchlengthsubjectroot", watcher, level);
  45118. }
  45119. };
  45120. var watchMany = function watchMany(obj, props, watcher, level, addNRemove) {
  45121. if (typeof obj == "string" || !(obj instanceof Object) && !isArray(obj)) {
  45122. //accepts only objects and array (not string)
  45123. return;
  45124. }
  45125. for (var i = 0; i < props.length; i++) {
  45126. //watch each property
  45127. var prop = props[i];
  45128. watchOne(obj, prop, watcher, level, addNRemove);
  45129. }
  45130. };
  45131. var watchOne = function watchOne(obj, prop, watcher, level, addNRemove) {
  45132. if (typeof obj == "string" || !(obj instanceof Object) && !isArray(obj)) {
  45133. //accepts only objects and array (not string)
  45134. return;
  45135. }
  45136. if (isFunction(obj[prop])) {
  45137. //dont watch if it is a function
  45138. return;
  45139. }
  45140. if (obj[prop] != null && (level === undefined || level > 0)) {
  45141. watchAll(obj[prop], watcher, level !== undefined ? level - 1 : level); //recursively watch all attributes of this
  45142. }
  45143. defineWatcher(obj, prop, watcher, level);
  45144. if (addNRemove && (level === undefined || level > 0)) {
  45145. pushToLengthSubjects(obj, prop, watcher, level);
  45146. }
  45147. };
  45148. var unwatch = function unwatch() {
  45149. if (isFunction(arguments[1])) {
  45150. unwatchAll.apply(this, arguments);
  45151. } else if (isArray(arguments[1])) {
  45152. unwatchMany.apply(this, arguments);
  45153. } else {
  45154. unwatchOne.apply(this, arguments);
  45155. }
  45156. };
  45157. var unwatchAll = function unwatchAll(obj, watcher) {
  45158. if (obj instanceof String || !(obj instanceof Object) && !isArray(obj)) {
  45159. //accepts only objects and array (not string)
  45160. return;
  45161. }
  45162. if (isArray(obj)) {
  45163. var props = ['__watchall__'];
  45164. for (var prop = 0; prop < obj.length; prop++) {
  45165. //for each item if obj is an array
  45166. props.push(prop); //put in the props
  45167. }
  45168. unwatchMany(obj, props, watcher); //watch all itens of the props
  45169. } else {
  45170. var unwatchPropsInObject = function unwatchPropsInObject(obj2) {
  45171. var props = [];
  45172. for (var prop2 in obj2) {
  45173. //for each attribute if obj is an object
  45174. if (obj2.hasOwnProperty(prop2)) {
  45175. if (obj2[prop2] instanceof Object) {
  45176. unwatchPropsInObject(obj2[prop2]); //recurs into object props
  45177. } else {
  45178. props.push(prop2); //put in the props
  45179. }
  45180. }
  45181. }
  45182. unwatchMany(obj2, props, watcher); //unwatch all of the props
  45183. };
  45184. unwatchPropsInObject(obj);
  45185. }
  45186. };
  45187. var unwatchMany = function unwatchMany(obj, props, watcher) {
  45188. for (var prop2 in props) {
  45189. //watch each attribute of "props" if is an object
  45190. if (props.hasOwnProperty(prop2)) {
  45191. unwatchOne(obj, props[prop2], watcher);
  45192. }
  45193. }
  45194. };
  45195. var timeouts = [],
  45196. timerID = null;
  45197. function clearTimerID() {
  45198. timerID = null;
  45199. for (var i = 0; i < timeouts.length; i++) {
  45200. timeouts[i]();
  45201. }
  45202. timeouts.length = 0;
  45203. }
  45204. var getTimerID = function getTimerID() {
  45205. if (!timerID) {
  45206. timerID = setTimeout(clearTimerID);
  45207. }
  45208. return timerID;
  45209. };
  45210. var registerTimeout = function registerTimeout(fn) {
  45211. // register function to be called on timeout
  45212. if (timerID == null) getTimerID();
  45213. timeouts[timeouts.length] = fn;
  45214. };
  45215. // Track changes made to an array, object or an object's property
  45216. // and invoke callback with a single change object containing type, value, oldvalue and array splices
  45217. // Syntax:
  45218. // trackChange(obj, callback, recursive, addNRemove)
  45219. // trackChange(obj, prop, callback, recursive, addNRemove)
  45220. var trackChange = function trackChange() {
  45221. var fn = isFunction(arguments[2]) ? trackProperty : trackObject;
  45222. fn.apply(this, arguments);
  45223. };
  45224. // track changes made to an object and invoke callback with a single change object containing type, value and array splices
  45225. var trackObject = function trackObject(obj, callback, recursive, addNRemove) {
  45226. var change = null,
  45227. lastTimerID = -1;
  45228. var isArr = isArray(obj);
  45229. var level,
  45230. fn = function fn(prop, action, newValue, oldValue) {
  45231. var timerID = getTimerID();
  45232. if (lastTimerID !== timerID) {
  45233. // check if timer has changed since last update
  45234. lastTimerID = timerID;
  45235. change = {
  45236. type: 'update'
  45237. };
  45238. change['value'] = obj;
  45239. change['splices'] = null;
  45240. registerTimeout(function () {
  45241. callback.call(this, change);
  45242. change = null;
  45243. });
  45244. }
  45245. // create splices for array changes
  45246. if (isArr && obj === this && change !== null) {
  45247. if (action === 'pop' || action === 'shift') {
  45248. newValue = [];
  45249. oldValue = [oldValue];
  45250. } else if (action === 'push' || action === 'unshift') {
  45251. newValue = [newValue];
  45252. oldValue = [];
  45253. } else if (action !== 'splice') {
  45254. return; // return here - for reverse and sort operations we don't need to return splices. a simple update will do
  45255. }
  45256. if (!change.splices) change.splices = [];
  45257. change.splices[change.splices.length] = {
  45258. index: prop,
  45259. deleteCount: oldValue ? oldValue.length : 0,
  45260. addedCount: newValue ? newValue.length : 0,
  45261. added: newValue,
  45262. deleted: oldValue
  45263. };
  45264. }
  45265. };
  45266. level = recursive == true ? undefined : 0;
  45267. watchAll(obj, fn, level, addNRemove);
  45268. };
  45269. // track changes made to the property of an object and invoke callback with a single change object containing type, value, oldvalue and splices
  45270. var trackProperty = function trackProperty(obj, prop, callback, recursive, addNRemove) {
  45271. if (obj && prop) {
  45272. watchOne(obj, prop, function (prop, action, newvalue, oldvalue) {
  45273. var change = {
  45274. type: 'update'
  45275. };
  45276. change['value'] = newvalue;
  45277. change['oldvalue'] = oldvalue;
  45278. if (recursive && isObject(newvalue) || isArray(newvalue)) {
  45279. trackObject(newvalue, callback, recursive, addNRemove);
  45280. }
  45281. callback.call(this, change);
  45282. }, 0);
  45283. if (recursive && isObject(obj[prop]) || isArray(obj[prop])) {
  45284. trackObject(obj[prop], callback, recursive, addNRemove);
  45285. }
  45286. }
  45287. };
  45288. var defineWatcher = function defineWatcher(obj, prop, watcher, level) {
  45289. var newWatcher = false;
  45290. var isArr = isArray(obj);
  45291. if (!obj.watchers) {
  45292. defineProp(obj, "watchers", {});
  45293. if (isArr) {
  45294. // watch array functions
  45295. watchFunctions(obj, function (index, action, newValue, oldValue) {
  45296. addPendingChange(obj, index, action, newValue, oldValue);
  45297. if (level !== 0 && newValue && (isObject(newValue) || isArray(newValue))) {
  45298. var i,
  45299. n,
  45300. ln,
  45301. wAll,
  45302. watchList = obj.watchers[prop];
  45303. if (wAll = obj.watchers['__watchall__']) {
  45304. watchList = watchList ? watchList.concat(wAll) : wAll;
  45305. }
  45306. ln = watchList ? watchList.length : 0;
  45307. for (i = 0; i < ln; i++) {
  45308. if (action !== 'splice') {
  45309. watchAll(newValue, watchList[i], level === undefined ? level : level - 1);
  45310. } else {
  45311. // watch spliced values
  45312. for (n = 0; n < newValue.length; n++) {
  45313. watchAll(newValue[n], watchList[i], level === undefined ? level : level - 1);
  45314. }
  45315. }
  45316. }
  45317. }
  45318. });
  45319. }
  45320. }
  45321. if (!obj.watchers[prop]) {
  45322. obj.watchers[prop] = [];
  45323. if (!isArr) newWatcher = true;
  45324. }
  45325. for (var i = 0; i < obj.watchers[prop].length; i++) {
  45326. if (obj.watchers[prop][i] === watcher) {
  45327. return;
  45328. }
  45329. }
  45330. obj.watchers[prop].push(watcher); //add the new watcher to the watchers array
  45331. if (newWatcher) {
  45332. var val = obj[prop];
  45333. var getter = function getter() {
  45334. return val;
  45335. };
  45336. var setter = function setter(newval, delayWatcher) {
  45337. var oldval = val;
  45338. val = newval;
  45339. if (level !== 0 && obj[prop] && (isObject(obj[prop]) || isArray(obj[prop])) && !obj[prop].watchers) {
  45340. // watch sub properties
  45341. var i,
  45342. ln = obj.watchers[prop].length;
  45343. for (i = 0; i < ln; i++) {
  45344. watchAll(obj[prop], obj.watchers[prop][i], level === undefined ? level : level - 1);
  45345. }
  45346. }
  45347. //watchFunctions(obj, prop);
  45348. if (isSuspended(obj, prop)) {
  45349. resume(obj, prop);
  45350. return;
  45351. }
  45352. if (!WatchJS.noMore) {
  45353. // this does not work with Object.observe
  45354. //if (JSON.stringify(oldval) !== JSON.stringify(newval)) {
  45355. if (oldval !== newval) {
  45356. if (!delayWatcher) {
  45357. callWatchers(obj, prop, "set", newval, oldval);
  45358. } else {
  45359. addPendingChange(obj, prop, "set", newval, oldval);
  45360. }
  45361. WatchJS.noMore = false;
  45362. }
  45363. }
  45364. };
  45365. if (WatchJS.useDirtyCheck) {
  45366. observeDirtyChanges(obj, prop, setter);
  45367. } else {
  45368. defineGetAndSet(obj, prop, getter, setter);
  45369. }
  45370. }
  45371. };
  45372. var callWatchers = function callWatchers(obj, prop, action, newval, oldval) {
  45373. if (prop !== undefined) {
  45374. var ln,
  45375. wl,
  45376. watchList = obj.watchers[prop];
  45377. if (wl = obj.watchers['__watchall__']) {
  45378. watchList = watchList ? watchList.concat(wl) : wl;
  45379. }
  45380. ln = watchList ? watchList.length : 0;
  45381. for (var wr = 0; wr < ln; wr++) {
  45382. watchList[wr].call(obj, prop, action, newval, oldval);
  45383. }
  45384. } else {
  45385. for (var prop in obj) {
  45386. //call all
  45387. if (obj.hasOwnProperty(prop)) {
  45388. callWatchers(obj, prop, action, newval, oldval);
  45389. }
  45390. }
  45391. }
  45392. };
  45393. var methodNames = ['pop', 'push', 'reverse', 'shift', 'sort', 'slice', 'unshift', 'splice'];
  45394. var defineArrayMethodWatcher = function defineArrayMethodWatcher(obj, original, methodName, callback) {
  45395. defineProp(obj, methodName, function () {
  45396. var index = 0;
  45397. var i, newValue, oldValue, response;
  45398. // get values before splicing array
  45399. if (methodName === 'splice') {
  45400. var start = arguments[0];
  45401. var end = start + arguments[1];
  45402. oldValue = obj.slice(start, end);
  45403. newValue = [];
  45404. for (i = 2; i < arguments.length; i++) {
  45405. newValue[i - 2] = arguments[i];
  45406. }
  45407. index = start;
  45408. } else {
  45409. newValue = arguments.length > 0 ? arguments[0] : undefined;
  45410. }
  45411. response = original.apply(obj, arguments);
  45412. if (methodName !== 'slice') {
  45413. if (methodName === 'pop') {
  45414. oldValue = response;
  45415. index = obj.length;
  45416. } else if (methodName === 'push') {
  45417. index = obj.length - 1;
  45418. } else if (methodName === 'shift') {
  45419. oldValue = response;
  45420. } else if (methodName !== 'unshift' && newValue === undefined) {
  45421. newValue = response;
  45422. }
  45423. callback.call(obj, index, methodName, newValue, oldValue);
  45424. }
  45425. return response;
  45426. });
  45427. };
  45428. var watchFunctions = function watchFunctions(obj, callback) {
  45429. if (!isFunction(callback) || !obj || obj instanceof String || !isArray(obj)) {
  45430. return;
  45431. }
  45432. for (var i = methodNames.length, methodName; i--;) {
  45433. methodName = methodNames[i];
  45434. defineArrayMethodWatcher(obj, obj[methodName], methodName, callback);
  45435. }
  45436. };
  45437. var unwatchOne = function unwatchOne(obj, prop, watcher) {
  45438. if (prop) {
  45439. if (obj.watchers && obj.watchers[prop]) {
  45440. if (watcher === undefined) {
  45441. delete obj.watchers[prop]; // remove all property watchers
  45442. } else {
  45443. for (var i = 0; i < obj.watchers[prop].length; i++) {
  45444. var w = obj.watchers[prop][i];
  45445. if (w == watcher) {
  45446. obj.watchers[prop].splice(i, 1);
  45447. }
  45448. }
  45449. }
  45450. }
  45451. } else {
  45452. delete obj.watchers;
  45453. }
  45454. removeFromLengthSubjects(obj, prop, watcher);
  45455. removeFromDirtyChecklist(obj, prop);
  45456. };
  45457. // suspend watchers until next update cycle
  45458. var suspend = function suspend(obj, prop) {
  45459. if (obj.watchers) {
  45460. var name = '__wjs_suspend__' + (prop !== undefined ? prop : '');
  45461. obj.watchers[name] = true;
  45462. }
  45463. };
  45464. var isSuspended = function isSuspended(obj, prop) {
  45465. return obj.watchers && (obj.watchers['__wjs_suspend__'] || obj.watchers['__wjs_suspend__' + prop]);
  45466. };
  45467. // resumes preivously suspended watchers
  45468. var resume = function resume(obj, prop) {
  45469. registerTimeout(function () {
  45470. delete obj.watchers['__wjs_suspend__'];
  45471. delete obj.watchers['__wjs_suspend__' + prop];
  45472. });
  45473. };
  45474. var pendingTimerID = null;
  45475. var addPendingChange = function addPendingChange(obj, prop, mode, newval, oldval) {
  45476. pendingChanges[pendingChanges.length] = {
  45477. obj: obj,
  45478. prop: prop,
  45479. mode: mode,
  45480. newval: newval,
  45481. oldval: oldval
  45482. };
  45483. if (pendingTimerID === null) {
  45484. pendingTimerID = setTimeout(applyPendingChanges);
  45485. }
  45486. };
  45487. var applyPendingChanges = function applyPendingChanges() {
  45488. // apply pending changes
  45489. var change = null;
  45490. pendingTimerID = null;
  45491. for (var i = 0; i < pendingChanges.length; i++) {
  45492. change = pendingChanges[i];
  45493. callWatchers(change.obj, change.prop, change.mode, change.newval, change.oldval);
  45494. }
  45495. if (change) {
  45496. pendingChanges = [];
  45497. change = null;
  45498. }
  45499. };
  45500. var loop = function loop() {
  45501. // check for new or deleted props
  45502. for (var i = 0; i < lengthsubjects.length; i++) {
  45503. var subj = lengthsubjects[i];
  45504. if (subj.prop === "$$watchlengthsubjectroot") {
  45505. var difference = getObjDiff(subj.obj, subj.actual);
  45506. if (difference.added.length || difference.removed.length) {
  45507. if (difference.added.length) {
  45508. watchMany(subj.obj, difference.added, subj.watcher, subj.level - 1, true);
  45509. }
  45510. subj.watcher.call(subj.obj, "root", "differentattr", difference, subj.actual);
  45511. }
  45512. subj.actual = clone(subj.obj);
  45513. } else {
  45514. var difference = getObjDiff(subj.obj[subj.prop], subj.actual);
  45515. if (difference.added.length || difference.removed.length) {
  45516. if (difference.added.length) {
  45517. for (var j = 0; j < subj.obj.watchers[subj.prop].length; j++) {
  45518. watchMany(subj.obj[subj.prop], difference.added, subj.obj.watchers[subj.prop][j], subj.level - 1, true);
  45519. }
  45520. }
  45521. callWatchers(subj.obj, subj.prop, "differentattr", difference, subj.actual);
  45522. }
  45523. subj.actual = clone(subj.obj[subj.prop]);
  45524. }
  45525. }
  45526. // start dirty check
  45527. var n, value;
  45528. if (dirtyChecklist.length > 0) {
  45529. for (var i = 0; i < dirtyChecklist.length; i++) {
  45530. n = dirtyChecklist[i];
  45531. value = n.object[n.prop];
  45532. if (!compareValues(n.orig, value)) {
  45533. n.orig = clone(value);
  45534. n.callback(value);
  45535. }
  45536. }
  45537. }
  45538. };
  45539. var compareValues = function compareValues(a, b) {
  45540. var i,
  45541. state = true;
  45542. if (a !== b) {
  45543. if (isObject(a)) {
  45544. for (i in a) {
  45545. if (!supportDefineProperty && i === 'watchers') continue;
  45546. if (a[i] !== b[i]) {
  45547. state = false;
  45548. break;
  45549. };
  45550. }
  45551. } else {
  45552. state = false;
  45553. }
  45554. }
  45555. return state;
  45556. };
  45557. var pushToLengthSubjects = function pushToLengthSubjects(obj, prop, watcher, level) {
  45558. var actual;
  45559. if (prop === "$$watchlengthsubjectroot") {
  45560. actual = clone(obj);
  45561. } else {
  45562. actual = clone(obj[prop]);
  45563. }
  45564. lengthsubjects.push({
  45565. obj: obj,
  45566. prop: prop,
  45567. actual: actual,
  45568. watcher: watcher,
  45569. level: level
  45570. });
  45571. };
  45572. var removeFromLengthSubjects = function removeFromLengthSubjects(obj, prop, watcher) {
  45573. for (var i = 0; i < lengthsubjects.length; i++) {
  45574. var subj = lengthsubjects[i];
  45575. if (subj.obj == obj) {
  45576. if (!prop || subj.prop == prop) {
  45577. if (!watcher || subj.watcher == watcher) {
  45578. // if we splice off one item at position i
  45579. // we need to decrement i as the array is one item shorter
  45580. // so when we increment i in the loop statement we
  45581. // will land at the correct index.
  45582. // if it's not decremented, you won't delete all length subjects
  45583. lengthsubjects.splice(i--, 1);
  45584. }
  45585. }
  45586. }
  45587. }
  45588. };
  45589. var removeFromDirtyChecklist = function removeFromDirtyChecklist(obj, prop) {
  45590. var notInUse;
  45591. for (var i = 0; i < dirtyChecklist.length; i++) {
  45592. var n = dirtyChecklist[i];
  45593. var watchers = n.object.watchers;
  45594. notInUse = n.object == obj && (!prop || n.prop == prop) && watchers && (!prop || !watchers[prop] || watchers[prop].length == 0);
  45595. if (notInUse) {
  45596. // we use the same syntax as in removeFromLengthSubjects
  45597. dirtyChecklist.splice(i--, 1);
  45598. }
  45599. }
  45600. };
  45601. setInterval(loop, 50);
  45602. WatchJS.watch = watch;
  45603. WatchJS.unwatch = unwatch;
  45604. WatchJS.callWatchers = callWatchers;
  45605. WatchJS.suspend = suspend; // suspend watchers
  45606. WatchJS.onChange = trackChange; // track changes made to object or it's property and return a single change object
  45607. return WatchJS;
  45608. });
  45609. /***/ }),
  45610. /***/ "./node_modules/node-libs-browser/mock/empty.js":
  45611. /*!******************************************************!*\
  45612. !*** ./node_modules/node-libs-browser/mock/empty.js ***!
  45613. \******************************************************/
  45614. /*! no static exports found */
  45615. /***/ (function(module, exports, __webpack_require__) {
  45616. "use strict";
  45617. /***/ }),
  45618. /***/ "./node_modules/webpack/buildin/module.js":
  45619. /*!***********************************!*\
  45620. !*** (webpack)/buildin/module.js ***!
  45621. \***********************************/
  45622. /*! no static exports found */
  45623. /***/ (function(module, exports, __webpack_require__) {
  45624. "use strict";
  45625. module.exports = function (module) {
  45626. if (!module.webpackPolyfill) {
  45627. module.deprecate = function () {};
  45628. module.paths = [];
  45629. // module.parent = undefined by default
  45630. if (!module.children) module.children = [];
  45631. Object.defineProperty(module, "loaded", {
  45632. enumerable: true,
  45633. get: function get() {
  45634. return module.l;
  45635. }
  45636. });
  45637. Object.defineProperty(module, "id", {
  45638. enumerable: true,
  45639. get: function get() {
  45640. return module.i;
  45641. }
  45642. });
  45643. module.webpackPolyfill = 1;
  45644. }
  45645. return module;
  45646. };
  45647. /***/ })
  45648. /******/ });
  45649. });
  45650. //# sourceMappingURL=ivprog.bundle.js.map